Now back to the serious stuff, 64 bit MASM. Here is a more advanced set of macros that give more information on any argument count error, it tells you if there are too many or not enough arguments and maintains the high level characteristics of the technique. It is a different brain to conventional MASM notation but it has its place with a dedicated command style language for a narrower range of tasks. The reason for the extra remote macros is to get each direct macro smaller which in turn would make the task of automating the macro production a lot cleaner so it could routinely be expanded up into a much larger macro count. The ".ma" macro is to put more data on each line where it is to your advantage.
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
include \masm32\include64\masm64rt.inc
check_count MACRO reqr,pname,args:VARARG
LOCAL acnt
acnt = argcount(args)
IF acnt gt reqr
echo ---------------------------------
echo pname : too many arguments
echo ---------------------------------
.err <* too many arguments *>
ELSEIF acnt lt reqr
echo ---------------------------------
echo pname : not enough arguments
echo ---------------------------------
.err <* not enough arguments *>
ENDIF
ENDM
set_data MACRO dname
.data?
dname dq ?
.code
ENDM
MsgBox MACRO args:VARARG
LOCAL rval
.ma check_count 4,"MsgBox",args # set_data rval # mov rval, rv(MessageBoxA,args)
EXITM < rval>
ENDM
.code
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
entry_point proc
call Select_Option
.if choice == IDYES
void = MsgBox(0,"You chose YES","Result",MB_OK)
.else
void = MsgBox(0,"You chose NO","Result",MB_OK)
.endif
.exit
entry_point endp
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Select_Option proc
choice = MsgBox(0,"Choose YES or NO","Choice",MB_YESNO)
ret
Select_Option endp
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
end