loading…

About this thing

A working MOS 6502 microcomputer simulator running entirely in your browser — CPU, RAM, ROM, video chip, and a real 6522 VIA peripheral, all wired to a memory-mapped bus. The same code runs as a terminal app and as this WebAssembly build. Long-term goal: a teaching tool for how 6502-era machines actually worked — chip selects, memory-mapped I/O, polling vs. interrupts, and writing assembly that transfers to real silicon.


How it's built

  • Go One simulator core, two front-ends.
  • TUI Native build runs in a real terminal via tcell.
  • WASM The browser build compiles the same code with GOOS=js and renders the TUI to a canvas.
  • Graphics-mode pixels overlay the cell grid using a sentinel-rune trick — so windows, shadows, and z-order all just work over the bitmap.

The FoxPro UI

Windows, menus, status bar, drop shadows, drag-to-move — this is foxpro-go, a from-scratch homage to FoxPro for DOS's TUI (and dBASE before it). The simulator embeds it as the host shell.

Try: F10 opens the menu bar. Drag any window by its title. Right-click on the desktop to drag the whole layout.

What's in the machine

  • CPU — two backends: a fast interpreter and a transistor-level netlist sim.
  • VIC — 40×13 char/color planes plus a 160×100 4-bpp graphics plane with hardware blits, fills, lines, and circles.
  • VIA #1 — 65C22 chip with Timer 1 free-running on its own 1 MHz oscillator, IFR/IER, polling-style pacing.
  • RAM/ROM — 8 KB each, reset vector at $FFFC.

Memory map

RangeDevice
$0000-$1FFFRAM (8 KB)
$2000-$9FFFopen / expansion
$A000-$A3FFVIC color plane
$A400-$A7FFVIC char plane
$A800-$ABFFVIC controller
$B000-$B0FF6522 VIA #1
$B100-$BFFFperipheral slots (15×)
$C000-$DFFFVIC graphics plane
$E000-$FFFFROM

Try this

  • Open Demo menu — bouncing balls, scrollers, a graphics quad-rotator.
  • Open VIA #1 window: watch the timer count down even when you stop the CPU.
  • Open Memory: hit v to cycle Hex / Disasm / Labels.
  • Type a base address in Memory to navigate — e.g. $B000 to inspect the VIA.

Hardware-faithful intent

Each peripheral lives on its own chip-select region, decoded by high address bits exactly the way a 74HC138 would on a real board. The VIA's registers mirror every 16 bytes through its 256-byte CS block — same as a real 65C22 with only 4 register-select pins. The intent: demos written here transfer to real silicon unmodified.

What's on screen

  • CPU — live A/X/Y/PC, status flags, half-cycle counter, address & data buses, R/W direction, IRQ/NMI lines. Reset button on the right.
  • Clock — Run, Stop, Step (one instruction), Tick (one half-cycle), and a speed selector (1 Hz → Max). The pacemaker for the whole machine.
  • VIC — the video chip's framebuffer (text or graphics mode), with a column of buttons for every controller command (Clear, Shifts, Rotates, Fills). Drag-to-scroll the memory strip below.
  • VIA #1 — the 6522 timer/peripheral chip. Counter ticks down on its own crystal (independent of the CPU clock), IFR/IER bit dots flicker as the timer fires. Watch it stay alive while you single-step.
  • Memory — hex view, with trace tinting (yellow = changed write, green = read). Press v to cycle Hex / Disasm / Labels.

Carl Edwards · thecarledwards.com