STY Instruction (Store Index Register Y to Memory)

Writes the value of index register Y to the specified address in memory.

STY Overloads

OpcodeSyntaxAddressing modeBytesCyclesNotes
84STY dpDP.231, 2
94STY dp, XDP. Idx X241, 2
8CSTY absAbs.341

Notes

  1. Add 1 cycle when the index flag is clear.
  2. Add 1 cycle when the direct page start address is not on a page boundary.

Flag changes

--------

This instruction does not change the status flags.

Explanation

The STY instruction writes the value of index register Y to memory according to the addressing mode specified by the opcode.
When the index flag in the status register is clear, it writes 16-bit data; when the index flag is set, it writes 8-bit data.
Data is written in little-endian order. That is, in memory the low byte always comes first.

Examples

Saving a value

    STY $12         ; save Y to $12

The only indexed mode available for STY is dp,X.

See also

LDA Instruction
LDX Instruction
LDY Instruction
STA Instruction
STX Instruction
STY Instruction
STZ Instruction