这里是代码:需要一些帮助打印字符串ASM程序
.model tiny
; assemble me this way
; ml /AT /c /Zm /coff /omf <file name>
; link me this way
; link2 /TINY <obj name>
COMSEG SEGMENT
org 7C00h
.code
start:
MyStr BYTE "HelloWorld", '$'
cld ; Clear Direction Flag
mov si, offset MyStr
whileloop:
lodsb ;; While Hello[Si] != '$'
cmp al, '$'
jne doproc
jmp endwhileloop
doproc:
mov ah, 0ah ;; Video operation in Ah to write
;; character in Al to screen.
mov bh, 0 ;; Alpha page 0
mov cx, 1
int 10h
jmp whileloop
endwhileloop:
jmp $
db 510-($-start) dup (0) ;Loads of zeroes
dw 0AA55h
end start
COMSEG ENDS
此代码只打印垃圾到命令提示符。 MASM,Windows XP,在16位虚拟机下运行。如果有人能帮我正确地在屏幕上打印字符,那就太好了。
所以我试图用0eh加载ah寄存器来使用BIOS例程,它仍然会打印垃圾。有没有任何理由不使用DOS系统调用?我正在写一个引导程序,所以使用DOS系统调用会导致任何问题? – TheFuzz 2011-02-03 05:00:06