z80:Opcodes:AND

From Learn @ Cemetech
Revision as of 07:50, 6 February 2016 by KermMartian (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Syntax

   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

Effects

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

Uses

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

T-States

r denotes 8-bit register.

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

See Also

BIT,CCF,CPL,OR,RES,SCF,SET,XOR