MCUez HC12 Assembler User’s Manual
MOTOROLA Macros 203
User’s Manual — MCUez HC12 Assembler
Section 9. Macros9.1 Contents
9.2 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.3 Macro Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.4 Defining a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
9.5 Calling Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
9.6 Macro Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
9.7 Labels Inside Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.8 Macro Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
9.9 Nested Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
9.2 Introduction
This chapter describes the functionality and use of macros for the MCUez HC12
assembler used with an MCUez application.
9.3 Macro Overview
A macro is a template for a code sequence. A macro must be defined before it
is called. When a macro is defined, it is given a name. This name becomes the
reference by which the macro is subsequently called. Once a macro is defined,
subsequent references to the macro name are replaced by its code sequence.
The assembler expands the macro definition each time the macro is called. The
macro call causes source statements to be generated, which may include macro
arguments. A macro definition may contain any code or directive except nested
macro definitions. Calling previously defined macros is also allowed. Source