Table 12, Bit arithmetic – Zilog Z08470 User Manual
Page 62

Z80 CPU Instructions
UM008007-0715
50
Z80 CPU
User Manual
General-Purpose Arithmetic and CPU Control Groups
The decimal adjust instruction can adjust for subtraction and addition, making BCD arith-
metic operations simple.
1.
To allow for this operation, the N flag is used. This flag is set if the most recent arithmetic
operation was a Subtract. The Negate Accumulator (NEG) instruction forms the two’s
complement of the number in the Accumulator.
2. A Reset Carry instruction is not included in the Z80 CPU, because this operation can
be easily achieved through other instructions such as a logical AND of the Accumu-
lator with itself.
Table 11 lists all of the 16-bit arithmetic operations between 16-bit registers. There are
five groups of instructions, including the Add with Carry and Subtract with Carry instruc-
tions; ADC and SBC affect all of the flags. These two groups simplify address calculation
or other 16-bit arithmetic operations.
instructions begin on page 185.
Table 12. 16-Bit Arithmetic
Source
BC
DE
HL
SP
IX
IY
Destination
HL
09
19
29
39
Add (ADD)
IX
DD
09
DD
19
DD
39
DD
29
IY
FD
09
FD
19
FD
39
FD
29
Add with Carry and set ADC flags
HL
ED
4A
ED
5A
ED
6A
ED
7A
Subtract with Carry and set SBC flags
HL
ED
42
ED
52
ED
62
ED
72
Increment (INC)
03
13
23
33
DD
23
FD
23
Decrement (DEC)
DB
1B
2B
3B
DD
2B
FD
2B
Note:
Notes:
Note: