ACC - The Data Accumulator

The Data Accumulator is a temporary storage location for working with data. It stores a single byte of data at a time. Each task has its own data accumulator.
The accumulator updates the zero and minus flags when updated.
The X register can often be used as a secondary accumulator.

The accumulator is not destroyed when compared to or stored from. You can do multiple comparisons until you find the match or relation you are looking for or store the same value into multiple places.

Almost every command interacts with the data accumulator in some way but these are the most common ones that directly affect it.

  • LDA - Load a value into the accumulator

  • CMP - Compare to the value in the accumulator

  • STA - Store from the accumulator

  • INC - Increments the accumulator by 1

  • DEC - Decrements the accumulator by 1

  • SWAP - Swaps the values in the accumulator and the X Register

  • TAX - Transfers the accumulator to the X Register

  • TXA - Transfers the X Register to the accumulator

  • AND - Clears specified bits in the accumulator

  • OR - Sets specified bits in the accumulator

Examples

{
LDA #4          //Load a value of 4 into the accumulator
CMP ~11         //Compare the value in ~11 with the value in the accumulator
STA $44         //Store the value in the accumulator into persistent memory location $44
LDA #0          //Load a value of zero and set the zero flag
SWAP            //Swap the value in the x register and the accumulator
}