LDS Rd, K
Loads (Copies) the value in memory location K into register Rd.
Rd may be any register.
K may be any address between 0 and 65535.
This is known as Direct addressing.
Often use a variable to represent the memory address.
Example: LDS R1, Data
LD Rd, X+
Loads (Copies) the value in memory location stored in the X register (R27:R26) into register Rd and increments the value in the X register.
X is incremented after the copy.
This is called post-increment.
LD Rd, -X
Decrements the value in the X register and loads (Copies) the value in memory location stored in the X register (R27:R26) into register Rd.
X is decremented before the copy.
This is called pre-decrement.
Note: Similar instructions exist for Y (R29:R28) and Z (R31:R30) registers.
ST X, Rr
Stores (Copies) the value in register Rr into the memory location stored in the X register (R27:R26).
This is known as Indirect addressing.
Post-increment and pre-decrement instructions similar to LD are available:
Note: Similar instructions exist for Y (R29:R28) and Z (R31:R30) registers.