Author Topic: Two different macros for arg count testing in 64 bit MASM.  (Read 172 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7618
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Two different macros for arg count testing in 64 bit MASM.
« on: July 11, 2020, 12:11:12 PM »
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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: