well im still learning but idk why it isnt working can someone shed some light on what im doing incorrect
.486
include \masm32\include\masm32rt.inc
.code
start:
mov eax, sval(input("First number:"))
mov ecx, sval(input("Second Number:"))
add eax,ecx
.if eax < 10
print str$(eax)
inkey
.else
@@:
print str$(esi)
dec eax
cmp eax,0
jnz @B
inkey
.endif
invoke ExitProcess,0
end start
Calls to functions tend to destroy the values in eax, ecx, edx, so when you call print and inkey it will mess up your value in eax.
mov eax, sval(input("First number:"))
mov ecx, sval(input("Second Number:"))
add eax,ecx
.if eax < 10
print str$(eax)
inkey
.else
@@:
push eax ; <----
print str$(esi)
pop eax ; <----
dec eax
cmp eax,0 ;this isn't actually needed - "dec" will set the zero-flag if necessary ;)
jnz @B
inkey
.endif
invoke ExitProcess,0
thanks i was just curious ive been trying to find a good resource to explain what pop push and eax and ecx and what everything is and is used for do you happen to know of one?
There are quite a few resources/tutorials lurking around, if you can manage to find them :wink
For beginners, I suppose http://webster.cs.ucr.edu/AoA/index.html and/or http://www.drpaulcarter.com/pcasm would be the main suggestions; other members may have more.