2021-01-02 03:07:40 +01:00
|
|
|
; Load root directory entry
|
|
|
|
; IN ax number of directory entry
|
|
|
|
lddir: push ax
|
|
|
|
mov cl, 4
|
|
|
|
shr ax, cl
|
|
|
|
xor dx, dx
|
|
|
|
call maprd
|
|
|
|
; get si to point to entry
|
|
|
|
pop si
|
|
|
|
mov cl, 5
|
|
|
|
shl si, cl
|
|
|
|
and si, 0x1FF
|
|
|
|
add si, dskbuf
|
|
|
|
ret
|
|
|
|
|
|
|
|
; find next file
|
|
|
|
fnfile: mov ax, [es:bx+FCBDEN]
|
|
|
|
inc word [es:bx+FCBDEN]
|
|
|
|
; bail out if we are at end of dir
|
|
|
|
cmp ax, [bpb+BPBRDE]
|
|
|
|
jnc .err
|
|
|
|
; load entry and first byte
|
|
|
|
push bx
|
|
|
|
call lddir
|
|
|
|
pop bx
|
|
|
|
; next if hidden, dir or vol label
|
|
|
|
test byte [si+0x0B], 0xDA
|
|
|
|
jnz fnfile
|
|
|
|
; bail out if end of dir
|
|
|
|
mov al, [si]
|
|
|
|
cmp al, 0
|
|
|
|
je .err
|
|
|
|
; next if deleted entry
|
|
|
|
cmp al, 0xE5
|
|
|
|
je fnfile
|
|
|
|
clc
|
|
|
|
ret
|
|
|
|
.err: stc
|
|
|
|
ret
|
|
|
|
|
|
|
|
; initialize a FCB for directory scanning
|
2021-01-02 03:48:04 +01:00
|
|
|
open: mov word [es:bx+FCBDEN], 0
|
|
|
|
.search: call fnfile
|
|
|
|
mov al, 0xFF
|
2021-01-02 03:07:40 +01:00
|
|
|
jc .ret
|
|
|
|
push si
|
|
|
|
lea di, [bx+1]
|
|
|
|
mov cx, 11
|
|
|
|
rep cmpsb
|
|
|
|
pop si
|
2021-01-02 03:48:04 +01:00
|
|
|
jne .search
|
|
|
|
mov al, 0
|
2021-01-02 03:07:40 +01:00
|
|
|
.ret: ret
|
|
|
|
|
|
|
|
putfn: mov cx, 11
|
|
|
|
.loop: lodsb
|
|
|
|
call pputc
|
|
|
|
loop .loop
|
|
|
|
ret
|