Level 9 Colossal Adventure - Disassembly and Interpreter

discuss classic text/graphic adventures for the bbc micro & electron
Post Reply
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

I thought I'd make it known that I've been working on a disassembly of the BBC Micro version of Level 9's Colossal Adventure.

Crowther and Woods original version was one of the first computer games I ever played. At school on a paper telex machine connected to the council mainframe. When I later got a BBC Micro, one of the first games I bought was Level 9's version, and it was stunning to find it was a complete version, with all the text I could remember plus an extended endgame. It didn't seem possible to have the full mainframe game on a 32K micro.

A very weird thing happened on one occasion. I can't remember what I was doing. Probably poking around in memory trying to work out how it worked. But by complete fluke the game was outputting what appeared to be it's complete text to the screen. One of the things I saw was some text congratulating the player for completing the game, and inviting the player to send a secret message back to Level 9 HQ. And in return they would send back another adventure game. I didn't record what it said, because I wanted to complete the game properly by myself, and only then claim my free game. But as it turned out I never did complete the game with all the points, and never saw that message again.

I don't know that that version of the game exists online anywhere. It was a very early BBC Micro cassette version. Came in a standard cassette case with a green cardboard insert. Certainly the version I've downloaded recently doesn't contain any text like that in the message data.

Anyway, I digress. I have a 6502 disassembler I wrong a couple of years ago. Functional, but not polished enough to release publicly. I figured I could use that to disassemble the 6502 machine code, and then, as I learned how A-Code works, I could expand the disassembler to also understand A-code. Eventually have the one program that could list out everything 6502, A-Code, messages and dictionary.

I'm part way through disassembling the 6502, adding meaningful labels as I understand what's going on. But it got to the stage where to document what I was understanding, it made sense to write in parallel an interpreter for a-code.

So the past 3 days I've been writing a new interpreter from scratch. It's great fun. It's rather like writing an emulator. I've got to the stage where it outputs:
Welcome to Colossal Adventure, the original classic mainframe adventure, from Level 9 Computing

You are standing beside a small brick building at the end of a road from the north. A river flows south. To the north is open country and all around is dense forest

What now?
I'm feeling quite pleased. I'm far enough in that it's worth talking about. Next stage is getting user input working. I should say that the interpreter is very rudimentary so far. I'm writing it so it just runs Colossal Adventure v1. Later on I can perhaps expand it to run the later versions of the a-code standard.

I should mention that both programs are written in Swift for the Mac. That's my usual programming platform.

I've read with interest the Lords of Time disassembly thread here, and also the thread on producing an A-Code specification over on the intfiction.org forum. All of the links on these threads have been very useful to me. Particularly the early draft on an A-Code spec that's up on GitHub. And the a-code listing for Snowball that someone made.
Last edited by cardboardguru on Sat May 14, 2022 12:30 pm, edited 1 time in total.
fuzzel
Posts: 1191
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by fuzzel »

cardboardguru wrote: Sat May 14, 2022 6:27 am A very weird thing happened on one occasion. I can't remember what I was doing. Probably poking around in memory trying to work out how it worked. But by complete fluke the game was outputting what appeared to be it's complete text to the screen. One of the things I saw was some text congratulating the player for completing the game, and inviting the player to send a secret message back to Level 9 HQ. And in return they would send back another adventure game. I didn't record what it said, because I wanted to complete the game properly by myself, and only then claim my free game. But as it turned out I never did complete the game with all the points, and never saw that message again.
I don't know that that version of the game exists online anywhere. It was a very early BBC Micro cassette version. Came in a standard cassette case with a green cardboard insert. Certainly the version I've downloaded recently doesn't contain any text like that in the message data.
Hi, good luck with your project, it'll be fascinating to find out how you get on and what you learn. Unless your memory is playing tricks on you after all these years it would appear that you were playing a very early version of Colossal Adventure, dare I say it, potentially the long-lost 16k version. You wouldn't still happen to have that old cassette would you?
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

