Fix hdd booting using bpb struc
This commit is contained in:
parent
1d64c2364d
commit
8ed9fe7465
2 changed files with 11 additions and 20 deletions
12
boot/mbr.asm
12
boot/mbr.asm
|
@ -10,7 +10,7 @@
|
|||
|
||||
%include "inc/bpb.asm"
|
||||
|
||||
%define bpb bs+0x0B
|
||||
%define params bs+0x0B
|
||||
|
||||
cpu 8086
|
||||
org 0x0600
|
||||
|
@ -72,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 [bpb+bpb_ss], 512
|
||||
cmp word [params+bpb.sectorsize], 512
|
||||
jne chain
|
||||
|
||||
; Media descriptor byte is never smaller than 0xF0
|
||||
cmp byte [bpb+bpb_md], 0xF0
|
||||
cmp byte [params+bpb.mediadesc], 0xF0
|
||||
jc chain
|
||||
|
||||
; ask BIOS what our disk geometry is
|
||||
|
@ -92,17 +92,17 @@ main: ; find active partition
|
|||
; update sectors per track
|
||||
xor ax, ax
|
||||
mov al, cl
|
||||
mov [bpb+bpb_spt], ax
|
||||
mov [params+bpb.tracksectors], ax
|
||||
|
||||
; update number of sides
|
||||
xor ax, ax
|
||||
mov al, dh
|
||||
mov [bpb+bpb_nos], ax
|
||||
mov [params+bpb.heads], ax
|
||||
|
||||
; update partition offset
|
||||
push si
|
||||
add si, 0x08
|
||||
mov di, bpb+bpb_po
|
||||
mov di, params+bpb.sectoroffset
|
||||
movsw
|
||||
movsw
|
||||
pop si
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue