Running old BASIC computer games

If you’re a computing enthusiast who’s been around for a while, you may remember David Ahl’s classic books, BASIC Computer Games and More BASIC Computer Games, from 1978 and 1979 respectively. These two volumes contained BASIC listings for many games taken from the pages of the hobbyist magazine Creative Computing.

ahlBooks

These books provided a popular source of games to build and experiment with for people who acquired microcomputers in the late 1970s and early 1980s. All of the games in the book are designed to run in Microsoft BASIC on systems with a simple teletype terminal. Partly as an exercise in nostalgia and partly as an exercise in programming, I decided to make updated graphical versions of some of the games from these books.

Many of the games are very simple and you can easily understand the algorithms from just examining the listing and looking at the example printouts of the game running. Some are more complex – and for these it is useful to be able to see the game running. So I had my first challenge: how could I run games written in a language that is almost 40 years old and intended to be used on systems that you’d be lucky to find outside of a museum or an e-bay auction?

Ideally I wanted to be able to run the games on my MacBook in OSX Mavericks. Looking at the introduction to the books reveals that most of the games were written in Microsoft 8080 BASIC on an Altair 8800 with 16K of RAM. Obtaining, restoring and running an original hardware 8800 is not impossible, but potentially difficult and expensive. Fortunately, there’s another option. As the MITS Altair 8800 was a popular machine there are a few emulators out there for modern platforms.

A good option for OSX seemed to be a popular multi-system simulator called SIMH. This has two Altair 8800 simulators that simulate the systems based on both the 8080 and the Z80 chipsets. Some research turned up a few binaries for OSX, but all of those that I found seemed to have been compiled for PowerPC Macs and were unceremoniously spat out by my Intel-based MacBook.

Fortunately SIMH is very actively maintained by a group of enthusiasts and the current codebase can be found on GitHub. I cloned it from https://github.com/simh/simh.git using the GitHub app.

Building SIMH was a breeze thanks to the comprehensive and well-maintained makefile. After starting Terminal and navigating to the folder containing the source files, entering make all will build all the currently supported simulators. I received a warning during the build, but this was because of a formatting issue and the binaries were created successfully.

The makefile creates a BIN folder with all of the simulators as Unix executables. There are two Altair simulators. I chose to use Altairz80. The simulator is run by navigating to the relevant folder in Terminal and then entering either altairz80, if the folder is included in the PATH environment variable, or ./altairz80 if it isn’t. If the simulator has compiled successfully, it responds with the following:

runAltair

So far so good, I had the start of a working environment. The next challenge was to get those BASIC games up and running. The website of Peter Schorn, the creator of the AltairZ80 simulator, has a collection of operating systems for the Altair. These include a CP/M 2.2 bundle that includes Microsoft BASIC and Eliza, one of the games from the books. After downloading, these files should be placed in the same folder as the simulator. CP/M can be started within the simulator by entering do cpm2.

The terminal should now be showing:

runCPM

Microsoft Basic can be started by entering MBASIC:

runMBASIC

A game can then be loaded with, for example, LOAD “ELIZA.BAS” and then run with RUN:

runEliza

So now I had a fully working environment, it was time to get the games. The full text of both books is available at atariarchives.org:

BASIC Computer Games
More BASIC Computer Games

One option at this point is to simply type in the games by hand – remember doing that? – and then save them to the virtual disk with e.g. SAVE “CHECKERS.BAS”. Fortunately a lot of them have been collected here: http://www.classicbasicgames.org, which saves some considerable hours of monotonous typing.

To get the listings from this site into the virtual disk I first saved them as text files on my MacBook, using a CP/M compliant filename, i.e. maximum of 8 characters followed by a dot and a three character extension e.g. ACEYDUCY.BAS. The files must be saved to the folder containing the simulator and the CP/M image.

Now to get them into the virtual disk image, you start the simulator and CP/M and then use the R (read) command, e.g. R ACEYDUCY.BAS:

readCommand

If you now get a directory listing, using DIR, you should see the file has been added to the virtual disk image:

directoryListing

Now you can start MBASIC and load and run the game as normal:

runGame

This entry was posted in BASIC, Games, Retro Computing and tagged , , , , , , , . Bookmark the permalink.

One Response to "Running old BASIC computer games"

Leave a reply