SearchA-ZI › IBM 1620

IBM 1620

1959 Open source · MIT Online

This is a from-scratch, in-browser emulator of the IBM 1620 (1959), code-named CADET - IBM's affordable decimal scientific computer. The 1620 is a decimal, variable-length machine: core storage is a string of BCD digits, each carrying a separate flag bit that marks the high-order end of a variable-length field or the sign of a number. Addresses are five decimal digits; instructions are a fixed twelve digits - a 2-digit op code and two 5-digit addresses.

Famously the Model 1 has no arithmetic hardware - "Can't Add, Doesn't Even Try" - so it adds and multiplies by table look-up in low memory: an addition table at 00300-00399 and a multiplication table at 00100-00299. This core builds both tables at boot and genuinely reads them to compute, exactly as the hardware did.

The emulator models that architecture faithfully: the digit + flag store, variable-length fields, the fixed instruction format, the op set (Add / Subtract / Multiply and Immediate forms, Compare, Transmit Digit / Field, Set / Clear Flag, Branch and the conditional branches, Control, and Read / Write / Dump Numerically), the result indicators, the four Program Switches and the console typewriter. It boots a demo that types the powers of two on the typewriter using the add table, multiplies 12 × 12 with the multiply table, and halts.

Because the entire machine is plain JavaScript, it plugs into the shared debugger: single-step the processor, watch the instruction address register advance twelve digits per instruction, disassemble the decimal op + P/Q addresses, set breakpoints and digit / flag watchpoints, and inspect every digit and flag of storage live.

Runs on: Web browser

IBM 1620 Online Emulator

Play IBM 1620 using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
IBM 1620 (CADET demo)IBM 1620IBM 1620openOpen ⛶

Machines emulated

Chips

Notes

Embedding

There is no upstream runtime to vendor here — the IBM 1620 core is written from scratch as one plain-global JavaScript module. Vendor it and load it before your boot script:

// the whole machine: decimal digit store + flag bits + table-lookup arithmetic + console typewriter
<script src="ibm-1620.js"></script>   // window.IBM1620 (the Machine constructor)

Boot. Construct the machine on a <canvas> and run your own loop. Because you own the loop, the debugger can pause and step it. One instruction is m.runInsn(); breakpoints are a host-side Set checked against the instruction address register at each instruction boundary:

var m = new IBM1620(canvas);
(function loop(){
  for (var i = 0; i < 2000 && !m.halted; i++) {
    if (bps.has(m.IR)) { running = false; break; }  // execution breakpoint
    m.runInsn();                                // exactly one 12-digit instruction
  }
  m.render();
  requestAnimationFrame(loop);
})();

The machine is plain objects — no wasm heap — so the debugger reaches everything directly:

MemberKindWhat it does
m.runInsn()methodFetch and execute exactly one fixed 12-digit instruction; advances the instruction address register. The single-step primitive.
m.stepInsn(n)methodRun n whole instructions.
m.dig / m.flagfieldCore storage: the decimal digits and the parallel flag bits (side-effect-free to read).
m.IR / m.P / m.QfieldThe instruction address register (PC), and the P and Q address registers of the current instruction.
m.ind / m.psfieldThe result indicators (High/Positive, Equal/Zero, Overflow) and the four console Program Switches.
m.poke(a, v)methodWrite one digit position through the watchpoint hook m.onWrite.
m.press(id)methodConsole action: START, STOP, SCE (single cycle), RESET, Dn (a typed digit), RM, RS, or PSn (toggle a program switch).

Debugger integration

The debugger plug-in (ibm-1620-debug.js) reads window.EMU_BOOT and calls EmuKit.defineMachine. Because the whole machine is ordinary JavaScript, single-stepping is just m.runInsn(), and the registers (instruction address register, op register, P and Q address registers, the return register, the three result indicators and the four program switches) are read and written straight off the machine object.

Breakpoints are a host-side Set the loop checks against the instruction address register before each instruction. Watchpoints are wired by installing m.onWrite = fn: every digit and flag write goes through m.poke / m.pokeFlag, which call the hook, so a write to a watched storage position pauses the machine promptly.

A new ibm1620 disassembler (/debugger/src/cpus/ibm1620.js) decodes the 1620's fixed twelve-digit format: a 2-digit op code plus a 5-digit P address and a 5-digit Q address. It renders the classic mnemonics (A, S, M, C, TF, TD, TFM, TDM, SF, CF, BNF, BNR, BI, BNI, B, BB, K, RN, WN, DN, H …). Unlike a byte machine every instruction is length 12, so the disasm view walks cleanly through storage; a region that is really data decodes as .dc.

Architecture

The IBM 1620 (1959, code-named "CADET") was IBM's affordable decimal, variable-length scientific computer. It is nothing like the fixed-word binary machines that followed:

  • Decimal digit store — core storage is a string of positions, each holding one BCD digit (0-9, plus record and group marks) and a separate flag bit. A flag over the high-order digit marks the left end of a variable-length field; a flag over the units digit is the algebraic sign. Addresses are five decimal digits; a Model 1 has 20,000 digits.
  • Fixed 12-digit instructions — a 2-digit op code, a 5-digit P address and a 5-digit Q address (OO PPPPP QQQQQ). The instruction address register advances by twelve each cycle. Data operands, in contrast, are variable length, delimited by flags.
  • "Can't Add, Doesn't Even Try" — the Model 1 had no arithmetic hardware. It added and multiplied by table look-up: an addition table lives at 00300-00399 and a multiplication table at 00100-00299. This core builds both at boot and genuinely reads them (twice per digit, to fold in the carry) — the CADET mechanism, visible in the memory view.
  • Op set — Add / Subtract / Multiply and their Immediate forms, Compare, Transmit Digit / Field (and Immediate), Set / Clear Flag, Branch and the conditional branches (Branch Indicator / No Indicator, Branch No Flag / No Record Mark, Branch and Transmit, Branch Back), Control, and the console typewriter I/O — Read / Write / Dump Numerically. Result indicators (High/Positive, Equal/Zero, Overflow) and four Program Switches steer the branches.
  • Console typewriter — the 1620's primary I/O. Write Numerically types a digit field to the paper; Control returns the carriage; Read Numerically takes numeric input from the keyboard.

This core models the digit+flag store, variable-length fields, the fixed instruction format, table-lookup arithmetic and the control flow fully. Indirect addressing and index registers (special features) are omitted, and paper-tape / card I/O are stubbed — the console typewriter is the live I/O. Every digit and flag of state is visible and steppable, which is exactly what makes it a clear debugging target.