68
EPSON
S5U1C62000A MANUAL
(S1C60/62 FAMILY ASSEMBLER PACKAGE)
CHAPTER 5: ASSEMBLER
Expansion rules
When a defined macro name appears in the source, the assembler inserts a statement string defined in
that location.
If there are actual parameters described in that process, the dummy parameters will be replaced with
the actual parameters in the same order as the latter are arranged.
The internal branch labels are replaced, respectively, with __L0001 ... from top of the source in the
same order as they appear.
Sample expansion:
When the macro WAIT shown above is defined:
Macro invocation
:
WAIT 15
:
After expansion
:
ld
a,15
;WAIT 15
rst
f,0b1101
__L0001:
nop5
jp
__L0001
("__L0001" denotes the case where an internal branch label is expanded for the first time in the source.)
Precautions
• The assembler only permits backward reference of a macro invocation. Therefore the macro definition
must precede the use of it.
• Once a defined macro name is defined, it cannot be canceled. If the same macro name is defined
duplicatedly, a warning message will appear. Until it is redefined, it is expanded with the original
content, and once it is redefined, it is expanded with the new content. Definition should be done with
distinct names, although the program operation will not be affected.
• No other characters than delimiters (space, tab, line feed, and commas) can be added before and after
a dummy parameter in a statement.
• The same character string as that of the define instruction cannot be used as a macro name.
• When the number of dummy parameters differs from that of actual parameters, an error will result.
• The maximum number of parameters and internal branch labels are limited according to the free
memory space.
• "__Lnnnn" used for the internal branch labels should not be employed as other label or symbol.