Push \ pop macros

Started by Vortex, October 02, 2006, 06:51:50 PM

Previous topic - Next topic

Vortex

Here is a set of macros to do consecutive push \ pop operations :

push2 MACRO args:VARARG
   FOR p,<args>
      push p
   ENDM
ENDM

pop2 MACRO args:VARARG
   FOR p,<args>
      pop p
   ENDM
ENDM

pushREV MACRO p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20

   FOR arg,<p20,p19,p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>

      IFNB <arg>
         push arg
      ENDIF
     
   ENDM

ENDM

popREV MACRO p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20

   FOR arg,<p20,p19,p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>

      IFNB <arg>
         pop arg
      ENDIF
     
   ENDM

ENDM

gabor

Hi!

This is smart! :)

I still can remember my wondering when I first got compile errors on my "push eax ebx" line. I was completly used to it with tasm I was only slowly able to get used to the seperated push method.

hutch--

Erol,

Compliments, these look good.  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hutch, Gabor,

Thanks for your kind words.