I am using nasm to print one string at a time but it prints two string at a time, i have added null character to the end and i am comparing the null character to check for the end of the string but both the strings end up getting printed even when i ask for only one of them.
[org 0x7c00]
mov bx, HELLO_MSG
call print_string
mov bx, GOODBYE_MSG
jmp $
%include "print_string.asm"
;Data
HELLO_MSG:
db 'Hello, World!',0
GOODBYE_MSG:
db 'GOODBYE!',0
times 510-($- $$) db 0
dw 0xaa55
The other file print_string.asm
print_string:
pusha
cld
mov ah,0x0e
config: mov al,[bx]
;Comparing the strings
mov cx,[bx]
cmp cx,0x00 ;Comparing for null
jne print
je end
print: int 0x10
add bx,1
jmp config
end: popa
ret