AND (AND Accumulator with Memory)

A = A AND [operand]

AND performs a bitwise AND operation on the accumulator register (A) and an operand. The result is then stored in the accumulator.

Addressing Modes

Addressing Mode

Opcode

Bytes

Cycles

Immediate

AND #const

29 nn

2

ZeroPage

AND zp

25 nn

3

ZeroPage+X

AND zp,x

35 nn

4

Absolute

AND addr

2D ll hh

4

Absolute+X

AND addr,x

3D ll hh

4-5

Absolute+Y

AND addr,y

39 ll hh

4-5

(Indirect+X)

AND (zp,x)

21 nn

6

(Indirect)+Y

AND (zp),y

31 nn

5-6

* Add 1 cycle if page boundary is crossed.

Flags Affected

  • N (Negative) – Set if the result has the most significant bit set (i.e., is negative); otherwise, it is cleared.

  • Z (Zero) – Set if the result is zero; otherwise, it is cleared.

Examples

Sets A to 0x02
LDA #$FF
AND #$02

; Sets A to 0xA0
LDA #$F0
AND #$A5

; Sets A to 0x00
LDA #$FF
AND #$00

See Also

  • ORA (OR Accumulator with Memory)

  • EOR (Exclusive OR Accumulator with Memory)

Comments