VICE 0.12.1
the Versatile Commodore Emulator

User's manual


Index


1. Overview

VICE is the one and only Versatile Commodore Emulator. It allows you to emulate the Commodore C64, VIC20 and PET3032/4032/8032 8-bit computers with one single package. The emulators run as separate programs, but have the same user interface, share the same settings and support the same file formats.

If you are a user of the previous (0.11.0) version, you will notice that the C128 emulator is no longer included. We apologize for this, but there was really no time to work at it anymore, as too much time was been spent with the many improvement for the other emulators. If you need the C128 emulator you must stick to the 0.11.0 release... or help us to maintain it in the new VICE versions.

1.1. Emulation features

All the emulators provide an accurate 6502/6510 emulator, with emulation of all the opcodes and accurate timing. Also all the undocumented opcodes are implemented, although (at the moment) only the 6510 version of them (the C64 uses a 6510, while the VIC20 and PET use a 6502). Unlike other emulators, the emulation of all the chips is cycle accurate, and tries to emulate timings as precisely as possible.

1.1.1. C64 emulator

The C64 emulator features a fairly complete emulation of the VIC-II video chip: sprites, all registers and all video modes are fully emulated. In order to save system resources, raster line updates and sprites are handled on a line-by-line basis, although most of the other features are emulated with a rather precise synchronization. This compromise allows most of the video tricks (eg. $D011 techniques such as VSP, FLD, FLI, AFLI, IFLI) to work correctly without eating too much CPU time.

Moreover, a rather complete emulation of the SID sound chip is provided. All the basic features are implemented as well as most of the complex ones including sync and ring modulation. Filters are the only major feature missing at the moment.

1.1.2. VIC20 emulator

The VIC20 is not complete yet, but already emulates all the internal hardware, including the VIA chips. Only part of the VIC-I video chip features are emulated, so many graphical effect will not work correctly (for example, the inverse text mode is not implemented).

Sound is implemented, but is still at the experimental stage. If you think it does not sound right and know how to improve it, feel free to contact us.

The VIA chips are not cycle exact at the moment.

1.1.3 PET 3032/4032/8032 emulator

The PET emulator emulates the 3032, 4032 and 8032 models. The hardware is pretty much the same and that's why one single program is enough to emulate all of them.

Both the 40 column and 80 column CRTC video chips are emulated, but some of the features are not implemented yet (for example, you cannot make the 80 column CRTC work in 40 column mode). Anyway, most of the missing features are not very important for average applications.

Sound is available for the PET as well, but as for the VIC20 it is still under construction (speaker dynamics are not emulated, and this can give very poor sound output).

1.2. The keyboard

Using the keyboard is quite straightforward, as each key is mapped to its usual character. VICE will press and release the Shift keys automatically to make everything work as expected.

Special keys are mapped differently for the VIC20 and C64 emulators and the PET emulator.

VIC20/C64 mapping:

PET mapping: When joystick emulation via the numeric keypad is enabled, the numeric keypad emulates the joystick as follows:

In order to emulate diagonal directions, you can either press two direction keys together or use the 7, 9, 1 and 3 keys.

There are also some keys that perform frequently used commands:

1.3. The disk drive emulation

All the emulators support emulation of up to 4 external disk drives as devices 8, 9, 10 and 11. Devices 8, 9 and 10 emulate virtual Commodore 1541 drives using disk images, i.e. files that contain a dump of all the blocks contained in a real floppy disk (if you want more information about what a disk image is, consult the comp.emulators.cbm FAQ). Device 11, instead, accesses file system directories, thus allowing you to access files without having to copy them to disk images. In addition, device 11 can be used to read and write P00 files (notice that, unlike other emulators, VICE uses the real file system name instead of the internal P00 name to access these files).

There are two available types of 1541 emulation for the disk image-based emulation. One of them the DOS level drive emulation. It does not really emulate the serial line, but patches the kernal ROM (with the so-called serial traps) so that serial line operations can be emulated via C language routines. This emulation is very fast, but only allows use of standard DOS functions (and not even all of them).

The other alternative is a hardware level drive emulation. As you probably know, the Commodore 1541 disk drive was provided with its own CPU (a 6502 as the VIC20) and its own RAM and ROM. So, in order to more closely emulate its features, a complete emulation of this hardware must be provided and that is what the hardware level emulation does. When the hardware level emulation is used, the kernal routines are no longer patched and the serial line is fully emulated. The problem with this emulation is that it needs a lot of processing power, mainly because the emulator has to emulate two CPUs instead of one.

