<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 9D xx: NOP 3 3 bbb: SECTION 5 4 4 000000 9D yy: NOP 5 5 000001 9D NOP 6 6 000002 9D NOP 7 7 aaa: SECTION 4 8 8 000001 9D 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 RS08, there are two additional section qualifiers: RS08_SHORT and RS08_TINY. When a section is declared as RS08_SHORT (or RS08_TINY) all the objects defined there can be accessed using the short (and respectively tiny) addressing modes.
The example in the following listing demonstrates the definition and usage of a SHORT section, and uses the direct addressing mode to access the symbol data.
1 1 dataSec: SECTION SHORT 2 2 000000 data: DS.B 1 3 3 4 4 codeSec: SECTION 5 5 6 6 entry: 7 7 000000 9C RSP 8 8 000001 A600 LDA #0 9 9 000003 B7xx STA data
Assembler directives: