STX

STX

STX - store X in a memory address.

Description

STX stores the contents of the X register into a memory location.

Examples

STX Absolute Addressing

STX $2002

This will store the contents of the X register in memory address $2002. Since the entire memory address number is used, this is referred to as absolute addressing.

STX Immediate Addressing

Immediate addressing is used to load a number straight into X, without loading it from memory.

Binary

STX #%101

This will load the number 5 into X using a binary number.

Decimal

STX #5

This will load 5 into X using a decimal number.

Hexadecimal

STX #$05

This will load 5 into X using a hexadecimal number.

Zero Page Addressing

Zero page addressing can only be used with the zero page memory ($0000 to $00ff).

STX $98

This will load the contents of the memory address $0098 into X.

Related Pages

  • STA - store the accumulator in a memory address
  • STY - store the Y register in a memory address
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.