【发布时间】:2011-08-07 15:37:40
【问题描述】:
我的期望是它打印一个字符串,但什么都没有打印出来。 当我将字符串变短时,它有时会起作用,而当我再次将它们变长时,它有时会起作用。
我不知道为什么这不起作用。
有人可以帮我吗? 谢谢。
我使用的汇编代码是:
(Emacs 23、Ubuntu 10.10、nasm、VirtualBox OSE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org 0x7c00
bits 16
str:
db "Some say the world will end in fire",10,13
db "Some say in ice",10,13
db "From what I've tasted of desire",10,13
db "I hold with those who favor fire",10,13
db "But if I had to perish twice,",10,13
db "I think I know enough of hate",10,13
db "To say that for destruction ice",10,13
db "is also great and would suffice."
db "Robert Frost - Fire and Ice"
db 0
start:
xor ax,ax
mov ds,ax
mov es,ax
mov si, str
xor bx,bx
mov ah, 0x0e
print:
lodsb ;al = current char
cmp al, 0
je end
int 0x10
jmp print
end:
cli
hlt
times 510 - ($-$$) db 0
dw 0xAA55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
【问题讨论】:
-
我认为您需要添加一条 CLD 指令,以确保 lodsb 增加 si 而不会减少它。但是,我认为还有其他一些问题。
标签: assembly x86 nasm bootloader bios