Chapter 3 Introduction to Operation

The contents of program4.asm are as follows.

 

global

data_set, time_filler

_CODE_01

section

CODE, PUBLIC, 1

data_set

mov

0, D2

 

data_set_

loop

D1, D2

 

cmp

 

bcc

data_set_end

 

mov

D0, (A0)

 

add

1, D2

 

add

2, A0

 

bra

data_set_loop

data_set_end

rts

 

_CODE_00

CODE, PUBLIC,1

section

time_filler

mov

0, D2

Time_filler

_loop

D1, D0

 

cmp

 

bcc

time_filler_end

time_filler

bra

time_filler_loop

_end

 

 

rts

 

 

end

 

As can be seen from the above two files, these programs are divided as follows.

main, time_filler ..._CODE_00

data_set

..._CODE_01

data1

..._DATA

Assemble and generate list files

Next assemble the two programs. Assemble with the option for output of list files in order to see what the list file is like when final addresses are not resolved.

as103 -l -g program3.asm

as103 -l -g program4.asm

g option

Option to output debug information in the relocatable object file.

l option

Option to output list file (not normally specified at this stage before linking, but

 

specify it here to see intermediate values).

This will assemble the two source files (program3.asm and program4.asm) in the current directory. It will add debug information (g option) to the relocatable object files (program3.rf and program4.rf), and

Assembling and Linking Multiple Sections 31

Page 43
Image 43
Panasonic MN1030 user manual Assemble and generate list files, Contents of program4.asm are as follows