__ Z <- rb
BIT
b,r
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | $CB |
0 | 1 | b | r |
This instruction tests bit b in register r and sets the Z flag accordingly. In the assembled object code, operands b and r are specified as follows:
Bit Tested | b | Reg | r | Hex | Reg | r | Hex | Reg | r | Hex | Reg | r | Hex | Reg | r | Hex | Reg | r | Hex | Reg | r | Hex |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 000 | A | 111 | $47 | B | 000 | $40 | C | 001 | $41 | D | 010 | $42 | E | 011 | $43 | H | 100 | $44 | L | 101 | $45 |
1 | 001 | A | 111 | $4F | B | 000 | $48 | C | 001 | $49 | D | 010 | $4A | E | 011 | $4B | H | 100 | $4C | L | 101 | $4D |
2 | 010 | A | 111 | $57 | B | 000 | $50 | C | 001 | $51 | D | 010 | $52 | E | 011 | $53 | H | 100 | $54 | L | 101 | $55 |
3 | 011 | A | 111 | $5F | B | 000 | $58 | C | 001 | $59 | D | 010 | $5A | E | 011 | $5B | H | 100 | $5C | L | 101 | $5D |
4 | 100 | A | 111 | $67 | B | 000 | $60 | C | 001 | $61 | D | 010 | $62 | E | 011 | $63 | H | 100 | $64 | L | 101 | $65 |
5 | 101 | A | 111 | $6F | B | 000 | $68 | C | 001 | $69 | D | 010 | $6A | E | 011 | $6B | H | 100 | $6C | L | 101 | $6D |
6 | 110 | A | 111 | $77 | B | 000 | $70 | C | 001 | $71 | D | 010 | $72 | E | 011 | $73 | H | 100 | $74 | L | 101 | $75 |
7 | 111 | A | 111 | $7F | B | 000 | $78 | C | 001 | $79 | D | 010 | $7A | E | 011 | $7B | H | 100 | $7C | L | 101 | $7D |
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 bit 2 in Register B contains 0, then upon the execution of
BIT 2,B
the Z flag in the F Register contains 1, and bit 2 in Register B remains at 0. Bit 0 in Register B is the least-significant bit.