SearchA-ZT › Thomson MO5

Thomson MO5

1984 Open source Online

The Thomson MO5 is a compact emulator built here in JavaScript around a genuine Motorola 6809 core, running the machine's own 16 KB Microsoft BASIC 1.0 and monitor ROM in the browser so it boots straight to the French home computer's cyan "OK" prompt with no downloads. The MO5 (Thomson, 1984) pairs a 6809E at 1 MHz with 32 KB of user RAM, a single MC6821 system PIA and a custom gate array driving a two-plane 320×200 16-colour bitmap. Every register, chip and byte of memory is a plain JavaScript object, so the whole machine can be paused, single-stepped and inspected live in the shared debugger.

Runs on: Web browser

Thomson MO5 Online Emulator

Play Thomson MO5 using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
MO5 BASICThomson MO5Thomson MO5greyOpen ⛶

Machine emulated

Chips

Notes

Embedding

There is no ready-made pure-JavaScript Thomson MO5, so this build reuses the proven JavaScript Motorola 6809 core from JSVecX (e6809.js, itself a port of Valavan Manohararajah's e6809.c) and wraps a small MO5 around it. The MO5 (Thomson, 1984) is a 6809E at 1 MHz with 32 KB of user RAM, a single MC6821 system PIA, and a custom gate array that scans a two-plane bitmap screen (320×200, 16 colours).

Boot. Give the 6809 a bus object with read8 / write8, map the 16 KB BASIC + monitor ROM at $C000, reset it (the reset vector at $FFFE reads $F003 from the monitor) and drive it from a loop you own - one field is 19,968 CPU clocks at 1 MHz / 50 Hz:

var cpu = new e6809();
cpu.init(machine);              // machine.read8 / machine.write8 = the bus
cpu.e6809_reset();             // PC <- read16($FFFE) = $F003 (monitor)
(function field(){
  var irq = pendingIrq ? 1 : 0; pendingIrq = false;  // 50 Hz gate-array IRQ
  for (var c = 0; c < 19968; )
    c += cpu.e6809_sstep(irq, 0);  // one instruction, returns its cycles
  render(); requestAnimationFrame(field);
})();

The machine is plain objects. Everything the debugger needs is a field or method. There is no wasm heap to reach into:

MemberKindWhat it does
cpu.e6809_sstep(irq, firq)methodExecute exactly one 6809 instruction with the current IRQ / FIRQ lines; returns its cycle count. The single-step primitive.
cpu.e6809_reset()methodReset the CPU - reloads PC from the $FFFE vector.
cpu.reg_a / reg_b / reg_dp / reg_cc / reg_pcfieldThe 8- and 16-bit registers as numbers; reg_x/y/u/s are boxed (.value holds the 16-bit register).
machine.read8(a) / write8(a,v)methodThe CPU bus: the two video planes, 32K RAM, the system PIA and the BASIC / monitor ROM.
vramColour / vramFormfieldThe two 8 KB video planes: a colour byte (foreground / background palette indices) and a form byte (which pixels take which colour).
port / touchefieldThe MC6821 registers and the keyboard matrix state ($00 held, $80 released).

Because the CPU, bus and RAM are ordinary JavaScript, the debugger single-steps with e6809_sstep, reads and writes registers straight off cpu, and implements breakpoints and watchpoints as host-side checks around the loop, no changes to the reused core.

Debugger integration

The plug-in (mo5-debug.js) reads the live machine from window.EMU_BOOT and hands the shared framework a description of the MO5. Nothing is patched into the emulator; the whole surface is ordinary field access.

  • Registers are read straight off cpu each refresh - A B D X Y U S DP PC CC plus the E F H I N Z V C condition flags decoded from reg_cc - and written back the same way. Single-step and watch them change.
  • Memory is five chips: a side-effect-free 64K CPU bus (the $A7C0 PIA / gate-array window is skipped so an auto-refreshing hex view never reads a live sync bit), the raw 32K user RAM, the two 8K video planes and the 16K ROM. Disassembly uses the shared m6809 decoder.
  • Single step is e6809_sstep - one 6809 instruction with its correct IRQ handling.
  • Breakpoints are host-side: with any set, the loop steps one instruction at a time and compares cpu.reg_pc before each. Watchpoints wrap the bus write path and pause on a write to a watched address.
  • Input is the real MO5 key matrix: the physical keyboard maps each character to its MO5 key, and an on-screen AZERTY MO5 keyboard drives the same scancodes for touch.

Architecture

The Thomson MO5 is a clean 6809 machine, and this build keeps each block as its own object:

  • e6809 - the Motorola 6809 core (reused from JSVecX), single-stepped by e6809_sstep.
  • Bus - the two 8K video planes at $0000, 32K user RAM at $2000, an empty cartridge slot at $B000, the system PIA in the $A7C0 page, and the 16K Microsoft BASIC 1.0 / monitor ROM at $C000 (holding the reset and interrupt vectors).
  • MC6821 PIA - port A ($A7C0) selects the video plane and border colour; port B ($A7C1) selects a keyboard scancode and reads the key back on bit 7. The gate array's 50 Hz frame-sync drives the interrupt that keeps the cursor and the BASIC timer running.
  • Gate-array video - 320×200 in 16 colours. Each 8-pixel cell reads a colour byte (foreground / background palette indices) from one plane and a form byte (the 8 pixel bits) from the other; the Thomson EF9369 palette is rendered to the canvas.

With no cartridge and no cassette, the monitor sizes the RAM, prints its cyan banner and drops to OK - a complete, inspectable machine that boots straight to BASIC.