The hardware level emulation is only available on the VIC20 and C64 emulators, and can only be used to emulate one drive at once. As a consequence, it is only available for unit 8 and disables all the other drives when activated.

On the other hand, the PETs don't use a serial IEC bus to communicate with the floppy, instead they use the parallel IEEE488 bus. This bus transfers byte by byte, as opposed to bit by bit as the C64 and VIC20 do, so in this case it is feasible to emulate the parallel line completely while emulating the drive at DOS level only. The IEEE488 line interpreter maps the drives 8-11 (as described above) to the IEEE488 disk units, and no kernal traps are needed. The same emulation is available in the C64, to emulate the Commodore IEEE488 bus interface.

1.4. Supported file formats

VICE supports the most popular file formats:

An utility (c1541) is provided to allow transfers between these formats.

Notice that the native format for disk images is X64; this means that, although the emulators and utilities can both read and write on D64 disk images, they never produce D64 files.

You can convert an X64 file back into a D64 file with the Un*x dd command:

1.5. System-specific notes

VICE should compile and run without major problems on many Un*x systems, but there are some known issues related to the sound driver. In fact, sound is the less portable part of the emulator and has not been thoroughly tested on all the supported platforms yet.

Linux, AIX and SGI systems should play sound without any problems; if you are running Linux please use the new 2.x kernels, as VICE needs some features that were not implemented in older versions of the Linux sound driver.

On the other hand, HP-UX and Solaris machines are known to cause troubles. If you think you can help debugging the code for these systems, your help would be really appreciated. We are having troubles finding HP-UX and SUN consoles to work at...


2. Usage

2.1. Using the PET/VIC20/C64 emulators

The names of the available emulators are:

You can run each of them by simply typing the name from a shell. If you want to run them from another application (e.g. a window manager or some other sort of program launcher) you should always run them from a terminal window such as xterm or rxvt, as a lot of debugging information is printed and the built-in monitor will be run in there.

There are several options you can specify on the command line, and the -help option lists them all. See below for a detailed description of all the command-line options.

2.1.1 The system ROMs

In order to work properly, the emulators need to load the system ROMs. The place where they will be searched for depends on the value of the directory resource. (See below for a description of what resources are and how they can be changed)

If directory is empty, the emulator will search for the ROMs in two places; first of all, it will try to load them from

where <EMU> is the emulator ID and can be either C64, VIC20 or PET. If they are not found here, it will try to load them from the current directory, under C64, VIC20 or PET.

If a directory has been specified instead, the emulator will always try to boot only from that directory.

The default ROM names for the VIC20 and C64 emulators are the following:

For the PET emulator the Basic and Kernal must be packed into a single file. The PET ROMs have the following names:

The actual ROM size would be 20 Kbytes, but the 32 KByte length is to allow loading of custom ROM extensions. The ROM loads at $8000, and the extension areas start at $9000. They reach to $C000 (12K, PET3032) or $B000 (8K, PET4032 and PET8032).

Special care must be taken as the PET emulator selects the model by auto-detecting (via checksum) the system ROM, so if you load the 3032 ROM it will behave like a 3032 (40 column), while if you load the 8032 ROM it will behave like a 8032 (80 column). For this reason, to select the appropriate PET model you can use the -kernal option or edit the configuration file as explained in the appropriate section.

When started, the &emulator will also try to load a RAM image file (default name is ram) with the same behavior described above. If not found, the RAM will be initialized as after a power-up.

2.1.2. The menus

When the emulator is running, two pop-up menus can be opened by pressing the right and left mouse button. The `left' menu is used to issue commands, while the `right' menu can be used to change emulation settings.

2.1.3. The .vicerc configuration file and the command-line options

When being run, the emulator will search for a .vicerc configuration file in your $HOME directory (VICERC in the current directory on MS-DOS). On Unix, if this is not found it will also try to find a vicerc file in your installation directory (usually something like /usr/local/lib/VICE). If they are both unavailable, the default values will be set. After the settings are initialized, the emulator parses the command line; this allows you to override the values found in the configuration file.

The configuration file contains the settings for all the emulators; this is achieved by dividing the file into emulator-specific sections. Each section begins with the name of the related emulator in brackets, i.e. one of these:

