Sunday, 12 July 2015

Commodore PET text adventures

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

OK, so you've got your Commodore PET running, and you've got an IEEE-488 disk drive, or a modern replacement like a PET microSD. But, what are you going to run on it? 
One of the things that suit the PET's text based display is text adventure games, and there are many available, mainly ported from other systems. I had a pet 8032 board in for repair last year from Bill Bright. He was looking forward to playing a particular adventure game, 'Colossal Cave'. He remembered playing that on a PET, many years ago, and he's recently been able to play it again. The following is from Bill:
As a young computer user in the early 1980s, I found a game called Adventure.  It was originally a game written by Willie Crowthers and Don Woods for a DEC mainframe.  The game I played, and loved, was a port of the original that was “abridged” for the PET by Jim Butterfield.
So my latest adventure started when I bought a PET 8032 on eBay.  Dave was kind enough to fix the motherboard for me and he also supplied me with a petdiskTS.  I thought my next step would be a simple Google search to find the Butterfield version of Adventure.  I was sadly mistaken.
Dave helped look for the files and the best we came up with were several incomplete versions or some that appeared to be complete but were on disks mixed with various other files.  It took some time, and a read through the code, but I finally managed to piece together what I believe to be the most complete version of Butterfield’s port. 
That version was written for a 40 column PET.  I had resigned myself to the fact that all of the software I wanted to play was designed for 40 column, so I tracked down a 4032 motherboard and replaced my 8032 board.  Then came the pet microSD and a visit to petSD.net.  There I found the Zork page and discovered there was a host of Infocom programs available for the 80 column PET.  This inspired me to attempt to compile an 80 column version of Adventure.
First I found that some unknown person had started the process, apparently in 1981.  I found several of the SEQ files already partially edited and some older versions of the PRG written for 80 column.  I decided to use what I could of the SEQ files but edit the 40 column version of the PRG that I was already using.  This version is indentified in the code as Version 4.  It is the same as earlier versions but has two additional sections of code that allow a player to save and load a game.  Handy, I thought.

So, armed with the PET, Vice, and Windows Notepad, I started editing Version 4 of the PRG and reformatting all of the text SEQ files.  (NOTE - There are probably still errors in the text, but playing the game is the best way to sort those out.)  At the end of this process, I had separate 40 column and 80 column versions of Adventure.  It was suggested that I put both on one disk and create a loader to auto-detect screen width to load the proper version.  Though in the same disk, each version can easily be separated.
The last hurdle that I faced was the subroutines for save and load that I had decided were worth including in the code were not working consistently.  They both used  the Basic 4 commands DOPEN and DCLOSE.  For some reason those commands worked on the native PET but not in a D64 file.  I rewrote those pieces to use the standard OPEN and CLOSE commands and all worked well. Unfortunately, having two sets of files left little room for saved games on a D64, so I moved the files to a D80 format.
Thanks to Bill for the 'guest blog'. I've added ccadventure.d80 to the sample files I provide with the pet microSD. Nils has also added it to petSD.net, there are a good selection of text adventures on there, mainly based on Edilbert Kirk's Z-Machine-Interpreter for Infocom Z-files. I've submitted my favourite Infocom text adventure, Douglas Adams' Hitchhikers Guide to the Galaxy game to that list. How many hours did I spend on that on my IBM PC back in the 80s? Nice to be able to use the Pet 8032 instead.
These sort of adventure games are a good test as there is a lot of disk activity involved. Loading it is fairly simple (see the PET microSD user guide for more info), thanks to Nils Eilers DOS Wedge on there, just press SHIFT and RUN/STOP to load the DOS wedge, then type

@CD:ccadventure.d80
or
@CD:hhgtg.d64

Then SHIFT and RUN/STOP again to start the loader.
This will select the appropriate version and load that. As you can see, the 80 column version has been much tidied up to make better use of the 80x25 screen.
You can now begin the adventure......
And just keep telling yourself, it's only a game....isn't it?