What we are building now
The Dragon machine is a Dragon 32 whose chips are emulated in your browser: the 6809 CPU, memory, video and cassette, through Ciaran Anscomb's XRoar emulator. The ROM, the chip that holds the BASIC language, belongs to its rights holders. So we are writing our own ROM in the 6809's machine language.
The goal
The real computer, as close as we know how, without copying the original code. Every decision is judged by one question: does this bring us closer to the original?
How we are building it
- The core: the BASIC that Microsoft published as open source (MIT licence). It gives us numbers, strings, variables and loops.
- Two rooms: I'm not a programmer; I build with AI. One AI agent reads the original and reports only facts, in its own words: what each command does, and at which memory addresses. A second agent writes the code without ever seeing the original. Behaviour as close to the original as we know how, our own code.
- The books of the time: the manuals that came with the computer and BASIC books from those years.
- The emulator's author: Ciaran Anscomb answered questions no book answers, such as the exact cassette speed.
How we test it
574 automatic tests run the ROM inside XRoar on every change. They check what appears on the screen, what is written to tape and what goes to the printer. Among them are 74 programs from old BASIC books, with the output printed in the book, and sound down to the CPU cycle.
What there is today
- The whole BASIC in one 16K chip, as in the original. The cartridge slot stays empty.
- All the commands, with the same error messages: graphics, sound and
PLAY,EDITandRENUM. - Cassette in the original format and at the original speed, including files.
- Printer:
LLISTandPRINT #-2. - RESET keeps your program, and BREAK stops with the line number.
- 25 extension hooks in memory, in the same places as the original. Cartridges add commands through them.
Speed against 1982
In 1982 the magazine Personal Computer World ran eight short BASIC programs on every computer and timed each one with a stopwatch. Here are the Dragon 32 results from the August 1982 issue, next to the same programs on our machine (in seconds):
| Test | What it does | Dragon 32, 1982 | Our machine |
|---|---|---|---|
| BM1 | an empty FOR loop, 1000 times | 1.6 | 1.6 |
| BM2 | a loop with IF and GOTO | 10.2 | 10.1 |
| BM3 | arithmetic with variables | 19.7 | 19.8 |
| BM4 | arithmetic with constants | 21.6 | 21.7 |
| BM5 | plus GOSUB | 23.3 | 23.5 |
| BM6 | plus an inner FOR loop | 34.3 | 35.5 |
| BM7 | plus writing to an array | 50.0 | 52.4 |
| BM8 | power, LOG and SIN, 100 times | 12.9 | 12.4 |
The first five come out almost exactly as on the original, within stopwatch accuracy. Three small differences remain: an inner FOR loop and writing to an array are a few percent slower here, and the maths functions a little faster. We will check them against a real Dragon.
Source: Personal Computer World, August 1982, p. 116.
What is still far from the original
- Machine-code software: many old games jump straight to addresses inside the original ROM. We built the addresses that software of the time used, each in its original place, and the command tables too. 35 games from that time already run on it without any change to their code, by Ken Kalish, Scott Adams, Mike Hughey, Tim Love, Harry Whitehouse, Ian Murray-Watson, Rolf Michelsen, Douglas J. Morgan, Gary Ritchie and Owen Stenseth, with their authors' permission. The next step: comparing it with a real Dragon.
- Speed: very close to the original (see above). A few percent remain in inner
FORloops, arrays and the maths functions. DLOAD: loading over a cable. We do not know yet what it does on a Dragon 32.- A real machine: we have not checked against a real Dragon yet. Everything we know comes from the original, the books and Ciaran.
This is a hobby project with no timetable. What we build here does not change the main app.
Do you have a real Dragon?
Some things can only be learned from a working machine. Please type these lines and tell us what appeared on the screen, and which model:
PRINT PEEK(144)*256+PEEK(145)(the length of the tone at the start of every tape)PRINT PEEK(287)(one memory value we do not know)10 REMthenLLIST, with no printer connected (does OK appear, or does it hang? RESET brings it back)DLOAD(an error, nothing, or a hang?)
You can write to us through the contact page.