Build drive selection logic for FCBs
This commit is contained in:
parent
4e779c5a22
commit
c41782c78f
4 changed files with 51 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
section .bss
|
||||
|
||||
; drive selected for I/O
|
||||
; drive actually selected for I/O
|
||||
dsknum: resb 1
|
||||
; current sector number
|
||||
dskseek: resd 1
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
; in FCB required
|
||||
; word offset in rootdir
|
||||
; used for search
|
||||
; word current cluster
|
||||
; byte record num in cluster
|
||||
section .bss
|
||||
|
||||
; default drive if field in FCB = 0
|
||||
defdrv: resb 1
|
||||
|
||||
section .text
|
||||
; Functions here generally expect the FCB to be at ES:BX
|
||||
|
||||
; Helper function: read the drive number from FCB,
|
||||
; apply default if necessary,
|
||||
; and make it current I/O drive
|
||||
setdrv: mov dl, [es:bx+fcb.drive] ; A=1
|
||||
test dl, dl
|
||||
jnz .nofix
|
||||
mov dl, [defdrv] ; A=0
|
||||
inc dl
|
||||
mov [es:bx+fcb.drive], dl ; A=1
|
||||
; now set as current i/o drive
|
||||
.nofix: dec dl ; A=0 for dsksel
|
||||
jmp dsksel
|
||||
|
||||
; FCB open
|
||||
fcbopn: ; call fcbfst
|
||||
|
@ -16,12 +31,10 @@ fcbcls: ; flush disk buffer
|
|||
ret
|
||||
|
||||
; FCB find first
|
||||
fcbfst: ; init search state in FCB
|
||||
; jmp to fcbnxt
|
||||
ret
|
||||
|
||||
fcbfst: mov word [es:bx+fcb.dirpos], 0
|
||||
; FCB find next
|
||||
fcbnxt: ; load rootdir sector from state
|
||||
fcbnxt: call setdrv
|
||||
; load rootdir sector from state
|
||||
; search until next match
|
||||
; next sec & loop if mismatch
|
||||
; err exit if no further matches
|
||||
|
@ -31,6 +44,7 @@ fcbnxt: ; load rootdir sector from state
|
|||
fcbdel: ; call fcbfst
|
||||
; get search state, load root dir from there
|
||||
; mark file as deleted
|
||||
; mark buffer dirty
|
||||
ret
|
||||
|
||||
; FCB read
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue