Macros have two types of arguments: actual and formal. Actual
arguments are the text given in the macro call after the name
of the macro. Formal arguments are specified by name in the
macro definition; that is, after the macro name in the .MACRO
directive. Actual arguments in macro calls and formal arguments
in macro definitions can be separated by commas (,), tabs, or
spaces.
The number of actual arguments in the macro call can be less
than or equal to the number of formal arguments in the macro
definition. If the number of actual arguments is greater than
the number of formal arguments, the assembler displays an error
message.
Formal and actual arguments normally maintain a strict positional
relationship. That is, the first actual argument in a macro call
replaces all occurrences of the first formal argument in the
macro definition. This strict positional relationship can be
overridden by using keyword arguments. See the section on keyword
arguments.
An example of a macro definition using formal arguments follows:
.MACRO STORE ARG1,ARG2,ARG3
.LONG ARG1 ; ARG1 is first argument
.WORD ARG3 ; ARG3 is third argument
.BYTE ARG2 ; ARG2 is second argument
.ENDM STORE
The following two examples show possible calls and expansions of
the macro previously defined:
STORE 3,2,1 ; Macro call
.LONG 3 ; 3 is first argument
.WORD 1 ; 1 is third argument
.BYTE 2 ; 2 is second argument
STORE X,X-Y,Z ; Macro call
.LONG X ; X is first argument
.WORD Z ; Z is third argument
.BYTE X-Y ; X-Y is second argument