Section 3: Assembler
271
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
3.8. Asm68k
Macros
The assembler asm68k supports two macro facilities: user-defined macros and
structured control macros. They are provided to simplify the task of
programming, improve the readability of assembly source, and help reduce the
frequency of errors. This section describes the user-defined macro and
structured control macro support.
3.8.1. User-Defined
Macros
Macros provide an efficient means of generating commonly used sequences of
code. A macro is defined once and can be used any number of times.
Parameters can be used to allow variations in the code sequences generated by
a single macro.
Using macros simplifies programming, since changes can be isolated to a single
location. Also, assembly programs written using macros are more concise and
easier to understand. The remainder of this section describes how to define and
invoke macros, as well as how to use macro parameters and conditional control.
3.8.1.1. Macro
Definition
A macro definition consists of a header, a body, and a terminator. Following is
the syntax for a macro definition:
Syntax
label MACRO [ comment ]
[
statement ]
.
.
.
ENDM
Description
label
Specifies the name of the macro. The first 32 characters of the
macro name are significant. Only the first character of the name
can be a period ( . ).
comment
Specifies a comment, which is typically used to document any
formal parameters of the macro.
statement
Specifies an assembler statement. It cannot be a macro definition
(i.e., macro definitions cannot be nested).