2019-10-08 19:54:39 +02:00
|
|
|
; User-accessible part of FCB (12 bytes)
|
|
|
|
%define fcb_drv 0 ; 1 byte
|
|
|
|
%define fcb_fn 1 ; 8 bytes
|
|
|
|
%define fcb_ext 9 ; 3 bytes
|
|
|
|
|
|
|
|
; Drive & FS data (4 bytes)
|
|
|
|
%define fcb_spt 12 ; byte sectors per track
|
|
|
|
%define fcb_nos 13 ; byte number of sides/heads
|
|
|
|
%define fcb_ss 14 ; byte sector size: 2^ss
|
|
|
|
%define fcb_cs 15 ; byte cluster size: 2^(ss+cs)
|
|
|
|
|
|
|
|
; Read/Write pointer (12 bytes):
|
|
|
|
; Will be overwritten by new filename for CL=17
|
|
|
|
%define fcb_fsize 16 ; dword file size
|
|
|
|
%define fcb_fptr 20 ; dword handle position
|
|
|
|
%define fcb_clus 24 ; word current cluster fptr points in
|
|
|
|
%define fcb_co 26 ; word start sector for theoretical cluster 0
|
|
|
|
|
|
|
|
; Link to directory item (3 bytes)
|
|
|
|
%define fcb_ds 28 ; word directory sector
|
|
|
|
%define fcb_do 30 ; byte directory offset
|
2019-09-29 14:23:39 +02:00
|
|
|
|
2019-10-08 19:54:39 +02:00
|
|
|
fcb_open_rootdir:
|
2019-09-29 23:25:29 +02:00
|
|
|
cmp byte [bx], 0
|
|
|
|
jne .drivedone
|
|
|
|
mov al, default_drive
|
|
|
|
mov [bx], al
|
|
|
|
.drivedone:
|
|
|
|
mov dl, [bx]
|
|
|
|
dec dl
|
|
|
|
|
2019-10-08 19:54:39 +02:00
|
|
|
xor ax, ax
|
|
|
|
xor dx, dx
|
|
|
|
; set directory sector to 0 (=rootdir)
|
|
|
|
mov [bx+fcb_ds], ax
|
|
|
|
; load first sector
|
|
|
|
call drive_read
|
|
|
|
|
|
|
|
; transfer sector size
|
|
|
|
mov ax, [diskbuf + 0x0B]
|
|
|
|
call log2
|
|
|
|
mov byte [bx+fcb_ss], al
|
|
|
|
|
|
|
|
; transfer cluster size
|
|
|
|
mov al, [diskbuf + 0x0D]
|
|
|
|
call log2
|
|
|
|
mov byte [bx+fcb_cs], al
|
|
|
|
|
|
|
|
; transfer sectors per track
|
|
|
|
mov al, [diskbuf + 0x18]
|
|
|
|
mov byte [bx+fcb_spt], al
|
|
|
|
|
|
|
|
; transfer number of heads/sides
|
|
|
|
mov al, [diskbuf + 0x1A]
|
|
|
|
mov byte [bx+fcb_nos], al
|
2019-09-29 23:25:29 +02:00
|
|
|
|
2019-09-29 14:23:39 +02:00
|
|
|
ret
|