NO

Author Topic: push \ pop macros  (Read 1266 times)

Offline Vortex

  • Member
  • *
  • Posts: 999
    • http://www.vortex.masmcode.com
push \ pop macros
« on: February 24, 2025, 09:50:26 PM »
push \ pop macros to process multiple values in one line :

Code: [Select]
@ArgCount MACRO arglist:VARARG
    LOCAL count
    count = 0
    FOR arg, <arglist>
        count = count + 1
    ENDM
    EXITM count
ENDM

@ArgI MACRO index:REQ, arglist:VARARG
    LOCAL count, retstr
    count = 0
    FOR arg, <arglist>
        count = count + 1
        IF count EQ index
            retstr TEXTEQU arg
        ENDIF
    ENDM
    EXITM retstr
ENDM

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

popREV MACRO args:VARARG
   LOCAL paramcount,arg
      paramcount=@ArgCount(args)
      WHILE paramcount
         pop @ArgI(paramcount,args)
         paramcount = paramcount - 1
      ENDM
ENDM
Code it... That's all...