272
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
The header consists of the macro name
label, the MACRO directive, and an
optional comment field. The terminator is the ENDM directive. The body is a
sequence of statements that are assembled each time the macro is invoked.
These statements can reference the formal parameters of the macro (see section
3.8.1.3 Parameters).
A macro can be referenced from within another macro definition prior to being
defined itself. Macros cannot be redefined, nor can they use the names of
instructions or directives.
3.8.1.2. Macro
Invocation
Following is the syntax for macro invocations:
Syntax
[
label ] macro[.qualifier ] [ parameter [, parameter ] . . .]
Description
label
Specifies an optional label.
macro
Specifies the name of the macro. It must have been previously
defined with the MACRO directive.
qualifier
Specifies a size qualifier that is passed to the macro as parameter
\0.
parameter
Specifies symbols, constants, expressions, or any other text. The
maximum number of parameters allowed is 35. They are passed
to the macro as parameters \1, \2, \3, etc.
When a macro is invoked, it generates assembler statements according to its
definition and actual parameters. These statements are treated as are any other
source statements. Any nested macros will be expanded when they are
encountered.
Once a macro is recognized, the specified actual parameters are saved. The first
specified parameter corresponds to formal parameter \1, the second corresponds
to \2, etc. Parameters are passed by name, not by value. Since the
parameter-passing mechanism is simply textual substitution, values of symbols
can be modified by the macro.