Go to the first, previous, next, last section, table of contents.

# 4 System files

In order to work properly, the emulators need to load a few system files:

- the system ROMs, raw binary files containing copies of the original ROMs of the machine you are emulating;
- the keyboard maps, text files describing the keyboard layout;
- the palette files, text files describing the colors of the machine you are emulating.
- the romset files, text files describing the different ROMs to load.

The place where they will be searched for depends on the value of the `Directory` resource, which is a colon (`:`)-separated search path list, like the UNIX `PATH` environment variable. The default value is

    PREFIX/lib/vice/EMU:$HOME/.vice/EMU:BOOTPATH/EMU

Where `PREFIX` is the installation prefix (usually ``/usr/local'`), `EMU` is the name of the emulated machine (`C64`, `C128`, `PET`, `CBM-II` or `VIC20`) and `BOOTPATH` is the directory where the executable resides. The disk drive ROMs are looked for in a directory with `EMU` set to `DRIVES`. `$HOME` is the user's home directory.

For example, if you have the C64 emulator installed in

    /usr/local/bin/x64

then the value will be

    /usr/local/lib/vice/C64:$HOME/.vice/C64:/usr/local/bin/C64

And system files will be searched for under the following directories, in the specified order:

1. `/usr/local/lib/VICE/C64`
2. `$HOME/.vice/C64`
3. `/usr/local/bin/C64`

System files can still be installed in a different directory if you specify a complete path instead of just a file name. For example, if you specify ``./kernal'` as the kernal image name, the kernal image will be loaded from the current directory. This can be done by using command-line options or by modifying resource values (see section 6.1 Format of resource files).

## 4.1 ROM files

Every emulator requires its own ROM set. For the VIC20 and the C64, the ROM set consists of the following files:

- ``kernal'`, the Kernal ROM (8 KBytes)
- ``basic'`, the Basic ROM (8 KBytes)
- ``chargen'`, the character generator ROM (4 Kbytes)

The C128 needs the following files:

- ``kernal'`, the Kernal ROM (8 Kbytes)
- ``basic'`, the Basic + Editor ROM (32 Kbytes)
- ``chargen'`, the character generator ROM (4 Kbytes)

The C128, VIC20 and C64 emulators also need the following DOS ROMs for the hardware-level emulation of the 1541, 1571 and 1581 disk drives:

- ``dos1541'`, the 1541 drive ROM (16 Kbytes)
- ``dos1541II'`, the 1541-II drive ROM (16 Kbytes)
- ``dos1571'`, the 1571 drive ROM (32 Kbytes)
- ``dos1581'`, the 1581 drive ROM (32 Kbytes)

In addition to those all emulators can handle a parallel IEEE488 interface (the C64 and C128 via `$df**` extension, the VIC20 via VIC1112 emulation) so they also need the DOS ROM for the IEEE disk drives:

- ``dos2031'`, the 2031 drive ROM (16 Kbytes) (DOS 2.6, Commodore ROM images 901484-03 and 901484-05)
- ``dos2040'`, the 2040 drive ROM (8 Kbytes) (DOS 1, Commodore ROM images 901468-06, 901468-07)
- ``dos3040'`, the 3040 drive ROM (12 Kbytes) (DOS 2, Commodore ROM images 901468-11, 901468-12 and 901468-13)
- ``dos4040'`, the 4040 drive ROM (12 Kbytes) (DOS 2, Commodore ROM images 901468-14, 901468-15 and 901468-16)
- ``dos1001'`, the 1001/8050/8250 drive ROM (16 Kbytes) (DOS 2.7, Commodore ROM images 901887-01 and 901888-01)

Note that there are other DOS images on the internet. The DOS 2.5 images might be used with the 8050, but it cannot handle the double sided drives of the 1001 and 8250 and it is not supported by VICE.

The PET emulator uses an expanded setup, because there are three major versions of the Basic and the Kernal, and many versions of the Editor ROM. In addition there are cartridge ROM sockets.

The Kernal files contain the memory from range $F000-$FFFF, the Basic ROMs either the range $C000-$DFFF or $B000-$DFFF. To handle the different screen sizes and keyboards, different so-called "editor-ROMs" for the memory range $E000-$E800 are provided. The PET ROMs have the following names:

- ``kernal1'`, the PET2001 Kernal ROM (4 KBytes) (Commodore ROM images 901447-06 and 901447-07)
- ``kernal2'`, the PET3032 Kernal ROM (4 KBytes) (Commodore ROM image 901465-03)
- ``kernal4'`, the PET4032/8032 Kernal ROM (4 KBytes) (Commodore ROM image 901465-22)
- ``basic1'`, the PET2001 Basic 1 ROM (8 KBytes) (Commodore ROM images 901447-09, 901447-02, 901447-03, 901447-04.bin. The -09 ROM is the revised -01 ROM)
- ``basic2'`, the PET3032 Basic 2 ROM (8 KBytes) (Commodore ROM images 901465-01 and 901465-01)
- ``basic4'`, the PET4032/8032 Basic 4 ROM (12 KBytes) (Commodore ROM images 901465-23, 901465-20 and 901465-21. The -23 ROM is a revised -19 ROM)
- ``edit1g'`, the PET2001 editor for graphics keyboards (2 KBytes) (Commodore ROM image 901447-05)
- ``edit2b'`, the PET3032 editor for business keyboards (2 KBytes) (Commodore ROM image 901474-01)
- ``edit2g'`, the PET3032 editor for graphics keyboards (2 KBytes) (Commodore ROM image 901447-24)
- ``edit4g40'`, the PET4032 editor for graphics keyboards (2 KBytes) (Commodore ROM image 901498-01)
- ``edit4b40'`, the PET4032 editor for business keyboards (2 KBytes) (Commodore ROM image 901474-02)
- ``edit4b80'`, the PET8032 editor for business keyboards (2 KBytes) (Commodore ROM image 901474-04-?)
- ``chargen'`, the character generator ROM (2k). It has two sets with 128 chars each. The second (inverted) half of each set is computed from the first half by inverting it. This is a PET hardware feature. (Commodore ROM image 901447-10)
- ``chargen.de'`, the character generator ROM (2k). This version is a patched German charset, with the characters [, \ and ] replaced by umlauts. It has been provided by U. Guettich and he reports that it is supported by some programs.

The PETs also have sockets for extension ROMs for the addresses $9000-$9FFF, $A000-$AFFF and $B000-$BFFF (the last one for PET2001 and PET3032 only). You can specify ROM image files for those extensions command line options `-petrom9`, `-petromA` and `-petromB` resp.

An alternative would be to specify a long kernal ROM with the `-kernal` option that includes the extension ROM areas.

Also, you can specify replacements for the basic ROM at $B000-$DFFF with the `-petromBasic` option and for the editor ROM at $E000-$E7FF with the `-petromEditor` option.

The CBM-II emulator again uses another setup. For those models the kernal used is the same for all. However, for different amounts of memory exist different versions of the BASIC ROMs. The 128k RAM version (C610, C710, B128) uses one bank of 64k for the BASIC text and another one for all the variables. The 256k RAM version uses one bank for text, one for variables, one for arrays and one for strings.

Also the character generator ROMs have a format different from the above. The other character ROMs have 8 bytes of pixel data per character. Those ROMs have 16 bytes per character instead. The C6x0 only uses the first 8 of it, but the C7x0 uses 14 lines per character and needs those increased ROMs. Both ROMs hold, like the PET, two character sets with 128 characters each. Again the second half of the full (256 char) character set is computed by inverting.

- ``kernal'`, the KERNAL (8k) for the business machines (6xx/7xx)
- ``kernal.500'`, the KERNAL (8k) for the personal machine (510) (901234-02)
- ``basic.128'`, the CBM-II 128k BASIC (16k)
- ``basic.256'`, CBM-II 256k BASIC (16k)
- ``basic.500'`, C510 BASIC (16k) (901236-02 + 901235-02)
- ``chargen.500'`, character generator ROM for the C5x0 (4k) (901225-01)
- ``chargen.600'`, character generator ROM for the C6x0 (4k)
- ``chargen.700'`, character generator ROM for the C7x0 (4k)

## 4.2 Keymap files

Keymap files are used to define the keyboard layout, defining which key (or combination of keys) must be mapped to each keysym.

In other words, the keyboard emulation works like this: whenever the user presses or releases a key while the emulation window has the input focus, the emulator receives an X-Window event with a value that identifies that key. That value is called a keysym and is unique to that key. The emulator then looks up that keysym in an internal table that tells it which key(s) to press or release on the emulated keyboard.

This table is described by the keymap file, which is made up of lines like the following:

    KEYSYM ROW COLUMN SHIFTFLAG

Where:

- `KEYSYM` is a string identifying the keysym: you can use the `xev` utility (shipped with the X Window system) to see what keysym is bound to any key;
- `ROW` and `COLUMN` identify the key on the emulated keyboard;
- `SHIFTFLAG` can have one of the following values:
  - `0`: the key is never shifted;
  - `1`: the key is shifted;
  - `2`: the key is the left shift;
  - `4`: the key is the right shift;
  - `8`: the key can be (optionally) shifted by the user.

The `SHIFTFLAG` is useful if you want certain keys to be "artificially" shifted by the emulator, and not by the user. For example, `F2` is shifted on the C64 keyboard, but you might want it to be mapped to the unshifted `F2` key on the PC keyboard. To do so, you just have to use a line like the following:

    F2 0 4 1

where `0` and `4` identify the key (row 0, column 4 on the keyboard matrix), and `1` specifies that every time the user presses `F2` the shift key on the C64 keyboard must be pressed.

There are also some special commands you can put into the keyboard file; they are recognized because they start with an exclamation mark:

- `!CLEAR` clears the currently loaded keyboard map; it is necessary to put this at the beginning of the file if you want the keymap file to override all of the current internal settings;
- `!LSHIFT`, `!RSHIFT`, followed by a row and a column value, specify where the left and right shift keys are located on the emulated keyboard; for example, C64 default keymaps will specify

      !LSHIFT 1 7
      !RSHIFT 6 4

Any line starting with the `#` sign, instead, is completely ignored. This is useful for adding comments within the keymap file.

VICE keymap files have the ``.vkm'` default extension, and every emulator comes with a default positional mapping and a default symbolic mapping.

## 4.3 Palette files

Palette files are used to specify the colors used in the emulators. They are made up of lines like the following:

    RED GREEN BLUE DITHER

where `RED`, `GREEN` and `BLUE` are hexadecimal values ranging from 0 to FF and specifying the amount of red, green and blue you want for each color and `DITHER` is a 4-bit hexadecimal number specifying the pattern you want when rendering on a B/W display.

You have to include as many lines as the number of colors the emulated machine has, and the order of the lines must respect the one used in the machine (so the N'th line must contain the specifications for color N - 1 in the emulated machine).

Lines starting with the `#` sign are completely ignored. This is useful for adding comments (such as color names) within the palette file.

For example, the default PET palette file (which has only two colors, 0 for background and 1 for foreground), looks like the following:

    #
    # VICE Palette file
    #
    # Syntax:
    # Red Green Blue Dither
    #

    # Background
    00 00 00 0

    # Foreground
    00 FF 00 F

## 4.4 Romset files

The Romset files are not used by default on all emulators. You might have recognized that the names of the ROM images are saved in resources. Loading a Romset file now just means a `shortcut' to changing all the resources with ROM image names and reloading the ROMs.

The PET and CBM-II emulators use this feature to change between the different ROM versions available for those machines. E.g. the Romset file for the PET 2001 is

    KernalName="pet2001"
    EditorName=
    ChargenName="chargen"
    RomModule9Name=
    RomModuleAName=
    RomModuleBName=

As you can see, the file even uses the same syntax as the resource file, it is just a bit stripped down.

Go to the first, previous, next, last section, table of contents.