SPRUI03E June 2015 – January 2023
Assemble Into the .data Section
.data
The .data directive sets .data as the current section; the lines that follow will be assembled into the .data section. The .data section is normally used to contain tables of data or preinitialized variables.
For more information about sections, see Chapter 3.
In this example, code is assembled into the .data and .text sections.
1 ***********************************************
2 ** Reserve space in .data **
3 ***********************************************
4 00000000 .data
5 00000000 .space 0CCh
6
7 ***********************************************
8 ** Assemble into .text **
9 ***********************************************
10 00000000 .text
11 00000000 00800358 ABS A0,A1
12
13 ***********************************************
14 ** Assemble into .data **
15 ***********************************************
16 000000cc table: .data
17 000000cc FFFFFFFF .word -1
18 000000d0 000000FF .byte 0FFh
19
20 ***********************************************
21 ** Assemble into .text **
22 ***********************************************
23 00000004 .text
24 00000004 008001A0 MV A0,A1
25
26 ***********************************************
27 ** Resume assembling into the .data section **
28 ***********************************************
29 000000d1 .data
30 000000d4 00000000 coeff .word 00h,0ah,0bh
000000d8 0000000A
000000dc 0000000B