76
The
VIC
20
User
Guide
Consider this more complex operation.
IF
A =
BAND
C < D GOTO
40
First the relational expressions are evaluated. Assume
that
the first expres-
sion
is
true and the second one
is
false. The statement then becomes
IF
-1
AND 0 GOTO
40
Performing the AND yields a 0 result.
IFO
GOT040
Recall that a single term has
an
implied
"<
>0"
following it. The expression
therefore becomes
IF
0 < > 0
GO
TO
40
Thus, the branch
is
not taken.
In contrast, a Boolean operation performed on two variables may yield
any integer number.
IF
A%
AND
B%
GOTO
40
Assume that
A%
=
255
and
B%
= 240. The Boolean operation
255
AND
240
yields 240. The statement, therefore, becomes
IF
240
GO
TO
40
or, with the
"<
>0",
IF
240<
> 0 GOTO
40
Therefore, the branch will be taken.
Now compare the following assignment statements:
A=
A AND
10
A=
A<
10
In the first example, the current value
of
A
is
logically ANDed with
10,
and
the result becomes the new value
of
A.
A must be in the integer range
-32768
to +32767. In the second example, the relational expression
A
<
10
is
evaluated
to
-lor
0, so A must end up with a value
of
-lor
O.