mbr: make use of BPB includes

This commit is contained in:
Nero 2020-04-30 20:22:14 +02:00
parent 6d1befb49f
commit 404825387b
1 changed files with 16 additions and 19 deletions

View File

@ -1,19 +1,16 @@
; FDC fields in VBR
%define bps (bs + 0x0B)
%define md (bs + 0x15)
%define spt (bs + 0x18)
%define nos (bs + 0x1A)
%define po (bs + 0x1C)
; blah dont judge me, i miss 8080
%macro retnz 0
jz short ($+3)
; blah dont judge me, i miss 8080
%macro retnz 0
jz short ($+2+1)
ret
%endmacro
%macro callc 1
jnc short ($+5)
%endmacro
%macro callc 1
jnc short ($+2+3)
call %1
%endmacro
%endmacro
%include "inc/bpb.asm"
%define bpb bs+0x0B
cpu 8086
org 0x0600
@ -75,11 +72,11 @@ main: ; find active partition
; FAT bpb has "bytes per sector" at this place
; we support only 512 byte sectors anyways
cmp word [bps], 512
cmp word [bpb+bpb_ss], 512
jne chain
; Media descriptor byte is never smaller than 0xF0
cmp byte [md], 0xF0
cmp byte [bpb+bpb_md], 0xF0
jc chain
; ask BIOS what our disk geometry is
@ -95,17 +92,17 @@ main: ; find active partition
; update sectors per track
xor ax, ax
mov al, cl
mov [spt], ax
mov [bpb+bpb_spt], ax
; update number of sides
xor ax, ax
mov al, dh
mov [nos], ax
mov [bpb+bpb_nos], ax
; update partition offset
push si
add si, 0x08
mov di, po
mov di, bpb+bpb_po
movsw
movsw
pop si