Finding out which drive was loaded into the x86 bootloader

I am writing a bootloader for x86. At some point, at the beginning of the boot, I need to load some sectors from my boot disk into memory. I do this with interrupt 0x13 (ah = 02), and when I try it on my virtual machine, it works like a charm. However, when I write the image to a USB drive, the machine does not boot, and I attached it to the sector boot instructions, it is obvious that my USB drive is not disk 0 (Floppy A), so reading is not performed.

How to determine which drive was used to boot?

Thanks!

0
source share
1 answer

The BIOS boot from the boot disk was loaded from the dl register. Source: OSDev Wiki , MBR Bootstrap section.

+4
source

Source: https://habr.com/ru/post/912362/


All Articles