I was trying to print a string in a boot sector and have the following code:
[org 0x7c00]
mov ah, 0x0e
mov bx, msg
call print
mov bx, msg1
call print
jmp $
print:
mov al, [bx]
int 0x10
inc bx
cmp al, 0
jne print
ret
msg db "hello",0
msg1 db "goodbye",0
times 510-($-$$) db 0
dw 0xaa55
The output using qemu looks like where the underscores are spaces:
hello_goodbye_
I don't know what I'm missing. The entire point I thought about is to keep looping and printing characters until I find a null character which the strings are terminated with.
I know that I can probably solve the problem with a jump to the end before the bios interrupt call, but I really want to understand why the spaces are being printed after the actual strings.
Any help is extremely appreciated!