User’s Manual MCUez HC12 Assembler
204 Macros MOTOROLA
Macros
statements generated by a macro call are inserted in the source file at the
position where the macro is invoked.
To call a macro, write the macro name in the operation field of a source
statement. Place the arguments in the operand field. The macro may contain
conditional assembly directives that cause the assembler to produce inline
coding variations of the macro definition.
Macro calls produce inline code to perform a predefined function. Each time the
macro is called, code is inserted in the normal flow of the program so that the
generated instructions are executed in line with the rest of the program.
9.4 Defining a Macro
The definition of a macro consists of four parts:
1. Header statement, a MACRO directive with a label that names the macro
2. Body of the macro, a sequential list of assembler statements, some
possibly including argument placeholders
3. The ENDM directive that terminates the macro definition
4. The MEXIT directive that stops macro expansion
The body of a macro is a sequence of assembler source statements. Macro
parameters are defined by parameter designators within these source
statements. Valid macro definition statements include the set of assembly
language instructions, assembler directives, and calls to previously defined
macros. However, macro definitions may not be nested.
NOTE:
Refer to Section 8. Assembler Directives for information about the

MACRO

,

ENDM

,

MEXIT

, and

MLIST

directives.