home *** CD-ROM | disk | FTP | other *** search
- ; TESTFILE.ASM - Aborts Submit if file is not present
- ; Mark Anaker 08/18/83
- ; From Byte magazine listing in the March 1985 issue .
- ; Modified by Merlin R. Null, 5/23/85.
- ; Added BEGIN and DONE to return to CP/M without
- ; warm boot when aborting. For CP/M 2.2 only.
- ;
- ;----------------------------------------------------------------
- ;
- ; 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
- ;
- ; Main Program Area
- ;
- START: LDA TBUFF ; get command line tail length
- CPI 16 ; is [d]:filename.ext > 15?
- JNC BADFIL ; yes, branch to error message
- 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 ABORT ; nope, not here
- CALL SPMSG ; message out to console
- DB CR,LF,'File found, continuing with Submit',CR,LF,0
- JMP BOOT ; found, continue with Submit
- ;
- ; Bad File Name Message
- ;
- BADFIL: CALL SPMSG ; message to console
- DB CR,LF
- DB '*** Filename exceeds maximum length ***',CR,LF,LF,0
- JMP KILLIT ; kill $$$.SUB
- ;
- ; Abort SUBMIT Operaton, File Not Found
- ;
- ABORT: CALL SPMSG ; message to console
- DB CR,LF,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
- T ; nope, not here
- CALL SPMSG ; message ou