Reputation: 5722
im writing a bootloader that looks for stage2 in FAT32. I have almost all the code working but for one thing - finding the correct partition or rather sector offset of my partition
the BIOS is kind enough to provide us with the drive number we were loaded from :
mov [_BOOTDRIVE], dl
however is there any way to get the sector of the partition we were loaded off from or does it have to be hardcoded some way ?
Upvotes: 0
Views: 379
Reputation: 39591
When the MBR bootsector loads and executes the partition bootsector, it loads DL with the drive number and DS:SI with a pointer the entry in the partition table for the selected partition. Your bootloader can read that entry to determine the location of it's partition.
Upvotes: 1