Finding out which drive was booted in x86 bootloader

家住魔仙堡 提交于 2019-12-31 07:00:14

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/9916738/finding-out-which-drive-was-booted-in-x86-bootloader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!