eax
is a volatile register, meaning its value is not required to be saved across function/macro calls. You need to save eax
before the print
macro and restore it afterwards:
mov eax, 0
x:
add eax,1
push eax
print str$(eax),13,10
pop eax
cmp eax, 4
jne x
inkey
exit
Or just use a non-volatile register which value is required to be saved by the callee (esi, edi, ebx)
mov ebx, 1
x:
add ebx,1
print str$(ebx),13,10
cmp ebx, 4
jne x
inkey
exit