;NULL v1.0 - CP/M Plus Utility - For writing a 0 byte file to disk ; ; COPYRIGHTED 1984 BY GUY GAMBLE ; ; This utility takes the place of the A>SAVE 0 filename.ext of CPM 2.2 ; and before. The main reason I wrote this was to make it easy to write ; a directory entry of type -.123 so the popular MCAT program can be ; used with C/PM Plus operating system. The program is self explanatory ; so I did not write a DOC file. ; ; The only thing you might need to know is that drive B: is the default ; drive that the program writes to. So you don't need to specify any ; drive when you name the file. ; ; This program is donated to Public Domain and I hope people will im- ; prove on it. It is not intended for commercial distribution. If you ; make modifications please update and resubmit to the Public Domain ; either here or any other RCPM BBS. ; - Guy Gamble ; ;======================================================================= ; ; System Equates under CP/M Plus ; BASE: EQU 0 FCB: EQU BASE+5CH BDOS: EQU BASE+5 PRINT: EQU 9 CONIN: EQU 1 CONOUT: EQU 2 RESETD: EQU 13 ;Disk system reset both drives SDSKR: EQU 37 ;Single disk reset SELDK: EQU 14 PFCB: EQU 152 ;CPM Plus only PARSE FCB RCONBF: EQU 10 MAKEF: EQU 22 OPEN: EQU 15 CLOSE: EQU 16 ; ; ; EQU for ASCII characters ; CR: EQU 0DH LF: EQU 0AH CLS: EQU 1AH ;Clear screen ; ; ; ORG BASE+100H ; ; ; Sign on messege ; CALL ILPRT DB CLS,LF,' NULL FILE UTILITY v1.0 - for CPM PLUS - 03/19/84' DB CR,LF,LF DB ' This writes a NULL file to drive B:',CR,LF,LF,0 ; START: LDA BUFLEN ;Maximum input buffer length (12 char) STA INBUF ;initialize 0 byte of the input buffer ; ;for BDOS function 10 ; ; LXI SP,STACK ;local stack XRA A CALL ILPRT DB ' Type Q to QUIT or',CR,LF,LF DB ' Press RETURN to continue ',0 CALL CRTIN CPI 'Q' JZ QUIT CPI CR JZ MSG CALL ILPRT DB CLS,LF,LF,' TRY AGAIN !!',CR,LF,LF,0 JMP START ; ; ; MSG: CALL ILPRT DB CLS,LF,LF,' INSERT DISK in drive B:',CR,LF,LF DB ' ENTER FILENAME.EXT',CR,LF,LF DB ' :',0 CALL INPUT CALL MOVFN ;move name from inbuf to FCB ; ;BDOS function 152 under CPM Plus only CALL RESDSK CALL OFILE INR A JNZ ERR1 CALL MFILE INR A JZ ERR2 CALL CFILE CALL ILPRT DB CLS,LF,LF,0 JMP INIT ; ; ILPRT: XTHL ;inline print routine ; ; ILPLP: MOV A,M PUSH H CALL CRTOUT POP H INX H MOV A,M ORA A JNZ ILPLP INX H XTHL RET ; ; CRTOUT: PUSH PSW MVI C,CONOUT MOV E,A CALL BDOS POP PSW RET ; ; CRTIN: MVI C,CONIN CALL BDOS ANI 07FH CPI ' ' RZ CPI 'C'-40H JZ QUIT CPI ' ' RC ANI 05FH RET ; ; ; INPUT: MVI C,RCONBF ;BDOS function 10 LXI D,INBUF ;input buffer address CALL BDOS CALL CRLF RET ; ; MOVFN: MVI C,PFCB ;move filename.ext from input ; ;buffer to FCB. BDOS 152 CPM Plus only LXI D,PFILE CALL BDOS RET ; ; RESDSK: MVI C,SDSKR ;reset drive B: only LXI D,0002 CALL BDOS ; MVI C,SELDK ;select drive B: MVI E,01 CALL BDOS RET ; ; OFILE: MVI C,OPEN ;check to see if file exists LXI D,FCB CALL BDOS RET ; ; MFILE: MVI C,MAKEF ;write file to disk LXI D,FCB CALL BDOS RET ; ; CFILE: MVI C,CLOSE LXI D,FCB CALL BDOS RET ; ; INIT: LXI H,INBUF ;initialization of input buffer LXI D,INBUF+1 LXI B,0026H MVI M,0 ;fill with 0's DB 0EDH,0B0H ;Z80 LDIR command JMP START ;start over again ; ; ERR1: CALL CFILE CALL ILPRT DB CLS,LF,LF,' +++ FILE ALREADY EXISTS +++',CR,LF,LF,0 JMP INIT ; ; ERR2: CALL ILPRT DB CLS,LF,LF,' +++ NO DIRECTORY SPACE +++',CR,LF,LF,0 JMP INIT ; ; QUIT: CALL CRLF MVI C,RESETD ;reset both drives before returning ; ;to CPM CALL BDOS JMP BASE ; ; CRLF: CALL ILPRT DB CR,LF,0 RET ; ; DS 80 ;local stack STACK: DB 0,0,0 ; ; PFILE: DW INBUF+2 ;BDOS function 152 DW FCB ;move filename.ext from inbuf+2 DB 0,0,0 ;to FCB address ; ; BUFLEN: DB 0CH,0,0 ;maximum number of char allowed ; ;to be input -filename.ext ; ;currently set for 12 chars INBUF: DB 0,0 DS 26H ; ; END