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 |
---|---|---|---|
AND #const |
|
2 |
|
AND zp |
|
3 |
|
AND zp,x |
|
4 |
|
AND addr |
|
4 |
|
AND addr,x |
|
4-5 |
|
Absolute+Y |
AND addr,y |
|
4-5 |
AND (zp,x) |
|
6 |
|
AND (zp),y |
|
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