
12.6 8-Bit Arithmetic
(Continued)
7
6
5
4
3
2
1
0
1
1
0
0
1
1
1
0
n
Timing:
M cyclesD2
T statesD7 (4, 3)
Addressing Mode:
SourceDImmediate
DestinationDImplied
SUB
n
Subtract the immediate data n from the Accumulator.
A
w
A
b
n
S: Set if result is negative
Z: Set if result is zero
H: Set if borrow from bit 4
P/V: Set if result exceeds 8-bit 2’s
complement range
N: Set
C: Set according to borrow
condition
0
7
6
5
4
3
2
1
1
1
0
1
0
1
1
0
n
Timing:
M cyclesD2
T statesD7 (4, 3)
Addressing Mode:
SourceDImmediate
DestinationDImplied
SBC
A, n
Subtract, with carry, the immediate data n from the Accumu-
lator.
A
w
A
b
n
b
CY
S: Set if result is negative
Z: Set if result is zero
H: Set if borrow from bit 4
P/V: Set if result exceeds 8-bit 2’s
complement range
N: Set
C: Set according to borrow
condition
0
7
6
5
4
3
2
1
1
1
0
1
1
1
1
0
n
Timing:
M cyclesD2
T statesD7 (4, 3)
Addressing Mode:
SourceDImmediate
DestinationDImplied
AND
n
The immediate data n is logically AND’ed to the Accumula-
tor.
A
w
A
!
n
S: Set if result is negative
Z: Set if result is zero
H: Set
P/V: Set if result parity is even
N: Reset
C: Reset
0
7
6
5
4
3
2
1
1
1
1
0
0
1
1
0
n
Timing:
M cyclesD2
T statesD7 (4, 3)
Addressing Mode:
SourceDImmediate
DestinationDImplied
OR
n
The immediate data n is logically OR’ed to the contents of
the Accumulator.
A
w
A
s
S: Set if result is negative
Z: Set if result is zero
H: Reset
P/V: Set if result parity is even
N: Reset
C: Reset
0
7
6
5
4
3
2
1
1
1
1
1
0
1
1
0
n
Timing:
M cyclesD2
T statesD7 (4, 3)
Addressing Mode:
SourceDImmediate
DestinationDImplied
XOR
n
The immediate data n is exclusively OR’ed with the Accu-
mulator.
A
w
A
Z
n
S: Set if result is negative
Z: Set if result is zero
H: Reset
P/V: Set if result parity is even
N: Reset
C: Reset
39