home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / rddt.lbr / CMDLINE.AZM / CMDLINE.ASM
Encoding:
Assembly Source File  |  1993-10-25  |  4.1 KB  |  153 lines

  1. ;===CMDLINE.ASM=====H WEINSTEIN================8306191400==================
  2. ;
  3. ;    This program is used in conjunction with my RDDT.COM
  4. ;    (derived from my RELOCATE.ASM merged into DDT.COM) to
  5. ;    set up a command line and alter the jump operation
  6. ;    at 0005h to enable observation of the entering of a
  7. ;    command, or to observe anything else including BIOS
  8. ;    or BDOS or CCP operations.
  9. ;
  10. ;    To do this, when RDDT prompts for a staring address,
  11. ;    select one which will not replace CCP and will not be
  12. ;    covered by the operation which you want to examine.
  13. ;
  14. ;    You need not enter a command line.  You may then watch
  15. ;    what CCP does when there is none, or you may experiment
  16. ;    with any of the CP/M program segments.  At some point,
  17. ;    the trace (T) function of the RDDT may run amok when
  18. ;    RDDT can't find its breakpoint.  If anyone figures out
  19. ;    what to do about that, feel free to alter this file.
  20. ;
  21. ;    RECIPE:
  22. ;
  23. ;        1. Assemble and load this program.
  24. ;        2. Rename it CMDLINE, omitting the
  25. ;           file extension so that it may not
  26. ;           be invoked as a transient program.
  27. ;        3. To place it in use, enter the command:
  28. ;
  29. ;            RDDT CMDLINE
  30. ;
  31. ;        4. After responded to the location prompt,
  32. ;           and RDDT hase relocated itself, enter:
  33. ;
  34. ;            -G100
  35. ;
  36. ;        5. Respond to the command line prompt as
  37. ;           though you were entering a command after
  38. ;           the CP/M prompt, e.g. XDIR<RETURN>.
  39. ;        6. The command line will be inserted into
  40. ;           the CCP command buffer, the necessary
  41. ;           parameters will be initialized, and the
  42. ;           jump at 0005h will be altered so RDDT
  43. ;           can't trap it.
  44. ;        7. Next, there will appear the location
  45. ;           of CCP as a message.  This will be followed
  46. ;           by *nnnn, indicating that RDDT has found
  47. ;           the end of this program at the address
  48. ;           represented by nnnn.
  49. ;        8. If you want to observe the carrying out of
  50. ;           the command line you entered, enter:
  51. ;
  52. ;            Gxxxx,xxxx
  53. ;
  54. ;           where xxxx is the start of CCP in the 
  55. ;           message above.  Then use the T and L
  56. ;           command in RDDT.
  57. ;
  58. ;--------------------------------------------------------------------------
  59. ;
  60.  
  61.     ORG    00100H
  62.  
  63.     LXI    D,REQ$CMD        ;POINT AT REQUEST MESSAGE
  64.     MVI    C,009H        ;PRINT IT
  65.     CALL    5
  66.     LDA    2    ;GET MSB OF BIOS ADDRESS IN A
  67.     SUI    016H    ;FIND MSB OF CCP ADDRESS
  68.     MOV    H,A    ;SET UP POINTERS IN CCP
  69.     MVI    L,088H    ;POINT AT FIRST BYTE POINTER
  70.     MVI    M,008H    ;ENTER CCP CMD BUFFER START ADDRESS
  71.     MVI    L,08AH    ;POINT AT LAST BYTE POINTER
  72.     MVI    M,008H    ;INITIALIZE IT
  73.     MVI    L,006H    ;ADDR OF CCP COMMAND LINE BUFFER IN HL
  74.     XCHG        ;PUT IT WHERE BDOS CAN USE IT
  75.     PUSH D        ;SAVE IT
  76.     MVI    C,00AH    ;READ CONSOLE BUFFER (BDOS FUNCTION 10)
  77.     CALL    5
  78.     POP    H    ;COMMAND LINE BUFFER ADDR TO HL
  79.     MVI    L,000H    ;MAKE IT START OF CCP
  80.     PUSH    H    ;SAVE IT
  81.     LDA    2    ;GET MSB OF BIOS ADDRESS
  82.     SUI    00EH    ;CONVERT TO MSB OF BDOS ADDRESS
  83.     STA    7    ;PUT IT INTO PAGE 0
  84.     MVI    A,011H    ;CHANGE FROM JUMP TO BDOS TO---
  85.     STA    6    ;     JUMP TO DISPATCHER(DEFEAT DDT TRAP)
  86.     LDA    2    ;GET MSB OF BIOS ADDR AGAIN
  87.     SUI    016H    ;MAKE IT CCP AGAIN
  88.     MOV    H,A    ;PUT ADDR OF CMD LINE BYTE COUNT--
  89.     MVI    L,007H    ;     INTO HL
  90.     MOV    A,M    ;GET COUNT
  91.     INR    A    ;INCREMENT IT
  92.     MOV    E,A    ;SET IT UP TO ADD TO HL
  93.     MVI    D,000H
  94.     DAD    D    ;ADD IT: HL NOW POINTS JUST AFTER COMMAND LINE
  95.     MVI    M,000H    ;MAKE SURE COMMAND LINE ENDS WITH NULL
  96.     MOV    A,H    ;GET MSB OF CCP ADDR FROM H INTO A
  97.     RRC        ;SWAP NIBBLES
  98.     RRC
  99.     RRC
  100.     RRC
  101.     CALL    CONVERT    ;CONVERT LO NIBBLE TO ASCII
  102.     STA    HI    ; INSERT IT INTO CCP$MSG
  103.     MOV    A,H    ;GET MSB OF CCP ADDR - DON'T SWAP THIS TIME
  104.     CALL    CONVERT ;CONVERT LO NIBBLE TO ASCII
  105.     STA    LO    ; INSERT IT INTO CCP$MSG
  106.     LXI    D,CCP$MSG    ;POINT AT CCP$MSG
  107.     MVI    C,009H        ;PRINT IT
  108.     CALL    5
  109.     XRA    A    ;RESET ALL 8080 REGISTERS
  110.     MOV    B,A
  111.     MOV    C,A
  112.     PUSH    B
  113.     PUSH    B
  114.     POP    D
  115.     POP    H
  116.     RST    7    ;DDT BREAKPOINT
  117.  
  118. CONVERT:        ;SR TO CONVERT NIBBLE TO ASCII
  119.     ANI    00FH    ;EXPLANATION WILL BE LEFT AS EXERCISE FOR READER
  120.     ADI    090H    ;  SEE RELOCATE.ASM IF YOU GET STUCK
  121.     DAA
  122.     ACI    040H
  123.     DAA
  124.     RET
  125. ;
  126. ;
  127. REQ$CMD:
  128.     DB    00DH
  129.     DB    00AH
  130.     DB    00AH
  131.     DB    'Enter comman'
  132.     DB    'd line:'
  133.     DB    00DH
  134.     DB    00AH
  135.     DB    00AH
  136.     DB    '$'
  137.  
  138.  
  139. CCP$MSG:
  140.     DB    00DH
  141.     DB    00AH
  142.     DB    00AH
  143.     DB    'CCP is at '
  144. HI:    DB    'X'
  145. LO:    DB    'X'
  146.     DB    '00h.'
  147.     DB    00DH
  148.     DB    00AH
  149.     DB    00AH
  150.     DB    '$'
  151.  
  152.     END    100h
  153.