I'm trying to pass arguments to a function call by pushing them onto the stack, then popping them into registers inside the function like this:
push keystring+0x7c00
call PrintString
jmp $
;====functions====
PrintString:
pop ecx
mov ah, 0x0e
LoopHead:
mov bl, 0
mov al, [ecx]
int 0x10
inc ecx
add bl, [ecx]
jnz LoopHead
ret
;====variables====
keystring:
db "Press any key...", 0
;====padding====
times 510-($-$$) db 0
db 0x55, 0xAA
It works fine if I do it by storing the argument in ecx and using ecx in the function, but for some reason pop just won't work. Does anybody know how I can fix this?