Hi friends,

Here is a set of macros simulating the push statement with extended capabilities :

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


Examples :
push2 eax,ebx,ecx,edx outputs the sequence :

push eax
push ebx
push ecx
push edx

pushREV eax,ebx,ecx,edx passes the parameters in reverse order simulating the STDCALL or C parameter passing convention :

push edx
push ecx
push ebx
push eax

Another example :
pushREV eax,OFFSET DlgName,NULL,OFFSET DlgProc,NULL
Attachments:
Posted on 2006-02-19 06:55:35 by Vortex

    See http://www.masmforum.com/simple/index.php?topic=3962.0 . Ratch
Posted on 2006-02-19 10:14:11 by Ratch