【发布时间】:2013-08-24 15:36:54
【问题描述】:
我正在尝试加载软盘的第二个扇区
我使用 fasm 1.7 和 windows 7、VMware 测试此代码。
为了制作软盘映像文件,我使用了 Ubuntu 13.04 中的 dd
我也使用dd 将.bin 写入.img
这是我的代码
org 0x7c00
;load 2nd sector to physical ram address 0xf00
;(load '7' to 0xf00)
mov ah, 02h
mov al, 1
mov ch, 0
mov cl, 2;1~63
mov dh, 0
mov dl, 0
mov bx, 0xf00
push 0
pop es
int 13h
;check whether it is loaded correctly
;by printing a ascii character in 0xf00
mov ah,0fh
int 10h
mov ah,0ah
mov al, [0xf00];
mov cx, 1
int 10h
;pause
jmp $
times 510-($-$$) db 0h
dw 0xaa55
second_sector:
db '7'
结果 = 根本不打印 '7' 我怎么了? 谢谢
【问题讨论】:
-
你确定
0f00h上有一个7吗?您的second_sector似乎不在该地址。 -
使用 ah 02h 和 int 13h,我想我将 second_sector 加载到 0xf00。你能告诉我更多吗?
-
mov al, [0xf00]隐含为[ds:0xfoo]。您已明确将es0 设为读取,但ds是“未知”。尝试修复它。 -
谢谢!它是固定的。
-
@FrankKotler 你真的应该把它作为一个答案,并得到它的功劳。
标签: assembly x86 bootloader fasm sector