LDX                   LDX Load index X with memory                    LDX

  Operation:  M -> X                                    N V - B D I Z C
                                                        / . . . . . / .

  +----------------+-----------------------+---------+---------+----------+
  | Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
  +----------------+-----------------------+---------+---------+----------+
  |  Immediate     |   LDX #$FF            |   $A2   |    2    |    2     |
  |  ZeroPage      |   LDX $FF             |   $A6   |    2    |    3     |
  |  ZeroPage,Y    |   LDX $FF,Y           |   $B6   |    2    |    4     |
  |  Absolute      |   LDX $FFFF           |   $AE   |    3    |    4     |
  |  Absolute,Y    |   LDX $FFFF,Y         |   $BE   |    3    |    4*    |
  +----------------+-----------------------+---------+---------+----------+
  * Add 1 when page boundary is crossed.
  For penalty cycles on the 65816, check the desired addressing mode.

What it does: Loads the X Register with a byte from memory.

Major uses: The X Register can perform many of the tasks that the Accumulator performs, but it is generally used as an index for loops. In preparation for its role as an index, LDX puts a value into the register.