pTAL Guidelines for TAL Programmers

Coding Guidelines
pTAL Guidelines for TAL Programmers527256-002
2-51
Overflow Traps Must Be Disabled to Test
$OVERFLOW
Overflow Traps Must Be Disabled to Test $OVERFLOW
Guideline: Do not test $OVERFLOW in portions of your code in which you have
enabled overflow traps.
In TAL, you can test $OVERFLOW anywhere in your code. The TAL compiler
generates object code that tests the current value of the overflow bit in the ENV
(environment) register.
In pTAL, you can test $OVERFLOW only in those portions of your code in which
overflow traps are disabled. The pTAL compiler reports a syntax error if you attempt to
test $OVERFLOW while overflow traps are enabled. The IF statement that tests
$OVERFLOW in Example 2-65 on page 2-51 is invalid.
Registers
TAL programs can use TNS registers such as the P, ENV, L, and S registers. TAL
programs can also reference data relative to TNS registers, for example relative to the
G register, which identifies the beginning of global memory.
pTAL does not support any of these TAL features.
Topics:
Base-Address Equivalencing on page 2-51
TNS Registers on page 2-52
TNS Registers and Trap Handlers on page 2-53
Saving the P, L, and S Registers on page 2-53
USE and DROP Statements on page 2-54
RP Directive on page 2-54
Base-Address Equivalencing
Guideline: Avoid base-address equivalenced declarations—declarations that equate
an identifier to an address at a relative offset from the G, L, or S register.
Example 2-65. Testing $OVERFLOW (TAL Only)
INT i := 10;
BEGIN : ENABLE_OVERFLOW_TRAPS ! Enable overflow traps
i := i - 1;
IF $OVERFLOW THEN ... ! Invalid test of $OVERFLOW
END;