Conditional Assembly Instructions (#Ifdef - Epson S5U1C62000A Manual

Epson cmos 4-bit single chip microcomputer manual
Table of Contents

Advertisement

5.7.4 Conditional Assembly Instructions
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
#ifdef
Format 1)
[#else
#endif
If the name is defined, <Statement string 1> will be subjected to the assembling.
If the name is not defined, and #else ... <Statement string 2> is described, then <Statement string 2>
will be subjected to the assembling. #else ... <Statement string 2> can be omitted.
#ifndef
Format 2)
[#else
#endif
If the name is not defined, <Statement string 1> will be subjected to the assembling.
If the name is defined, and #else ... <Statement string 2> is described, <Statement string 2> will be
subjected to the assembling. #else ... <Statement string 2> can be omitted.
<Name>:
Conforms to the restrictions on Define name. (See #define.)
<Statement string>:
All statements, excluding conditional assembly instructions, can be described.
Sample description:
#ifdef
TYPE1
ld
#else
ld
#endif
#ifndef
SMALL
#define
SP1
#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.
S5U1C62000A MANUAL
(S1C60/62 FAMILY ASSEMBLER PACKAGE)
<Name>
<Statement string 1>
<Statement string 2> ]
<Name>
<Statement string 1>
<Statement string 2> ]
x,0x12
x,0x13
0x31
(#ifdef ... #else ... #endif, #ifndef... #else ... #endif)
EPSON
CHAPTER 5: ASSEMBLER
69

Advertisement

Table of Contents
loading

Table of Contents