问题描述
我要编写和测试引导加载程序.为此,我计划将引导加载程序复制到软盘映像文件中,然后将其安装在VM中.
I'm going to write and test a bootloader. In order to do this, I am planning to copy the bootloader onto a floppy image file and mount it in a VM.
但是,我不确定将引导加载程序的机器代码放在哪里.它只是被转储到文件的前几个字节中吗?
However, I'm not sure where to put the bootloader's machine code. Does it just get dumped into the first few bytes of the file?
推荐答案
软盘的引导扇区是第一个扇区.如果您要谈论的是原始软盘映像(1440K),则它应该是映像文件的前512个字节.
The boot sector of the floppy was the first sector. If you're talking about a raw floppy image (1440K), it should be the first 512 bytes of the image file.
它从内存中被BIOS加载到7c00:0000(实模式)中,然后跳转到该地址.
From memory, this gets loaded by the BIOS into 7c00:0000 (real mode) and then jumps to that address.
DOS引导软盘上有一个3字节的JMP
指令,用于跳过磁盘参数块(DPB),其中详细介绍了磁盘的属性.但是,如果您完全控制磁盘和启动代码,那么我认为您无需遵循该约定.我不记得有任何BIOS在检查加载的内容是否有效(尽管很久以前就知道了).
The DOS boot floppies had a 3-byte JMP
instruction there to jump over the Disk Parameter Block (DPB), which detailed the attributes of the disk. But, if you're in total control of the disk and your boot code, I don't think you need to follow that convention. I don't recall any BIOS' checking what was loaded for validity (though admittedly it was a long time ago).
这篇关于将引导加载程序存储在软盘映像上的什么位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!