Hi @ all,
I have to implement an algorithm (which is not actually important), and I think the easiest way is to make it recursive, but... MASM32 does not support recursion by itself, does it?:confused:

Thanx in advance,
Daniel
Posted on 2001-12-01 12:27:07 by dguzz
Sure it does. Put your all your variables on the stack using LOCAL, PUSH whatever registers you use when you enter, and POP them when you leave. :)
Posted on 2001-12-01 14:00:19 by S/390
I wrote a game recently, and a couple of the functions used recursion quite heavily. I made a list of all the registers i used in each function, then added them to a "USES" clause at the top of the function. The advantage over doing this instead of just PUSHing the regs at the start is that i could have several exit points, and MASM would automatically insert the right POPs for me, a good way to avoid bugs, especially if you could be calling the same function 10's or 100's of times :)

The USES clause looks like this:



myFunc proc USES esi ebx ecx edx hWnd :DWORD, arrayPtr :DWORD, .....
Posted on 2001-12-01 21:02:53 by sluggy
Thanx to all...;)
I'll try to code it asap...

Sincerely,
Daniel
Posted on 2001-12-02 04:16:03 by dguzz
LOL. I always forget about USES since it's "new". Doesn't make much difference in most of my code, since I always try to have only one RET, partly to keep from having all those extra POPs... :grin:

It is a nice feature though... :)
Posted on 2001-12-02 20:53:28 by S/390

It is a nice feature though... :)

Yeah, we move to asm for its power and flexibility, but then we use high-level type stuff in it, kind of ironic :)
Posted on 2001-12-02 21:43:22 by sluggy