/opcodes/bit

Arithmetic // BIT (test BIT)

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 Tested b Register r 0 000 B 000 1 001 C 001 2 010 D 010 3 011 E 011 4 100 H 100 5 101 L 101 6 110 A 111 7 111

Example

If bit 2 in Register B contains 0, then upon the execution of a BIT 2, B instruction, 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.

Opcodes