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

LDX (Load X Index With Memory) loads the X Index Register with the specified memory. It is similar in function to LDA and LDY opcodes.


This pseudo C code shows how the LDA 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.
X_INDEX = Operand;            // Stores the Operand in the X Index Register.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Immediate LDA #Operand A1 2 2
Zero Page LDA Operand A6 2 3
Zero Page, X LDA Operand, X B6 2 4
Absolute LDA Operand AE 3 4
Absolute, X LDA Operand, X BE 3 4*
* Add 1 if page boundary is crossed.