.PSECT defines a program section and its attributes and refers to
a program section after it is defined. Use program sections to do
the following:
o Develop modular programs.
o Separate instructions from data.
o Allow different modules to access the same data.
o Protect read-only data and instructions from being modified.
o Identify sections of the object module to the linker and the
debugger.
o Control the order in which program sections are stored in
virtual memory.
When the assembler encounters a .PSECT directive that specifies
a new program section name, it creates a new program section
and stores the name, attributes, and alignment of the program
section. The assembler includes all data or instructions that
follow the .PSECT directive in that program section until it
encounters another .PSECT directive. The assembler starts all
program sections at a relative location counter of 0.
The assembler does not automatically define program sections.
Any code or data placed before the first .PSECT directive in the
source code produces an assembly error.
If the assembler encounters a .PSECT directive that specifies
the name of a previously defined program section, it stores the
new data or instructions after the last entry in the previously
defined program section, even with program sections that have
the OVR attribute. (OVR program sections from separate modules
are overlaid by the linker. The OVR attribute does not affect
how multiple contributions to a psect are processed within a
single assembly unit.) You need not relist the attributes when
continuing a program section, but any attributes that are listed
must be the same as those previously in effect for the program
section. A continuation of a program section cannot contain
attributes conflicting with those specified, or defaulted, in
the original .PSECT directive.
The attributes listed in the .PSECT directive describe the
contents of the program section. Except for the EXE and NOEXE
attributes, the assembler does not check to ensure that the
contents of the program section actually adhere to the attributes
listed. However, the assembler and the linker do check that
all program sections with the same name have exactly the same
attributes. The assembler and linker display an error message if
the program section attributes are not consistent.
Program section names are independent of local symbol, global
symbol, and macro names. You can use the same symbolic name
for a program section and for a local symbol, global symbol,
or macro name. You may want to use unique names for clarity and
maintainability.