SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
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 12.
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 ; Constant into .data
11 00000000 INDEX .set 0
12 00000000 E3A00000 MOV R0, #INDEX
13
14 ***********************************************
15 ** Assemble into .data. **
16 ***********************************************
17 000000cc Table: .data
18 000000cc FFFFFFFF .word -1 ; Assemble 32-bit
19 ; constant into .data.
20
21 000000d0 FF .byte 0FFh ; Assemble 8-bit
22 ; constant into .data.
23
24 ***********************************************
25 ** Assemble into .text. **
26 ***********************************************
27 00000004 .text
28 00000004 000000CC" con: .field Table, 32
29 00000008 E51F100C LDR R1, con
30 0000000c E5912000 LDR R2, [R1]
31 00000010 E0802002 ADD R2, R0, R2
32 ***********************************************
33 ** Resume assembling into the .data section **
34 ** at address 0Fh. **
35 ***********************************************
36 000000d1 .data