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..
Posted on 2001-08-26 12:21:15 by vcv
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).
Posted on 2001-08-26 12:54:26 by bitRAKE
...or did you mean in code? That is just the remainder of div (edx).
Heh..wow, how did I miss that? Thanks.
Posted on 2001-08-26 14:44:29 by vcv
It must have been all the shaking. :tongue:
Posted on 2001-08-26 14:48:36 by bitRAKE
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
Posted on 2001-08-26 17:07:01 by Thomas