Meh
This commit is contained in:
parent
4abfab2812
commit
b3014ef8e4
@ -13,7 +13,7 @@ fcb_cs: equ 15 ; byte cluster size: 0=128, 1=256, 2=512, ...
|
|||||||
fcb_co: equ 16 ; word start sector for theoretical cluster 0
|
fcb_co: equ 16 ; word start sector for theoretical cluster 0
|
||||||
|
|
||||||
; Read/Write pointer (6 bytes)
|
; Read/Write pointer (6 bytes)
|
||||||
fcb_left: equ 18 ; word number of bytes left to read from diskbuf
|
fcb_left: equ 18 ; word number of bytes left to read in current sector
|
||||||
fcb_off: equ 20 ; dword offset in disk (not in file)
|
fcb_off: equ 20 ; dword offset in disk (not in file)
|
||||||
|
|
||||||
; Link to directory item (4 bytes)
|
; Link to directory item (4 bytes)
|
||||||
@ -23,6 +23,7 @@ fcb_end: equ 32
|
|||||||
|
|
||||||
fcb_open_rootdir:
|
fcb_open_rootdir:
|
||||||
mov dl, 0x01
|
mov dl, 0x01
|
||||||
|
or dl, 0x80
|
||||||
mov [bx], dl
|
mov [bx], dl
|
||||||
dec dl
|
dec dl
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ fcb_open_rootdir:
|
|||||||
; Default 2 heads, 9 sectors
|
; Default 2 heads, 9 sectors
|
||||||
mov word [bx+fcb_spt], 0x0209
|
mov word [bx+fcb_spt], 0x0209
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
|
xor dx, dx
|
||||||
lea di, [bx+fcb_ss]
|
lea di, [bx+fcb_ss]
|
||||||
; Sector & Cluster size 128 bytes
|
; Sector & Cluster size 128 bytes
|
||||||
mov cx, (fcb_end - fcb_ss)
|
mov cx, (fcb_end - fcb_ss)
|
||||||
@ -39,9 +41,7 @@ fcb_open_rootdir:
|
|||||||
call drive_read
|
call drive_read
|
||||||
|
|
||||||
; copy sector size
|
; copy sector size
|
||||||
mov ax, [diskbuf + 0x0B]
|
mov ax, [diskbuf + fdc_ss]
|
||||||
; ... save as number of valid bytes in diskbuf
|
|
||||||
mov WORD [bx+fcb_left], ax
|
|
||||||
call log2
|
call log2
|
||||||
sub ax, 7
|
sub ax, 7
|
||||||
; ... save as sector size
|
; ... save as sector size
|
||||||
@ -55,35 +55,17 @@ fcb_open_rootdir:
|
|||||||
mov byte [bx+fcb_cs], al
|
mov byte [bx+fcb_cs], al
|
||||||
|
|
||||||
; copy sectors per track
|
; copy sectors per track
|
||||||
mov al, [diskbuf + 0x18]
|
mov al, [diskbuf + fdc_spt]
|
||||||
mov byte [bx+fcb_spt], al
|
mov byte [bx+fcb_spt], al
|
||||||
|
|
||||||
; copy number of heads/sides
|
; copy number of heads/sides
|
||||||
mov al, [diskbuf + 0x1A]
|
mov al, [diskbuf + 0x1A]
|
||||||
mov byte [bx+fcb_nos], al
|
mov byte [bx+fcb_nos], al
|
||||||
|
|
||||||
ret
|
xor dx, dx
|
||||||
|
mov ax, [diskbuf + fdc_sf]
|
||||||
|
mul byte [diskbuf + fdc_fn]
|
||||||
|
add ax, [diskbuf + fdc_rsc]
|
||||||
|
int3
|
||||||
|
|
||||||
fcb_get_sector_mask:
|
|
||||||
push cx
|
|
||||||
xor ax, ax
|
|
||||||
not ax
|
|
||||||
mov cl, [bx+fcb_ss]
|
|
||||||
add cl, 7
|
|
||||||
shl ax, cl
|
|
||||||
pop cx
|
|
||||||
ret
|
|
||||||
|
|
||||||
fcb_getc:
|
|
||||||
push bx
|
|
||||||
call fcb_get_sector_mask
|
|
||||||
not ax
|
|
||||||
and ax, [bx+fcb_off]
|
|
||||||
xchg ax, bx
|
|
||||||
add bx, diskbuf
|
|
||||||
mov al, [bx]
|
|
||||||
pop bx
|
|
||||||
add word [bx+fcb_off], 1
|
|
||||||
adc word [bx+fcb_off+2], 0
|
|
||||||
dec word [bx+fcb_left]
|
|
||||||
ret
|
ret
|
||||||
|
@ -22,8 +22,7 @@ init:
|
|||||||
mov dx, banner
|
mov dx, banner
|
||||||
call print_string
|
call print_string
|
||||||
|
|
||||||
mov si, init_program
|
call exec_chain
|
||||||
call exec
|
|
||||||
|
|
||||||
cli
|
cli
|
||||||
.halt:
|
.halt:
|
||||||
@ -50,6 +49,7 @@ cpm_syscall:
|
|||||||
%include "char.asm"
|
%include "char.asm"
|
||||||
|
|
||||||
%include "exec.asm"
|
%include "exec.asm"
|
||||||
|
%include "fdc.asm"
|
||||||
%include "fcb.asm"
|
%include "fcb.asm"
|
||||||
%include "fcbparse.asm"
|
%include "fcbparse.asm"
|
||||||
%include "drive.asm"
|
%include "drive.asm"
|
||||||
|
14
lib/fdc.asm
Normal file
14
lib/fdc.asm
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
; FDC Descriptor / BIOS parameter block
|
||||||
|
fdc_ss: equ 0x0B ; WORD sector size
|
||||||
|
fdc_sc: equ 0x0D ; BYTE sectors per cluster
|
||||||
|
fdc_rsc: equ 0x0E ; WORD reserved sectors
|
||||||
|
fdc_fn: equ 0x10 ; BYTE FAT tables
|
||||||
|
fdc_rde: equ 0x11 ; WORD root directory entries
|
||||||
|
fdc_ts: equ 0x13 ; WORD total sector count
|
||||||
|
; 0 if >65535, use lrgts then
|
||||||
|
fdc_mi: equ 0x15 ; BYTE media descriptor byte
|
||||||
|
fdc_sf: equ 0x16 ; WORD sectors per FAT
|
||||||
|
fdc_spt: equ 0x18 ; WORD sectors per track
|
||||||
|
fdc_nos: equ 0x1A ; WORD sides/heads
|
||||||
|
fdc_po: equ 0x1C ; DWORD partition offset
|
||||||
|
fdc_lrgts: equ 0x20 ; DWORD large sector count
|
Loading…
Reference in New Issue
Block a user