;File: DIRSIZE.ASM ; ; DIRSIZE - Display directory size. ; Count the number of occupied slots ; in the disk directory. ; 5000 ORG 100H DRS: LXI H,0 ;Present COUNT = 0 5005 SHLD COUNT 5010 LXI D,BUFF ;Set buffer address 5015 MVI C,1AH 5020 CALL 5 ; 5025 MVI C,11H ;Find first occurence 5030 LXI D,FCB 5035 CALL 5 5040 CPI 0FFH 5045 JZ DRS2 ;If done ; DRS1: CALL AEC ;Advance entry count 5050 MVI C,12h ;Find next occurence 5055 CALL 5 5060 CPI 0FFH 5065 JNZ DRS1 ;If not done ; ; Display the resulting count. ; DRS2: CALL ALN ;CR,LF 5070 LHLD COUNT 5075 CALL DHW ;Display hex word 5080 LXI D,DRSA ;"entries used" 5080 CALL MSG 5085 JMP 0000 ; ; AEC - Advance Entry Count. ; AEC: LHLD COUNT 5090 INX H 5095 SHLD COUNT 6000 RET ; DRSA: DB ' directory entries are currently' 6005 DB ' occupied (value in hex).$' COUNT: DW 0 FCB: DB 0,'???????????',0,0,0,0 6010 DS 20 ; ; DHW-DISPLAY HEX WORD. ; DISPLAY FOUR HEX DIGITS ; ENTRY HL=WORD TO BE DISPLAYED ; DHW: PUSH H 2710 MOV A,H ;DISPLAY HIGH BYTE 2720 CALL DHB 2730 POP H Š2740 MOV A,L ;Display low byte ; ; DHB - Display Hex Byte. ; Display two hex digits. ; Entry A = byte to be displayed ; DHB: PUSH PSW 3000 RRC ! RRC ! RRC ! RRC 3100 CALL DHD ;display hex digit 3200 POP PSW ; ; DHD - Display Hex Digit. ; Entry A,low 4 bits = digit ; DHD: ANI 0FH 3300 CPI 10 3400 JNC DHD1 ;If not 0 through 9 ; 3500 ADI '0' 3600 JMP DCH ; DHD1: ADI 'A'-10 ;Create "A,B,C,D,E, or F" ; ; DCH - Display one character. ; Entry A = ASCII encoded char ; DCH: MOV E,A 3800 MVI C,2 3900 CALL 5 4100 RET ; ; ALN - Advance to new line. ; Issue CR,LF ; ALN: MVI A,0DH ;carriage-return 4500 CALL DCH 4505 MVI A,0AH ;line-feed 4600 CALL DCH 4700 RET ; ; FCC - Filter out Control Codes. ; Entry A = ASCII code ; Exit B = ASCII graphic char ; A = 'up-arrow' if control-code ; = blank, if graphic ; FCC: CPI 20H 1700 JNC FCC1 ;If not control code ; ; We have a control-code. ; Return 'up-arrow' in A; graphic in B. ; 1800 ADI 40H 1900 MOV B,A 2000 MVI A,5EH ;up-arrow Š2100 RET ; ; We have a graphic character. ; Return blank in A; graphic in B. ; FCC1: MOV B,A 2200 MVI A,20H ;blank 2300 RET ; ; MSG - Issue Message to Console. ; Entry DE = message address ; MSG: MVI C,9 2400 CALL 5 2500 RET ; ; RCC - Read a Console Character. ; Exit A = character ; RCC: MVI C,1 2600 CALL 5 2700 RET ORG 200H BUFF EQU $