EasyManua.ls Logo

Radio Shack TRS-80 Model III - Page 129

Radio Shack TRS-80 Model III
274 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BASIC
Logical Operators
Logical
operators
make
logical comparisons. Normally, they
are
used in IF/THEN
statements to make
a
logical test between two or
more relations
.
For example:
IFA
=
1 OR
C
=
2
THEN PRINT
X
The
logical operator,
OR,
compares the two relations
A
=
1
and
C
=
2.
Logical
operators
may also be
used
to
make bit-comparisons of two numeric
expressions.
For this application, BASIC does a
bit-by-bit comparison of the two operands,
according to predefined rules for the specific
operator.
Note:
The operands are converted to integer type,
stored internally
as
16-bit,
two's complement numbers. To understand the results of
bit-by-bit
comparisons, you need to keep this in mind.
The following table summarizes
the action
of
Boolean operators in bit
manipulation.
Operator
Meaning
of
Operation
First
Operand
Second
Operand
Result
AND When both
bits are
1
, the
result
will be 1. Otherwise,
the result
will be 0.
1
1
1
1
1
OR
Result
will be 1 unless both
bits are 0.
1
1
1
1
1
1
1
NOT Result is
opposite of bit. 1
?
119

Other manuals for Radio Shack TRS-80 Model III

Related product manuals