Akalabeth

It is hard to overstate the influence the Ultima series had on my teens, both just in terms of playing the games but also motivating me to really dive into programming.

I had the opportunity to tell Richard Garriott this at SxSW in 2004 and occasionally via Twitter more recently.

Ultima IV was the first game I really got into although I went back and played the earlier ones, including Akalabeth.

In my teens I remember hacking the map files for both Ultima IV and Ultima V. A couple of years ago, I redid that work in Python (see Ultima IV (PC) on this site).

In 2009, I wrote a Python script that could at least retrieve the CATALOG and raw files (if text) from Apple ][ disk images (of which there are many archived on the Internet).

Back in 2014, Richard posted a photo of Akalabeth running on his original Apple ][+.

I asked him if it was true that Akalabeth was written in BASIC and, if so, if the source was available.

He confirmed it was BASIC and said he'd look for the source for me.

A few weeks later, still reminiscing about the Apple ][ days (as I often do), I dusted off my Apple ][ disk image reader and put it up on Github.

I then decided to go looking for disk images of Akalabeth to see if I could extract the source from those (I hardly wanted to bug Lord British himself).

I found a bunch of Akalabeth disk images on the archive.org backup of the Asimov Apple ][ Archive.

a2disk could read their CATALOG perfectly.

The results fell into two categories.

Some disk images had:

Disk Volume 254, Free Blocks: 394

  A 003 HELLO                         
 *A 011 AKALABETH INSTRUCTIONS        
 *A 002 AKALABETH START               
  A 086 AKALABETH

Others had:

Disk Volume 254, Free Blocks: 280

 *A 003 AKALABETH                     
 *A 005 AKA0                          
 *A 002 AKA1                          
 *B 034 AKA2                          
 *B 034 AKA3                          
 *B 018 AKA4                          
 *B 034 AKA5                          
 *A 086 AKA6

The A indicates Applesoft BASIC.

The Apple ][ stored BASIC programs in tokenized form on disk, very similar to how they were stored in memory.

So I decided to write a de-tokenizer, which now ships with a2disk.

Exploring the First Disk Image

HELLO

Here's what HELLO looks like de-tokenized:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/1_HELLO

AKALABETH START

And AKALABETH START looks like:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/1_AKALABETH_START

AKALABETH INSTRUCTIONS

AKALABETH INSTRUCTIONS looks like:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/1_AKALABETH_INSTRUCTIONS

AKALABETH

The main game is in the AKALABETH file which we'll explore in considerable detail shortly.

Exploring the Second Disk Image

What about the second disk image, the one with the AKA0-6?

AKALABETH in the first disk image is identical to AKA6 in the second.

AKA2-5 are binary files. We'll return later to decoding those.

AKALABETH

AKALABETH in the second disk image is:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/2_AKALABETH

AKA0

AKA0 is:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/2_AKA0

AKA1

And AKA1 is:

Not found: /Users/jtauber/Development/vuepress-sites/game-hacking/2_AKA1

which is the same as AKALABETH START in the first disk image.

Conclusions on the Two Disk Images

I strongly suspect the second disk image is the original and the first disk image is some simplification.

It has the odd "Ultima I" reference and also includes instructions which presumably were provided in printed form in the original game.