Ok I don't understand the difference here. I'll explain with an example.
mov ABC,4
mov Randx,0
mov eax,ABC
.while Randx < eax
;DO CODE
inc Randx
.endw
and this:
mov Randx,0
.while Randx < 4
;DO CODE
inc Randx
.endw
Both codes compile perfectly, but the first one seems to block the programm.
Why is this? And how can I make the first one work?
Thanks in advance.
If you are including windows.inc, ABC is a structure and cannot be used as a variable name.
i was using ABC as an example.. Let it be sjdhfqkhfsjfdhskh... Now can somebody anwser ?
I tested it with masm 6.14 and 6.15 with no problem.
Do you have additional code within the loop? any api and most procs will trash eax.
What you've actually posted will work fine, the problem comes when you actually put something useful instead of ";DO CODE" -- if that code modifies 'eax' in any way, then you're no longer comparing against the value '4', but whatever the new value of eax is.
So, to make the first one work, you could push/pop to reserve the value of eax:
mov ABC,4
mov Randx,0
mov eax,ABC
.while Randx < eax
push eax
;DO CODE
pop eax
inc Randx
.endw
Tedd thank you, it works perfectly now :) !