有人知道以下代码有什么问题吗?
我不能按照我想要的方式工作。 我只想打印一个变量的单个字符(字母'h')。
为此,我只使用间接寻址通过方括号
复制内容[]
; Set BIOS print screen settings
mov ah, 0x0e ; Teletype
mov bh, 0 ; Page number
mov bl, 4 ; Red on black (00000100 - High 0000 is black, low 0100 is red)
mov cx, 1 ; Writes one character
; Printing to screen
mov al, [msg] ; Copy the contents of 'H' into 'al'; IT SEEMS THIS IS NOT WORKING!!!
jmp print_char ; Jump to executable code and do not let CPU step on DATA SECTION
; [BEG DATA SECTION]
msg: db 'HELLO', 0
; [END DATA SECTION]
print_char:
int 0x10 ; Call BIOS routine to print the char located at 'al'
infinite_loop:
jmp $
times 510 -($-$$) db 0 ; Pad with 0 until byte 510
dw 0xAA55 ; MBR Boot code signature
答案 0 :(得分:2)
问题在于它顶部缺少以下指令:
org 0x7c00
在@Michael Petch的答案中有关于此的更多信息。