Question

I have written a simple bootloader based on: http://www.viralpatel.net/taj/tutorial/hello_world_bootloader.php

It should only display "Booting..." on the screen, but it also displays each message I defined("Booting...Remove disk and press enter for reboot..."). How can I fix it?

This is my code:

[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
Was it helpful?

Solution

mov al, endofline should be mov si, endofline

Thanks @Frank Kotler

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top