load our base headers in the same order as the mbr

This commit is contained in:
2024-10-02 10:26:36 -04:00
parent 2bbfa0931b
commit 7c446ef3b2

View File

@@ -25,17 +25,9 @@
jmp short init jmp short init
nop nop
bpb_start: %include "fat32/bpb_reserve_area.inc"
; fill BPB area with 0x00 since we skip writing this part to disk
; but we need it for the 'jmp short entry; nop' above
times 33 db 0x00
ebpb_start:
; fill BPB area with 0x00 since we skip writing this part to disk
; but we need it for the 'jmp short entry; nop' above
times 54 db 0x00
%include "entry.inc" %include "entry.inc"
init: init:
cli ; We do not want to be interrupted cli ; We do not want to be interrupted
@@ -48,25 +40,22 @@ init:
mov bp, sp ; base ptr = stack ptr mov bp, sp ; base ptr = stack ptr
mov bx, VBR_ENTRY ; move BP to the new start of the initial boot sector mov bx, VBR_ENTRY ; move BP to the new start of the initial boot sector
sti ; all done with inital setup and relocation, reenable interupts
jmp 0:main ; fix up cs:ip just in case and jump to relocated code jmp 0:main ; fix up cs:ip just in case and jump to relocated code
%include "config.inc" %include "config.inc"
%include "errors.inc"
%include "memory.inc" %include "memory.inc"
%include "partition_table.inc" %include "partition_table.inc"
%include "errors.inc"
%include "fat32/bpb.inc" %include "fat32/bpb.inc"
main: main:
sti ; all done with inital setup and relocation, reenable interupts
mov [bsDriveNumber], dl ; BIOS passes drive number in DL mov [bsDriveNumber], dl ; BIOS passes drive number in DL
mov [partition_offset], si ; save passed partition entry offset mov [partition_offset], si ; save passed partition entry offset
.check_FAT_size: .check_FAT_size: ; we only support a very specific setup of FAT32
cmp dword [bsSectorHuge], 0 ; SectorsHuge will not be set if FAT12/16 cmp dword [bsSectorHuge], 0 ; SectorsHuge will not be set if FAT12/16
ja main.load_stage2 ja main.load_stage2