fuzzel wrote: Sat May 14, 2022 10:31 am Unless your memory is playing tricks on you after all these years it would appear that you were playing a very early version of Colossal Adventure, dare I say it, potentially the long-lost 16k version. You wouldn't still happen to have that old cassette would you?
It was a very early version. But I don't believe it can have been the 16K version, as I was so impressed that it seemed to have all the text of the mainframe version. The 16K version must have had very truncated text - like a Scott Adams adventure I would guess.

Anyhow, no, I have nothing left from that BBC era. Many house moves since then. Maybe one of the Austin brothers will come up with it if they do contribute their stuff at some point.
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

At the time, it felt to me like the Level 9 version of Colossal Cave had the entire text of the Crowther & Woods mainframe version. I see now I can compere the two that actually the principle locations might be the same. But the actual text was written independently. And is significantly better written. For example:


Crowther and Woods:
YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.
Level9:
You are standing beside a small brick building at the end of a road from the north. A river flows south. To the north is open country and all around is dense forest

Crowther and Woods:
YOU ARE IN THE HALL OF THE MOUNTAIN KING, WITH PASSAGES OFF IN ALL DIRECTIONS.
Level9
You are in the Hall of the Mountain Kings, a huge room decorated with majestic statues. The east wall is covered by trophies and the mounted heads of elves and monsters with a carved granite throne standing beneath them. The hall is hung about with the tattered remains of rich tapestries and has large doorways on all sides

Crowther and Woods:
YOU ARE IN A LARGE ROOM, WITH A PASSAGE TO THE SOUTH, A PASSAGE TO THE WEST, AND A WALL OF BROKEN ROCK TO THE EAST. THERE IS A LARGE "Y2" ON A ROCK IN THE ROOM'S CENTER.
Level9:
You are in a huge room with passages to the south and west and a maze of broken rock to the east. 'Y2' is carved on a rock in the very centre of the room
Additionally the maps are significantly different. I had thought the L9 version was simply extended, with extra areas added - particularly above ground, and the end game sequence. But actually even in the very familiar core area of the cave, the two layouts are only similar. There's not a one to one equivalence of locations or directions.

I would think that the Austin brothers only had their memories and a hand drawn map of the original when they created their version. It could have been an inferior copy, but they surpassed it in every way.
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

Does anyone know what the EXIT opcode does?

It takes 4 variables as arguments. So 5 bytes in total.

I’ve looked at both the Level 9 interpreter source and the BBC Micro 6502 disassembly, and I just can’t work it out. I had thought that perhaps it exited the game, and the arguments were for error info. But it doesn’t look like it’s that after all.

