SPRUI03E June 2015 – January 2023
Assemble Into Named Section
.sect "section name "
.sect " section name " [,{RO|RW}] [,{ALLOC|NOALLOC}]
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.
The sections can be marked read-only (RO) or read-write (RW). Also, the sections can be marked for allocation (ALLOC) or no allocation (NOALLOC). These attributes can be specified in any order, but only one attribute from each set can be selected. RO conflicts with RW, and ALLOC conflicts with NOALLOC. If conflicting attributes are specified the assembler generates an error, for example:
"t.asm", ERROR! at line 1:[E0000] Attribute RO cannot be combined with attr RW
.sect "illegal_sect",RO,RW
This example defines two special-purpose sections, Sym_Defs and Vars, and assembles code into them.
1 **********************************************
2 ** Begin assembling into .text section. **
3 **********************************************
4 00000000 .text
5 00000000 000005E0 ZERO A0
6 00000004 008425E0 ZERO A1
7
8 **********************************************
9 ** Begin assembling into vars section. **
10 **********************************************
11 00000000 .sect "vars"
12 00000000 4048F5C3 pi .float 3.14
13 00000004 000007D0 max .int 2000
14 00000008 00000001 min .int 1
15
16 **********************************************
17 ** Resume assembling into .text section. **
18 **********************************************
19 00000008 .text
20 00000008 010000A8 MVK 1,A2
21 0000000c 018000A8 MVK 1,A3
22
23 **********************************************
24 ** Resume assembling into vars section. **
25 **********************************************
26 0000000c .sect "vars"
27 0000000c 00000019 count .short 25