A Dragon 1982 seriesDREAM · 1982–83

Software of the Day

Programming

DREAM: the tool behind the fast games

DREAM by Mike Kerry came out in 1982–83 from Dragon Data, the company that made the computer. It is an editor plus an assembler for machine code, the language almost every fast game of the time was written in. The All Dream edition adds Dreambug, a tool for finding bugs.

Why machine code

BASIC is easy to write but slow. Machine code is direct orders to the 6809 processor: dozens of times faster, but harder. DREAM does three things: an editor to write the program, an assembler that turns it into code the processor understands, and running it straight away.

Loading from tape

First reserve some memory: CLEAR 200,12000 and ENTER. Then CLOADM, and when OK appears, type EXEC. When it asks OLD TEXT?, press N and the screen clears.

A first program

This program fills the screen with the letter A and waits for a key. Type each line followed by ENTER. A line that starts with a space must start with a space: a word at the start of a line is a label (like LOOP), and the instruction comes after a space.

@ LDX #$0400
 LDA #'A
LOOP STA ,X+
 CMPX #$0600
 BLO LOOP
KEY LDX $A000
 JSR ,X
 BEQ KEY
 RTS

What each line does

LDX #$0400 points at the start of screen memory, and the @ marks where the program starts. LDA #'A takes the letter. STA ,X+ puts it on the screen and moves one place on. CMPX #$0600 and BLO LOOP go round until the end of the screen. The next three lines check for a key press, and RTS returns to the editor.

Assemble and run

BREAK, A, ENTERAssemble: the code appears beside each line
BREAK, X, ENTERRun: the screen fills with A
Any keyBack to the editor
BREAK, Q, ENTERFrom the assembler back to the editor, to fix errors
BREAK, T, ENTERBack to text mode after a graphics program

A first experiment

Change 'A to another character, say '*, and run it again. This is the moment you feel how fast machine code is: the screen fills in an instant.

This guide is in our own words, for Dragon owners who have the original program. We do not host the program or its original manual. We tried every step on an emulated machine with the same chips.

All guides · What Dragon Owners Were Reading · The history of the Dragon