
IF 0<200 AND F<4 TEEN 80
IF I>10 OR K<O THEN 50
IF NOT P THEN 100
Logical operators
work
by
converting
their
operands
to
sixteen
bit, siqned, two
r
S
complement integers in the range
-32768 to +32767.
(If the operands are not in
this
range,
an error results.) If both operands are supplied as 0 or -1,
logical operators return 0 or -1.
The
given
operation
is
performed
on
these integers in bitwise fashion, i.e., each
bit of the result is determined by the corresponding bits in
the two operands.
Thus, it is possible to use logical operators to test
bytes
for
a
particular
bit
pattern.
For
instance,
the
AND
operator maybe used to "mask" all but one of the bits of
a
status
byte
at a machine I/O port.
The OR operator may be
used to "merge" two bytes
to
create
a
particular
binary
value.
Tbe following examples will help demonstrate how the
logical operators work.
63 • binary 111111 and 16 • binary
10000, so 63 AND 16 - 16
15 • binary 1111 and 14 - binary 1110,
so 15 AND 14 - 14 (binary 1110)
-1 - binary 1111111111111111 and
8 • binary 1000, so -1 AND 8 • 8
4 • binary 100 and 2 -binary
10,
so 4 OR 2 - 6 (binary 110)
10 - binary 1010, so 1010 OR 1010 •
1010 (10)
-1 • binary 1111111111111111 and
-2 • binary 1111111111111110,
so -1 OR -2 • -1.
The bit
complement of sixteen zeros is
sixteen ones, which is the
two's complement representation of -1.
The two's complement of any integer
is t,hebit complement plus one.
Содержание Basic Interpreter Basic 80
Страница 1: ...5IA iC intc tit tcl c t ...
Страница 2: ......
Страница 6: ... ...
Страница 10: ......
Страница 26: ......
Страница 33: ...2 5 Intentially left blank ...
Страница 37: ...BASIC SO COMMANDS AND STATEMENTS 2 9 Intentially left blank ...
Страница 40: ...410 DEF FNAB X Y XA3 YA2 420 T FNAB I J Line 410 de ines the function function is called in line 420 ...
Страница 112: ......
Страница 136: ......
Страница 140: ......
Страница 160: ......
Страница 165: ......
Страница 166: ......
Страница 174: ......
Страница 176: ......
Страница 182: ......
Страница 184: ......
Страница 190: ......