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
(added undisbeliever's opcode page link) |
(→External Links: MCS page) |
||
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{| class="wikitable" style="float:right;clear:right;width:40%" | |||
{| class="wikitable" style="float:right;clear:right;width: | |||
!colspan="8"|Basic Info | !colspan="8"|Basic Info | ||
|+ | |+ | ||
Line 9: | Line 7: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Absolute]] | ||
|8D | |8D | ||
|3 bytes | |3 bytes | ||
|4 cycles | |4 cycles* | ||
|+ | |+ | ||
| | |[[Absolute Long]] | ||
|8F | |8F | ||
|4 bytes | |4 bytes | ||
|5 cycles | |5 cycles* | ||
|+ | |+ | ||
| | |[[Direct Page Addressing|Direct Page]] | ||
|85 | |85 | ||
|2 bytes | |2 bytes | ||
|3 cycles | |3 cycles* | ||
|+ | |+ | ||
| | |[[Direct Page Indirect]] | ||
|92 | |92 | ||
|2 bytes | |2 bytes | ||
|5 cycles | |5 cycles* | ||
|+ | |+ | ||
| | |[[Direct Page Indirect Long]] | ||
|87 | |87 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles* | ||
|+ | |+ | ||
|absolute indexed by X | |absolute indexed by X | ||
|9D | |9D | ||
|3 bytes | |3 bytes | ||
|4 cycles | |4 cycles* | ||
|+ | |+ | ||
|absolute long indexed by X | |absolute long indexed by X | ||
|9F | |9F | ||
|4 bytes | |4 bytes | ||
|5 cycles | |5 cycles* | ||
|+ | |+ | ||
|absolute indexed by Y | |absolute indexed by Y | ||
|99 | |99 | ||
|3 bytes | |3 bytes | ||
|4 cycles | |4 cycles* | ||
|+ | |+ | ||
|direct page indexed by X | |direct page indexed by X | ||
|95 | |95 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles* | ||
|+ | |+ | ||
|direct page indexed indirect by X | |direct page indexed indirect by X | ||
|81 | |81 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles* | ||
|+ | |+ | ||
|direct page indirect indexed by Y | |direct page indirect indexed by Y | ||
|91 | |91 | ||
|2 bytes | |2 bytes | ||
|5 cycles | |5 cycles* | ||
|+ | |+ | ||
|direct page indirect long indexed by Y | |direct page indirect long indexed by Y | ||
|97 | |97 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles* | ||
|+ | |+ | ||
| | |[[Stack Relative]] | ||
|83 | |83 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles* | ||
|+ | |+ | ||
|stack relative indirect indexed by Y | |stack relative indirect indexed by Y | ||
|93 | |93 | ||
|2 bytes | |2 bytes | ||
|7 cycles | |7 cycles* | ||
|} | |} | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="9"|Flags | !colspan="9"|Flags Affected | ||
|+ | |+ | ||
|N | |[[Negative Flag|N]] | ||
|V | |[[Overflow Flag|V]] | ||
|M | |[[M Flag|M]] | ||
|X | |[[X Flag|X]] | ||
|D | |[[Decimal Flag|D]] | ||
|I | |[[I Flag|I]] | ||
|Z | |[[Zero Flag|Z]] | ||
|C | |[[Carry Flag|C]] | ||
|+ | |+ | ||
|. | |. | ||
Line 101: | Line 99: | ||
|. | |. | ||
|} | |} | ||
'''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. | |||
===== Cycle Penalties ===== | |||
* 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. | |||
=== See Also === | === See Also === | ||
* [[LDA]] | |||
* [[STX]] | * [[STX]] | ||
* [[STY]] | * [[STY]] | ||
Line 108: | Line 113: | ||
=== External Links === | === External Links === | ||
* [[Eyes & Lichty]] page on STA: https://archive.org/details/0893037893ProgrammingThe65816/page/n529 | * [[Eyes & Lichty]] page 503, on STA: https://archive.org/details/0893037893ProgrammingThe65816/page/n529 | ||
* [[Labiak]] page on STA: https://archive.org/details/Programming_the_65816/page/n194 | * [[Labiak]] page 184 on STA: https://archive.org/details/Programming_the_65816/page/n194 | ||
* [[MCS6500 Manual]] page on STA: https://archive.org/details/mos_microcomputers_programming_manual/page/n20 | * [[MCS6500 Manual]] page 5 on STA: https://archive.org/details/mos_microcomputers_programming_manual/page/n20 | ||
* [[Carr]] page on STA: https://archive.org/details/6502UsersManual/page/n286 | * [[Carr]] page 273 on STA: https://archive.org/details/6502UsersManual/page/n286 | ||
* [[Leventhal]] page on STA: https://archive.org/details/6502-assembly-language-programming/page/n145 | * [[Leventhal]] page 3-96 on STA: https://archive.org/details/6502-assembly-language-programming/page/n145 | ||
* 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 | ||
Line 119: | Line 124: | ||
[[Category:Group One Instructions]] | [[Category:Group One Instructions]] | ||
[[Category:Inherited from 6502]] | [[Category:Inherited from 6502]] | ||
[[Category:Load/Store Instructions]] |
Latest revision as of 04:23, 6 December 2023
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.
Cycle Penalties
- 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.
See Also
External Links
- Eyes & Lichty page 503, on STA: https://archive.org/details/0893037893ProgrammingThe65816/page/n529
- Labiak page 184 on STA: https://archive.org/details/Programming_the_65816/page/n194
- MCS6500 Manual page 5 on STA: https://archive.org/details/mos_microcomputers_programming_manual/page/n20
- Carr page 273 on STA: https://archive.org/details/6502UsersManual/page/n286
- Leventhal page 3-96 on STA: https://archive.org/details/6502-assembly-language-programming/page/n145
- 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