Panasonic PanaXSeries MN1030 Series User Manual page 204

Panasonic microcomputer user's manual
Table of Contents

Advertisement

Chapter 10 Writing Assembler Control Statements
Usage example
A source file that uses #ifdef and #ifndef is shown below.
#define
_TEXT
#ifdef
#else
#endif
#ifndef
#else
#endif
The assembled list file is shown below.
***
Loc
Object
00000000
8001
00000002
8504
The identifier VERSION is defined in line number 1. The replacement string is a null character. Since
VERSION has been defined, the #ifdef starting from line number 4 will assemble block 1 (line number
5 here), and will not assemble block 2 (shown as line number X).
The #ifndef directive inverts the condition, so block 2 (line number 12) will be assembled.
192 Conditional Assembly
VERSION
section
CODE, PUBLIC,1
VERSION
mov
0x01, D0
mov
0x02, D0
VERSION
mov
0x03, D1
mov
0x04, D1
PanaX Series MN1030 Cross Assembler
Line
Source
1
#define
2
3
_TEXT
4
#ifdef
5
6
#else
7x
8
#endif
9
#ifndef
10X
11
#else
12
13
#endif
ifdef.lst
Page 1
VERSION
section
CODE, PUBLIC, 1
VERSION
mov
0x01, D0
mov
0x02, D0
VERSION
mov
0x03, D1
mov
0x04, D1
**

Advertisement

Table of Contents
loading

Table of Contents