;===CMDLINE.ASM=====H WEINSTEIN================8306191400================== ; ; This program is used in conjunction with my RDDT.COM ; (derived from my RELOCATE.ASM merged into DDT.COM) to ; set up a command line and alter the jump operation ; at 0005h to enable observation of the entering of a ; command, or to observe anything else including BIOS ; or BDOS or CCP operations. ; ; To do this, when RDDT prompts for a staring address, ; select one which will not replace CCP and will not be ; covered by the operation which you want to examine. ; ; You need not enter a command line. You may then watch ; what CCP does when there is none, or you may experiment ; with any of the CP/M program segments. At some point, ; the trace (T) function of the RDDT may run amok when ; RDDT can't find its breakpoint. If anyone figures out ; what to do about that, feel free to alter this file. ; ; RECIPE: ; ; 1. Assemble and load this program. ; 2. Rename it CMDLINE, omitting the ; file extension so that it may not ; be invoked as a transient program. ; 3. To place it in use, enter the command: ; ; RDDT CMDLINE ; ; 4. After responded to the location prompt, ; and RDDT hase relocated itself, enter: ; ; -G100 ; ; 5. Respond to the command line prompt as ; though you were entering a command after ; the CP/M prompt, e.g. XDIR. ; 6. The command line will be inserted into ; the CCP command buffer, the necessary ; parameters will be initialized, and the ; jump at 0005h will be altered so RDDT ; can't trap it. ; 7. Next, there will appear the location ; of CCP as a message. This will be followed ; by *nnnn, indicating that RDDT has found ; the end of this program at the address ; represented by nnnn. ; 8. If you want to observe the carrying out of ; the command line you entered, enter: ; ; Gxxxx,xxxx ; ; where xxxx is the start of CCP in the ; message above. Then use the T and L ; command in RDDT. ; ;-------------------------------------------------------------------------- ; ORG 00100H LXI D,REQ$CMD ;POINT AT REQUEST MESSAGE MVI C,009H ;PRINT IT CALL 5 LDA 2 ;GET MSB OF BIOS ADDRESS IN A SUI 016H ;FIND MSB OF CCP ADDRESS MOV H,A ;SET UP POINTERS IN CCP MVI L,088H ;POINT AT FIRST BYTE POINTER MVI M,008H ;ENTER CCP CMD BUFFER START ADDRESS MVI L,08AH ;POINT AT LAST BYTE POINTER MVI M,008H ;INITIALIZE IT MVI L,006H ;ADDR OF CCP COMMAND LINE BUFFER IN HL XCHG ;PUT IT WHERE BDOS CAN USE IT PUSH D ;SAVE IT MVI C,00AH ;READ CONSOLE BUFFER (BDOS FUNCTION 10) CALL 5 POP H ;COMMAND LINE BUFFER ADDR TO HL MVI L,000H ;MAKE IT START OF CCP PUSH H ;SAVE IT LDA 2 ;GET MSB OF BIOS ADDRESS SUI 00EH ;CONVERT TO MSB OF BDOS ADDRESS STA 7 ;PUT IT INTO PAGE 0 MVI A,011H ;CHANGE FROM JUMP TO BDOS TO--- STA 6 ; JUMP TO DISPATCHER(DEFEAT DDT TRAP) LDA 2 ;GET MSB OF BIOS ADDR AGAIN SUI 016H ;MAKE IT CCP AGAIN MOV H,A ;PUT ADDR OF CMD LINE BYTE COUNT-- MVI L,007H ; INTO HL MOV A,M ;GET COUNT INR A ;INCREMENT IT MOV E,A ;SET IT UP TO ADD TO HL MVI D,000H DAD D ;ADD IT: HL NOW POINTS JUST AFTER COMMAND LINE MVI M,000H ;MAKE SURE COMMAND LINE ENDS WITH NULL MOV A,H ;GET MSB OF CCP ADDR FROM H INTO A RRC ;SWAP NIBBLES RRC RRC RRC CALL CONVERT ;CONVERT LO NIBBLE TO ASCII STA HI ; INSERT IT INTO CCP$MSG MOV A,H ;GET MSB OF CCP ADDR - DON'T SWAP THIS TIME CALL CONVERT ;CONVERT LO NIBBLE TO ASCII STA LO ; INSERT IT INTO CCP$MSG LXI D,CCP$MSG ;POINT AT CCP$MSG MVI C,009H ;PRINT IT CALL 5 XRA A ;RESET ALL 8080 REGISTERS MOV B,A MOV C,A PUSH B PUSH B POP D POP H RST 7 ;DDT BREAKPOINT CONVERT: ;SR TO CONVERT NIBBLE TO ASCII ANI 00FH ;EXPLANATION WILL BE LEFT AS EXERCISE FOR READER ADI 090H ; SEE RELOCATE.ASM IF YOU GET STUCK DAA ACI 040H DAA RET ; ; REQ$CMD: DB 00DH DB 00AH DB 00AH DB 'Enter comman' DB 'd line:' DB 00DH DB 00AH DB 00AH DB '$' CCP$MSG: DB 00DH DB 00AH DB 00AH DB 'CCP is at ' HI: DB 'X' LO: DB 'X' DB '00h.' DB 00DH DB 00AH DB 00AH DB '$' END 100h