Macro-Definitions - Epson S1C62 Family Reference Manual

Cmos 4-bit single chip microcomputer development tool
Table of Contents

Advertisement

CROSS ASSEMBLER ASM62XX

Macro-definitions

4.6.2
The macro-definition should be done by using the MACRO and the ENDM instructions (pseudo-instruc-
tion).
MACRO ~ ENDM
<Macro-name>_ MACRO_ [<Dummy-argument>, ...]
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
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
LOOP
III-16
Statement
:
ENDM
MACRO
REG,ADDR
LD
X,ADDR
LD
REG,MX
ENDM
MACRO
CNT
LOCAL
LOOP
LD
A,CNT
SBC
A,1
JP
NZ,LOOP
ENDM
Replaces LOOP with ??nnnn at expansion.
EPSON
DEVELOPMENT TOOL REFERENCE MANUAL
S1C62 FAMILY

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c62 series

Table of Contents