18/03/2016

Building BBC Micro game disc images using Linux


[July 2017 update - links to BBC games updated to HTTPS links]

I wrote this following blog post around Christmas 2015, during that time I posted various BBC Micro games running via the JavaScript based jsBeeb emulator onto Facebook. These games were typically buried within compilation discs, so were not easy to access. Although jsBeeb provides an auto boot facility, you still had to go through any menus provided on the disc in order to get access to said game. This post details how you can build your own images, via a special tool, available to build on all platforms.

The article follows...

As it is Christmas, there's no better time to stoke the fires of nostalgia, and take part in some retro gaming. In the past, a fair amount of effort was required to satisfy your desire for playing of games of yesteryear. Thankfully, browser technology and the incredible abilities of the JavaScript language now make it much easier than ever to play old games.

The Internet Archive, for example, have their MS-DOS Games Archive, which contains a huge cache of games, some well known, others less so.

My particular area of interest is the BBC Micro. For those of you who are unaware, the BBC Micro was a British built computer, made by Acorn Computers. These machines made it into many of Britain's schools during the 1980s and 90s, and in some countries abroad. Acorn also created the ARM processor, which is now used in just about any electronic device in existence.

In any case, the Beeb has a great collection of games, most of which are now playable on jsBeeb, a JavaScript based emulator, created by Matt Godbolt. If you visit bbc.godbolt.org, and run the default disc image, you'll be able to play the original release of Elite, one of the most famous games of all time. This is Elite Dangerous' granddaddy!

Although jsBeeb has a link to various commercial arcade game images, provided by the Stairway to Hell website, you can in fact, boot up your own disc images. These files are usually zipped, and contain either an SSD or DSD file (single sided and double sided discs). These are based on the 5 ¼” floppy discs, that made great frisbees in their time, but could impale itself in necks if you were not careful.

One source of these great games are from the pages of computer magazines of the day. For the Beeb, we had titles such as A+B Computing, Acorn User, The Micro User and Electron User. If you wanted, you could type the games listings yourself, which could take some hours to do, or you could subscribe, and receive a disc in the post. These discs are what you now find on the Internet as zipped image files.

Although jsBeeb can automatically boot these discs for you, many of the discs required some further interaction before you could find the games in question to play. This inconvenience, along with the complexity of tools to edit/create these image files, made some of these games unreachable to a potential new audience.

So, I thought, why not bury myself in these tools, and create some brand new disc images, which could then auto boot and run the game straight away?

As I am using Linux, the best tool by far for disc image creation and editing is Walter Schouten's bbcim. Conceived in the mid 1990s, Walter revised the code in 2014, making it easier to compile and use for newer flavours of Linux, or any Unix based system.

[Note: since the time this was written, Schouten's website has been taken offline. The most recent archived version of the site does not include links to the binary for bbcim. I've uploaded a gzipped tarball of version 1.0 of the software from my website. You can download it here.] 

Following his sparse but functional instructions, I was able to create the binary executable, ready for use on the command line. First, I downloaded a disc image from the 8bs website, one of the subscription discs for The Micro User magazine. I was after a particular festive game, called Revenge of the Snowmen, from the January 1990 issue. We're talking about a game over 25 years old. But great games never age, right?

Written in BBC Basic by Jon Perry and Pali Rao, it made a big impression on me, in terms of how it worked. As a two player game involving the throwing of snowballs at each other, it used some fancy maths to calculate speed and trajectory of your snowballs. It's a great example of what BBC Basic, without the use of assembly language, could muster. The game uses brightly drawn, colourful graphics, and is actually great fun to play. A perfect candidate for festive fun.

Having obtained the image, and confirmed that it worked in jsBeeb, the time came to extract the game, and create a 'boot' file (called !BOOT) so it could auto run via a customised URL.

A fair amount of trial and error was required here. Building the binary was quite easy, the instructions were adequate. I did have to close my terminal and reopen it though for it to run.

To run it, I typed ./bbcim, which showed the copyright message, and asked for an option. The supplied instructions provide details of all the various commands and arguments you could use to create and modify images, plus extract files.

The disc image, called tmu90-01.ssd, could be inspected via:

./bbcim -c tmu90-01.ssd

This listed the image contents, and there it was, the game, saved as the filename $.revenge.

Now, to create a new image, I used:

./bbcim -new Revenge.ssd

A nice new disc image to fill with the game and a boot file.

Now, to extract the revenge file, I used this command:

./bbcim -e tmu90-01.ssd $.revenge

This extracted the file (saving it as tmu90-01.ssd.$.revenge), and also created a .inf file, which contains meta data required when merging the file into a new image. Now, to add the file to the new image:

./bbcim -a Revenge.ssd tmu90-01.ssd.$.revenge

A quick issue of the ./bbcim -c Revenge.ssd revealed that the game file was now present in my new disc image. Great!

Now, to make it bootable. This proved a little more hairy. You see, the fact that the boot file is called $.!boot plays havoc with the Unix command line. If I did:

./bbcim -e tmu90-01.ssd $.!boot

I would get the error message bash: !boot: event not found.

Damn!

I did a search on Google, and found the answer, I merely had to escape the ! with a backslash, thus:

./bbcim -e tmu90-01.ssd $.\!boot

This extracted the boot file successfully. Now of course, I had to edit it. I was initially hesitant, how would I edit the boot file on Linux? Turns out, I only had to open the !boot file in a text editor such as Gedit, and change the filename to “revenge”. Saved, it was done.

Now all I had to do, was one final command:

./bbcim -a Revenge.ssd tmu90-01.ssd.$.\!boot

This copied the boot file into the disc image. The new disc image was now complete.

Having moved the SSD file to my web server, I put together the URL to jsbeeb, complete with the URL of the image file, plus the &autoboot query string:

http://bbc.godbolt.org/?disc=http://www.sassquad.com/downloads/Revenge.ssd&autoboot

The image file now boots successfully, and the game is ready to play.

Brilliant!

I leave you with some choice links to the games I was able to bring to a new audience. Enjoy!
Post a Comment