In my work in progress interpreter, I see that EXIT gets called when I type NORTH or one of the other compass points, but not with other commands. And the other commands (such as LOOK and INV) work. But the direction commands don’t (with my code that hasn’t implemented the EXIT opcode.

So, it seems that this is a specific command to move around the map. But this is odd, because none of the other a-code opcodes are specifically adventure game related. They all deal with generic variables, lists, messages and so on. Not locations or objects in an adventure game.

If it is a command to move to another location what are the 4 parameters? (Not simply directions as there are 8 compass directions plus up and down).

I’d single step through the Level 9 terp to try and work out what the code is doing, but I’m on a Mac and I don’t think there’s a working port for current OSX versions.

Grateful for any insight anyone might have.
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

I’ve made some progress by looking at the 6502 disassembly. Yes this is about moving about on the map. First thing is to understand the format of the map data.

Map locations are numbers starting at 1. If you add 100 (0x64) to the location number, you get the message number that describes it.

So you start at location 1.
0x65 / 0x3611 : You are standing beside a small brick building at the end of a road from the north. A river flows south. To the north is open country and all around is dense forest

The map data is a list of 16 bit words. The first few words belong to location 1. The last word that is part of a location has bit 16 set. So here is the data for the first 2 locations:

0x1B0E 0x1115 0x130E 0x9402
0x1403 0x1308 0x0208 0x1908 0x8707

Each word holds a direction, and a destination.

Directions are the same numbers (1-15) given by the dictionary:
0x1 / 0x1180 NORTH
0x2 / 0x1186 NEAST
0x2 / 0x118c NORTHEAST
0x3 / 0x1196 EAST
0x4 / 0x119b SOUTH
0x5 / 0x11a1 SEAST
0x5 / 0x11a7 SOUTHEAST
0x6 / 0x11b1 SWEST
0x6 / 0x11b7 SOUTHWEST
0x7 / 0x11c1 WEST
0x8 / 0x11c6 NWEST
0x8 / 0x11cc NORTHWEST
0x9 / 0x11d6 UPWARDS
0x9 / 0x11de ABOVE
0xa / 0x11e4 DOWN
0xb / 0x11e9 INSIDE
0xb / 0x11f0 INTO
0xb / 0x11f5 ENTER
0xc / 0x11fb OUTSIDE
0xc / 0x1203 LEAVE
0xc / 0x1209 EXIT
0xd / 0x120e JUMP
0xd / 0x1213 LEAP
0xe / 0x1218 CLIMB
0xf / 0x121e CROSS
0xf / 0x1224 OVER
0xf / 0x1229 ACROSS

Bits 8-11 hold the direction. And bits 0-7 hold the location number of the destination if you move in that direction.

This leaves bits 12-14, which contain information, but I’m not sure what it’s for. It’s a mystery.

Now, back to the EXIT instruction. It has 4 parameters:
Var1 is input. The current location.
Var2 is input. The direction.
Var3 is output. It’s the mystery number.
Var4 is output. It’s the destination.

At least that is my understanding right now. I’ll code it up for my terp, and see if it works.
User avatar
cardboardguru
Posts: 239
Joined: Fri Mar 09, 2018 10:26 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by cardboardguru »

Cause for a bit of celebration for me. My new interpreter is working. At least the core functionality is working. It can play the game now.

The working title is Austin, in tribute to the brothers that created aCode and the games.
Attachments
Screenshot 2022-05-21 at 02.50.58.png
User avatar
KenLowe
Posts: 4675
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by KenLowe »

Well done =D> =D> =D>.
fuzzel
Posts: 1191
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by fuzzel »

cardboardguru wrote: Wed May 18, 2022 12:04 am Bits 8-11 hold the direction. And bits 0-7 hold the location number of the destination if you move in that direction.

This leaves bits 12-14, which contain information, but I’m not sure what it’s for. It’s a mystery.

Now, back to the EXIT instruction. It has 4 parameters:
Var1 is input. The current location.
Var2 is input. The direction.
Var3 is output. It’s the mystery number.
Var4 is output. It’s the destination.

At least that is my understanding right now. I’ll code it up for my terp, and see if it works.
Very nice work, I'm glad to see that you're making real progress with this. I can't pretend to understand how a-code works but hopefully I'm going to learn a lot through your postings. One thought I've just had about the three mystery bits 12-14, and this is probably a complete coincidence, but there are three magic words for movement, XYZZY, PLUGH and PLOVER. Just a thought.
rainbird rich
Posts: 12
Joined: Fri Jul 29, 2005 3:55 pm
Contact:

Re: Level 9 Colossal Adventure - Disassembly and Interpreter

Post by rainbird rich »

Wow. This is all fascinating stuff.

I'm no programmer (other than a bit of php and mysql stuff for my old-old web site, and AMOS fiddling in the early 1990s), but Colossal Adventure on the BBC from Level 9 was the first text adventure I ever bought. Not the first one I ever played (that was another Colossal variant, called Pyramid 2000 on a friend's TRS-80) but it's still my favourite version, and I love the trilogy both in its original form and in 'Jewels of Darkness'.
Richard Hewison

http://www.birdsanctuary.co.uk
memories of Telecomsoft
Post Reply

Return to “8-bit acorn software: classic adventure games”