EasyManua.ls Logo

Commodore VIC-20 - Page 89

Commodore VIC-20
404 pages
Print Icon
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...
Chapter
3:
Programming the
VIC
20
Computer 75
Boolean operators operate on integer operands one binary digit at a
time. VIC BASIC stores all numbers in binary format, using two's comple-
ment notation to represent negative numbers. Therefore
we
can illustrate an
AND operation as follows:
43
AND
137
=
9---------,
I
L...I
----:
89
16
- 10001001
L--------2B
I6
-OOlOlOll
09
16
- 00001001
Here
is
an
OR
operation.
43
OR
137=
171
---------,
I
\...1
---:
89
16
- 10001001
~-----"2BI6
- 00
10
lOll
AB
I6
-lOlOlOll
Here are two NOT operations.
NOT
43
=
212
----------,
L..I
---_I
2B
I6
- 00101011
l l
D4
16
- 1l010100
NOT
137=
118----------.
IL..
---_I
89
16
_ 10001001
l l
76
16
- 01l1O1l0
If
operands are not integers, they are converted to integer form; the
Boolean operation
is
performed, and the result
is
returned as a 0 or
1.
If
a Boolean operator has relational operands, then the relational
operand is evaluated to
-lor
0 before the Boolean operation
is
performed.
Thus the operation
A=
I
ORC<
2
is
equivalent to

Other manuals for Commodore VIC-20

Related product manuals