Z-80 Instructions: Part D.


8-BIT ARITHMETIC AND LOGICAL GROUP

Mnemonic
Symbolic
Operation
Flags OP-Code No. of
Bytes
No. of
M Cycles
No. of
T Cycles

Comments
C Z P/V S N H 76 543 210
ADD A,r A ← A + r V 0 10 000   r   1 1 4    r    Reg 
 000   B 
 001   C 
 010   D 
 011   E 
 100   H 
 101   L 
 111   A 
ADD A,n A ← A + n V 0 11 000 110
← n →
2 2 7
ADD A,(HL) A ← A + (HL) V 0 10 000 110 1 2 7
ADD A,(IX+d) A ← A + (IX+d) V 0 11 011 101
10 000 110
← d →
3 5 19
ADD A,(IY+d) A ← A + (IY+d) V 0 11 111 101
10 000 110
← d →
3 5 19
ADC A,s A ← A + s + CY V 0      001              s is any of r, n,
(HL), (IX+d),
(IY+d) as shown for
ADD instruction.
 
 
The indicated bits
replace the 000 in
the ADD set above.
SUB A,s A ← A - s V 1      010             
SBC A,s A ← A - s - CY V 1      011             
AND s A ← A ⋀ s 0 P 0 1      100             
OR s A ← A ⋁ s 0 P 0 0      110             
XOR s A ← A ⊕ s 0 P 0 0      101             
CP s A - s V 1      111             
INC r r ← r + 1 V 0 00   r   100  1 1 4For  r  see
  ADD above
INC (HL) (HL) ← (HL) + 1 V 0 00 110 100  1 3 11 
INC (IX+d) (IX+d) ← (IX+d) + 1 V 0 11 011 101
00 110 100 
← d →
3 6 23 
INC (IY+d) (IY+d) ← (IY+d) + 1 V 0 11 111 101
00 110 100 
← d →
3 6 23 
DEC m m ← m - 1 V 1             101   
 
 
 
 
 
    m is any of r, (HL),
(IX+d), (IY+d) as
shown for INC.
Same format and
states as INC.
Replace 100 with
101 in OP code.

 Notes:  The V symbol in the P/V flag column indicates that the P/V flag contains the overflow of
  the result of the operation. Similarly the P symbol indicates parity. V = 1 means overflow.
  V = 0 means not overflow. P = 1 means parity of the result is even. P = 0 means parity of
 the result is odd.
 
 Flag Notation:   • = flag not affected, 0 = flag reset, 1 = flag set, X = flag is unknown, 
   ↕ = flag is affected according to the result of the operation.