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