Search › A-Z › M › Manchester Baby (SSEM)
Manchester Baby (SSEM)
The Manchester Baby, or Small-Scale Experimental Machine (SSEM), ran the world's first stored-program on 21 June 1948 at the University of Manchester. This is an original implementation, written from scratch for emulators.org: a 32-word store, every word 32 bits, held on a Williams-Kilburn cathode-ray tube and drawn as a 32 × 32 grid of dots. A single 32-bit accumulator does the arithmetic and a control register walks through the instructions. There are only seven instructions. The last three bits of a word choose the operation and the last five bits give a store line, and with no ADD, addition is done by negating and subtracting.
It boots with a demo already running: an endless counter that increments a store word, so its dot pattern and the accumulator visibly climb across the tube. The whole machine - accumulator, control register and every store line - is exposed to the shared debugger, so you can single-step the fetch-decode-execute cycle, set breakpoints on a store line, watch a line for writes, and read the program back as a disassembly. An on-screen control panel gives Run, Stop, Step and Reset; the Baby itself had switches rather than a keyboard.
Runs on: Web browser
Manchester Baby (SSEM) Online Emulator
Play Manchester Baby (SSEM) using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Counter demo | Manchester Baby (SSEM) | Manchester Baby (SSEM) | open | Open ⛶ |
Chips
Notes
Embedding
The Manchester Baby here is authored from scratch in one small file, ssem.js. It is a plain global - SSEM.create(canvas) returns a machine object whose whole state is ordinary JavaScript, so the debugger reaches straight into it with no wasm heap or hidden loop.
Boot. Create the machine on a <canvas>, load a program (a map of store line → 32-bit word), then run your own loop built on ssem.step() (execute exactly one instruction):
var baby = SSEM.create(canvas);
baby.load({0:16392, 1:24583, 2:16391, 3:32774, 4:24584, 5:6, 6:-1});
(function loop(){
var r = baby.step(); // 'ok' | 'stop'
baby.render();
if (r !== 'stop') requestAnimationFrame(loop);
})();
The machine is plain fields. Everything the debugger needs is live on the object:
| Member | Kind | What it does |
|---|---|---|
baby.step() | method | Execute exactly one instruction; returns 'ok' or 'stop' (halted by STP). The single-step primitive. |
baby.a · baby.ci | fields | The 32-bit accumulator and the 5-bit control register (program counter), read and written live. |
baby.store | field | The 32 words of store (an array of signed 32-bit values). |
baby.peek(a) · baby.poke(a,v) | methods | Side-effect-free read / write of a store line, used by the debugger's memory views. |
baby.onWrite(a,v) | hook | Called on every store write; the boot uses it to implement watchpoints. |
Because the accumulator, CI and store are ordinary JavaScript, breakpoints are a host-side Set of line numbers checked before each step(), and watchpoints are checked inside onWrite - no changes to the core.
Architecture
The Small-Scale Experimental Machine ("Baby") ran its first program on 21 June 1948 at the University of Manchester, the first time a computer executed a program held in its own electronic memory. It is tiny enough to hold in your head:
- 32-word store (lines 0-31), every word 32 bits, held on a Williams-Kilburn CRT as a 32 × 32 grid of dots (a bright dash = 1, a dim dot = 0), least-significant bit first. Every line is simultaneously data and one instruction.
- Accumulator (A) - the single 32-bit working register, on its own tube.
- Control (CI) - the line number of the next instruction, incremented before each fetch.
- Present Instruction (PI) - the instruction currently being obeyed.
An instruction packs a 5-bit line number in bits 0-4 and a 3-bit function number in bits 13-15.
| Function | Mnemonic | Effect |
|---|---|---|
000 | JMP | CI ← S[line] |
001 | JRP | CI ← CI + S[line] |
010 | LDN | A ← −S[line] |
011 | STO | S[line] ← A |
100 · 101 | SUB | A ← A − S[line] |
110 | CMP | skip next instruction if A < 0 |
111 | STP | halt |
With no ADD instruction, arithmetic is done by negating: to add you load the negative, store it, load it back and subtract. The shared debugger's ssem decoder turns each word back into these mnemonics in the disassembly view (and prints constants as .line), so you can watch the fetch-decode-execute cycle one instruction at a time.