News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Two different macros for arg count testing in 64 bit MASM.

Started by hutch--, July 11, 2020, 12:11:12 PM

Previous topic - Next topic

hutch--

I have no intention of using them myself but for any who are interested, here are the two macros in a test piece.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    MessageBox@ MACRO args:VARARG
      argcheck 4, MessageBox@, args
      rcall MessageBox,args
    ENDM

    argcheck MACRO cnt, mname, args:VARARG
      var = argcount(args)
      IF var ne cnt
        goto errmsg
      ENDIF
      goto bye
    :errmsg
      echo *****************************************************************************************
      %echo ( ERROR => mname : Invalid arg count = num2str(var) : cnt required )
      echo *****************************************************************************************
      .err
    :bye

    ENDM

    MessageBoxX MACRO arg1:REQ,arg2:REQ,arg3:REQ,arg4:REQ
      rcall MessageBox,arg1,arg2,arg3,arg4
    ENDM

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc

    MessageBoxX 0,"MASM64 Pure and Simple"," UI Template",MB_OK,0
    MessageBox@ 0,"MASM64 Pure and Simple"," UI Template"   ;; ,MB_OK

    .exit

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end