Question

I'm writing a game bootloader for x86. At one point, early in the booting, I need to load some sectors from my boot drive into memory. I do this with interrupt 0x13 (ah=02), and when I try it in my virtual machine it works like a charm. However when I burn the image to a usb drive, the machine fails to boot, and I pinned it down to the sector loading instructions, apparently my usb drive isn't drive 0 (Floppy A), so the read fails.

How can I determine which drive was used to boot?

Thanks!

Was it helpful?

Solution

BIOS loads number of drive bootloader was loaded from to register dl. Source: OSDev Wiki, section MBR Bootstrap.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top