找出在x86引导程序中引导了哪个驱动器 [英] Finding out which drive was booted in x86 bootloader
问题描述
我正在为x86编写游戏引导程序. 有一次,在启动的早期,我需要将某些部分从启动驱动器加载到内存中.我使用中断0x13(ah = 02)来执行此操作,当我在虚拟机中尝试时,它就像一个超级按钮.但是,当我将映像刻录到USB驱动器时,机器无法启动,并且将其固定到扇区加载指令中,显然我的USB驱动器不是驱动器0(软盘A),因此读取失败.
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?
谢谢!
推荐答案
BIOS加载驱动器引导加载程序从其加载到寄存器dl
的数目.来源: OSDev Wiki , MBR引导程序部分.
BIOS loads number of drive bootloader was loaded from to register dl
. Source: OSDev Wiki, section MBR Bootstrap.
这篇关于找出在x86引导程序中引导了哪个驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!