We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

STA: Difference between revisions

From SnesLab
Jump to: navigation, search
(→‎External Links: hide archive URL for E&L)
(deindented headers)
 
(4 intermediate revisions by the same user not shown)
Line 122: Line 122:
</pre>
</pre>


===== Cycle Penalties =====
If you are trying to store zero somewhere, consider [[STZ]] instead.
 
==== Cycle Penalties ====
* In all [[addressing modes]], STA takes one extra cycle when the accumulator is 16 bits wide.
* In all [[addressing modes]], STA takes one extra cycle when the accumulator is 16 bits wide.
* In [[direct page addressing]] modes, STA takes another extra cycle if the low byte of the [[direct page register]] is nonzero.
* In [[direct page addressing]] modes, STA takes another extra cycle if the low byte of the [[direct page register]] is nonzero.
Line 130: Line 132:
* [[STX]]
* [[STX]]
* [[STY]]
* [[STY]]
* [[STZ]]


=== External Links ===
=== External Links ===
* [[Eyes & Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/503 page 503] on STA
* [[Eyes & Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/503 page 503] on STA
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n194 page 184] on STA
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n194 page 184] on STA
* [[MCS6500 Manual]] page 5 on STA: https://archive.org/details/mos_microcomputers_programming_manual/page/n20
* 2.1.2 on [[MCS6500 Manual]], [https://archive.org/details/mos_microcomputers_programming_manual/page/n20 page 5] on STA
* [[Carr]] page 273 on STA: https://archive.org/details/6502UsersManual/page/n286
* [[Carr]], [https://archive.org/details/6502UsersManual/page/n286 page 273] on STA
* [[Leventhal]] page 3-96 on STA: https://archive.org/details/6502-assembly-language-programming/page/n145
* [[Leventhal]], [https://archive.org/details/6502-assembly-language-programming/page/n145 page 3-96] on STA
* snes9x implementation of STA: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L1219
* snes9x implementation of STA: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L1219
* undisbeliever on STA: https://undisbeliever.net/snesdev/65816-opcodes.html#sta-store-accumulator-to-memory
* undisbeliever on STA: https://undisbeliever.net/snesdev/65816-opcodes.html#sta-store-accumulator-to-memory

Latest revision as of 06:37, 22 August 2024

Basic Info
Addressing Mode Opcode Length Speed
Absolute 8D 3 bytes 4 cycles*
Absolute Long 8F 4 bytes 5 cycles*
Direct Page 85 2 bytes 3 cycles*
Direct Page Indirect 92 2 bytes 5 cycles*
Direct Page Indirect Long 87 2 bytes 6 cycles*
Absolute Indexed by X 9D 3 bytes 4 cycles*
Absolute Long Indexed by X 9F 4 bytes 5 cycles*
Absolute Indexed by Y 99 3 bytes 4 cycles*
Direct Page Indexed by X 95 2 bytes 4 cycles*
Direct Page Indexed Indirect by X 81 2 bytes 6 cycles*
Direct Page Indirect Indexed by Y 91 2 bytes 5 cycles*
Direct Page Indirect Long Indexed by Y 97 2 bytes 6 cycles*
Stack Relative 83 2 bytes 4 cycles*
Stack Relative Indirect Indexed by Y 93 2 bytes 7 cycles*
Flags Affected
N V M X D I Z C
. . . . . . . .

STA (Store Accumulator) is a 65x instruction that stores the value of the accumulator. If the accumulator is 16 bits wide, its low byte is stored at the effective address and its high byte is stored at the effective address plus one.

No flags are affected.

Syntax

STA addr
STA long
STA dp
STA (dp)
STA [dp]
STA addr, X
STA long, X
STA addr, Y
STA dp, X
STA (dp, X)
STA (dp), Y
STA [dp], Y
STA sr, S
STA (sr, S), Y

If you are trying to store zero somewhere, consider STZ instead.

Cycle Penalties

See Also

External Links