LDA (LoaD Accumulator)¶
A = [operand]
LDA (LoaD Accumulator) is an instruction that loads a value from memory into the accumulator register (A). The operand can be either an immediate value, a memory location specified by its address, or a memory location specified by an indexed indirect or indirect indexed address.
The result is stored in the accumulator, and the Zero and Negative flags are set based on the result.
Addressing Modes¶
Mode |
Syntax |
Bytes |
Cycles |
---|---|---|---|
LDA #const |
|
2 |
|
LDA zp |
|
3 |
|
LDA zp,x |
|
4 |
|
LDA addr |
|
4 |
|
LDA addr,x |
|
4-5 |
|
Absolute+Y |
LDA addr,y |
|
4-5 |
LDA (zp,x) |
|
6 |
|
LDA (zp),y |
|
5-6 |
Flags Affected¶
N (Negative) – Set if the loaded value has the most significant bit set (i.e., is negative); otherwise, it is cleared.
Z (Zero) – Set if the loaded value is zero; otherwise, it is cleared.
Examples¶
Load a Constant into the Accumulator¶
LDA #10 ; load A with constant 10
Load a Value from a Memory Location¶
LDA $20 ; load A with the value at memory location $20
Load a Value from a Memory Location with an Offset¶
LDX #2 ; load X with 2
LDA $10,X ; load A with the value at memory location $12 ($10 + X)