Справочник Пользователя для Panasonic MN1030

Скачать
Страница из 340
Chapter 10   Writing Assembler Control Statements
192  Conditional Assembly
Usage example
A source file that uses #ifdef and #ifndef is shown below.
The assembled list file is shown below.
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.
#define
VERSION
_TEXT
section
CODE, PUBLIC,1
#ifdef
VERSION
mov
0x01, D0
#else
mov
0x02, D0
#endif
#ifndef
VERSION
mov
0x03, D1
#else
mov
0x04, D1
#endif
ifdef.lst
Page 1
***   PanaX Series MN1030 Cross Assembler    ** 
Loc
Object
Line
Source
1
#define
VERSION
2
3
_TEXT
section
CODE, PUBLIC, 1
4
#ifdef
VERSION
00000000
8001
5
mov
0x01, D0
6
#else
7x
mov
0x02, D0
8
#endif
9
#ifndef
VERSION
10X
mov
0x03, D1
11
#else
00000002
8504
12
mov
0x04, D1
13
#endif