Skip to content
BetterDL

Accumulator

Also called: ACC, accumulator register

A CPU register that is both an operand and the destination of every arithmetic instruction, so results build up in it.

An accumulator is a working register that every calculation goes through. In Tiny8, the ACC (8 bits) is:

  • one input of every ALU operation, with the other operand read from memory;
  • the place every result goes.

So ADD a means ACC ← ACC + M[a]. Results accumulate: a chain of ADDs builds a running total.

This makes the instruction format small. Each instruction names only one memory address, because the other operand and the destination are always the ACC. Machines like this are called one-address or accumulator machines.

The cost: every value has to pass through one register. To combine two memory words you LOAD one, ADD the other, and STORE the result. Modern CPUs use a register file of many registers instead.

In Tiny8, values are unsigned and wrap modulo 256, and the zero flag loads every time the ACC does.

Worked examples

Example

Building a result in the ACC

Compute M[A] = M[B] − M[C] + M[B], with M[B] = 10 and M[C] = 3.

  1. 1.

    LOAD B: ACC = 10.

  2. 2.

    SUB C: ACC = 10 − 3 = 7.

  3. 3.

    ADD B: ACC = 7 + 10 = 17.

  4. 4.

    STORE A: M[A] = 17. The ACC still holds 17.

Example

Wrap-around

ACC = 250. Tiny8 executes ADD with an operand of 10.

  1. 1.

    250 + 10 = 260.

  2. 2.

    Only 8 bits fit, so the result is 260 − 256 = 4.

  3. 3.

    ACC = 4, and Z = 0.

Common mistakes

  • Thinking STORE clears the ACC. It copies the ACC to memory and leaves it unchanged.

  • Forgetting the 8-bit wrap: results above 255 lose 256.

Practice Accumulator

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Accumulator is taught in Basic CPU / Computer Architecture.