STY (STore Y register)¶
[operand] = Y
The STY instruction transfers the contents of the Y register to the specified memory location. The operand specifies the memory location where the data is to be stored.
Addressing Modes¶
Mode |
Syntax |
Bytes |
Cycles |
---|---|---|---|
STY zp |
|
3 |
|
STY zp,x |
|
4 |
|
STY addr |
|
4 |
Flags Affected¶
None.
Examples¶
Storing a Value to a Memory Location¶
LDY #10 ; load Y with constant 10
STY $40 ; store the value of Y to memory location $40
Storing the Y Register to an Absolute Address¶
STY $2000 ; store the value of Y to memory location $2000
Storing the Y Register to a Zero-Page Address¶
STY $40 ; store the value of Y to memory location $40
Storing the Y Register to an Address Indexed by X¶
LDY #10 ; load Y with constant 10
LDX #2 ; load X with constant 2
STY $40,X ; store the value of Y to memory location $42 (assuming X = 2)
See Also¶
LDA (LoaD Accumulator)
STA (STore Accumulator)
STX (STore X register)