lesson

Updated 6 days ago
When you write code in Python or C, a compiler translates your logic into raw electrical operations executed directly on silicon.
At this fundamental hardware level, the central processing unit (CPU) does not know what a variable or loop is โ it only knows how to shuffle binary numbers across tiny internal storage slots called registers.
How does a chip keep track of where it is, do math, and remember the outcome of calculations simultaneously?
The Three Essential CPU Registers
A register is an ultra-fast, on-chip storage location made of flip-flops that can read and write data within a single clock cycle.
In 1945, mathematician John von Neumann formalized modern computer architecture, establishing three core registers that every microcontroller relies on to execute code.
๐Interactive diagram
The program counter (PC) holds the memory address of the next instruction waiting to be fetched and executed.
The working register (often called the accumulator or
WREG) serves as the temporary scratchpad where the arithmetic logic unit (ALU) loads operands and stores calculation results.The status register consists of individual one-bit flags that record specific outcomes of the most recent ALU operation, such as whether a result was zero (Z) or produced a carry (C).
Now that we know where data lives inside the chip, how do we write commands that manipulate these registers?
Anatomy of an Assembly Instruction
Assembly language is a human-readable text format where short mnemonic words directly represent binary machine code instructions.