$ROUTINE defines a routine, makes it the current routine, and
performs the following actions:
o Creates and associates a linkage section, code section, and
data section with the routine.
o Defines a procedure descriptor and optional signature block in
accordance with the values of macro arguments.
o Optionally stores a pointer to the data section within the
linkage section.
o Creates the following numeric and lexical symbols:
Symbol Description
$CS Address at start of the current routine's code
section.
$DS Address at start of the current routine's data
section.
$DP Optional address of a pointer to the current
routine's data section. This symbol has a value
that is an address in the current routine's
linkage section at which the $ROUTINE macro has
placed the address of the data section ($DS) as
follows:
$DP = .
.ADDRESS $DS
$DP enables you to access the data area of the
current routine from its linkage section.
$LS Address of the current routine's linkage section.
$SIZE Size of fixed area of stack frame of the current
routine. This symbol is valid only with STACK and
REGISTER routines.
$RSA_ The offset within the fixed-stack area to the
OFFSET register save area. This symbol is valid only with
STACK routines.
$RSA_END The offset within the fixed-stack area to the the
first byte beyond the end of the register save
area (if any).
$CODE$ A lexical string symbol that defines the routine's
code psect name and attributes.
$DATA$ A lexical symbol that defines the routine's data
psect name and attributes.
$LINK$ A lexical string symbol that defines the routine's
linkage psect name and attributes.
o Optionally generates a standard instruction prologue sequence
at the beginning of the code section.
If you specify /NAMES=AS_IS on the command line, all but
the last three of these symbols are defined in both complete
uppercase and complete lowercase. These symbols are intended
for your use outside of the macros themselves. For example,
the values of these numeric symbols may be useful as a
mnemonic when coding an instruction with a register as in
the following example:
lda SP,-$SIZE(SP)
The last three symbols, $CODE$, $DATA$, and $LINK$, are only
defined in uppercase. They are used by the $ROUTINE macro
for the default code, data, and linkage section psect names
and attributes. You can define these symbols before invoking
$ROUTINE to alter the default program sections as follows:
- $CODE$ = "MY_CODE,EXE,OCTA,SHR,NORD,NOWRT,GBL"
- $DATA$ = "MY_DATA,NOEXE,OCTA,NOSHR,RD,WRT,GBL"
- $LINK$ = "MY_LINK,NOEXE,OCTA,SHR,RD,NOWRT,GBL"
These statements cause $ROUTINE to use the previous psect
names and attributes by default. If you specify any of the
CODE_SECTION, DATA_SECTION, or LINKAGE_SECTION arguments in
your invocation of $ROUTINE, $ROUTINE uses the psect name and
attributes specified with the argument.
In addition, $ROUTINE redefines the corresponding $CODE$,
$DATA$, or $LINK$ lexical string symbol to the value
you specify when you specify any of the CODE_SECTION,
DATA_SECTION, or LINKAGE_SECTION arguments with $ROUTINE.