News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

push macros for POASM

Started by Vortex, February 19, 2006, 10:47:44 AM

Previous topic - Next topic

Vortex

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 args:VARARG
   LOCAL paramcount,arg
      paramcount=@ArgCount(args)
      WHILE paramcount
         push @ArgI(paramcount,args)
         paramcount = paramcount - 1
      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
[attachment deleted by admin]

Vortex

Added a popREV macro to pop arguments in reverse order.

[attachment deleted by admin]