CHAPTER 4: ASSEMBLER
68
EPSON
S5U1C63000A MANUAL
(S1C63 FAMILY ASSEMBLER PACKAGE)
4.7.4 Macro Instructions (#macro ... #endm)
Any statement string can be left defined as a macro using the macro instruction (#macro), and the content
of that definition can be invoked from different parts of the program with the macro name. Unlike a
subroutine, the part that is invoking a macro is replaced with the content of the definition.
Instruction format
#macro
<Macro name>
[<Dummy parameter>] [,<Dummy parameter>] ...
<Statement string>
#endm
<Macro name>:
• The first character is limited to a–z, A–Z, ? and _.
• The second and the subsequent characters can use a–z, A–Z, 0–9, ? and _.
• Uppercase and lowercase characters are discriminated. (#macro itself is case insensitive.)
When assembling with the "-c" option, all symbols are case insensitive.
• One or more spaces or tabs are necessary between the instruction and the macro name.
<Dummy parameter>:
• Dummy parameter symbols for macro definition. They are described when a macro to be defined
needs parameters.
• One or more spaces or tabs are necessary between the macro name and the first parameter symbol.
When describing multiple parameters, a comma (,) is necessary between one parameter and another.
• The same symbols as for a macro name are available.
• The number of parameters are limited according to the free memory space.
<Statement string>:
• The following statements can be described:
- Basic instruction (mnemonic and operand)
- Conditional assembly instruction
- Internal branch label
*
- Comments
• The following statements cannot be described:
- Assembler pseudo-instructions (excluding conditional assembly instruction)
- Other labels than internal branch labels
- Macro invocation
∗
Internal branch label
A macro is spread over to several locations in the source. Therefore, if you describe a label in a macro,
a double definition will result, with an error issued. So, use internal branch labels which are only
valid within a macro.
• The number of internal-branch labels are limited according to the free memory space.
• The same symbols as for a macro name are available.
Sample definition:
#define C_RESET
0b1101
#macro
WAIT
COUNT
ld
%a,COUNT
and
%f,C_RESET
LOOP:
nop
jr
LOOP
#endm
Summary of Contents for S5U1C63000A
Page 4: ......
Page 14: ......
Page 304: ......
Page 305: ...S1C63 Family Assembler Package Quick Reference ...