Commodore 2001-8 User Manual page 141

Table of Contents

Advertisement

range - 32768 to
+
32767. They then perform the specified logical operation on them and return a result
within the same range. If the arguments are not in this range, an ?ILLEGAL QUANTITY ERROR results.
The operations are performed in bitwise fashion, this means that each bit of the result is obtained by
examining the bit in the same position for each argument.
The following truth table shows the logical relationship between bits:
OPERATOR
AND
OR
NOT
63 AND 16= 16
15 AND 14 = 14
-lAND8=8
4AND2=O
100R10=10
-10R-2=-1
NOTO= -1
NOT X
NOT1= -2
ARGo 1
ARGo 2
RESULT
1
1
1
0
1
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
0
0
0
1
0
0
1
EXAMPLES OF BOOLEAN EXPRESSIONS
Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND
is binary 10000 or 16.
15 equals binary 1111 and 14 equals binary 1110, so 15 and 14 equals binary 1110
or 14.
-1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is
binary 1000 or
8
decimal.
4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because none
of the bits in either argument match to give a 1 bit in the result.
Binary 1010 OR'd with binary 1010, or 10 decimal.
Binary 1111111111111111 (-l)OR
O
d with binary 1111111111111110(-2)equals
binary 1111111111111111,or -1.
The bit complement of binary Oto 16 places is sixteen ones (1111111111111111)
or
-1.
Also NOT -1 =0.
NOT X is equal to - (X
+
1). This is because to form the sixteen bit two's
complement of the binary, you take the bit (one's) complement and add one.
The sixteen bit complement of 1 is 1111111111111110, which is equal to - (1
+
1)
or -2.
D·3

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents