pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-21
Setting $OVERFLOW
Setting $OVERFLOW
For a pTAL program running as a native process, the native compiler generates code
that tests for overflow after every assignment statement if overflow traps are enabled or
if all of the following conditions are true:
Overflow traps are disabled.
The root operator—the last operator evaluated—on the right side of an assignment
statement is one of the following:
°
Negate (unary -), +, -, *, /, '/'
°
$DBL of an INT, FIXED, REAL, or REAL(64) value
°
$DBLR of an INT, FIXED, REAL, or REAL(64) value
°
$FLTR of a REAL(64) value
°
$FIX of a REAL or REAL(64) value
°
$FIXD
°
$FIXI
°
$FIXL
°
$FIXR of a REAL or REAL(64) value
°
$INT of a FIXED, REAL, or REAL(64) value
°
$INTR of a FIXED, REAL, or REAL(64) value
°
$FIXEDTOASCII
°
$SCALE for which
1 <= exponent <= 4
The next statement is an IF statement that tests $OVERFLOW.
Testing Hardware Indicators
In TAL, you can test the values of hardware indicators anywhere in your program. The
meaning of a hardware indicator, however, can be difficult to determine because of
side effects and because of characteristics of the instructions that set the indicators.
You can test hardware indicators only after one of the following statements:
Assignment statement
CALL statement
SCAN statement
RSCAN statement
You can access hardware indicators in pTAL programs only as follows: Hardware
indicators can appear only in the conditional expression of an IF statement. You
cannot:
Test a hardware indicator in the conditional expression of a DO-UNTIL statement
or of a WHILE statement.
Reference a hardware indicator in an expression other than in the conditional
expression of an IF statement.