Build drive selection logic for FCBs
This commit is contained in:
parent
4e779c5a22
commit
c41782c78f
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
%include "inc/bpb.asm"
|
%include "inc/bpb.asm"
|
||||||
%include "inc/mbr.asm"
|
%include "inc/mbr.asm"
|
||||||
|
%include "inc/fcb.asm"
|
||||||
|
|
||||||
; kernel stack size in words
|
; kernel stack size in words
|
||||||
%define stacksize 512
|
%define stacksize 512
|
||||||
@ -22,18 +23,30 @@ print_banner: mov si, banner
|
|||||||
cmp al, 0x0D
|
cmp al, 0x0D
|
||||||
jnz .loop
|
jnz .loop
|
||||||
|
|
||||||
|
cmp dl, 0x80
|
||||||
|
jc .k
|
||||||
|
sub dl, (0x80-2)
|
||||||
|
.k: mov [defdrv], dl
|
||||||
|
|
||||||
call dskrst
|
call dskrst
|
||||||
|
|
||||||
mov dl, 0
|
mov bx, testfcb
|
||||||
call dsksel
|
call fcbfst
|
||||||
|
|
||||||
hlt: hlt
|
hlt: hlt
|
||||||
jmp hlt
|
jmp hlt
|
||||||
|
|
||||||
|
%include "kernel/fcb.asm"
|
||||||
|
%include "kernel/drive.asm"
|
||||||
|
|
||||||
|
section .data
|
||||||
|
|
||||||
%defstr VERSIONSTR VERSION
|
%defstr VERSIONSTR VERSION
|
||||||
banner: db "RDOS ", VERSIONSTR, 0x0A, 0x0D
|
banner: db "RDOS ", VERSIONSTR, 0x0A, 0x0D
|
||||||
|
|
||||||
%include "kernel/drive.asm"
|
testfcb: db 0
|
||||||
|
db "HELLO ", "COM"
|
||||||
|
times 30 db 0
|
||||||
|
|
||||||
section .bss
|
section .bss
|
||||||
|
|
||||||
|
10
inc/fcb.asm
Normal file
10
inc/fcb.asm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
struc fcb
|
||||||
|
.drive resb 1
|
||||||
|
.filename resb 8
|
||||||
|
.type resb 3
|
||||||
|
.fn2 resb 8
|
||||||
|
.tp2 resb 3
|
||||||
|
.dirpos resw 1
|
||||||
|
.cluster resw 1
|
||||||
|
.recordnum resb 1
|
||||||
|
endstruc
|
@ -1,6 +1,6 @@
|
|||||||
section .bss
|
section .bss
|
||||||
|
|
||||||
; drive selected for I/O
|
; drive actually selected for I/O
|
||||||
dsknum: resb 1
|
dsknum: resb 1
|
||||||
; current sector number
|
; current sector number
|
||||||
dskseek: resd 1
|
dskseek: resd 1
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
; in FCB required
|
section .bss
|
||||||
; word offset in rootdir
|
|
||||||
; used for search
|
; default drive if field in FCB = 0
|
||||||
; word current cluster
|
defdrv: resb 1
|
||||||
; byte record num in cluster
|
|
||||||
|
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
|
; FCB open
|
||||||
fcbopn: ; call fcbfst
|
fcbopn: ; call fcbfst
|
||||||
@ -16,12 +31,10 @@ fcbcls: ; flush disk buffer
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
; FCB find first
|
; FCB find first
|
||||||
fcbfst: ; init search state in FCB
|
fcbfst: mov word [es:bx+fcb.dirpos], 0
|
||||||
; jmp to fcbnxt
|
|
||||||
ret
|
|
||||||
|
|
||||||
; FCB find next
|
; FCB find next
|
||||||
fcbnxt: ; load rootdir sector from state
|
fcbnxt: call setdrv
|
||||||
|
; load rootdir sector from state
|
||||||
; search until next match
|
; search until next match
|
||||||
; next sec & loop if mismatch
|
; next sec & loop if mismatch
|
||||||
; err exit if no further matches
|
; err exit if no further matches
|
||||||
@ -31,6 +44,7 @@ fcbnxt: ; load rootdir sector from state
|
|||||||
fcbdel: ; call fcbfst
|
fcbdel: ; call fcbfst
|
||||||
; get search state, load root dir from there
|
; get search state, load root dir from there
|
||||||
; mark file as deleted
|
; mark file as deleted
|
||||||
|
; mark buffer dirty
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; FCB read
|
; FCB read
|
||||||
|
Loading…
Reference in New Issue
Block a user