User:Johnburger/Demo/BIOS/MBR

From OSDev Wiki
Jump to navigation Jump to search

Strictly speaking, the Master Boot Record (MBR) is not actually a BIOS structure. It's defined by itself - its own code defines and accesses the Partition Table entries embodied within itself.

It could be that this boot code has been loaded from the MBR, so we need to access the entry that defines the Partition to continue to load the rest of the system.

Demo/BIOS/MBR.inc

;
; BIOS/MBR.inc
;

; These are the definitions for the standard BIOS Master Boot Record

; If we booted from a hard disk, ES:SI will be pointing to the relevant Partition
                STRUC           BIOS.MBR.Entry
.Active         RESB            1
.StartHead      RESB            1
.StartCylSect   RESW            1
.Type           RESB            1
.EndHead        RESB            1
.EndCylSect     RESW            1
.Start          RESD            1
.Size           RESD            1
                ENDSTRUC

; The two CylSect entries above have the following format. But don't be fooled!
; The HIGH bits of the Cylinder are in the LOW byte  - it's weirdly reversed!
BIOS.MBR.Entry.Cyl  EQU         1111_1111_1100_0000b
BIOS.MBR.Entry.Sect EQU         0000_0000_0011_1111b