SearchA-ZA › appl.emu

appl.emu

2025 Open source · MIT Online

appl.emu is a pure-JavaScript emulator of the Apple-1, Apple's first computer (1976). It runs Steve Wozniak's 6502 machine in the browser and boots straight to the Wozmon monitor, with keyboard input and a character-terminal display, no ROM to load, no plug-ins.

Visit the official site ↗

Runs on: Web browser

appl.emu Online Emulator

Play appl.emu using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
Wozmon monitorappl.emuApple IgreyOpen ⛶

Machines emulated

Chips

Notes

Embedding

appl.emu ships as a single main.js that builds the machine inside a DOMContentLoaded closure, renders to a growing <pre>, and drives itself from a setInterval loop, none of which is reachable from outside, and none of which can be paused or single-stepped. The debugger needs all three. So we keep appl.emu's 6502 core, its embedded Wozmon ROM and its PIA ($D010–$D013) behaviour verbatim, but re-package them as a factory that hands back the live machine and renders to a real <canvas>:

var a1 = Apple1(canvas);        // builds RAM, loads Wozmon, resets the CPU
(function loop(){
  for (var i = 0; i < 4000; i++) a1.step();  // one 6502 instruction each
  a1.render();                        // paint the 40×24 glass TTY
  requestAnimationFrame(loop);
})();

The machine is plain objects. Everything the debugger needs is a live handle on the returned object:

MemberKindWhat it does
a1.step()methodExecute exactly one 6502 instruction (cpu.step()). The single-step primitive.
a1.cpufieldLive CPU: .pc .a .x .y .sp .status, plus reset() and the opcode table.
a1.read(a) / a1.write(a,v)methodThe CPU bus - RAM plus the Apple-1 PIA at $D010–$D013 (keyboard in, display out).
a1.ramfieldThe raw 64 KB Uint8Array, under the PIA window.
a1.feedKey(code)methodQueue a 7-bit ASCII key; the PIA returns it with the high bit set, as the real hardware does.
a1.render()methodDraw the 40×24 terminal to the canvas.

Because the CPU, bus and RAM are ordinary JavaScript, the debugger single-steps with a1.step(), reads and writes the registers straight off a1.cpu, and implements breakpoints and watchpoints as host-side checks around the loop and around cpu.write - no changes to the emulation.

Architecture

The Apple-1 (1976) is about as simple as a computer gets: a 6502, 4 KB of RAM, a Motorola 6821 PIA for I/O, and Steve Wozniak's 256-byte "Wozmon" monitor in ROM at $FF00. There is no video chip; a terminal-style character generator scans a fixed 40×24 display. appl.emu models exactly this:

  • 6502 CPU - an interpreted core, one instruction per step(); the full official opcode set (decimal mode is a no-op, which Wozmon does not need).
  • PIA at $D010–$D013 - $D010 KBD and $D011 KBDCR feed keystrokes in (high bit = key ready); $D012 DSP takes characters out to the display.
  • Wozmon ROM - Wozniak's monitor, embedded as bytes and mapped at $FF00 with the reset/IRQ vectors pointing at it, so the machine comes up in the monitor with nothing to load.
  • Terminal - a 40×24 upper-case glass TTY; this build renders it to a canvas (the upstream project renders to the DOM).

It boots straight to the Wozmon prompt, a complete, fully inspectable machine that is an ideal first target for a 6502 debugger.