Macros
Calling Macros
MCUez HC12 Assembler User’s Manual
MOTOROLA Macros 205
9.5 Calling Macros
The form of a macro call is:
[<label>:] <name>[.<sizearg>] [<argument> [,<argument>]...]
Although a macro may be referenced by another macro prior to its definition in
the source module, all macros must be defined before their first call. The name
of the called macro must appear in the operation field of the source statement.
Arguments are supplied in the operand field, separated by commas.
The macro call produces inline code at the location of the call, according to the
macro definition and the arguments specified in the macro call. The source
statements of the expanded macro are then assembled subject to the same
conditions and restrictions affecting any source statement. Nested macro calls
are also expanded at this time.
9.6 Macro Parameters
A maximum of 36 substitutable parameters can be used in the source statements
that constitute the body of a macro. These parameters are replaced by the
corresponding arguments in a subsequent call to that macro.
A parameter designator consists of a back slash character (\), followed by a digit
(0–9) or an uppercase letter (A– Z). Parameter designator \0 corresponds to a
size argument that follows the macro name, separated by a period (.).
Example:
Consider this macro definition:
MyMacro: MACRO
DC.\0 \1, \2
ENDM
When this macro is used in a program, for instance:
MyMacro.B $10, $56
The assembler expands it to:
DC.B $10, $56