【发布时间】:2011-04-08 19:24:42
【问题描述】:
我正在阅读这篇关于如何从软盘启动的文章:http://www.cs.umbc.edu/portal/help/nasm/boot.shtml
我将在这里给出代码:
; boot1.asm stand alone program for floppy boot sector
; Compiled using nasm -f bin boot1.asm
; Written to floppy with dd if=boot1 of=/dev/fd0
; Boot record is loaded at 0000:7C00,
ORG 7C00h
; load message address into SI register:
LEA SI,[msg]
; screen function:
MOV AH,0Eh
print: MOV AL,[SI]
CMP AL,0
JZ done ; zero byte at end of string
INT 10h ; write character to screen.
INC SI
JMP print
; wait for 'any key':
done: MOV AH,0
INT 16h ; waits for key press
; AL is ASCII code or zero
; AH is keyboard code
; store magic value at 0040h:0072h to reboot:
; 0000h - cold boot.
; 1234h - warm boot.
MOV AX,0040h
MOV DS,AX
MOV word[0072h],0000h ; cold boot.
JMP 0FFFFh:0000h ; reboot!
msg DB 'Welcome, I have control of the computer.',13,10
DB 'Press any key to reboot.',13,10
DB '(after removing the floppy)',13,10,0
; end boot1
我使用 nasm 组装它,然后使用 dd 将其复制到 USB 驱动器。然后我重新启动了系统,它工作得很好。我的问题是,为什么即使我们没有在第 511 个字节定义 0xaa55 也能正常工作?请向我解释一下。还有,什么是冷启动和热启动?请给我一个很好的链接,在那里我可以详细了解启动过程...
编辑: 感谢您的回复!但我发现为什么在这种情况下会发生这种情况。那是我前段时间让这个驱动器可以启动,之后又格式化了很多次。原来格式不影响MBR。因此,当我使用 lde 打印驱动器内容的十六进制转储时,我发现签名仍然存在。现在我删除了它,从驱动器启动显示错误“找不到操作系统”。
【问题讨论】:
-
当 0072:0000 的值为 0 时,计算机执行更多的开机自检 (POST)。如果值为 1234h,则完成的 POST 较少。特别是,将值设置为 1234h 将绕过启动内存测试。