In the past few days i've done some tests for an OS, but i can't understand why this code doesn't work: my function gets in input the string address(in BX) and the string length (in CX). If i put a numerical value (i.e. 10) in CX it works, if I put [len] in CX it doesn't work.
bits 16
org 0x7c00
mov bx, string
mov cx, [len]
call print
jmp $
; bx = string address, cx = string lenght
print:
xor si, si
._loop:
mov al, [bx+si]
mov ah, 0x0e
int 0x10
inc si
cmp si, cx
jl ._loop
ret
string db "Hello world!"
len equ $-string
times 510-($-$$) db 0
dw 0xaa55
lenis anequfor an immediate, rather than an address, the OP should be usingmov cx, len- Michael