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

Immediate

LDA #const

A9 nn

2

ZeroPage

LDA zp

A5 nn

3

ZeroPage+X

LDA zp,x

B5 nn

4

Absolute

LDA addr

AD ll hh

4

Absolute+X

LDA addr,x

BD ll hh

4-5

Absolute+Y

LDA addr,y

B9 ll hh

4-5

(Indirect+X)

LDA (zp,x)

A1 nn

6

(Indirect)+Y

LDA (zp),y

B1 nn

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)

See Also

  • STA (STore Accumulator)

  • LDX (LoaD X register)

  • LDY (LoaD Y register)

Comments