ENIAC
The ENIAC, the Electronic Numerical Integrator and Computer, was built at the Moore School of Electrical Engineering at the University of Pennsylvania by John Mauchly and J. Presper Eckert, and unveiled in 1945. It was the first general-purpose, electronic, digital computer: about 18,000 vacuum tubes, 30 tons, and roughly a thousand times faster than the electromechanical machines before it. It had no stored program - it was programmed by plugging cables and setting switches, and reprogramming it could take days. This is an original implementation, written from scratch for emulators.org: the twenty decimal accumulators, each a signed ten-digit number shown as ten decades of neon lamps with one lit per decade, the digit trunks that carry pulses between units, the high-speed multiplier and the divider / square-rooter, the constant transmitter and the master programmer that closes loops.
It boots with the famous table of squares already running: the machine computes 1, 4, 9, 16 and on by adding successive odd numbers by the method of differences, so the neon accumulator lamps count while the printer punches each square. The whole machine, the twenty accumulators, the cycling-unit phase, the master programmer and the plugboard program, is exposed to the shared debugger, so you can single-step the program-line pulses, set breakpoints on a line, watch an accumulator for writes, and read the plugboard back as a disassembly. An on-screen keypad gives Initiate, Stop, single Pulse, Line step and Initial Clear; the ENIAC itself was wired on a plugboard and started from switches.
Runs on: Web browser
ENIAC Online Emulator
Play ENIAC using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Table of squares | ENIAC | ENIAC | open | Open ⛶ | |
| Running adder | ENIAC | ENIAC | open | Open ⛶ | |
| Factorial (multiplier) | ENIAC | ENIAC | open | Open ⛶ | |
| Reciprocal table (divider) | ENIAC | ENIAC | open | Open ⛶ | |
| Square-root table | ENIAC | ENIAC | open | Open ⛶ |
Machines emulated
Chips
Notes
Embedding
The ENIAC here is authored from scratch in one small file, eniac.js. It is a plain global — ENIAC.create(canvas) returns a machine object whose whole state (the twenty accumulators, the digit trunks and the plugboard program) is ordinary JavaScript, so the debugger reaches straight into it with no wasm heap and no hidden loop.
Boot. Create the machine on a <canvas>, load a program (a plugboard chain of program-line pulses plus the initial accumulator values), then run your own loop built on eniac.step() (fire exactly one program-line pulse):
var e = ENIAC.create(canvas);
var K = ENIAC.K;
e.load({ acc:{0:0, 1:1}, prog:[
{k:K.XMIT, acc:1, out:'A', tr:0}, // A01 transmits the odd number onto trunk 0
{k:K.RECV, acc:0, ch:0, tr:0}, // A00 receives it (square += odd)
{k:K.CONST, val:2, tr:0}, {k:K.RECV, acc:1, ch:0, tr:0},
{k:K.STEP, limit:12}, {k:K.CBACK, n:5}, {k:K.HALT}
]});
(function tick(){
var r = e.step(); // 'ok' | 'halt' — one pulse
e.render();
if (r !== 'halt') requestAnimationFrame(tick);
})();
The machine is plain fields. Everything the debugger needs is live on the object:
| Member | Kind | What it does |
|---|---|---|
e.step() | method | Fire exactly one program-line pulse; returns 'ok' or 'halt'. The single-step primitive. |
e.acc · e.sign | fields | The twenty accumulators (signed 10-digit values) and their PM signs. |
e.trunk | field | The digit trunks (buses) that carry pulses between units. |
e.line | field | The current program line — the "program counter" over the plugboard chain. |
e.mp · e.phase | fields | The master-programmer stepper (loop control) and the cycling-unit phase. |
e.peekAcc(i) · e.pokeAcc(i,v) | methods | Side-effect-free read / write of an accumulator — used by the debugger. |
e.onWrite(i,v) | hook | Called on every accumulator write; the boot uses it to implement watchpoints. |
Because the accumulators, trunks and program are ordinary JavaScript, breakpoints are a host-side Set of program lines checked before each step(), and watchpoints are checked inside onWrite — no changes to the core.
Debugger integration
The plug-in (eniac-debug.js) describes the machine to the shared debugger, and a new decoder (debugger/src/cpus/eniac.js) makes the plugboard readable. The ENIAC has no stored program and no instruction set, so this is an unusual but faithful mapping:
- The plugboard is the program. The disassembly view decodes one program-line pulse per address instead of one byte: accumulator
CLR, transmit (A05 A→T1add /S→T1subtract), receive (A00 α←T1on a channel), theMULT/DIV/SQRTunits, the constant transmitter, and the master-programmerSTEP/CBACKthat close a loop. Anything unrecognised decodes to.pulse. - Registers are the twenty accumulators (summarised as the low 32 bits of each, written back), plus the current program
LINE, the cycling-unitPHASE, the master-programmer countMPCNTand theHALTflag — read live and written back each refresh. (The register inputs show the low bits; the canvas shows all ten neon decades.) - Single step is one
e.step()— the program line advances by one pulse. Breakpoints are host-side checks on the program line (click a line in the disassembly gutter); watchpoints fire insideonWritewhen a watched accumulator is written. - Like
cpus/analytical.jsandcpus/mix.js, the decoder cannot express a structured pulse through the byte-masked reader the view provides, so it reads the real pulse off the live core (window.EMU_BOOT.eniac.prog) and falls back to a one-byte kind code only when the core is absent.
Architecture
The ENIAC — Electronic Numerical Integrator and Computer — was built at the Moore School of Electrical Engineering, University of Pennsylvania, by John Mauchly and J. Presper Eckert, and unveiled in 1945. It was the first general-purpose, electronic, digital computer: roughly 18,000 vacuum tubes, 30 tons, and about a thousand times faster than the electromechanical machines before it. It had no stored program — it was programmed by plugging cables and setting switches, and reprogramming it could take days.
- Twenty accumulators — the memory and the adders in one. Each holds a signed ten-decimal-digit number. Every decade is a ring counter of ten neon lamps with exactly one lit — the glowing lamp is the digit — and a PM lamp shows the sign, negatives held in ten's complement. This is the display the emulator draws.
- Digit trunks — the buses that carry decimal digit pulses between units. A unit transmits its number onto a trunk (the A output adds, the S output sends the complement to subtract); a receiving accumulator counts those pulses in on one of five input channels, α β γ δ ε.
- Program-line pulses — a program pulse fires a unit's operation and, when it finishes, emits an output pulse that fires the next line. The plugboard wires those lines into a sequence; this chain is the "program".
- The multiplier and the divider / square-rooter — separate high-speed units for the operations the accumulators could not do directly.
- The master programmer — a bank of steppers with decade counters that count passes and switch program lines after a set number: the ENIAC's loop and branch control.
- The cycling unit — the central clock. One addition time is twenty pulse-times; every transmit and receive happens within it.
- Constant transmitter, function tables, card reader / punch — input of numbers and output of results.
The bundled demos are small plugboard loops in the spirit of the ENIAC's first real work (ballistics tables): a table of squares by the method of differences (add successive odd numbers), a running adder, a factorial driven by the multiplier, a reciprocal table driven by the divider, and a scaled square-root table — a Store counter, an accumulator folding a running result, and a master-programmer step closing the loop.