O'Reilly logo

Gaming Hacks by Simon Carless

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Play Commodore 64 Games Without the C-64

Relive the glory days of Commodore’s long-lived personal computers.

Commodore’s unassuming C-64 had a surprisingly long run as the king of computer games. The inexpensive machine had powerful sound, colorful graphics, and just enough hackability that clever developers could squeeze every last bit of performance out of its 1-MHz processor and specialized graphics and sound chips.

Although Commodore’s Amiga surpassed the C-64 (and the improved, though relatively ignored, C-128), the PC finally took over the reign of computer games in the early ’90s. Commodore’s 1992 bankruptcy didn’t help, either. [2]

A decade later, the C-64 lives on, sometimes in hardware, but more often in emulators. If you’re feeling nostalgic for Commodore BASIC—a simple, easy to use, and, in retrospect, fairly awful programming language—or the thousands of games produced in that heady decade, you’re in luck.

Installing VICE

Two emulators vie for the top spot in C-64 emulation, VICE, available from http://www.viceteam.org/, and CCS64, available from http://www.computerbrains.com/ccs64/. CCS64 is shareware, and the current version runs only on Windows, while the GPLd VICE runs on several platforms. Both work well, but we’ll concentrate on VICE.

Download the current version for your platform from the VICE homepage. Windows users: unzip the WinVICE-1.14.zip file to its own directory (perhaps C:\WinVice-1.14). Mac OS X users: mount and install the VICE1.14-macosx.dmg image as usual. Unix users should know what to do already.

Tip

The archive contains a HTML version of the documentation, found in the html/ subdirectory. See html/vice_toc.html for a good starting point.

Run the C-64 emulator as x64. There are also C-128, VIC-20, PET, and CBM-II emulators, if you’re feeling really retro.

Loading Disk Images

We’ll use Richard Bayliss’s public-domain Balloonacy (see http://web.ukonline.co.uk/tnd64/download_library.html) as the example game. This cute little action game has you guiding a helium-filled balloon through a dangerous maze of lasers, walls, and sharp corners everywhere.

Launching the game is easy. From the command line, launch the emulator (x64 for the C-64, x128 for the C-128, and so on), passing the name of the disk image to launch as the final command parameter. One nice feature of VICE is that it can extract a disk image from inside a compressed file.

$ x64 balloonacy.zip

This loads the disk image and launches it. Alternately, you can boot the emulator and load the image manually:

$ x64

When the familiar blue-on-blue screen appears (see Figure 1-2), click the left mouse button and select “Attach a disk image.” Choose the drive number to use—remember, the first 1541 or 1571 starts as device number 8—and browse to the disk image to load. Hit the Select button, and then press OK. In effect, you’ve just put a floppy disk in the drive.

The familiar C-64 prompt

Figure 1-2. The familiar C-64 prompt

If you don’t see the files you want to load, be sure to check the filter expression in the Show box. By default, it shows only files with extensions starting with the letters g, d, or x, regardless of case. To see all files, change the expression to *.*.

Now reach back a decade or more into long-forgotten BASIC commands. To read the directory of the disk, load the special directory file ($), then list it. Figure 1-3 shows the results.

The Balloonacy disk directory listing

Figure 1-3. The Balloonacy disk directory listing

               LOAD "$",8
SEARCHING FOR $
LOADING
READY.
LIST

If you just want to run the program, use the special “load into memory” command, then run the program (some programs run automatically):

               LOAD "*",8,1

SEARCHING FOR *
LOADING
READY.
RUN

It’s been a decade, so how do you remember all of these commands? Unless you spent your childhood writing games on the C-64, you might prefer to consult the Commodore 64 Online User Manual (http://www.lemon64.com/manual/). Feel free to snicker over the section on cassette drives.

Configuring Joystick Emulation

Unless you have a joystick plugged into your machine (at the time of writing, this required running VICE on Linux), the number pad is the easiest way to play games. As you’d expect, the number keys correspond to the directions, where 8 is up, 4 is left, 6 is right, and 2 is down. 0 is fire.

Right-click in the VICE window, and select the Joystick settings menu. From here, you can configure joysticks 1 and 2. Many C-64 games contrarily used joystick 2 for player one, and vice versa. Select Joystick device in port 2, then the Numpad option. Be sure that joystick 1 has a different setting; none is fine.

Left-click again, and choose Save settings. This saves you from having to reconfigure the joystick every time you launch a new game.

Now that you have joystick emulation configured, hit 0 on the number pad to start the game. Figure 1-4 shows a (paused) screenshot of the first level.[3]

Balloonacy level one

Figure 1-4. Balloonacy level one

There are a few other keys and options worth remembering, as seen in Table 1-1.

Table 1-1. VICE key commands

Key

Action

Alt-8

Attach a new image to drive 8.

Alt-1

Load a snapshot.

Alt-s

Save a snapshot.

Alt-F9

Perform a soft reset.

Alt-p

Pause the emulator.

Finding Games

Unless you want to program your own games in Commodore BASIC,[4] you’ll need a disk image. Fortunately, these are easy to find. C64.com (http://www.c64.com/) and C64 Unlimited (http://www.c64unlimited.net/) have huge collections of downloadable games. If you have a pile of old floppy disks gathering dust in the closet, this is a wonderful resource. If not, or if you’re not sure about the legalities of media shifting (see [Hack #1] ), it’s easy enough to play homebrew games.

It’s exceedingly difficult to find homebrew games, however. The C-64 had a huge piracy problem, especially considering that it predated the Internet explosion. Though many games are at least a decade old, there are still copyright considerations to keep in mind.

Of course, there’s much fun to have in hacking around the games (Chapter 6) and creating games (Chapter 7).



[2] For more on C-64 history, see http://commodore.ca/products/c64/commodore_64.htm.

[3] To be honest, my arcade skills are rusty enough that in 10 minutes of playing, I couldn’t beat this level. That’s a good sign.

[4] At least one author started his illustrious career this way.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required