Panasonic MN1030 Laptop User Manual


 
Chapter 10 Writing Assembler Control Statements
194 Conditional Assembly
Usage example
A source file that uses #if and #ifn is shown below.
The assembled list file is shown below. The program first sets DEVICE to 1. Therefore the expression
DEVICE-1 will be 0, so the #if directive causes line number 7 to be assembled and the #ifn directive
causes line number 10 to be assembled.
DEVICE equ 1
_TEXT section CODE, PUBLIC, 1
#if DEVICE-1
mov 0x01, D0
#else
mov 0x02, D0
#endif
#ifn DEVICE-1
mov 0x03, D0
#else
mov 0x04, D0
#endif
if.lst Page 1
*** PanaX Series MN1030 Cross Assembler ***
Loc Object Line Source
=00000001 1 DEVICE equ 1
2
3 _TEXT section CODE, PUBLIC, 1
4 #if DEVICE-1
5X mov 0x01, D0
6 #else
00000000 8002 7 mov 0x02, D0
8 #endif
9 #ifn DEVICE-1
00000002 8503 10 mov 0x03, D1
11 #else
12X mov 0x04, D1
13 #endif