* Prints file names from disk in compact format * Syntax: SFILES [/u] * XEQ START ORG 100H COPY NPTDEFS START EQU $ SCAN MVI A,PSOPT get string LXI D,BUFF point to buffer CALL PSCAN get parms [/n] JC ERROR JZ DEFAULT default /0 LXI H,BUFF MOV A,M first parm char CPI '/' JNZ ERROR must be / INX H MOV A,M get disk # STA DISKN save it DEFAULT LXI D,FNAME file name LXI H,0 static buffer CALL SYS DB OPEOP open directory JMP OERROR STA FLNBR save file number MVI E,6 six per line MVI C,16 16 blocks in directory NEXT LDA FLNBR get it PUSH B PUSH D LXI B,100H get 100 bytes LXI D,BUFF point to buffer CALL SYS read block DB RBLOP JMP OERROR POP D POP B LDA BUFF get number of files in block MOV B,A save it in B LXI H,BUFF+2 point to first file NEXTF DCR B count down JM COUNT done PUSH B PUSH H CALL PTFLN print file name POP H POP B MOV A,L ADI 21 point to next file MOV L,A JMP NEXTF COUNT LDA BUFF get number of files in block ORA A reset CY and ACY DAA . make it packed decimal MOV B,A save it in B LDA FCNT2 second byte of count ORA A reset CY and ACY ADD B add number of files DAA . make it packed decimal STA FCNT2 save it JNC DCRC less than 100 LDA FCNT1 first byte of count INR A add one STA FCNT1 save it DCRC DCR C count down JNZ NEXT read next block * PRINT EQU $ MVI A,13 CR CALL CONOUT output MVI A,' ' CALL CONOUT output LDA FCNT1 first byte ORA A set flags JZ PRNT2 skip if zero ADI '0' make it ASCII CALL CONOUT output PRNT2 LDA FCNT2 second byte RRC . upper nibble RRC RRC RRC ANI 0FH ADI '0' make it ASCII CALL CONOUT output LDA FCNT2 lower nibble ANI 0FH ADI '0' make it ASCII CALL CONOUT output LXI H,MSG point to message PLOOP MOV A,M get char ORA A set flags JZ FINISH done CALL CONOUT output INX H next JMP PLOOP more FINISH LDA FLNBR get file number CALL SYS close it DB CLOOP JMP OERROR CALL SYS return DB RETOP * ERROR MVI A,ERSYN syntax error OERROR STA ECODE MVI A,0 LXI H,-1 no message CALL UTIL DB UXOP JMP ERRTN DB -1 no command code ECODE DB -1 ERRTN HLT should never get here * PTFLN EQU $ print file name MVI D,8 eight char max PTCHR MOV A,M get character ORA A set flags JZ FILL end of file name CALL CONOUT output DCR D INX H JNZ PTCHR FILL INR D add 2 INR D MVI A,' ' FILLN CALL CONOUT blank fill DCR D JNZ FILLN DCR E end of line? RNZ . not done MVI A,13 CR CALL CONOUT MVI E,6 reinitialize RET * FCNT1 DB 0 high order digit FCNT2 DB 0 low order digits FNAME ASC 'DIRECTRY/' DISKN DB '0' FLNBR DB 0 MSG ASC ' files in directory' DB 0DH,0 BOTTOM EQU $ MSBOTT EQU