I am trying to implement a print function in an external file given this code:
[ org 0x7c00 ]
mov bx , HELLO_MSG
call print_string
mov bx , GOODBYE_MSG
call print_string
jmp $
%include "print_string.asm"
HELLO_MSG:
db "Hello , World !" , 0 ;
GOODBYE_MSG:
db "Goodbye !", 0
times 510 -( $ - $$ ) db 0
dw 0xaa55
The function I wrote looks like this:
print_string :
pusha
mov ax, bx
mov ah , 0x0e
int 0x10
popa
ret
But it doesn't work. I guess it's because I am using the wrong registers... but I am a little confused, because in previous examples in the tutorial, the character to be printed is first moved to al
and in the print function only this is used:
mov ah , 0x0e
int 0x10
ret
But since here, bx
is used, I can't just print what's in al
, right?
Some help would be highly appreciated!!