Reference Guide
98 Chapter 4
Assembler Directives and Pseudo-Operations
.MACRO Directive
.MACRO Directive
The .MACRO directive marks the beginning of a macro definition. An
.ENDM directive must be used to end the macro definition.
Syntax
label .MACRO [ formal_parameter[,formal_parameter]...]
Parameters
label The name of the macro.
formal_parameter Specifies a string of characters
treated as a positional parameter.
The ith actual parameter in a macro
invocation is substituted for the ith
formal parameter in the macro
declaration wherever the formal
parameter appears in the body of the
macro definition.
Discussion
Normal Assembler syntax is observed within macro definitions, except
that text substitution is assumed for formal parameters. The following
line is an example of a macro declaration:
DECR .MACRO LAB,VAL
LAB and VAL are formal parameters. Their actual values are determined
by the first and second parameters on any invocation of the macro DECR.
On the macro invocation, the parameters are delimited by commas.
Successive commas indicate a null parameter, causing the expanded
macro to substitute null for one of its formal parameters. When the
number of formal parameters exceeds the number of actual parameters,
null parameters are inserted for the excess parameter positions. When
the number of actual parameters exceeds the number of formal
parameters, a warning is issued and the excess parameters are ignored.