Here's what I do:
- All of my program code goes into a SECTION code
- All of my data goes into a SECTION DATA
By setting a6 to the data space base adress at the beginning of the program and indexing by the labels in the data section, the assembler will manage the proper addresses:
Code: Select all
SECTION data
a: DS.L 1
b: DS.L 1
c: DS.W 1
buffer: ds.b 100
Code: Select all
SECTION code
lea.l 0(a6,a4),a6 ; let a6 point to the bottom of the data space
move.l #100,a(a6) ; moves 100 to a6+a
move.l #200,b(a6) ; same for b
move.w #100-1,d0
loop:
clr.b buffer(a6,d0.w) ; clear the buffer
dbra d0,loop
If you write your code in multiple source files, the code that defines what's going on in your data space typically goes into an include file, that is INCLUDEd in all your code files.