Chapter
5.
Macros
The I
RPC
(indefinite repeat character) directive causes a sequence
of
macro prototype instructions to
be
repeated
for each
text
character
of
the actual parameter specified. If the
text
string
is
enclosed
in
optional angle brackets,
any
delimiters appearing
in
the
text
string are treated simply
as
text to be substituted into the
prototype
code.
The
assembler generates one iteration
of
the prototype code for each character
in
the text string. For each
iteration, the
assembler substitutes the next character from the string for each occurrence
of
the dummy param-
eter. A list
of
n
text
characters generates n repetitions
of
the IRPC macro body.
An
empty
string specifies a
null
actual operand. I
RPC
generates one copy
of
the macro body substituting a null for each occurrence
of
the
dummy parameter.
Example:
PROGRAM
CODE
GENERA
TED
CODING
LHLD
DATE-l
LHLD
DATE-l
MVDATE:
IRPC
X,1977
INX
H
INX
H
MVI
M,l
MVI
M,X
INX
H
ENDM
MVI
M,9
INX
H
MVI
M,7
INX
H
MVI
M,7
IRPC provides the capability to treat each character
of
a string individually; concatenation (described later
in
this
chapter) provides the
capability for building
text
strings from individual characters.
EXITM Directive
Label Opcode Operand
optional:
EXITM
EXITM provides
dn
alternate method for terminating a macro expansion or the repetition
of
a REPT, IRP, or
IRPC code sequence. When
[XITM
is
encountered, the assembler ignores
all
macro prototype instructions
located between the
EXITM and
ENDM
directive for this macro. Notice
that
EXITM may
be
used
in
addition
to ENDM,
but
not
in
place
(If
ENDM.
When used
in
nested macros, EXITM
cause~
an exit to the previous
level
of
macro expansion.
An
EXITM within
a
REPT, IRP, or IRPC terminates not only the current expansion, but
all
subsequent iterations
as
well.
Any data appearing
in
the operand field
of
an EXITM directive causes an error.
Example:
EXITM
is
typically used
to
suppress unwanted macro expansion.
In
the following example, macro expansion
is
terminated when the EXITM directive
is
assembled because the condition X
EO
0
is
true.
5-9