SPRU513Z August 2001 – October 2023 SM320F28335-EP
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 2.
In this example, code is assembled into the .data and .text sections.
1 *******************************************
2 ** Reserve space in .data. **
3 *******************************************
4 000000 .data
5 000000 .space 0CCh
6 *******************************************
7 ** Assemble into .text. **
8 *******************************************
9 000000 .text
10 0000 INDEX .set 0
11 000000 9A00 MOV AL,#INDEX
12 *******************************************
13 ** Assemble into .data. **
14 *******************************************
15 00000c Table: .data
16 00000d FFFF .word -1 ; Assemble 16-bit constant into .data.
17 00000e 00FF .byte 0FFh ; Assemble 8-bit constant into .data.
18 *******************************************
19 ** Assemble into .text. **
20 *******************************************
21 000001 .text
22 000001 08A9" ADD AL,Table
000002 000C
23 *******************************************
24 ** Resume assembling into the .data **
25 ** section at address 0Fh. **
26 *******************************************
27 00000f .data