TAL Reference Manual
Expressions
TAL Reference Manual—526371-001
4-17
Carry Indicator
CALL WRITE( ... );
IF >= THEN
system_message := -1; !True
ELSE
system_message := 0; !False
IF system_message = -1 THEN ... ;
Carry Indicator
The carry indicator is bit 9 in the environment register (ENV.K). The carry indicator is
affected as follows:
To check the state of the carry indicator, use $CARRY in an IF statement immediately
after the operation that affects the carry indicator. If the carry indicator is on, $CARRY
is –1 (true). If the carry indicator is off, $CARRY is 0 (false). The following example
tests the state of the carry indicator after addition:
INT i, j, k; !Declare variable
i := j + k;
IF $CARRY THEN ... ; !Test state of carry bit from +
The following operations are not portable to future software platforms:
•
Testing $CARRY after multiplication or division
•
Passing the carry bit as an implicit parameter into a procedure or subprocedure
•
Returning the carry bit as an implicit result from a procedure or subprocedure
Overflow Indicator
The overflow indicator is bit 8 in the environment register (ENV.V). The overflow
indicator is affected as follows:
Operation Carry Indicator
Integer addition On if carry out of bit <0>
Integer subtraction or negation On if no borrow out from bit <0>
INT(32) multiplication and division Always off
Multiplication and division except INT(32) Preserved
SCAN or RSCAN operation On if scan stops on a 0 (zero) byte
Array indexing and extended structure
addressing
Undefined
Shift operations Preserved
Operation Overflow Indicator
Unsigned INT addition, subtraction, and negation Preserved
Addition, subtraction, and negation except unsigned INT On or off
Division and multiplication On or off