SLAU131Y October 2004 – June 2021
Assemble Into Named Section
.sect "section name "
The .sect directive defines a named section that can be used like the default .text and .data sections. The .sect directive sets section name to be the current section; the lines that follow are assembled into the section name section.
The section name identifies the section. The section name must be enclosed in double quotes. A section name can contain a subsection name in the form section name :subsection name. See Chapter 3 for more information about sections.
This example defines a special-purpose section named Vars and assembles code into it.
1 ***************************************************
2 ** Begin assembling into .text section. **
3 ***************************************************
4 0000 .text
5 0000 403B MOV #0x78,R11
0002 0078
6 0004 503B ADD #0x78,R11
0006 0078
7 ***************************************************
8 ** Begin assembling into Vars section. **
9 ***************************************************
10 0000 .sect "Vars"
11 0000 CCCD .float 0.05
0002 3D4C
12 0004 00AA X: .word 0xAA
13 ***************************************************
14 ** Resume assembling into .text section. **
15 ***************************************************
16 0008 .text
17 0008 5B0C ADD R11,R12
18 ***************************************************
19 ** Resume assembling into Vars section. **
20 ***************************************************
21 0006 .sect "Vars"
22 0006 000D .field 13
23 0008 000A .field 0xA
24 000a 0010 .field 0x10