SPRU513Z August 2001 – October 2023 SM320F28335-EP
Assemble Into the .text Section
.text
The .text sets .text as the current section. Lines that follow this directive will be assembled into the .text section, which usually contains executable code. The section program counter is set to 0 if nothing has yet been assembled into the .text section. If code has already been assembled into the .text section, the section program counter is restored to its previous value in the section.
The .text section is the default section. Therefore, at the beginning of an assembly, the assembler assembles code into the .text section unless you use a .data or .sect directive to specify a different section.
For more information about sections, see Chapter 2.
This example assembles code into the .text and .data sections. The .data section contains integer constants and the .text section contains character strings.
1 ******************************************
2 ** Begin assembling into .data section. **
3 ******************************************
4 000000 .data
5 000000 000A .byte 0Ah, 0Bh
000001 000B
6
7 ******************************************
8 ** Begin assembling into .text section. **
9 ******************************************
10 000000 .text
11 000000 0041 START: .string "A", "B", "C"
000001 0042
000002 0043
12 000003 0058 END: .string "X", "Y", "Z"
000004 0059
000005 005A
13
14 000006 8100' ADD ACC, @START
15 000007 8103' ADD ACC, @END
16
17 ******************************************
18 ** Resume assembling into .data section.**
19 ******************************************
20 000002 .data
21 000002 000C .byte 0Ch, 0Dh
000003 000D
22 ******************************************
23 ** Resume assembling into .text section.**
24 ******************************************
25 000008 .text
26 000008 0051 .string "Quit"
000009 0075
00000a 0069
00000b 0074