pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-22
Testing Hardware Indicators
Assign the value of a hardware indicator to a variable in an assignment statement.
Pass a hardware indicator as an actual parameter to a procedure.
The following statements illustrate valid references to hardware indicators:
IF < THEN ...
IF $CARRY THEN ...
IF $OVERFLOW THEN ...
The following statements contain invalid references to hardware indicators:
INT i;
i := >; ! ERROR: invalid in assignment stmt
CALL p( < ); ! ERROR: invalid as parameter
i := IF < THEN -i ELSE i; ! ERROR: invalid in IF expression
DO
...
CALL AWAITIOX( .... );
UNTIL = ; ! ERROR: invalid in DO-UNTIL stmt
An IF statement that tests a hardware indicator must follow immediately the
statement that establishes the value of the hardware indicator, or be part of a nest
of IF statements as described later in this topic. The following sequence is valid:
I := I + 1;
IF < THEN ...
The hardware indicator in the conditional expression of an IF statement must be
the first operand in the expression, as follows:
IF $CARRY THEN ... ! OK: H/W indicator is
! first operand
IF <= OR a >= 99 THEN ... ! OK: H/W indicator is
! first operand
IF I <= 999 AND > THEN ... ! ERROR: Condition code must
! be first operand
IF a = b OR $CARRY THEN ... ! ERROR: $CARRY must be
! first operand
IF a = b OR $OVERFLOW THEN ... ! ERROR: $OVERFLOW must be
! first operand
The first statement in an IF statement’s THEN clause or ELSE clause (or both)
can, in turn, be an IF statement that tests the condition code established by the
conditional expression of the containing IF statement. In this case, the root
operator in the containing IF statement’s conditional expression must be one of the
following:
°
A relational operator
°
An expression that consists only of a condition code