Implement file open

This commit is contained in:
Nero 2021-03-19 18:50:50 +00:00
parent f702006582
commit fbab632616

View File

@ -1,9 +1,15 @@
; FCB layout
; 1 byte drive (0=default, 1=A:, 2=B:, ...)
; 8.3 filename
; 8.3 filename for rename
FCBSIZ equ 30
struc FCB
FCBDRV resb 1 ; BYTE drive (0=default, 1=A:, 2=B:, ...)
FCBFN resb 11 ; 11 BYTES filename
FCBCLUS resw 1 ; DWORD current cluster
FCBRN resb 1 ; BYTE record in cluster
endstruc
FCBSIZ equ FCB_size
section .data
@ -136,11 +142,13 @@ fndnxt mov bp, sp
; copy over drive byte
movsb
; copy filename
push ds
mov ax, cs
mov ds, ax
mov si, bx
mov cx, 11
rep movsb
pop ds
; done!
xor ax, ax
ret
@ -149,5 +157,12 @@ fndnxt mov bp, sp
.ret: sbb al, al
ret
open:
ret
open call fndfst
test al, al
jnz .ret
; read start cluster
mov ax, [cs:bx+26]
mov [ds:bx+FCBCLUS], ax
; reset record number
mov byte [ds:bx+FCBRN], 0
.ret ret