2021-01-21 23:28:57 +01:00
|
|
|
; FCB layout
|
2021-01-05 00:29:50 +01:00
|
|
|
|
2021-03-19 19:50:50 +01:00
|
|
|
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
|
2021-02-25 01:45:56 +01:00
|
|
|
|
|
|
|
section .data
|
|
|
|
|
|
|
|
defdrv db 0
|
|
|
|
dta dd 0
|
2021-01-21 23:28:57 +01:00
|
|
|
|
|
|
|
section .text
|
2021-01-05 00:19:14 +01:00
|
|
|
|
2021-01-23 18:32:53 +01:00
|
|
|
; auto-complete drive field in fcb
|
2021-02-25 01:45:56 +01:00
|
|
|
; 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
|
2021-01-23 18:32:53 +01:00
|
|
|
test dl, dl
|
2021-02-25 01:45:56 +01:00
|
|
|
jnz .log
|
|
|
|
; replace with current drive
|
|
|
|
mov dl, [cs:defdrv] ; 0-based
|
2021-01-23 18:32:53 +01:00
|
|
|
inc dl
|
2021-02-25 01:45:56 +01:00
|
|
|
mov [si], dl ; 1-based
|
|
|
|
.log dec dl
|
2021-03-19 20:26:38 +01:00
|
|
|
mov ax, cs
|
|
|
|
mov ds, ax
|
2021-02-25 01:45:56 +01:00
|
|
|
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]
|
2021-01-23 18:32:53 +01:00
|
|
|
ret
|