# BIT b,r

## Operation

```     __
Z <- rb```

BIT

## Operands

b,r

b7b6b5b4b3b2b1b0
1 1 0 0 1 0 1 1\$CB
0 1 br

## Description

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 TestedbRegrHexRegrHexRegrHexRegrHexRegrHexRegrHexRegrHex
0000A111\$47B000\$40C001\$41D010\$42E011\$43H100\$44L101\$45
1001A111\$4FB000\$48C001\$49D010\$4AE011\$4BH100\$4CL101\$4D
2010A111\$57B000\$50C001\$51D010\$52E011\$53H100\$54L101\$55
3011A111\$5FB000\$58C001\$59D010\$5AE011\$5BH100\$5CL101\$5D
4100A111\$67B000\$60C001\$61D010\$62E011\$63H100\$64L101\$65
5101A111\$6FB000\$68C001\$69D010\$6AE011\$6BH100\$6CL101\$6D
6110A111\$77B000\$70C001\$71D010\$72E011\$73H100\$74L101\$75
7111A111\$7FB000\$78C001\$79D010\$7AE011\$7BH100\$7CL101\$7D

## Condition Bits Affected

 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.

## Example

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.