Z-80 Instructions: Part H.


BIT SET, RESET, AND TEST 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
BIT b,r Z ← ¬ r b X X 0 1 11 001 011
01   b     r  
2 2 8  r    Reg.
 000    B
 001    C
 010    D
 011    E
 100    H
 101    L
 111    A
 
 b   Bit Tested
 000    0
 001    1
 010    2
 011    3
 100    4
 101    5
 110    6
 111    7
BIT b,(HL) Z ← ¬ (HL) b X X 0 1 11 001 011
01   b   110
2 3 12
BIT b,(IX+d) Z ← ¬ (IX+d) b X X 0 1 11 011 101
11 001 011
← d →
01   b   110
4 5 20
BIT b,(IY+d) Z ← ¬ (IY+d) b X X 0 1 11 111 101
11 001 011
← d →
01   b   110
4 5 20
SET b,r r b ← 1 11 001 011
11   b     r  
2 2 8
SET b,(HL) (HL) b ← 1 11 001 011
11   b   110
2 3 12
SET b,(IX+d) (IX+d) b ← 1 11 011 101
11 001 011
← d →
11   b   110
4 5 20
SET b,(IY+d) (IY+d) b ← 1 11 111 101
11 001 011
← d →
11   b   110
4 5 20
RES b,m m b ← 0
m≡r, (HL),
    (IX+d),
    (IY+d)
            10                      To form new OP-
code replace 11
of SET b,m with
10. Flags and
time states same
as for SET
instruction.

 Notes:  The notation sb indicates bit b (0 to 7) of location s.
 ¬ is used as bitwise NOT where Zilog used an overbar instead.
 
 
 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.