<name>: SECTION [SHORT][<number>]
None
This directive declares a relocatable section and initializes the location counter for the following code. The first SECTION directive for a section sets the location counter to zero. Subsequent SECTION directives for that section restore the location counter to the value that follows the address of the last code in the section.
<name> is the name assigned to the section. Two SECTION directives with the same name specified refer to the same section.
<number> is optional and is only specified for compatibility with the MASM Assembler.
A section is a code section when it contains at least one assembly instruction. It is considered to be a constant section if it contains only DC or DCB directives. A section is considered to be a data section when it contains at least a DS directive or if it is empty.
The example in the following listing demonstrates the definition of a section aaa, which is split into two blocks, with section bbb in between them.
The location counter associated with the label zz is 1, because a NOP instruction was already defined in this section at label xx.
Abs. Rel. Loc Obj. code Source line ---- ---- ------ --------- ----------- 1 1 aaa: SECTION 4 2 2 000000 01 xx: NOP 3 3 bbb: SECTION 5 4 4 5 5 000000 01 yy: NOP 6 6 000001 01 NOP 7 7 000002 01 NOP 8 8 aaa: SECTION 4 9 9 000001 01 zz: NOP
The optional qualifier SHORT specifies that the section is a short section, That means than the objects defined there can be accessed using the direct addressing mode.
For S12Z, there are two additional section qualifiers: S12Z_SHORT and S12Z_TINY. When a section is declared as S12Z_SHORT (or S12Z_TINY) all the objects defined there can be accessed using the short (and respectively tiny) addressing modes.
Assembler directives: