NASM - Bootloader Printline

时间:2013-07-09 16:22:11

标签: assembly nasm bootloader bios

我编写了一个基于以下内容的简单引导加载程序:http://www.viralpatel.net/taj/tutorial/hello_world_bootloader.php

它应该只在屏幕上显示“Booting ...”,但它也会显示我定义的每条消息(“Booting ... Remove disk and press enter for reboot ...”)。我该如何解决?

这是我的代码:

[BITS 16]
[ORG 0x7C00]

xor ax,ax
mov ds,ax

mov si, msg_boot
call printline

loop:
jmp loop

reboot:
mov si, msg_remove_disk
call printline
call .inputcheck
ret
.inputcheck:
call input
cmp al, 13
je .end
jmp .inputcheck
.end:
call reset
ret

reset:
db 0Eah
dw 0000h
dw 0FFFFh
ret

exit:
ret

print:
mov al, [si]
inc si
or al, al
jz exit
mov ah, 0x0E
int 0x10
jmp print

printline:
call print
mov al, endofline
call print
ret

input:
mov ah, 0
int 16h
ret

msg_boot db 'Booting...', 0
msg_remove_disk db 'Remove disk and press enter for reboot...', 0

endofline db 13, 10, 0

TIMES 510 - ($ - $$) db 0
DW 0xAA55

1 个答案:

答案 0 :(得分:1)

mov al,endofline 应该 mov si,endofline

谢谢@Frank Kotler