_____ Z <- (HL)b
BIT
b,(HL)
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | $CB |
0 | 1 | b | 1 | 1 | 0 |
This instruction tests bit b in the memory location specified by the contents of the HL register pair and sets the Z flag accordingly. In the assembled object code, operand b is specified as follows:
Bit Tested | Hex | |
---|---|---|
0 | 000 | $46 |
1 | 001 | $4E |
2 | 010 | $56 |
3 | 011 | $5E |
4 | 100 | $66 |
5 | 101 | $6E |
6 | 110 | $76 |
7 | 111 | $7E |
S | is unknown. |
Z | is set if specified bit is 0, otherwise it is reset. |
H | is set. |
P/V | is unknown |
N | is reset. |
C | is not affected. |
If the HL register pair contains $4444, and bit 4 in the memory location $4444 contains 1, then upon the execution of
BIT 4,(HL)
the Z flag in the F Register contains 0, and bit 4 in memory location 4444h remains at 1. Bit 0 in memory location 4444h is the least-significant bit.