Memory and the processor · Copying a byte

A place
to work.

Memory gives bytes a place to stay. A processor carries out instructions using small working spaces called registers. Meet one of them: A.

The processor is also called the CPU, short for central processing unit. Here we use an Intel 8080.

Memory · eight locations shownAddresses 0–7

Address 3 holds our starting byte. Address 4 is where we will put a copy. Values below are decimal.

Select a memory byte to edit

Address 3 starts at 200; address 4 starts at 42.

Select a location to edit it in the explorer below. The read and write always use addresses 3 and 4.

Inside the processorIntel 8080

Register A

0decimal

Binary
0000 0000
Hexadecimal
00

A holds one byte. The processor’s instructions change it.

Step through the program

Enable JavaScript to run this experiment.

Last instruction

No instruction has run. A starts at 0.

Change the byte at address 3

Edits here change memory immediately. They do not change A or run an instruction.

Byte at address 3Unsigned · 0 to 255

Enable JavaScript to change this byte. This example shows 200.

Change the byte

Hex digit C

Hex digit 8

Add the values of the bits that are on

128 + 64 + 8 = 200

See the 8080 instructions

The first instruction is LDA 0003H: load A from memory address 3. The second is STA 0004H: store A at address 4. The load and store preserve the processor’s flags.

This view shows the first eight locations of a 65,536-byte RAM. The instructions live elsewhere, starting at hexadecimal address 0100. The program counter, PC, tells the processor where to find its next instruction.

Current PC: 0100 (hexadecimal). The lesson stops offering steps at 0106, just after the final instruction. This is a lesson boundary; the processor has not executed a halt instruction.

No instruction has run.

The record includes the reads that fetch the instruction bytes, as well as the data read or write. Editing a memory byte in the explorer is a separate learner action; it does not alter the last instruction’s record.

Explore the Intel 8080 guide

A copy in A.

Press Read address 3 into A. A now holds 200, and address 3 still holds 200. Reading a byte does not take it away from memory.

The processor has copied the value into a separate place. A is a register inside the processor; it is not another address in this RAM.

A copy back to memory.

Now press Write A to address 4. The value in A replaces whatever was at address 4. A itself keeps its value.

If you changed address 3 to 17 after reading, address 4 still receives 200. The write takes its value from A, not from address 3.

Load, then store.

Bringing a value into a register is called a load. Writing it from a register to memory is called a store.

On the Intel 8080, A is also called the accumulator. It is a working register used for arithmetic. In the next lesson, we will change its value with a calculation between the load and the store.

For now, the important idea is that a register can hold a copy of a byte independently of memory. Each button above runs a real 8080 instruction to make that copy.