Start section.
SECTIONsectionname[GLOBAL | STATIC | LOCAL]
.
.
section source statements
.
.
ENDSEC
The SECTION directive defines the start of a section. All symbols that are defined within a section have the symbol associated with them as their section name. This serves to protect them from like-named symbols elsewhere in the program. By default, a symbol defined inside any given section is private to that section unless the GLOBAL or LOCAL qualifier accompanies the SECTION directive.
Any code or data inside a section is considered an indivisible block with respect to relocation. Code or data associated with a section is independently relocatable within the memory space to which it is bound, unless the STATIC qualifier follows the SECTION directive on the instruction line.
Symbols within a section are generally distinct from other symbols used elsewhere in the source program, even if the symbol name is the same. This is true as long as the section name associated with each symbol is unique, the symbol is not declared public ( XDEF/ GLOBAL), and the GLOBAL or LOCAL qualifier is not used in the section declaration. Symbols that are defined outside of a section are considered global symbols and have no explicit section name associated with them. Global symbols may be referenced freely from inside or outside of any section, as long as the global symbol name does not conflict with another symbol by the same name in a given section.
If the GLOBAL qualifier follows the sectionname in the SECTION directive, then all symbols defined in the section until the next ENDSEC directive are considered global. The effect is as if every symbol in the section were declared with GLOBAL. This is useful when a section needs to be independently relocatable, but data hiding is not desired.
If the STATIC qualifier follows the sectionname in the SECTION directive, then all code and data defined in the section until the next ENDSEC directive are relocated in terms of the immediately enclosing section. The effect with respect to relocation is as if all code and data in the section were defined within the parent section. This is useful when a section needs data hiding, but independent relocation is not required.
If the LOCAL qualifier follows the sectionname in the SECTION directive, then all symbols defined in the section until the next ENDSEC directive are visible to the immediately enclosing section. The effect is as if every symbol in the section were defined within the parent section. This is useful when a section needs to be independently relocatable, but data hiding within an enclosing section is not required.
The division of a program into sections controls not only labels and symbols, but also macros and DEFINE directive symbols. Macros defined within a section are private to that section and are distinct from macros defined in other sections even if they have the same macro name. Macros defined outside of sections are considered global and may be used within any section. Similarly, DEFINE directive symbols defined within a section are private to that section and DEFINE directive symbols defined outside of any section are globally applied. There are no directives that correspond to XDEF for macros or DEFINE symbols, and therefore, macros and DEFINE symbols defined in a section can never be accessed globally. If global accessibility is desired, the macros and DEFINE symbols should be defined outside of any section.
Sections can be nested to any level. When the Assembler encounters a nested section, the current section is stacked and the new section is used. When the ENDSEC directive of the nested section is encountered, the Assembler restores the old section and uses it. The ENDSEC directive always applies to the most previous SECTION directive. Nesting sections provides a measure of scoping for symbol names, in that symbols defined within a given section are visible to other sections nested within it. For example, if section B is nested inside section A, then a symbol defined in section A can be used in section B without XDEFing in section A or XREFing in section B. This scoping behavior can be turned off and on with the NONS and NS options, respectively.
Sections may also be split into separate parts. That is, sectionname can be used multiple times with SECTION and ENDSEC directive pairs. If this occurs, then these separate (but identically named) sections can access each other's symbols freely without the use of the XREF and XDEF directives. If the XDEF and XREF directives are used within one section, they apply to all sections with the same section name. The reuse of the section name is allowed to permit the program source to be arranged in an arbitrary manner (for example, all statements that reserve X space storage locations grouped together), but retain the privacy of the symbols for each section.
When the Assembler operates in relative mode (the default), sections act as the basic grouping for relocation of code and data blocks. For every section defined in the source, a set of location counters is allocated for each DSP memory space. These counters are used to maintain offsets of data and instructions relative to the beginning of the section. At link time, sections can be relocated to an absolute address, loaded in a particular order, or linked contiguously as specified by the programmer. Sections which are split into parts or among files are logically recombined so that each section can be relocated as a unit.
In relative mode, all sections are initially relocatable. However, a section or a part of a section may be made absolute either implicitly by using the ORG directive or explicitly through use of the MODE directive.
A label is not allowed with this directive.
SECTION AUDIOFILTER