SearchA-ZT › TI-82 (JavaScript)

TI-82 (JavaScript)

1993 MIT Online

An in-browser emulator of the TI-82, the 1993 Zilog Z80 graphing calculator that Texas Instruments built as the successor to the TI-81 and the forerunner of the TI-83. It runs a compact pure-JavaScript Z80 core (Molly Howell's MIT Z80.js) wrapped in an original TI-82 machine, and boots straight to the home screen. Type on the on-screen calculator keypad or your physical keyboard.

The TI-82 hardware — the 128 KB masked-ROM / 32 KB RAM memory map with port-2 paging, the Toshiba T6A04 96×64 LCD, the keypad matrix and the ~108 Hz timer — is modelled from TilEm's libtilemcore "x2" module, the reference open-source TI-82 core, so the authentic TI-82 operating system boots. Because everything is ordinary JavaScript, it plugs into the shared in-page debugger: single-step the Z80, read and write the registers and memory, and set breakpoints and watchpoints, all live.

Visit the official site ↗

Runs on: Web browser

TI-82 (JavaScript) Online Emulator

Play TI-82 (JavaScript) using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
TI-82 home screenTI-82 (JavaScript)TI-82greyOpen ⛶

Machines

Chips

Notes

Embedding

The emulator is two vendored pieces: a Z80 CPU core (Z80.js, MIT) and an original JavaScript TI-82 machine (ti-82.js) that models the calculator hardware, plus the grey TI-82 operating-system ROM. The machine owns its own run loop rather than free-running, so the debugger can pause, single-step and breakpoint it.

Boot. Fetch the 128 KB OS ROM, build the machine on a <canvas>, and it runs a 60 Hz frame loop that also pumps the calculator's ~108 Hz hardware timer. The Z80 starts from reset at $0000; the OS programs its memory paging (port 2) and the T6A04 LCD, enables interrupt mode 1, and settles on the home screen:

var rom = new Uint8Array(await (await fetch(romUrl)).arrayBuffer());
var m = TI82.boot(canvas, rom);       // installs ROM, returns the machine
// inside the machine's own frame loop:
while (tstates < target) {
  var t = z80.run_instruction();     // one Z80 instruction
  pumpTimer(t);                     // advance the ~108 Hz timer
  if (pending) serviceIRQ();        // IM1 -> RST $38 when IFF1 set
}

Everything the debugger needs is a plain object — there is no wasm heap to reach into:

MemberKindWhat it does
z80.run_instruction()methodExecute exactly one Z80 instruction; returns its T-cycle count. The single-step primitive.
z80.getState() / setState()methodRead/write the whole register file (AF BC DE HL IX IY SP PC I R and the flags).
z80.interrupt(nmi, data)methodRaise the maskable interrupt; in IM1 the core vectors to $0038 (the TI-82 ISR).
readByte(a) / writeByte(a,v)methodSide-effect-free view of the banked 64 KB CPU bus for the hex/disasm panes.
romRead(a) / ramRead(a)methodThe raw 128 KB masked ROM and 32 KB RAM chips, unbanked.
pressKey(id) / releaseKey(id)methodDrive a key in the port-1 matrix by group<<3|bit; ON is a sentinel handled via port 3.

Because the CPU, ROM and RAM are ordinary JavaScript, the debugger single-steps with run_instruction(), reads and writes registers through getState/setState, and implements breakpoints and watchpoints as host-side checks in the loop — no changes to the CPU core.

Debugger integration

The plug-in (ti-82-debug.js) describes the machine to the shared debugger and nothing more. It reuses the shared z80 disassembler (/debugger/src/cpus/z80.js):

  • Registers are read live from the Z80 core each refresh (A B C D E H L, IX IY SP PC, I R and the S Z H P/V N C flags) and written back through setState.
  • Memory is exposed as three chips — the banked 64 KB CPU bus, the 128 KB masked ROM and the 32 KB RAM — all read side-effect-free (no I/O windows), so opening a hex or disassembly window never disturbs the running machine.
  • Single step is one run_instruction(); breakpoints are a PC set checked before each instruction; watchpoints wrap the RAM-write path and pause the loop the moment a watched address changes. At the home screen the OS sits in a keypad-poll loop driven by the timer interrupt, so stepping there walks that poll — set a breakpoint inside a running program to watch interpreter code.
  • Keypad — the on-screen TI-82 keypad (and the physical keyboard) drive the port-1 key matrix directly, group by group, exactly as the OS scans it; the ON key is delivered through port 3 as the real hardware does.

How the hardware is modelled. The port map, the port-2 memory paging, the T6A04 LCD command set (ports 0/1, 8-bit word mode, X/Y auto-increment, the read dummy-latch), the active-low keypad scan, and the ~108 Hz timer interrupt gated by port 3 all follow TilEm's libtilemcore x2 module (the reference open-source TI-82 core). Interrupts are level-triggered: a pending timer/ON interrupt stays asserted until the OS acknowledges it by rewriting port 3, so getState is only read while an interrupt is actually waiting and the closed-debugger hot path stays fast.

Architecture

The TI-82 (1993) is the Z80 graphing calculator Texas Instruments built as the successor to the TI-81 and the sibling that the later TI-83 was derived from. This build models the original masked-ROM machine:

  • Zilog Z80 at 6 MHz (a Toshiba T6A84C00 in the real unit), run one instruction at a time by a compact pure-JavaScript core. It uses interrupt mode 1 (the ISR at $0038), driven by a ~108 Hz hardware timer and the ON key.
  • Memory — 128 KB of masked ROM (eight 16 KB pages, $00$07) and 32 KB of RAM (pages $08$09), mapped into four 16 KB slots. $0000$3FFF is fixed to ROM page 0; the $4000 and $8000 slots are paged through port 2; $C000$FFFF is RAM. Unlike the TI-83 Plus that followed, there is no Flash.
  • Display — a Toshiba T6A04 controller driving a 96×64 monochrome LCD over ports 0 (command) and 1 (data): 8-bit word mode, a settable column/row pointer with X or Y auto-increment, contrast, and a hardware vertical-scroll (Z-address) that the render honours.
  • Keypad — an 8×8 matrix read through port 1 (write a group-select mask, read the row bits active-low). The 1993 layout has a dedicated MATRX key and no APPS, and X,T,θ without the later ,n.
  • ROM — the TI-82 operating system (v19.0), a 128 KB system image © Texas Instruments, installed into the ROM pages.

The TI-82 has no sound hardware (only a link port), so it is silent by design. The OS ROM is grey system firmware — self-hosted here and cited; the Z80 core is MIT-licensed.