TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-11
Example of $CARRY Function
To check the state of the carry indicator, use $CARRY in an IF statement immediately
following 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 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
Example of $CARRY Function
In this example, $CARRY tests the state of the carry bit after addition:
INT i, j, k; !Declare variable
i := j + k;
IF $CARRY THEN ... ; !Test state of carry bit
$COMP Function
The $COMP function obtains the one’s complement of an INT expression.
int-expression
is an INT expression.
Example of $COMP Function
In this example, $COMP returns a value equal to the one’s complement of 10:
INT some_int; !Declare variable
some_int := $COMP (10); !Return -11
$DBL Function
The $DBL function returns an INT(32) value from an INT, FIXED(0), REAL, or
REAL(64) expression.
$COMP
(
int-expression
)
VST1406.vsd