This setup makes it possible for you to edit the configuration file with a text editor.

The resources for one emulator must be specified in the following form:

There can be spaces between the ResourceValue and the `=' symbol, and they will not be included in the value. If you want to force them, you must put the ResourceValue between double quotes ("...").

All the resources have command-line counterparts, but some command-line options are not available as resources. Here is a list of all the command-line options (in parenthesis, you'll find the name of the corresponding resource specification if available):

2.1.4. The Monitor

The built-in monitor features command-line editing with history and file name completion. It accepts the following commands:

2.1.5. The XDebugger

(Warning: the XDebugger is still under construction, and is not 100% functional yet).

When the XDebugger is enabled, a new window pops up. On the left it shows the opcode the CPU is working on, while on the right several register contents are displayed.

Below the registers is the status line. It shows the status of the emulator. It can be Running, Halted or Trace. You can switch between the states with the buttons below the status line. Run lifts off the CPU, Stop halts it, and Trace lets it run with displaying the executed opcodes in the left window.

When the emulator is stopped, it is possible to run single-step execution by pushing the Step button.

With the Skip button the next opcode to be executed can be skipped. This way JAM (i.e. illegal) opcodes can easily be used to trap a program and then be skipped here.

2.2. Using c1541

c1541 is a stand-alone disk image maintenance program. It can be used both interactively and from the command line.

The syntax is:

If some OPTIONS but no IMAGE are specified, c1541 runs in batch mode; otherwise, it attaches the IMAGE if present and enters the interactive mode, where you can type commands that are executed when you press Enter (abbreviations can are allowed). As with the monitor, file name completion and command line editing with history are provided. Use quit to exit.

Notice that c1541 always creates X64 files, but can read and write D64 files automatically, without the need for any special options.

Each command-line option has an interactive-mode counterpart, that is shown in parenthesis: (abbreviations are allowed when not ambiguous)

When more than one command is specified in batch mode, all of them are executed in the same order they have on the command line.

This information should also be available in section 1 of your on-line manual pages (man 1 c1541).

2.3. Using petcat

petcat can be used to expand tokenized basic programs into 7-bit ASCII text. The syntax is:

FILES can be either raw CBM binary files or P00. Available options are:

Available versions are: More information about petcat should be available in section 1 of your on-line manual pages (man 1 petcat).


3. Other documents


4. Acknowledgments

VICE derives from X64, the first Commodore 64 emulator for the X Window System. Here is an informal list of the people who were mostly involved in the development of X64 and VICE:

The VICE core team:

External contributors:

(We hope we have not forgotten anybody; if you think we have, please tell us)

Thanks also to everyone else for sending suggestions, ideas, bug reports, questions and requests. In particular, a warm thank goes to the following people:

Last but not least, a very special thank to: For writing really cool emulators to compete with. :-)


5. Copyright

VICE is Copyright (c) 1993-1997 Ettore Perazzoli, Teemu Rantanen, André Fachat, Jouko Valta, Jarkko Sonninen and Daniel Sladic.

Matrix Printer Emulator, Bitmap Font Building from the Blue Book Program program_21.ps

6. Contacts

You can find the latest news about VICE at the official VICE home page:

Also the public patches and beta releases will be available there as well, so you might want to have a look at it periodically. If you are going to report a bug, please check those pages first; it is possible that the problem you encountered has already been fixed with a newer version.

If you want to report bugs, make suggestions or contribute to the project, e-mail one of the following people:

When you report a bug, please try to be as accurate as possible and describe how it can be reproduced to the very detail. You should also tell us what machine you are running on, what operating system you are using as well as the version of it.

In any case, we would really be glad to receive your comments about VICE.

If you want to contribute, please ask first. It has already happened a couple of times that somebody started working at something that had already been done but not released to the public, and we really do not want anybody to waste time.

People willing to port VICE to other platforms are always welcome. In particular, we would be really glad if somebody ported VICE to MacOS or Windows NT/95. A port of the 0.11.0 C64 emulator for MacOS already exists but it is quite buggy and not maintained any longer.

There are some newsgroups you might be interested in:

We also recommend reading the comp.emulators.cbm and comp.sys.cbm FAQs, that are posted on a regular basis on the corresponding newsgroups and are also available via FTP from rtfm.mit.edu.