Chapter 3 Introduction to Operation
40 Conditional Assembly and Linking
Select false condition, assemble, and link
Make the define source statement line into a comment line, or just delete it. Then assemble and link
with the same procedure as before.
as103 program5.asm
ld103 -m -T_CODE=40000000 program5.rf
as103 -l -a m103.map program5.asm
The contents of the final list file program5.lst are as follows.
Note that the symbol table is not displayed.
Note how line number 14 is not assembled because the condition fails and how line number 16 is
assembled instead.
Specify assembly conditions in the command
Until this point the condition has been specified by define in the source file, but it has been bothersome
to edit the source file each time. The explanation below describes how to directly specify conditions
with command options. This operation is valid only with regards to #ifdef.
program5.lst Page 1
*** PanaX series Series MN1030 Cross Assembler ***
Loc Object Line Source
1 #define DEBUG
2
3*
M4 dat_set macro adr, dat
5 mov adr, A0
6 mov dat, D0
7 mov D0, (A0)
8 endm
9*
10
11 _CODE section CODE, PUBLIC, 1
40000000 12 main
13 #ifdef DEBUG
14X dat_set data1, 0x11
15 #else
M16 dat_set data1, 0x22
40000000 FCDC0C000040 16+ mov data1, A0
40000006 8022 16+ mov 0x22, D0
40000008 60 16+ mov D0, (A0)
17 #endif
18
19 _DATA section DATA, PUBLIC, 4
4000000C 00000000 20 data1 dd 0
40000010 00000000 21 data2 dd 0
22 end