CROSS ASSEMBLER ASM62XX
III-16
EPSON
S1C62 FAMILY
DEVELOPMENT TOOL REFERENCE MANUAL
4.6.2
Macro-definitions
The macro-definition should be done by using the MACRO and the ENDM instructions (pseudo-instruc-
tion).
■
MACRO ~ ENDM
<Macro-name>_ MACRO_ [<Dummy-argument>, ...]
Statement
:
ENDM
The statement block enclosed by a MACRO pseudo-instruction and an ENDM pseudo-instruction is
defined as a macro. Any name can be assigned to the macro as long as it conforms to the rules regard-
ing the characters, length, and label field.
A macro can have an argument passed to it when it is called. In this case, any symbol can be used as a
dummy argument in the macro definition where the actual argument is to be substituted and the same
symbol must be written after the MACRO pseudo-instruction. Multiple dummy arguments must be
separated by commas (,).
Be sure to write the ENDM statement at the end of a macro-definition.
Example:
This macro loads data from the memory location specified by ADDR into the A or B register specified
by REG. Sample call: LDM A,10H
LDM MACRO REG,ADDR
LD X,ADDR
LD REG,MX
ENDM
These dummy arguments are replaced by actual arguments when the macro is expanded.
■
LOCAL
If a macro having a label is expanded at multiple locations, the label duplicates, causing an error. The
LOCAL pseudo-instruction prevents this error occurring.
LOCAL_<Label-name>[,<Label-name>...]
The label specified by the LOCAL pseudo-instruction is replaced by "??nnnn" when the macro is
expanded. Field nnnn is a four-digit decimal field, to which values 0001 to 9999 are assigned
sequentially.
The LOCAL pseudo-instruction must be written at the beginning of the macro. The LOCAL pseudo-
instruction is ignored if another instruction precedes it.
Example:
WAIT MACRO CNT
LOCAL LOOP
LD A,CNT
LOOP SBC A,1
←
Replaces LOOP with ??nnnn at expansion.
JP NZ,LOOP
ENDM
Summary of Contents for S1C62 Family
Page 1: ...MF599 06 Development Tool Reference Manual CMOS 4 BIT SINGLE CHIP MICROCOMPUTER S1C62 Family ...
Page 4: ......
Page 6: ......
Page 8: ......
Page 10: ......
Page 18: ......
Page 20: ......
Page 22: ......
Page 26: ......
Page 28: ......
Page 30: ......
Page 54: ......
Page 56: ......
Page 58: ......
Page 70: ......
Page 72: ......
Page 74: ......
Page 82: ......
Page 84: ......
Page 86: ......
Page 98: ......
Page 100: ......
Page 112: ......
Page 206: ......
Page 208: ......
Page 210: ......