STA
Store Accumulator to Memory
Stores the accumulator into memory.
On all processors, the data written to memory is 8-bit. However, for 16-bit processors with the m flag is clear then the data written is 16-bit with the low-order 8-bits at the effective address and the high-order 8-bits at the effective address plus one.
Flags Affected
None. |
Instructions
Syntax | Opcode | Available on: | # of | # of | Addressing Mode | ||
---|---|---|---|---|---|---|---|
(hex) | 6502 | 65C02 | 65816 | bytes | cycles | ||
STA addr | 8D | x | x | x | 3 | 41 | Absolute |
STA long | 8F | x | 4 | 51 | Absolute Long | ||
STA dp | 85 | x | x | x | 2 | 31, 2 | Direct Page |
STA (dp) | 92 | x | x | 2 | 51, 2 | Direct Page Indirect | |
STA [dp] | 87 | x | 2 | 61, 2 | Direct Page Indirect Long | ||
STA addr,X | 9D | x | x | x | 3 | 41 | Absolute Indexed X |
STA long,X | 9F | x | 4 | 51 | Absolute Long Indexed X | ||
STA addr,Y | 99 | x | x | x | 3 | 41 | Absolute Indexed Y |
STA dp,X | 95 | x | x | x | 2 | 41, 2 | Direct Page Indexed X |
STA (dp,X) | 81 | x | x | x | 2 | 61, 2 | Direct Page Indexed Indirect X |
STA (dp),Y | 91 | x | x | x | 2 | 51, 2 | Direct Page Indirect Indexed Y |
STA [dp],Y | 97 | x | 2 | 61, 2 | Direct Page Indirect Long Indexed Y | ||
STA sr,S | 83 | x | 2 | 41 | Stack Relative | ||
STA (sr,S),Y | 93 | x | 2 | 71 | Stack Relative Indirect Indexed Y |
Notes:
- 65816: Add 1 cycle if m=0 (16-bit memory/accumulator)
- 65816: Add 1 cycle if low byte of Direct Page register is not 0
Last modified November 5, 2021: Add instruction categories (6b74ff9)