LDY

From NES Hacker Wiki
Revision as of 15:37, 24 May 2013 by TheAlmightyGuru (talk | contribs) (Created page with "{{Infobox Opcode | Title = Load Y Index With Memory | Opcode = LDY | Operation = M → Y | StatusN = Change | StatusZ = Change | StatusC = Ignore | StatusI = Ig...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Load Y Index With Memory
Opcode: LDY
Operation: M → Y
Status Register: Status-List.png
Status-Change.pngStatus-Space.pngStatus-Change.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.png

LDY (Load Y Index With Memory) loads the Y Index Register with the specified memory. It is similar in function to LDA and LDX opcodes. Unlike LDA, there aren't as many addressing modes available for LDY.

Operation

This pseudo C code shows how the LDY opcode functions when it is executed.

SET_NEGATIVE(Operand);        // Clears the Negative Flag if the Operand is $#00-7F, otherwise sets it.
SET_ZERO(Operand);            // Sets the Zero Flag if the Operand is $#00, otherwise clears it.
Y_INDEX = Operand;            // Stores the Operand in the Y Index Register.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Immediate LDY #Operand A0 2 2
Zero Page LDY Operand A4 2 3
Zero Page, X LDY Operand, X B4 2 4
Absolute LDY Operand AC 3 4
Absolute, X LDY Operand, X BC 3 4*
* Add 1 if page boundary is crossed.

Examples