What is assembly?

What is assembly?

Glen Beck and Betty Snyder operating ENIAC at the Ballistic Research Laboratory.
Glen Beck and Betty Snyder operating ENIAC at the Ballistic Research Laboratory.

ENIAC was the first general-purpose electronic computer. It was built at the University of Pennsylvania and finished in 1945. Snyder was one of six women who programmed it by hand.

Before machines like ENIAC, the word computer meant a person who did calculations by hand, and the six women who programmed ENIAC had been hired for that work. To program the machine, they rewired it: they plugged cables and set switches every time the problem changed. That rewiring is the historical reason assembly language exists. Within a few years, engineers in Europe and America began replacing wires and switch settings with short written codes that stood for instructions, so a person could read and change a program without touching a connector.

First, a CPU (central processing unit) is the chip at the center of your computer, and it does one job: it carries out a long list of small commands called instructions, one after another, billions per second. Each instruction is easy by itself, such as adding two numbers, moving a value, or jumping to another place.

Assembly is the form of the instructions a CPU runs that a person can read. Each line is (almost) one machine instruction. You do not get loops, objects, or strings. You move numbers between registers, small storage slots inside the processor, and memory.

Maurice Wilkes examining a part of EDSAC at the University of Cambridge.
Maurice Wilkes examining a part of EDSAC at the University of Cambridge.

EDSAC ran David Wheeler's Initial Orders, one of the first programs that translated written instructions into machine code.

Every processor needs a program that reads written instructions and produces the raw bits the hardware executes: an assembler. The assembler on this page targets one instruction set.

This simulator uses RISC-V, a modern instruction set used in real chips and taught in universities. What you learn here applies directly to hardware.

Yunsup Lee holding an early RISC-V prototype chip in 2013.
Yunsup Lee holding an early RISC-V prototype chip in 2013.

RISC-V is an open instruction set architecture. Anyone may implement its published specification in hardware, and no fee or permission is required.

Any instruction set design has to decide how much work a single instruction performs. CISC (Complex Instruction Set Computer) chips, including the x86 architecture found in most desktop and laptop computers, put a large amount of work into each instruction. One instruction might read a value from memory, perform arithmetic on it, and store the result back, all in a single step. RISC-V follows the design argued for by Patterson & Ditzel, 1980: each instruction performs one simple operation, and any complex behavior is produced by combining many of these instructions.

RISC stands for Reduced Instruction Set Computer. The hardware is built to run a small group of simple instructions at high speed. Complex behavior is produced by combining these simple, fast steps.

Kathleen Booth's assembler for the ARC (Booth, 1947) and David Wheeler's Initial Orders for EDSAC (Wilkes, Wheeler & Gill, 1951) rank among the earliest working assemblers, and historians continue to debate which one came first. RISC-V, the instruction set this simulator runs, defines a small, open list of instructions that anyone can implement (Asanović & Patterson, 2014). Every lesson from this point on teaches that instruction set directly.