SearchA-ZT › TI-59

TI-59

1977 LGPL-2.1 Online

An in-browser emulator of the TI-59, Texas Instruments' flagship programmable calculator with magnetic cards and plug-in ROM modules. It runs the TMS0500-simulator core (a chip-level model of the TMC0501 arithmetic chip, by Hynek Sladký and Matthieu Castet) compiled to WebAssembly, executes the genuine TI-59 ROM microcode, and boots straight to the red LED display showing 0. Type on the on-screen calculator keyboard or your physical keyboard.

Because the core is driven through a small set of exported functions, the emulator plugs into the shared in-page debugger: single-step the TMC0501, read and write the registers and memory, and set breakpoints and watchpoints, all live.

Visit the TMS0500-simulator project ↗

Visit the official site ↗

Runs on: Web browser

TI-59 Online Emulator

Play TI-59 using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
TI-59TI-59TI-59greyOpen ⛶

Chips

Notes

Embedding

The runtime is the TMS0500-simulator (Hynek Sladký / Matthieu Castet, LGPL-2.1): a chip-level model of the TMS0500 "building blocks" that runs the genuine TI-59 microcode. It is written as separate chip files that talk over a shared struct bus; we compile it to WebAssembly with Emscripten and add one glue file (web.c) of EMSCRIPTEN_KEEPALIVE entry points, so JavaScript owns the loop. One script loads the module:

// Emscripten factory; resolves ti59-core.wasm next to the loader.
<script src="ti59-core.js"></script>   // window.TI59Module() -> Promise<Module>

Boot. Build the chip set (the ROMs are embedded in the wasm with --embed-file), then run the TMC0501 from its power-on reset until it settles idle at the 0. display, and paint the 12-digit red LED each frame from the display string:

web_init();                          // wire ALU + 3 ROM + 2 const SCOM + 4 data-RAM + display + keys
for (var i=0; i<500000; i++) web_run_cycle();  // power-on -> idle "0."
(function loop(){
  for (var i=0; i<budget; i++) web_run_cycle();  // one TMC0501 microinstruction each
  render(web_disp());               // 12-digit LED string -> 7-segment canvas
  requestAnimationFrame(loop);
})();

The core is reached through a handful of exported C functions (all in web.c), each called on demand, never per S-state:

ExportKindWhat it does
web_run_cycle()fnRun exactly one TMC0501 microinstruction (all 16 S-states of one cycle). The single-step primitive.
web_disp()fnPointer to the current 12-digit display string (digits, decimal points, -, and the C/E overflow/error markers).
web_reg(i)fnPointer to a 16-nibble working register: 0=A 1=B 2=C 3=D 4=E, read and written straight off the ALU state.
web_geti(i) / web_seti(i,v)fnThe scalar state: KR, SR, the flag words fA/fB, the R5 digit, the status flags, PC (the current ROM address) and the D-state counter.
web_rom_read(a)fnOne 13-bit program word at an absolute address (side-effect free), for the disassembly view.
web_ram_read(a) / web_ram_write(a,v)fnThe data RAM as a flat nibble space (register*16 + digit) - the debugger's memory + watchpoint surface.
web_key(ascii)fnInject a key by its keymap character - how both the on-screen and physical keyboards drive the scanned matrix.
web_reset()fnPower-on reset: clear the ALU and data RAM, re-seed the ROM PC to 0 and re-boot to 0.

Debugger integration

The plug-in (ti59-debug.js) reads the live core from window.EMU_BOOT and calls EmuKit.defineMachine with a transport, the TMC0501 register set and the memory. The TMC0501 is a new architecture with no existing decoder, so a disassembler ships as /debugger/src/cpus/tmc0501.js.

The TMC0501 decoder is a port of the simulator's disasm.c (the encoding is documented in US patent 3,900,722). Program words are 13 bits. Bit 12 marks a conditional branch (bit 11 the branch-on-COND sense, bits 10..1 a 10-bit displacement, bit 0 the sign). Otherwise bits 11..8 select the family: 0 flag / bit-register ops, 8 keyboard scan, A the wait / STO-RCL / peripheral group, and everything else a masked ALU operation - op dst.MASK, src over one of the digit fields ALL MANT EXP MMSD MLSD ... One wrinkle: the shared hex/disasm views mask memory reads to 8 bits, but words are 13 bits, so the embed publishes window.TMC0501_WORD_READ and the decoder pulls full-width words through it.

What was customised for the debugger. The only files added to the upstream simulator are web.c (the loop + entry points) and a few EMSCRIPTEN_KEEPALIVE accessors appended to alu.c, brom.c and ram.c; the terminal key path in key.c was rerouted to a small ASCII FIFO fed by web_key. Nothing in the per-cycle path changed, so with the debugger closed the machine runs at full speed. The five working registers A..E are 16 BCD digits (64 bits), shown as a low and a high 32-bit half. Single-step is one web_run_cycle(). Breakpoints are a host-side Set of 16-bit ROM addresses: when any are set the loop steps one cycle at a time and compares the PC (the ALU's current instruction address). Write watchpoints sample the watched RAM nibbles after each stepped cycle and halt on a change, so any store on the RAM bus trips them.

How to rebuild. With Emscripten on PATH, from src/ (the vendored core is in core/, the ROM text in rom/):

emcc core/*.c -O2 -I core -s MODULARIZE=1 -s EXPORT_NAME=TI59Module      -s 'EXPORTED_FUNCTIONS=[_web_init,_web_run_cycle,_web_reset,_web_disp,_web_key,...]'      -s 'EXPORTED_RUNTIME_METHODS=[ccall,cwrap,UTF8ToString,HEAPU8]'      -s ALLOW_MEMORY_GROWTH=1 --embed-file rom -o ti59-core.js

Architecture

The TI-59 (1977) is Texas Instruments' flagship programmable calculator: 960 program steps or 100 data registers of magnetic-card-storable memory, plug-in solid-state software modules, and full scientific functions, built on the TMS0500 chip set.

  • TMC0501 arithmetic chip - a 16-digit serial BCD processor with five working registers A B C D E (sixteen 4-bit digits each) operated a masked FIELD at a time (ALL MANT EXP MMSD MLSD DPT ...), the flag words fA/fB, the keyboard/return register KR, the subroutine register SR, and the single-digit adder latch R5. Program flow is the COND flag plus 13-bit conditional branches.
  • ROM - the TI-59 operating system lives in the TMC0582 and TMC0583 "First ROM" chips (each 2.5K x 13-bit words of instruction plus a constant table) and the TMC0571 library. The 13-bit words are fetched serially over the IRG bus.
  • Data RAM - four data-RAM chips of 30 sixteen-digit registers, holding the user data registers and program steps (nibble-addressed as register*16 + digit).
  • Display - a 12-digit red LED panel driven directly by the TMC0501's segment lines; each D-state the ALU streams one digit (with zero-suppression, the decimal point from R5, sign, and the C/E markers) onto the 7-segment panel.
  • Keyboard - a scanned matrix read on the K lines during the KEY instruction; the pressed key's (D-state, K-line) is latched into KR for the ROM to read.

Because every chip is a plain C object over a shared bus, the TMC0501 is a clear, fully steppable debugging target once compiled to WebAssembly.