Epson S1C62 Family ユーザーズマニュアル

ページ / 219
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