60 lines
1023 B
NASM
60 lines
1023 B
NASM
; FCB layout
|
|
|
|
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
|
|
|
|
defdrv db 0
|
|
dta dd 0
|
|
|
|
section .text
|
|
|
|
; auto-complete drive field in fcb
|
|
; also logs in the drive
|
|
; IN ds:dx far ptr FCB
|
|
fcbdrv push ds
|
|
push dx
|
|
mov si, dx
|
|
; if currently zero, ...
|
|
mov dl, [si] ; 1-based
|
|
test dl, dl
|
|
jnz .log
|
|
; replace with current drive
|
|
mov dl, [cs:defdrv] ; 0-based
|
|
inc dl
|
|
mov [si], dl ; 1-based
|
|
.log dec dl
|
|
mov ax, cs
|
|
mov ds, ax
|
|
call logdrv ; 0-based
|
|
pop dx
|
|
pop ds
|
|
; if carry flag set, resume stack at bp
|
|
; this instant-returns some higher level procs
|
|
jnc .ret
|
|
mov sp, bp
|
|
; duplicate carry bit into all 8 AL bits
|
|
; similar to SALC instruction
|
|
.ret sbb al, al
|
|
ret
|
|
|
|
; set disk transfer address
|
|
; IN DS:DX dta ptr
|
|
setdta mov [cs:dta], dx
|
|
mov [cs:dta+2], ds
|
|
ret
|
|
|
|
; get disk transfer address
|
|
; OUT ES:BX dta ptr
|
|
getdta les bx, [cs:dta]
|
|
ret
|