Chapter
5.
Macros
NUL
In
certain cases it
is
not necessary to pass a parameter to a macro. It
is
necessary, however, to indicate the omission
of
the parameter. The omitted
(or
null) parameter can
be
represented
by
two consecutive delimiters
as
in
the list PARMl "PARM3. A null parameter can also
be
represented
by
two
consecutive
single quotes: ",PARM2,PARM3. Notice that a null
is
quite
different from a blank: a blank
is
an
ASCII
character with the hexadecimal
representation
20H; a null has no character representation.
In
the assembly
listing a
null looks the same
as
a blank, but that
is
only because
no
substi·
tution has taken place. The programmer must decide the meaning of a null
parameter.
AI
though the mechan
ism
is
somewha t d ifferen t, the defaults taken
for assembler controls provide a good example
of
what a null parameter can
mean.
For example, coding MOD85
as
an
assembler control specifies that
the assembler
is
to generate object code for the 8085. The absence
of
this
control (which
in
effect
is
a null parameter) specifies that the assembler
is
to generate only 8080 object code.
Assembler controls are explained
in
the
1515-1/
8080/8085
Macro
Assembler
Operator
5 Manual, 9800292.
Example'
In
a macro with the dummy parameters W
,X,Y
,Z
it
is
acceptable for either
the X or
Y parameter to
be
null, but not both. The following
IF
directive
tests for the error condition:
IF
NUL
X&Y
EXITM
When
a macro
is
expanded, any ampersand preceding or following a dummy parameter
in
a macro definition
is
removed and the substitution
of
the actual parameter occurs at that point.
When
it
is
not adjacent to a dummy
parameter, the ampersand
is
not removed and
is
passed
as
part
of
the macro expansion text.
NOTE
The ampersand must
be
immediately adjacent to the text being
concatenated; intervening
blanks are not allowed.
If
nested macro definitions (described below) contain ampersands, the only ampersands removed are those adjacent
to dummy parameters belonging to the macro definition currently being expanded.
All
ampersands must
be
re-
moved
by
the time the expansion
of
the encompassing macro body
is
performed. Exceptions force illegal character
errors.
Ampersands placed inside strings are recognized
as
concatenation delimiters when adjacent to dummy parameters;
similarly, dummy parameters within character strings are recognized
only when they are adjacent to ampersands.
Ampersands are not recognized
as
operators
in
comments.
5·11