I'm trying to create a program that causes a window to "shake". What I need is the equivelant of the C++ % operator, or another way go generate a random number..
temp TEXTEQU <9 MOD 5>
temp TEXTEQU %temp
% ECHO temp
temp TEXTEQU <7 MOD 5>
temp TEXTEQU %temp
% ECHO temp
temp TEXTEQU <2 MOD 5>
temp TEXTEQU %temp
% ECHO temp
Output:
4
2
2
MASM macros are such a complex thing. :tongue:
...or did you mean in code? That is just the remainder of div (edx).
temp TEXTEQU %temp
% ECHO temp
temp TEXTEQU <7 MOD 5>
temp TEXTEQU %temp
% ECHO temp
temp TEXTEQU <2 MOD 5>
temp TEXTEQU %temp
% ECHO temp
Output:
4
2
2
MASM macros are such a complex thing. :tongue:
...or did you mean in code? That is just the remainder of div (edx).
...or did you mean in code? That is just the remainder of div (edx).
Heh..wow, how did I miss that? Thanks.It must have been all the shaking. :tongue:
I've you are mod-ing with a number that is a power of 2, a simple and will do to.
reg % (2^x) = and reg, (2^x - 1)
example: eax % 8 is and eax, (8-1)
Thomas
reg % (2^x) = and reg, (2^x - 1)
example: eax % 8 is and eax, (8-1)
Thomas