After further investigation, the problem was really simple to solve, I just needed to add 1 line at the beginning of the document org 0x100
would look like this:
[bits 16]
org 0x100 ; aqui la linea que faltaba para que funcionara
segment .text
global start
start:
lea si,[msg]
call caracter
mov ah,4Ch ; end the program
int 21 ; hello darkness my old friend
caracter:
mov al,[si]
cmp al,0
jz endprint
mov ah,0Eh ; imprime el caracter
int 10h
inc si ; avanza al siguiente caracter
jmp caracter
endprint:
ret
segment .data
msg db "Hola mundo",0
This is necessary because according to Nasm's official documentation:
In this model, the code you end up writing starts at 0x100 ...
Which means that we started working in memory address 0x100 and therefore it is necessary to adjust the location counter
to that position which is done with org 0x100
, without this line it was evident that garbage was printed that the information was not in the direction one thought.