Chapter
3.
Instruction
Set
3-68
1---0_1~
data
~
Cycles:
States:
Addressing:
Flags:
2
7
immediate
Z,S,P,CY,AC
Summary
of
Logical Operations
AND produces a one bit
in
the result only when the corresponding bits
in
the test data and the mask data are
ones.
OR produces a one bit
in
the result when the corresponding
bit~
in
either the test data or the mask datd dre
ones.
Exclusive
OR
produces a one bit only when the corresponding bits
in
the test data dnd the mask datd are
different; i.e.,
a one bit
in
either the test data or the mask data
~
but
not both produces a one bit
in
the
resu
I
t.
Example:
AND
1010101lO
0000
1111
0000 1010
OR
10101010
00001111
1010
1111
EXCLUSIVE OR
10101010
0000
1111
1010 0101
Assume that a program uses bits 7 and 6
of
a byte as flags that control the cdlling
of
two subroutines. The
program tests the bits by rotdting the
contents
of
the accumulator until the de'>ired bit
is
in
the
Cdrry
fldg;
a
CC
instruction (Call if Carry) tests the flag and calls the subroutine if required.
Assume
that
the control flag byte
i~
positioned normally
in
the accumulator, and the program must
<,et
OFF
hit
6 and
~et
bit 7 ON. The remaining bits, which are status flag'; used for
other
purposes, must not
be
,litered.
Since any bit exciusive-ORed with a one
is
complemented, and any bit exciusive-ORed with a zero remdins
unchanged, the following instruction
is
used:
XRI
The instruction has the following results:
Accumulator
Immediate data
11000000B
01001100
11000000
10001100