News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Compact procedure_call macro

Started by HSE, April 12, 2021, 01:32:56 AM

Previous topic - Next topic

HSE

Hi Hutch!

Here an alternative more compact of the macro:    procedure_call MACRO fname:REQ,a1:VARARG

    LOCAL lead,wrd2,ssize,sreg,svar
 
      arg1_n = 0 
      FOR arg2, <a1>
        ;; **************************
        ;; first 4 register arguments
        ;; **************************
          IF arg1_n eq 0
            REGISTER arg2,cl,cx,ecx,rcx,xmm0
          ENDIF
       
          IF arg1_n eq 1
            REGISTER arg2,dl,dx,edx,rdx,xmm1
          ENDIF
       
          IF arg1_n eq 2
            REGISTER arg2,r8b,r8w,r8d,r8,xmm2
          ENDIF
       
          IF arg1_n eq 3
            REGISTER arg2,r9b,r9w,r9d,r9,xmm3
          ENDIF
        ;; **************************
        ;; following stack arguments
        ;; **************************
          IF arg1_n gt 3
            STACKARG arg2,arg1_n*8
          ENDIF

          arg1_n = arg1_n + 1
      ENDM

      call fname

    ENDM


Regards, HSE.
Equations in Assembly: SmplMath