Where to store the bootloader on a floppy image?

点点圈 提交于 2020-01-03 17:44:46

问题


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?


回答1:


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.

From memory, this gets loaded by the BIOS into 7c00:0000 (real mode) and then jumps to that address.

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).




回答2:


its been a VERY long time but if i recall in DOS it was stored in the MBR. i believe its still the same today

http://en.wikipedia.org/wiki/Master_boot_record



来源:https://stackoverflow.com/questions/3706029/where-to-store-the-bootloader-on-a-floppy-image

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