pTAL Conversion Guide

pTAL Conversion Guide527302-002
18-1
18 pTAL Built-In Routines
In TAL, CODE statements enable you to execute specific TNS instructions.
pTAL does not support CODE statements. Instead, pTAL built-in routines provide the
functionality of required TNS instructions that standard pTAL features and millicode
routines do not provide.
pTAL does not define built-in routines for TNS instructions whose functionality is:
Available through standard pTAL constructs
Available through calls to native millicode routines
Not needed to run programs as native processes
In a few cases, pTAL defines a built-in routine because the equivalent millicode routine
cannot be called from pTAL.
pTAL supports each built-in routine through a combination of native instructions and
calls to system routines.
Many built-in routines can be executed only by processes running in privileged mode
(see the pTAL Reference Manual).
Most built-in routines are executable statements—rather than routines that return
values— such as the following:
$ATOMIC_ADD(a, b);
Some built-in routines return values, as in the following:
a := $ATOMIC_GET(b);
t := $READTIME;
Although you can execute built-in routines explicitly in pTAL, the TAL compiler does not
recognize the built-in routines. You can maintain compatibility between TAL and pTAL
source code by calling the built-in routines using DEFINEs that conditionally include
either the pTAL built-in routine or the equivalent TAL source code. By using DEFINEs
in your source code, you can compile your program using either the native or TAL
compiler and obtain the same results.
Topics:
TNS Instruction Codes Supported by Millicode Routines on page 18-2
TNS Instruction Codes Not Needed in the Native Environment on page 18-2
TNS Instruction Codes Supported by pTAL Built-In Routines on page 18-3
Parameters to Built-In Routines on page 18-6
Built-In Routines and Hardware Indicators on page 18-8
One for each built-in routine, listed alphabetically, beginning with $ASCIITOFIXED
on page 18-8 (for the complete list, see Table 18-2 on page 18-4)