I wrote a simple recursive print function in x86 assembly, however, I noticed that all the instructions after call print
never get executed, after scratching my head over it, I figured that if I remove push ax, pop ax
everything works fine, is there something I miss about the stack?
Here is the code:
print:
push ax
mov ah, 0x0e
mov al, [bx+si]
inc si
cmp al, 0x00
int 0x10
jne print
mov al, 0x0d
int 0x10
mov si,0
pop ax
ret
it's a simple recursive function with the base condition of the null character, the parameter is bx, while the counter is SI.