Dragon 32/64 and TRS-80 Color Computer: emulator, 6809 assembler and debugger
A Dragon 32, Dragon 64 or TRS-80 Color Computer 2 in your browser — a cycle-counted Motorola 6809, the SAM 6883, the MC6847 VDG with every text, semigraphics and graphics mode (and NTSC artifact colours), both 6821 PIAs, the 6-bit DAC, joysticks, CAS tapes, cartridges — with your own BASIC ROMs or an open 6809 monitor. Write 6809 assembly and debug it with breakpoints beside the code.
Added
How to use it
The Dragon 32 (Dragon Data, Wales, 1982) and Tandy’s TRS-80 Color Computer are nearly the same machine: a Motorola 6809, the 6883 SAM handing out memory, the 6847 VDG making the picture, and two 6821 PIAs for the keyboard, joysticks, sound and cassette. Their keyboards are wired differently and their ROMs differ, which is why most software runs on one or the other. Pick the model on the Machine tab, press Power on, and click the screen to give it the keyboard.
ROMs
Both machines start in Microsoft’s BASIC: Dragon BASIC (one 16 KB ROM) or Color BASIC with Extended Color BASIC (two 8 KB ROMs) on the CoCo. They are still copyright — Microsoft’s, Tandy’s and Dragon Data’s successors' — and no rights holder has allowed them to be shared, so this page does not include them. Other emulators work the same way: XRoar, the reference Dragon/CoCo emulator, ships no ROMs and its packages say the images "are still under copyright". The Dragon 64 BASIC source and the CoCo ROM disassemblies people have published are Microsoft’s code too, so they are no way round it. I found no open replacement BASIC for these machines (Microsoft opened its 6502 BASIC in 2025, not the 6809 one).
Load ROM files… on the Machine tab takes the images you have: d32.rom (or the two 8 KB
halves), d64_1.rom and d64_2.rom for the Dragon 64, bas12.rom/bas13.rom and
extbas11.rom for the CoCo. Each one is recognised by its CRC-32 (as MAME lists them) or by its
sign-on text, and kept in IndexedDB in this browser only.
Without ROMs the machine runs the GW 6809 monitor, an open stand-in written for this site
(its source is in dragon-coco-data.js, MIT licence). It has no BASIC, but it keeps BASIC’s
conventions so machine code written for either ROM runs on it: the indirect jump table at $A000
(POLCAT, CHROUT, CSRDON, BLKIN, BLKOUT, JOYIN, WRTLDR), the interrupt vectors in RAM at
$0100–$0111, the screen at $0400 and the cassette and timer variables. At its > prompt:
|
show 64 bytes of memory |
|
change memory |
|
run code there (it comes back with RTS); |
|
load a machine-code file from tape |
|
save memory to tape (start, end, run address) |
|
read the joysticks |
|
clear the screen |
An SWI in your code shows the registers and returns to the prompt.
BASIC
With the ROMs loaded, type at the OK prompt, or use the BASIC tab: pick an example or paste a
listing and press NEW, type & RUN. The text is handed to the ROM’s own keyboard routine one key
at a time, as if typed, so it works for any program; letters go in as capitals unless you untick
that. Ctrl+V on the screen (or the Paste button) types the clipboard. The examples — PRINT@,
SET blocks, PMODE 4 circles, PLAY (Ode to Joy), JOYSTK and machine code from DATA —
run on both machines; the CoCo needs Extended Color BASIC for PMODE, CIRCLE and PLAY.
Assembly
The Assembly tab has a 6809 assembler written for this site, in Motorola syntax: labels in the
first column, ORG, EQU, FCB/FDB/FCC/RMB, SETDP, IF/ELSE/ENDIF; every
addressing mode (#imm, <direct, >extended, ,X+, ,--S, A,X, D,Y, 5,U,
label,PCR, [,X++], [$A002]), the shortest offsets that fit, and long branches. Assemble &
run (Ctrl+Enter) resets the machine, waits for the prompt, puts the code in memory and types
EXEC &H4000 (BASIC) or G 4000 (the monitor). The examples print through JSR [$A002] and
read keys through JSR [$A000], so they run under either ROM: hello world, reading keys,
semigraphics 4 colour blocks, PMODE 4 set up by hand through the SAM and the VDG (on a CoCo its
stripes come out in artifact colours), four-colour CG3 graphics, a scale on the DAC, a field-sync
interrupt counter hooked into $010C, a joystick-driven block and SWI as a breakpoint. Build .CAS
tape, Download .BIN (Disk BASIC’s LOADM format) and Download .DGN (DragonDOS) make files for
other emulators or a real machine.
Debugging
The Assembly tab is a split view: the editor, and beside it (below on a phone) the screen with the registers (A, B, D, X, Y, U, S, DP and the EFHINZVC condition codes), the S stack with likely return addresses, the code around PC and watches.
-
Click a line number beside the code to set a breakpoint; right-click it to run to that line; F9 toggles the cursor line.
-
F5 continue, F6 pause, F11 step, F10 step over a
JSR/BSR, Shift+F11 step out, Ctrl+F10 run to the cursor line. -
When the program stops the line is marked, and the status says where — your line, the ROM or the cartridge — and which scan line the beam is on.
The Debugger tab works on anything that runs. Its disassembly names the ROM jump table, the RAM vectors and every PIA and SAM register. Views: SAM and VDG (all sixteen SAM bits with their set/clear addresses, the display offset and mode, the CPU rate and map type; the VDG mode from PIA1 port B), PIAs (both chips' ports, control registers and what each line is wired to, keys held, joysticks) and Sound and tape (the DAC, the analogue multiplexer, the motor and the tape position).
Tapes, programs and cartridges
Drop files on the screen or the Tapes, programs and cartridges box:
-
.CAS — goes in the cassette; with Start what I load on the page types
CLOADandRUNfor a BASIC program orCLOADM:EXECfor machine code (the monitor’sLandG). Fast tape jumps over the ROM’s own BLKIN routine, found through the jump table at $A006, and fills each block at once; turn it off and the real 1200/2400 Hz signal goes through PIA1 at its own speed, timed by the ROM itself. Whatever the machine writes to tape (CSAVE,CSAVEM, the monitor’sS) is decoded from the DAC back into bytes: Save recording downloads it as a CAS. Every machine-code file on a tape also has Load & run, which needs no ROM. -
.BIN (Disk Extended BASIC LOADM files) and .DGN (DragonDOS binaries) load straight into memory and run.
-
.CCC / .ROM cartridges go in at $C000; they start themselves through the cartridge line’s FIRQ, as on the real machine.
-
Save state / Load state store the machine as a
.gwdcsnapshot (this page’s own format; not the ROMs).
Keys and joysticks
Enter is ENTER, Backspace and ← are the left arrow (BASIC’s back space), Esc is BREAK, Home is CLEAR. Letters type as capitals; Shift+letter gives lower case, which these machines show in inverse video. The mouse over the screen is the right joystick (its button is the fire button), and a gamepad works too. On a phone, Keyboard shows the keyboard.
Presenting
Full screen fills the screen with the Dragon or CoCo display; ⛶ Present (or F) shows only the screen for a talk. Keys keep working; Esc closes.
How it works
The 6809 is emulated instruction by instruction with the data sheet’s cycle counts (including each indexed mode’s extra cycles and PSH/PUL’s per-byte cost), the half carry and DAA, NMI, FIRQ and IRQ with their different stacking, SWI2/SWI3, CWAI and SYNC; it has its own tests, written against Motorola’s documentation (I found no public 6809 test suite with a licence I could use). The SAM counts the video addresses — so its mode and the VDG’s can be mixed into the semigraphics 8/12/24 modes — and sets the CPU rate (the "speed-up poke" works) and the map type. The picture is drawn a scan line at a time from the VDG’s mode on PIA1 port B: 32 × 16 text with semigraphics 4 and 6, and the eight graphics modes from 64 × 64 to 256 × 192, with the NTSC artifact colours of the 256-dot mode (blue or red first: a real CoCo picks one at power-on). The VDG’s 5 × 7 character set was drawn for this site. Horizontal and field sync go to PIA0’s CA1 and CB1, so BASIC’s 50 or 60 Hz timer interrupt runs; the keyboard is the 7 × 8 matrix scanned through PIA0, the joysticks a comparator against the DAC, and sound is the DAC (through the analogue multiplexer and the sound-enable line) plus the 1-bit output, mixed at 44.1 kHz.
Limits
-
No Microsoft ROMs are included; without yours there is no BASIC.
-
No disc controller (Disk BASIC, DragonDOS), no printer, serial port or CoCo 3.
-
The Dragon 64’s 6551 serial chip is a stub; its 64K mode needs ROM 2.
-
The "address-dependent" CPU rate is approximated from where the code runs.
-
Mid-line changes to the VDG mode appear from the next scan line.
Linking to an example
Share link copies the model, the tab and the code or listing. Links can be written by hand:
| Parameter | Meaning | Example |
|---|---|---|
|
|
|
|
The tab: |
|
|
An Assembly example ( |
|
|
Assembly source for the editor |
|
|
A BASIC listing for the BASIC box |
|
|
Open full screen; run the code or listing straight away |
|
Presets: hello world in 6809 code, PMODE 4 artifact colours on a CoCo, semigraphics 4, PMODE 4 circles in BASIC, the SAM and VDG view.
Related: BBC Micro, Acorn Electron, ZX Spectrum, MSX, 6502 assembler, retro font editor.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.