Ubuntu/Install and set up VICE

From Iseborn Wiki
Jump to: navigation, search

VICE is a Commodore computer emulator. I only use it to emulate the C64, but it can also emulate (for example) VIC20 and C128.

First of all, some useful links:

Installing VICE is easy, but there are some things you need to do afterwards to make it run on Ubuntu 14.04.

After installation, you can start the C64 emulator by entering x64sc in a terminal window. You should know right now that this is not the best way to run the emulator, or even the only C64 emulator that you got with VICE, but it is how we will do it while setting things up.

Entering x64sc will only give you a tiny amount of information, and an error message saying that the kernal ROM could not be loaded. For some reason (probably to avoid copyright violations), the system ROMs (including the kernal) are not included in the installation even though they are included in the source package. See Install missing system ROMs for how to fix this problem.

Install VICE

Installing VICE it is simple enough:

sudo apt-get install vice

Install missing system ROMs

The system ROMs are not included in the installation, but they are included in the source package. So what we need to do is to manually download the source file package for VICE and extract the ROMs manually. Sounds complicated? Well, it's not. Here is how you do it:

VICE looks for the system ROMs in a couple of locations, but the directory where they really are supposed to be is /usr/lib/vice (assuming you didn't change any default paths during the installation of VICE).

As you can imagine, different emulators (for example VIC20 and C64) uses different system ROMs. So each emulator has its own sub directory for the system ROMs that are specific for that emulator. For example, the C64 emulator (which is the only one that I care about - at least for now) kernel ROM should be located in /usr/lib/vice/C64.

Other system ROMs are shared between different emulators. For example, the system ROM for the (emulated) 1541 floppy-disk drive can be used by several of the emulators, and is therefor located in the general driver directory, /usr/lib/vice/DRIVES.

The command sequence below will:

  1. Go to the directory where the system files are located, /usr/lib/vice.
  2. Create a temporary directory to work in, and enter it.
  3. Download the source file package for VICE ans unpack it in the temporary directory.
  4. Copy the relevant system ROMs from the unpacked source package to the appropriate system file directories.
cd /usr/lib/vice
sudo mkdir temp
cd temp
sudo wget http://www.zimmers.net/anonftp/pub/cbm/crossplatform/emulators/VICE/vice-2.4.tar.gz
sudo tar vzxf vice-2.4.tar.gz
 
# Copy the C64-specific system ROMs
cd /usr/lib/vice/temp/vice-2.4/data/C64/
sudo cp basic chargen kernal /usr/lib/vice/C64/
 
# Copy the common drive ROMs
cd /usr/lib/vice/temp/vice-2.4/data/DRIVES/
sudo cp d1541II d1571cr dos* /usr/lib/vice/DRIVES/
 
# Copy the common printer ROMs
cd /usr/lib/vice/temp/vice-2.4/data/PRINTER/
sudo cp cbm1526 mps801  mps803 nl10-cbm /usr/lib/vice/PRINTER/

When you have verified that it works (run x64sc again), you should remove the temporary directory you created above.

cd /usr/lib/vice/
sudo rm -rf temp

Adjust settings

Now that the C64 emulator works, we can begin to set it up.

VICE stores the user settings (or "resources" as they are sometimes called in the documentation) in the file ~/.vice/vicerc, which is an old-fashioned .ini file (except for its name). This file is not created until the user (you) tells vice to save the settings for the first time, so lets do that:

  1. Start the C64 emulator by entering x64sc.
  2. Go to the Settings menu and select Save settings.
  3. Exit the emulator.

Open ~/.vice/vicerc in your favorite text editor. At this point, it will only have one file section, "[C64SC]" (since you had started it with x64sc).

NOTE: All settings in this file are specific to the emulator indicated by it's heading. For example, if you want to change the web browser used to show the VICE manual, you will need to change the HTMLBrowserCommand setting under each of the headings in the file.

Choose web browser for the Manual

VICE does not honor your selection for default web browser. The hard-coded choice is to use Firefox, but you can change this by editing the value for HTMLBrowserCommand.

In that setting, the character sequence %s will be replaced by the URL for the document that VICE wants to open. So to change the web browser to (for example) Google Chrome, find the line for HTMLBrowserCommand and change it to:

HTMLBrowserCommand="google-chrome %s"

Playing a C64 game

This is probably why you wanted to install the emulator in the first place, right? Actually, for me it isn't. I wanted the emulator to see if I still (after all these years since I last owned a C64) would find it fun enough to program it to make it worth buying one (and to sacrifice the necessary space on my desk). Still, I suppose we at least have to try one game...

There are different ways to do this. You could for example load the game from within the emulated C64 from a likewise emulated tape recorder or disk drive. That is hardly worth the effort though. It's easier to just download a ROM with the game and start the C64 emulator with the ROM as argument, so that is what we'll do now.

Learn by example - Donkey Kong

Here we will download and run the classic Donkey Kong platform game.

First we need to download the game. There are lots of web sites for this, and you can just Google "c64 rom" to find them. For this example I'll give you a direct link though (or Google "c64 rom mario bros" if the link has expired):

http://coolrom.com/roms/c64/34088/Donkey_Kong.php

Download the file to some easy to access place. I have created the directory ~/c64/roms/games/ for this stuff, but the location doesn't matter as long as you know where you download the ROMs to. In this case the ROM file is named Donkey Kong.zip, so for me the path to it is ~/c64/roms/games/Donkey\ Kong.zip.

To start the C64 emulator and load the ROM, all you need to do is to run this command (change the path as needed):

x64sc ~/c64/roms/games/Donkey\ Kong.zip

That's all.

The emulator will read the ZIP file and will there find instructions to load and run the game from an emulated tape player. By default, this will take some time to do since even the speed of the emulated tape player is authentic (you will actually see the triple-digit rotation counter for the player in the bottom right corner of the C64 window together with an icon indicating when the tape is running). You can speed things up by pressing Alt-W to engage warp mode - just remember to disengage it when the game starts.

This game is played by joystick. I don't have one connected, so I don't know how to get it working with the C64 emulator. Since the (original) joysticks for the C64 were strictly digital, you can (for example) use the num-pad (numeric keyboard) to emulate it. Just go to the Options menu and fiddle with the Joystick settings.