; SUBTOOL.ASM Combined PAUSE.ASM and TESTFILE.ASM from Byte ; magazine listing, March 1985 issue by Mark Anacker. Added ; begin and done to return to CP/M without warm boot when ; aborting. - Merlin R. Null 5/23/85 ; ;---------------------------------------------------------------- ; ; Define CP/M Routines ; RCONF EQU 1 ; read CON: into (A) WCONF EQU 2 ; write (A) to CON: DRIVE EQU 4 ; check current drive number BDOS EQU 5 ; system call entry CSTAF EQU 11 ; check CON: status DELFIL EQU 19 ; delete file ; ; Misc. Equates ; BOOT EQU 0 FCB EQU 005CH ; default file control block BEL EQU 7 ; bell LF EQU 10 ; line feed CR EQU 13 ; carriage return TRUE EQU 0FFH ; flag for true TBUFF EQU 80H ; transient default buffer ; ORG 0100H ; load at start of TPA ; ; Set Up Stack ; BEGIN: LXI H,0 ; save CP/M stack DAD SP SHLD CPMSP LXI SP,STAK ; set up local stack LDA DRIVE ; save current disk STA DRSAV MVI C,CSTAF ; check console status CALL BDOS ; for any input ORA A JZ START ; if none, run the program MVI C,RCONF ; read and ignore CON: CALL BDOS ; (debounce keys) JMP START ; run the program ; ; COMMON SUBROUTINES ; ; Message Pointed to by Stack out to Console ; SPMSG: XTHL ; get "return address" to HL PUSH B ; save BC PUSH D ; save DE ; SPMSG1: MOV A,M ; get one message character ORA A ; check for zero INX H ; point to next JZ SPMSG2 ; exit if done MVI C,WCONF ; select write to CON: MOV E,A ; character to E PUSH H ; save HL CALL BDOS ; output to CP/M POP H ; restore HL JMP SPMSG1 ; get another ; SPMSG2: POP D ; restore DE POP B ; restore BC XTHL ; restore stack for RET ; "return" when done ; ; End of Program Execution ; DONE: LDA DRSAV ; restore "current" disk STA DRIVE LHLD CPMSP ; restore CP/M stack SPHL RET ; return to CP/M ; ; Start of Main Program ; START: LDA TBUFF ; get command line tail length CPI 16 ; is filename too long? JNC BADFIL ; yes, abort to error message CPI 1 ; is there a command line tail? JNC FINDF ; yes, run find-file ; no, fall through to pause PAUSE: CALL SPMSG ; message to console DB CR,LF,'Press A to abort, any other' DB ' to continue ',0 MVI C,RCONF ; get char from console CALL BDOS ; let BDOS do it ANI 5FH ; mask to upper case CPI 'A' ; is it A? JZ KILLIT ; yes, kill $$$.SUB CALL SPMSG ; message to console DB CR,LF,0 ; add line for next message JMP RESUME ; return to SUBMIT ; ; Find File ; FINDF: MVI C,17 ; search for first function LXI D,FCB ; point to filename CALL BDOS ; let BDOS find it CPI TRUE ; true if file not found JZ NOFIL ; nope, not here CALL SPMSG ; message out to console DB 'File found. ',0 JMP RESUME ; file found, continue with ; Submit ; ; Resume operation of Submit ; RESUME: CALL SPMSG ; message out to console DB 'Continuing with Submit.',CR,LF,0 JMP BOOT ; exit to warm boot ; ; Bad File Name Message ; BADFIL: CALL SPMSG ; message to console DB CR,LF DB '*** Filename exceeds maximum length ***',CR,LF,LF DB 'Do not use a filename extension!',CR,LF,0 JMP KILLIT ; kill $$$.SUB ; ; Abort SUBMIT Operaton, File Not Found ; NOFIL: CALL SPMSG ; message to console DB CR,LF DB '**** File not found ****',CR,LF,0 ; fall through to KILLIT ; ; Kill $$$.SUB ; KILLIT: LXI D,SUBFCB ; point to $$$.SUB MVI C,DELFIL ; Delete File function CALL BDOS ; let BDOS do it CALL SPMSG ; message to console DB BEL,CR,LF,'Submit processing aborted!',CR,LF,0 JMP DONE ; exit to CP/M ; ; Data Area ; SUBFCB: DB 1 ; drive A: DB '$$$ SUB' ; Submit processor file DS 24 ; the rest of the FCB ; ; Define Space ; DRSAV: DB 0 ; current drive number CPMSP: DW 0 ; CP/M stack pointer ; ; DS 20H ; reserve stack of 32 bytes STAK: ; END