(DMC8) Bit Instructions

Mnemonic

Symbolic
Operation

Flags
S    Z    H   P/V  N    C

Opcode
76 543 210

Hex

Bytes

M
Cycles

Clock
Cycles

Comments

BIT b, r

       __
Z
¬ rb

X        1    X    0    •

11 001 011
01   b     r

CB

2

2

8

r        Reg
000   B
001   C
010   D
011   E
100   H
101   L
111   A

 

b       Bit
000   0
001   1
010   2
011   3
100   4
101   5
110   6
111   7

 

BIT b, (HL)

       ____
Z ¬ (HL)b

X        1    X    0    •

11 001 011
01   b   110

CB

2

3

12

BIT b, (IX + d)

       ______
Z ¬ (IX+ d)b

X        1    X    0    •

11 011 101
11 001 011
¬    d     ®
01   b   110

DD
CB

4

5

20

BIT b, (IY + d)

       ______
Z ¬ (IY+ d)b

X        1    X    0    •

11 111 101
11 001 011
¬    d     ®
01   b   110

FD
CB

4

5

20

SET b, r

rb ¬ 1

•     •     •     •     •     •

11 001 011
11   b     r

CB

2

2

8

SET b, (HL)

(HL)b ¬ 1

•     •     •     •     •     •

11 001 011
11   b   110

CB

2

4

15

SET b, (IX + d)

(IX+ d)b ¬ 1

•     •     •     •     •     •

11 011 101
11 001 011
¬    d     ®
11   b   110

DD
CB

4

6

23

SET b, (IY + d)

(IY+ d)b ¬ 1

•     •     •     •     •     •

11 111 101
11 001 011
¬    d     ®
11   b   110

FD
CB

4

6

23

RES b, r

rb ¬ 0

•     •     •     •     •     •

11 001 011
10   b     r

CB

2

2

8

RES b, (HL)

(HL)b ¬ 0

•     •     •     •     •     •

11 001 011
10   b   110

CB

2

4

15

RES b, (IX + d)

(IX+ d)b ¬ 0

•     •     •     •     •     •

11 011 101
11 001 011
¬    d     ®
10   b   110

DD
CB

4

6

23

RES b, (IY + d)

(IY+ d)b ¬ 0

•     •     •     •     •     •

11 111 101
11 001 011
¬    d     ®
10   b   110

FD
CB

4

6

23

Notes:

The notation mb indicates bit b (0 to 7) of location m.
BIT instructions are performed by an bitwise AND.

Flag Notation:

• = flag is not affected, 0 = flag is reset, 1 = flag is set, X = flag is “don’t care”,
= flag is set according to the result of the operation.