CLS ASMޏCLS COMDOSLIKE DOCLABEL ASM&+|LABEL COM5ylMORE ASM9'MORE COMQAPAUSE ASMS PAUSE COM]L VOL ASM_TVOL COMrr2BDOS EQU 0005H ;System Call Location TPA EQU 0100H ;Transient Program Area CROUT EQU 2D ;Character Output Function CTRZ EQU 26D ;Control Z Character ; CLS ORG TPA ;Program Start Location MVI C,CROUT ;Load Fuction Call MVI E,CTRZ ;Load E with CTRZ CALL BDOS ;Call CP/M to Output RET ;Return to CP/M Control ; END T ;Load Fuction Call MVI E,CTRZ ;Load E with CTRZ Here are 5 utility programs that I use on a regular basis on my CP/M machine to simulate the niceties of MS-DOS. The programs are simple and written assembler for the 8080. CLS Clear the Screen (Uses Control Z) PAUSE Pause batch job with option to terminate (Control C) with a prompt to make sure you know what you are doing. LABEL Give diskette a volume label for quick reference. VOL Display volume identification put on by LABEL Note: LABEL creates a hidden file so it won't be seen. MORE Must have utility. Replaces TYPE command. Pages display and prompt if you want more. Control C to cancel scrolling. These are simple utilities, so if you want piping, and input/output re-direction see ZCPR utilities. These will take up very little space and require no modification under most CP/M installations. See .ASM files for usage. HARRIS LANDSBERG BROOKLYN, NEW YORK  HARRIS LANDSBERG BROOKLYN, NEW YORK elete RET ;Ret;******************************************** ; Program Written by: HARRIS LANDSBERG c1985 ; Name: LABEL.ASM in standard 8080 ASM code ; ; Designed as a MS-DOS diskette volume ident ; label editor simulator. ; ; Comment: Works in conjunction with VOL in ; order to label diskettes for identification ; similar to MS-DOS LABEL program. Create ; a hidden file call DISKETTE.VOL on disk. ; ; Run: LABEL [d:] ;******************************************** BDOS EQU 0005H ;System Call Location DMA EQU 0080H ;DMA Buffer Location FCB EQU 005CH ;File Control Block DMAL EQU 128 ;DMA Buffer Length GCD EQU 25 ;Get Current Disk READ EQU 20 ;Read Sequential Record SDMA EQU 26 ;Set DMA Address SFF EQU 17 ;Search For First OPEN EQU 15 ;Open File Function MFILE EQU 22 ;Make File Function CLOSE EQU 16 ;Close File Function DLT EQU 19 ;Delete File Function WSR EQU 21 ;Write Sequnetial Record CONIN EQU 1 ;Character Input COUT EQU 2 ;Character Output PSTR EQU 9 ;Print String Function RCON EQU 10 ;Read Console Buffer NOTF EQU 255 ;File Not Found TPA EQU 0100H ;Transient Program Area FEM EQU 26 ;File End Mark CR EQU 13 ;Carraige Return LF EQU 10 ;Line Feed Charcter ; LABEL ORG TPA ;Program Start ; MVI C,SDMA ;Set Buffer Location LXI D,DMA ;At DMA Address CALL BDOS MVI C,PSTR ;Output MSG to Console LXI D,MSG CALL BDOS LDA FCB ;For Which Drive? CPI 0 ;Default Drive CZ GETDR ;Get Current Drive ADI 40H ;Upgrade to A,B,C etc. MVI C,COUT ;Display to Console MOV E,A CALL BDOS LXI D,FCB+1 ;Start Move to position LXI H,FILE ;Start Move from posit. MVI B,11 ;Total 11 Characters FNAME MOV A,M ;From Mem to Accumulator STAX D ;Put into FCB INX D ;Increment Pointers INX H DCR B ;Decrement Counter JNZ FNAME ;Not Finished? MVI C,SFF ;Set Search Directory LXI D,FCB ;For First Call CALL BDOS CPI NOTF ;Not Found? JZ NOVOL ;Has no label MVI C,OPEN ;Open "VOL" File LXI D,FCB CALL BDOS MVI C,READ ;Read First Record LXI D,FCB CALL BDOS MVI C,PSTR ;Output Second string LXI D,YESV CALL BDOS LXI H,DMA ;Start of Record MVI B,11 ;Total 11 Characters DVOL PUSH H ;Save Registers PUSH B MVI C,COUT ;Output Character MOV E,M CALL BDOS POP B ;Restore Registers POP H INX H ;Increment Pointer DCR B ;Decrement Counter JNZ DVOL ;Not Finished? JMP ENDV ;Return to CP/M NOVOL MVI C,PSTR ;Output has no label LXI D,NOV CALL BDOS MVI A,0FFH ;Flag for No Volume STA FEXIST ;Store in Flag Location ENDV MVI C,PSTR ;Output Prompt Message LXI D,PROMPT CALL BDOS MVI C,RCON ;Read Console Buffer LXI D,VID ;Buffer Address CALL BDOS LDA VID+1 ;# of Chars to Accumulator CPI 0 ;ENTER only? JZ EONLY ;No Charcters! LDA FEXIST ;Load File Exist Flag CPI 0FFH ;Does it exist? CNZ DLTFILE ;Delete DISKETTE.VOL MVI A,0CFH ;Make a System File STA FCB+10 ;Change the "O" in VOL CALL CLEAN ;Clean FCB of leftover info. MVI C,MFILE ;Make a Directory Entry LXI D,FCB ;Filename in FCB CALL BDOS CALL RELOC ;Relocate Label to DMa MVI C,WSR ;Write Sequential Record LXI D,FCB ;Filename in FCB CALL BDOS MVI C,CLOSE ;Close the File LXI D,FCB ;Filename in FCB CALL BDOS FINI MVI C,COUT ;Line Feed Character MVI E,LF CALL BDOS RET ; ; Subroutines ; GETDR MVI C,GCD ;Get Current Disk CALL BDOS INR A ;Increment Accumulator RET EONLY LDA FEXIST ;Load File Exist Flag CPI 0FFH ;Does it exist? JZ FINI ;No previous Volume MVI C,COUT ;Skip Extra Line MVI E,LF CALL BDOS AGAIN MVI C,PSTR ;Prompt to Delete LXI D,PRMT2 CALL BDOS MVI C,CONIN ;Character Input CALL BDOS CALL CAPITAL ;Make Character a Capital CPI 'N' ;Don't Delete JZ FINI ;Finished CPI 'Y' ;Delete Volume JNZ AGAIN ;Invalid response CALL DLTFILE ;Delete the File JMP FINI CAPITAL CPI 'a' ;Small Character RM ;No! SUI 020H ;Change to Capital RET DLTFILE MVI C,DLT ;Delete Volume ID LXI D,FCB ;Filename in FCB CALL BDOS RET CLEAN LXI H,FCB+12 ;Right after Filename MVI A,0 ;Zero it out (hex) MVI B,23 ;Load Counter CLOOP MOV M,A ;Into Memory INX H ;Increment Pointer DCR B ;Decrement Counter JNZ CLOOP ;20 iterations? RET RELOC LXI H,VID+2 ;Put VID Address in HL LXI D,DMA ;Put DMA Address in DE MVI B,11 ;Load Counter RLOOP MOV A,M ;Transfer to Accum. STAX D ;Transfer to DMA INX H ;Increment Pointers INX D DCR B ;Decrement Counter JNZ RLOOP ;All Moved? MVI A,FEM ;File End Mark STA DMA+11 ;After 11 Characters RET FILE DB 'DISKETTEVOL' MSG DB LF,'Volume in drive $' NOV DB ' has no label$' YESV DB ' is $' PROMPT DB CR,LF,LF,'Volume label (11 ' DB 'Characters, ENTER for none)? $' PRMT2 DB CR,LF,'Delete current volume label (Y/N)? $' FEXIST DB 0 VID DB 255 ; END T DB CR,LF,LF,'Volume label (11 ' DB 'Characters, ENTER for none)? $'  8:\@_]!- ~#(\l\\ X! ^#Zy J>2 ] ::>2f \\\ <:ʼ  NʼYüa \!h>w#! ~#>2DISKETTEVOL Volume in drive $ has no label$ is $ Volume label (11 Characters, ENTER for none)? $ Delete current volume label (Y/N)? $;******************************************** ; Program Written by: HARRIS LANDSBERG c1985 ; Name: MORE.ASM using standard 8080 ASM code ; ; Designed as a MS-DOS More filter simulation ; when listing a file to the crt device. ; ; Comment: Will clear keyboard buffer if keys ; are held down too long accidently. One of ; my first attempts in Assembler. Control C ; at --more-- prompt will return to CP/M. ; ; Run: MORE [d:]filename[.ext], no "*" or "?" ;******************************************** bdos equ 0005H ;function call location fcb equ 005CH ;file control block dma equ 0080H ;dma buffer location dmal equ 128 ;dma length sline equ 23 ;lines per screen filel equ 11 ;filename.ext length rchr equ 1 ;read character function pchr equ 2 ;output character function drio equ 6 ;direct i/o function pstr equ 9 ;string output function open equ 15 ;open file function read equ 20 ;read sequential record sdma equ 26 ;set dma location ctrc equ 3 ;control c (break) lf equ 10 ;line feed cr equ 13 ;carriage return ctrz equ 26 ;file end charcter wildc equ '?' ;wildcard character iread equ 0FFH ;input using direct i/o ; start org 0100H ;start location ; lxi h,fcb+1 ;filename location mvi b,filel ;file length check mov a,m ;memory -> accumulator cpi wildc ;wildcard? jz invnam ;zero=invalid name inx h ;next position dcr b ;decrement count jnz check ;not zero=continue mvi c,sdma ;set dma location lxi d,dma call bdos mvi c,open ;open file lxi d,fcb ;name in fcb call bdos inr a ;test if found jz notf ;zero=not found rdfil mvi c,read ;read file lxi d,fcb ;name in fcb call bdos ana a ;test if end rnz ;not zero=end mvi b,dmal ;d=dma length lxi h,dma ;hl=dma location again mov a,m ;memory -> accumulator cpi ctrz ;end-of-file? rz ;zero=eof mov e,a ;reg a -> reg e cpi lf ;line feed? jnz nolf ;not zero=not lf lda line ;line variable -> reg a inr a ;increment sta line ;store back nolf inx h ! push h ;next position, save dcr b ! push b ;one less, save mvi c,pchr ;print character call bdos lda line ;line variable -> reg a cpi sline ;full screen? jnz nmore ;not zero=not full mvi c,pstr ;print string lxi d,more ;promt location call bdos xra a ;reset accumulator sta line ;store in line clkey mvi c,drio ;clear keyboard buffer mvi e,iread ;using direct i/o call bdos ana a jnz clkey ;again if not clear mvi c,rchr ;wait for character call bdos cpi ctrc ;break? jnz domore ;not zero=not break pop b ! pop h ;clean stack ret domore mvi c,pstr ;print character lxi d,crlf ;skip line call bdos nmore pop b ! pop h ;obtain stack info mov a,b ;reg b -> reg a ana a ;test jz rdfil ;zero=buffer finished jmp again ;more in buffer notf mvi c,pstr ;print string lxi d,fnot ;error message jmp bdos invnam mvi c,pstr ;print string lxi d,invn ;error message jmp bdos ; more db '--more--$' fnot db 'file not found$' invn db 'invalid filename$' line db 0 crlf db cr,lf,'$' ; end start !] ~?ʓ#\<ʋ\!~_ D:<2#: 2ay x$3  --more--$file not found$invalid filename$ $BDOS EQU 0005H ;System Call Location TPA EQU 0100H ;Transient Program Area BREAK EQU 3 ;Control Break Key CHRIN EQU 1 ;Character Input Function STOUT EQU 9 ;String Output Function LF EQU 10 ;Line feed CR EQU 13 ;Carriage Return SFF EQU 17 ;Search for file DFILE EQU 19 ;Delete File ; PAUSE ORG TPA ;Program Start Location MVI C,STOUT ;Load Fuction Call LXI D,MSG ;Load Address of MSG CALL BDOS ;Call CP/M to Output MVI C,CHRIN ;Load Function Call CALL BDOS ;Call CP/M to Input CPI BREAK ;Break Character? RNZ ;Nope MVI C,SFF ;Search for file LXI D,BAT ;$$$.SUB file present CALL BDOS ;Call CP/M to Find INR A ;manipulate return code RZ ;not batch mode TERM LXI D,PROMPT MVI C,STOUT ;Prompt to terminate CALL BDOS ;Call CP/M to Output MVI C,CHRIN ;Get character CALL BDOS ;Call CP/M for input CALL UPPC ;convert to uppercase CPI 'N' RZ ;continue CPI 'Y' JNZ TERM ;invalid response MVI C,DFILE ;Delete file LXI D,BAT ;$$$.SUB file CALL BDOS ;Call CP/M for Delete RET ;Return to CP/M Control ; UPPC CPI 'a' RM ;less than 'a' SUI 20H ;capitalize RET ; MSG DB 'Strike a key when ready . . .$' BAT DB 0,'$$$ SUB' PROMPT DB CR,LF,'Terminate Batch Job (Y/N)?$' ; END  key when ready . . .$' BAT D A_<k ;NY_a Strike a key when ready . . .$$$$ SUB Terminate Batch Job (Y/N)?$;******************************************** ; Program Written by: HARRIS LANDSBERG c1985 ; Name: VOL.ASM using standard 8080 ASM code ; ; Designed as a MS-DOS diskette volume indent ; used in conjuction with LABEL. ; ; Comment: Will read file DISKETTE.VOL which ; was created by LABEL program, and display ; it to the CRT device. DISKETTE.VOL is a ; hidden file for less detraction. ; ; Run: VOL [d:] ;******************************************** BDOS EQU 0005H ;System Call Location DMA EQU 0080H ;DMA Buffer Location FCB EQU 005CH ;File Control Block SDMA EQU 26 ;Set DMA Address GCD EQU 25 ;Get Current Disk READ EQU 20 ;Read Sequential Record SFF EQU 17 ;Search For First OPEN EQU 15 ;Open File Function COUT EQU 2 ;Character Output PSTR EQU 9 ;Print String Function NOTF EQU 255 ;File Not Found TPA EQU 0100H ;Transient Program Area LF EQU 10 ;Line Feed Charcter ; VOL ORG TPA ;Program Start ; MVI C,SDMA ;Set Buffer Location LXI D,DMA ;At DMA Address CALL BDOS MVI C,PSTR ;Output MSG to Console LXI D,MSG CALL BDOS LXI H,FCB ;For Which Drive? MOV A,M CPI 0 ;Default Drive CZ GETDR ;Get Current Drive ADI 40H ;Upgrade to A,B,C etc. MVI C,COUT ;Display to Console MOV E,A CALL BDOS LXI D,FCB+1 ;Start Move to position LXI H,FILE ;Start Move from posit. MVI B,11 ;Total 11 Characters FNAME MOV A,M ;From Mem to Accumulator STAX D ;Put into FCB INX D ;Increment Pointers INX H DCR B ;Decrement Counter JNZ FNAME ;Not Finished? MVI C,SFF ;Set Search Directory LXI D,FCB ;For First Call CALL BDOS CPI NOTF ;Not Found? JZ NOVOL ;Has no label MVI C,OPEN ;Open "VOL" File LXI D,FCB CALL BDOS MVI C,READ ;Read First Record LXI D,FCB CALL BDOS MVI C,PSTR ;Output Second string LXI D,YESV CALL BDOS LXI H,DMA ;Start of Record MVI B,11 ;Total 11 Characters DVOL PUSH H ;Save Registers PUSH B MVI C,COUT ;Output Character MOV E,M CALL BDOS POP B ;Restore Registers POP H INX H ;Increment Pointer DCR B ;Decrement Counter JNZ DVOL ;Not Finished? JMP ENDV ;Return to CP/M NOVOL MVI C,PSTR ;Output has no label LXI D,NOV CALL BDOS ENDV MVI C,COUT ;Output Extra Line Feed MVI E,LF CALL BDOS RET GETDR MVI C,GCD ;Get Current Disk CALL BDOS INR A ;Increment Accumulator RET ; FILE DB 'DISKETTEVOL' MSG DB LF,'Volume in drive $' NOV DB ' has no label$' YESV DB ' is $' ; END  !\~}@_]! ~#)\m\\ ! ^#[u