Implement reading geometry info from floppy BPB

This commit is contained in:
Nero 2020-05-04 19:49:26 +00:00
parent 6317d48396
commit 9377924eab
1 changed files with 6 additions and 5 deletions

View File

@ -65,6 +65,10 @@ select_floppy:
xor ax, ax xor ax, ax
call seek call seek
call read call read
mov ax, [disk_buffer+0x0B+bpb_spt]
mov [disk_spt], ax
mul word [disk_buffer+0x0B+bpb_nos]
mov [disk_tracks], ax
ret ret
; Set absolute sector number ; Set absolute sector number
@ -84,14 +88,13 @@ seek: push ax
ror dl, 1 ror dl, 1
ror dl, 1 ror dl, 1
or dl, ah or dl, ah
;inc dx inc dx
; dh bit 0-7: cylinder 0-7 ; dh bit 0-7: cylinder 0-7
; dl bit 0-5: sector number 0-5 ; dl bit 0-5: sector number 0-5
; dl bit 6-7: cylinder 8-9 ; dl bit 6-7: cylinder 8-9
; store ; store
mov byte [disk_chs+1], al mov byte [disk_chs+1], al
mov word [disk_chs+2], dx mov word [disk_chs+2], dx
int 3
ret ret
seek_zero: seek_zero:
@ -106,11 +109,9 @@ read: mov ax, 0x0201
lea bx, [disk_buffer] lea bx, [disk_buffer]
push cs push cs
pop es pop es
int 3
int 0x13 int 0x13
int 3
ret ret
; Write a sector into buffer ; Write a sector into buffer
write: write: stc
ret ret