Chapter 3 Introduction to Operation

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.

 

 

program5.lst Page 1

 

Loc

*** PanaX series Series MN1030 Cross Assembler ***

Object

Line

Source

DEBUG

 

 

 

1

#define

 

 

 

2

*

 

 

 

 

3

macro

adr, dat

 

 

M4

dat_set

 

 

5

 

mov

adr, A0

 

 

6

 

mov

dat, D0

 

 

7

 

mov

D0, (A0)

 

 

8

*

endm

 

 

 

9

 

 

 

 

10

_CODE

section

CODE, PUBLIC, 1

40000000

 

11

 

12

main

DEBUG

 

 

 

13

#ifdef

data1, 0x11

 

 

14X

#else

dat_set

 

 

15

dat_set

data1, 0x22

40000000

FCDC0C000040

M16

 

16+

 

mov

data1, A0

40000006

8022

16+

 

mov

0x22, D0

40000008

60

16+

#endif

mov

D0, (A0)

 

 

17

 

 

 

 

18

_DATA

section

DATA, PUBLIC, 4

4000000C

00000000

19

20

data1

dd

0

40000010

00000000

21

data2

dd

0

 

 

22

 

end

 

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.

40 Conditional Assembly and Linking

Page 52
Image 52
Panasonic MN1030 user manual Select false condition, assemble, and link, Specify assembly conditions in the command