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 .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 12.
This example assembles code into the .text and .data sections.
1 ******************************************
2 ** Begin assembling into .data section. **
3 ******************************************
4 00000000 .data
5 00000000 0A .byte 0Ah, 0Bh
00000001 0B
6 ******************************************
7 ** Begin assembling into .text section. **
8 ******************************************
9 00000000 .text
10 00000000 41 START: .string "A","B","C"
00000001 42
00000002 43
11 00000003 58 END: .string "X","Y","Z"
00000004 59
00000005 5A
12 00000008 E3A01003 MOV R1, #END-START
13 0000000c E1A01181 MOV R1, R1, LSL #3
14
15 ******************************************
16 ** Resume assembling into .data section.**
17 ******************************************
18 00000002 .data
19 00000002 0C .byte 0Ch, 0Dh
00000003 0D
20 ******************************************
21 ** Resume assembling into .text section.**
22 ******************************************
23 00000010 .text
24 00000010 51 .string "QUIT"
00000011 55
00000012 49
00000013 54