pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Hardware Indicators After Assignments
Topics:
• $OVERFLOW (page 236)
• $CARRY (page 236)
• Condition Codes (page 237)
$OVERFLOW
After every assignment statement, the compiler generates code that tests for overflow if either:
• Overflow traps are enabled
• All of the following conditions are true:
Overflow traps are disabled.◦
◦ The root operator is one of the following:
Negation (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.
$CARRY
You can test $CARRY if the root operator is one of the following:
• Signed integer addition or subtraction
INT i, j, k;
i := j + k; ! $CARRY can be tested after this statement
i := j - k; ! $CARRY can be tested after this statement
• Unsigned integer addition or subtraction
INT i, j, k;
I := j '+' k; ! $CARRY can be tested after this statement
I := j '-' k; ! $CARRY can be tested after this statement
• Unary minus
INT i;
i := -i; ! $CARRY can be tested after this statement
236 Hardware Indicators