AND is an instruction that takes an 8-bit input an compares it with the accumulator. It checks to see if both are set. If either one is reset, the resulting bit in the accumulator is zero.

0 and 0 result: 0
0 and 1 result: 0
1 and 0 result: 0
1 and 1 result: 1


AND op8

Allowed Instructions

and a
and b
and c
and d
and e
and h
and l
and ixh
and ixl
and iyh
and iyl
and (hl)
and (ix+n)
and (iy+n)
and n        ;8 bit constant


C and N flags cleared, P/V is parity, rest are altered by definition.


The most important use of AND is in bit-masking. For more information on bit-masking, see here.


r denotes 8-bit register.

r 4
X 7
(hl) 7
(ix+X) 19
(iy+X) 19

See Also


Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.