4 conditional assembly instructions – Epson S5U1C62000A User Manual
Page 81

S5U1C62000A MANUAL
EPSON
69
(S1C60/62 FAMILY ASSEMBLER PACKAGE)
CHAPTER 5: ASSEMBLER
5.7.4 Conditional Assembly Instructions
(#ifdef ... #else ... #endif, #ifndef... #else ... #endif)
A conditional assembly instruction determines whether assembling should be performed within the
specified range, dependent on whether the specified name (Define name) is defined or not.
Instruction formats
Format 1)
#ifdef
[#else
#endif
If the name is defined,
If the name is not defined, and #else ...
will be subjected to the assembling. #else ...
Format 2)
#ifndef
[#else
#endif
If the name is not defined,
If the name is defined, and #else ...
subjected to the assembling. #else ...
Conforms to the restrictions on Define name. (See #define.)
All statements, excluding conditional assembly instructions, can be described.
Sample description:
#ifdef
TYPE1
ld
x,0x12
#else
ld
x,0x13
#endif
#ifndef
SMALL
#define
SP1
0x31
#endif
Name definition
Name definition needs to have been completed by either of the following methods, prior to the
execution of a conditional assembly instruction:
(1) Definition using the start-up option (-d) of the assembler.
Example:
as62 -d TYPE1 sample.s
(2) Definition in the source file using the #define instruction.
Example:
#define TYPE1
The #define statement is valid even in a file to be included, provided that it goes before the
conditional assembly instruction that uses its Define name. A name defined after a conditional
assembly instruction will be regarded as undefined.
When a name is going to be used only in conditional assembly, no substitute character string
needs to be specified.