I want to create
printl function that allow me to print string in the
ax register. I am in 16-bit real mode and I can not find any way to print a message. I using
int 0x10 to print a single letter.
I try pass argument (string to print) in
bx register, then in a loop print letter by letter and then go back using
ret. My code didn't really work -- either it created a infinite loop or printed a strange sign.
If you know more efficient way to do it then it's not a problem. I would also like to ask about comment your code if you gave any
This is my code
start: mov bx, welcome ;put argument to bx call printl ;call printl function in sysf.asm hlt ;halt cpu welcome db 'Hello', 0 include 'sysf.asm' times 510 - ($-$$) db 0 db 0x55 db 0xAA
;print function ; al is one letter argument (type Java:char) ; print: pusha mov ah, 0x0e int 0x10 popa ret ; go back ;printl function ; bx is argument of type Java:String ; printl: pusha jmp printl001 printl001: lodsb ; I was working with si register but i would like to use bx register or al,al jz printl002 mov ah, 0x0e int 0x10 jmp printl001 printl002: popa ret