pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-3
Managing Overflow and Traps in pTAL
Handling Overflow and Traps Across TAL Procedures
When a TAL procedure calls another procedure, the system saves the current state of
the environment register, which includes the T and V bits, on the call stack. The system
does not, however, change the values of the T and V bits in the environment register.
The values of the T and V bits, therefore, are the same upon entering the called
procedure as they were in the calling procedure.
When a procedure returns to its caller, the system sets the values of the T and V bits to
the values the system stored on the call stack when the procedure was called.
For example, if your program sets the T bit at the beginning of its run and never
changes it, traps will be enabled throughout the programs execution.
Thus, the following statements apply to all TAL programs:
The state of the T bit and the state of the V bit upon entering a procedure are
always the same as they were in the calling procedure.
The state of the T bit and the state of the V bit after returning from a called
procedure are always the same as they were when the calling procedure executed
the call, except as noted in the next item.
The state of the T bit and the state of the V bit upon returning from a called
procedure might differ from their state at the time of the initial call. This occurs if
the called procedure (or a procedure that it calls) alters the values of the T bit or V
bit that the system saved at the time of the initial call.
Managing Overflow and Traps in pTAL
Native architecture does not have an equivalent of TNS architecture’s environment
register or of the T bit or V bit in the environment register, nor does pTAL support TAL
CODE statements; therefore, you cannot manipulate a bit to enable or disable traps or
interrupts for native processes.
pTAL provides new syntax that enables you to specify whether to run with traps
enabled or disabled at any point in your program. The new syntactic elements consist
of:
A compiler directive
A procedure attribute
A clause associated with the BEGIN keyword at the beginning of a block
The effect, however, of the new pTAL syntax differs depending on whether you run
your pTAL program as a TNS process or as a native process. The differences are
described in the following topics.