From NES Hacker Wiki
Jump to: navigation, search
Store Accumulator In Memory
Opcode: STA
Operation: A → M
Status Register: Status-List.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.


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.