STA

From NES Hacker Wiki
Revision as of 17:13, 3 June 2013 by TheAlmightyGuru (talk | contribs) (Created page with "{{Infobox Opcode | Title = Store Accumulator In Memory | Opcode = STA | Operation = A → M | StatusN = Ignore | StatusZ = Ignore | StatusC = Ignore | StatusI =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Store Accumulator In Memory
Opcode: STA
Operation: A → M
Status Register: Status-List.png
Status-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.png

STA (Store Accumulator In Memory) stores the accumulator into a specified memory address. It is probably the second most-used opcode in 6502 assembly as it stores the most-used register. It is similar in function to STX and STY.

Operation

This pseudo C code shows how the STA opcode functions when it is executed.

STORE(Operand, ACCUMLATOR);   // Stores the Accumulator Register into the memory address specified in the operand.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Zero Page STA Operand 85 2 3
Zero Page, X STA Operand, X 95 2 4
Absolute STA Operand 8D 3 4
Absolute, X STA Operand, X 9D 3 4*
Absolute, Y STA Operand, Y 99 3 4*
(Indirect, X) STA (Operand, X) 81 2 6
(Indirect), Y STA (Operand), Y 91 2 5*
* Add 1 if page boundary is crossed.

Examples