2

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

它应该只在屏幕上显示“正在启动...”,但它还会显示我定义的每条消息(“正在启动...删除磁盘并按 Enter 重新启动...”)。我该如何解决?

这是我的代码:

[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
4

1 回答 1

1

mov al, endofline 应该是 mov si, endofline

谢谢@弗兰克科特勒

于 2013-07-09T17:09:07.293 回答