Chapter 3 Introduction to Operation
Assembling and Linking Multiple Sections 31
The contents of program4.asm are as follows.
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 st age befo re 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
global data_set, time_filler
_CODE_01 section CODE, PUBLIC, 1
data_set mov 0, D2
data_set_ loop
cmp D1, D2
bcc data_set_end
mov D0, (A0)
add 1, D2
add 2, A0
bra data_set_loop
data_set_end rts
_CODE_00 section CODE, PUBLIC,1
time_filler mov 0, D2
Time_filler _loop
cmp D1, D0
bcc time_filler_end
bra time_filler_loop
time_filler _end
rts
end