The Graphic Adventure Creator
Back in 1985, text adventures were all the rage, and I wrote a program called the Graphic Adventure Creator to help people make them. This is a retro game archaeologist's guide to the code.
The article How We Programmed in the Olden Days describes the process by which the GAC was programmed, using a hex editor and considerable patching.
I have found a partial hex listing which gives a flavour of how I actually worked (pages 1 2 3 4 5 6 and 7 ).
This looks like a fairly late listing, as most of the code already exists and there are few changes and additions.
Each entry point is labelled in the right margin. There is no distinction between code and data, for example T_DATA on page 1 is a list of the 8 punctuation marks that can appear after each word in the text dictionary. For the curious, these are nothing, space, '.', ',', '-', '!', '?', ':'.
On page 6, there is an example of adding a couple of bytes to the code at 2B4B. Luckily, there are a bunch of NOP bytes (00) preceding this routine, so I was easily able to shift the start of the routine back 2 bytes from 2B46 to 2B44 in order to accommodate them.
By this point in the project, I was no longer thinking in terms of instruction mnemonics - I could read the hex code directly. This was not a healthy state to be in, especially as others would have to look at my code later.
The Disassembled Code
This is not a friendly format to hand to someone and say "Rewrite this for the BBC micro, please." A disassembled and much tidied-up version of the code which was used for porting.
First job - write a disassembler. I was still in the mindset that spending £40 on a disassembler was a waste of money when I could write one myself in a week. OK, two. Maybe three, if you don't mind the IX and IY instructions being a bit wrong.
Eventually, all the code was correctly disassembled and the destination of every jump recorded in a table. The code was then disassembled again with these jump destinations labelled. You will see that most of the labels in the code are still of the form L1458 ("L" plus the original address of the code). When reassembled, it's unlikely that the labels will match the addresses, but that's not a problem.
Finally, I used my handwritten notes to search-and-replace for the actual routine entry points, giving them meaningful names.
The actual code also had many patches which I moved inline, as you can occasionally see by the labels being out of order. Much of the workspace which is collected at the end in the listing was in fact sprinkled throughout the code, close to the routines that needed it.
As my text editor had limited space and my typing wasn't too fast, I hand-annotated the listing.
I'd like to apologize at this point. The code is currently in the form of a series of scanned photocopied sheets, with hand annotations. This is how it was given to the porting team, and I clearly owe them apologies too.
Also, the first one or two characters of all the labels seems to have been cropped during the copy, or else my copy has faded.
You can browse the images in the directory of scanned images. They are simply labelled 00.jpg to 97.jpg.
I also have some early notes from before it was called GAC. ADVAL was the name I had given it (ADVenture Algorithmic Language) in prototype, and the notes appear to be from ADVAL3 which is a direct ancestor of the GAC.
These notes include the symbol table (page 1 and 2 ), an early plan for the editing screen, the conditional language compiler, decompiler and editor, along with an early list of graphics commands.
Interesting Code Features
As I reacquaint myself with the code, I will add more information about interesting features here.
The main entry point for the editor seems to be at L1BE9 on page 38.
The compiler and decompiler routines start near the bottom of page 24.
I would like to acknowledge Ian Andrew of Incentive Software, for extensive guidance while writing the GAC. Without him it would have been a lot less user-friendly, reliable, and successful.
Thanks also to the porting team: Brendan Kelly (Spectrum), Dave Kirby (BBC micro and Acord Electron) and Malcom Hellon (Commodore 64).
And also thanks to retro code archaeologist Prof. John Aycock who prompted me to finally make this available.