LDY (LoaD Y register)

Y = [operand]

LDY (LoaD Y register) is an instruction that loads a value from memory into the Y register. 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 Y register, and the Zero and Negative flags are set based on the result.

Addressing Modes

Mode

Syntax

Bytes

Cycles

Immediate

LDY #const

A0 nn

2

ZeroPage

LDY zp

A4 nn

3

ZeroPage+X

LDY zp,x

B4 nn

4

Absolute

LDY addr

AC ll hh

4

Absolute+X

LDY addr,x

BC ll hh

4-5

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 Y Register

    LDY #10    ; load Y with constant 10

Load a Value from a Memory Location

    LDY $20    ; load Y with the value at memory location $20

Load a Value from a Memory Location with an Offset

    LDX #2     ; load X with 2
    LDY $10,X  ; load Y with the value at memory location $12 ($10 + X)

See Also

  • LDA (LoaD Accumulator)

  • STA (STore Accumulator)

  • LDX (LoaD X register)

Comments