Hello,
Typically, there are two "Stage 1" boot loaders on HDDs. One that is loaded by the BIOS (MBR Bootstrap) and one that the MBR loads (The OS's bootstrap.)
The BIOS loads the 1st sector of the HDD (The MBR) to 0x7c00 and executes it if the boot signature (0xaa55) is valid. The MBR bootstrap program reads the partition table (also located in the MBR) and gets the first sector of the active partition. It relocates itself to another address, and loads that sector to 0x7c00. It checks this sectors boot signature and executes it, passing in the drive number that was passed to it from the BIOS in DL. From here, the OS's bootstrap program takes control and continues through that OS's specific boot process.
The MBR bootstrap is just a flat binary real mode program loaded at 0x7c00, with the partition table located at 0:0x07be. You can create this in NASM like this:
Code: Select all
;your boot code
times 0x1be-($-$$) db 0
; partition table must be at 0:0x07be
; there are only 4 entries in the table, or 64 bytes
partition_table:
%rep MBR_NUM_ENTRIES
istruc mbr_entry
at mbr_entry.m_boot, db 0
at mbr_entry.m_startHead, db 0
at mbr_entry.m_startSect, dw 0
at mbr_entry.m_id, db 0
at mbr_entry.m_endHead, db 0
at mbr_entry.m_endSect, dw 0
at mbr_entry.m_partSect, dd 0
at mbr_entry.m_partSize, dd 0
iend
%endrep
dw BOOT_SIG
where BOOT_SIG is the boot signature (0xaa55) and MBR_NUM_ENTRIES is 4. If the m_boot entry in your MBR is 0x80, then it is an active partition. Read the sector at startSect to 0x7c00 and execute it.
There is no "parameter block". Technically the OS's bootstrap loader may not even contain one, the BPB is a filesystem detail, its never actually needed depending on the filesystem.
So, basically the BIOS loads and executes the MBR bootstrap. The MBR bootstrap reads and loads an active partition containing your FAT16 formatted partition and OS bootstrap code. Your FAT16 bootstrap code contains the BPB and loads your OS.