Spotlight › First impressions

VICE brings the Commodore 64 to os8088

Commodore BASIC and VIC-II graphics in an IBM PC window -- with a 386 or faster required to run them at a useful speed.

software
VICE 3.10
guest
MOS 6510, 64KB RAM
required host
386 or faster

An XT or 286 is too slow. Both can start the emulator, but neither runs it at a useful speed.

VICE (C64)
An os8088 window in the top left of the screen containing a Commodore 64 startup screen: four stars, COMMODORE 64 BASIC V2, four stars, then 64K RAM SYSTEM 38911 BASIC BYTES FREE and READY. A status strip along the bottom of the window reads 2386 per cent cpu, 1196.1 fps.
38911 BASIC BYTES FREE. The startup screen every C64 printed, produced the way the real one produces it: the Commodore ROMs, executing on an emulated 6510, one instruction at a time.

Meet the Commodore 64

Sixty-four kilobytes, color graphics, three-voice sound and BASIC at power-on.

A Home Computer with 64K

When the Commodore 64 appeared in 1982, its proposition was easy to understand. It put 64KB of memory, a full keyboard, color graphics and BASIC in one machine that could use the family television. Turn it on and the interpreter was waiting; plug in a cartridge or connect a disk drive and it became a game machine, a music machine or an introduction to programming.

At its core was the 6510, a 6502 with an input/output port added for memory control. The VIC-II supplied sixteen colors, scrolling and eight hardware sprites. The three-voice SID supplied the sound. Those three chips gave software authors more to work with than the specification's 64KB suggested, and kept the machine on sale for eleven years.

Putting One PC Inside Another

A Commodore 64 in an IBM PC window? The two machines spent the 1980s on opposite sides of the desk. The PC handled spreadsheets and word processors; the 64 connected to the television. VICE now puts the latter inside the former, beside Minesweeper, with the Commodore ROMs reaching their own READY. prompt.

Taking a Look

The familiar blue screen is monochrome here, with Commodore's ROMs running underneath.

10 PRINT
The Commodore 64 window filled edge to edge with an endless maze pattern built from diagonal line characters, generated by a one-line BASIC program.
The one-liner everybody knows. 10 PRINT CHR$(205.5+RND(1));:GOTO 10 picks one of two diagonal characters at random, forever. Typed in and run: the ROM's BASIC interpreter, the 6510 executing it, and the screen scrolling underneath.
Alt+D
The same maze pattern with no window around it, filling the whole screen at double size, with a thin status strip along the very bottom.
The whole screen, at double size. Alt+D drops the window. A VGA screen has room to draw every C64 pixel twice, so the picture becomes 640 by 400. A CGA or Hercules screen has not, and gets it centred at its own size.
File
The File menu open over the Commodore 64 window, listing Smart attach, Attach disk image, Detach datasette image, Cartridge freeze, Printer slash plotter, Activate monitor, Reset machine CPU, Power cycle machine, Reset drive number 8 and Exit emulator. Six of the ten are drawn in grey.
What it cannot do is greyed, not hidden. The menus are VICE's, down to the keyboard shortcuts. There is no disk drive, no tape deck and no cartridge slot here, so those items are visible and disabled rather than quietly missing.
LOAD"*",8
The Commodore 64 window showing LOAD quote star quote comma 8 typed at the prompt, then SEARCHING FOR star, then question mark DEVICE NOT PRESENT ERROR, then READY.
An honest answer from a machine with no drive. Nothing here pretends a 1541 is attached. The serial bus is modelled, it reads back what the machine itself is driving, and the ROM reaches its own conclusion and prints its own error.
About
A panel over the Commodore 64 window headed About VICE, reading The Commodore 64 Emulator, VICE 3.10, os8088 port PAL, Copyright 1996 to 2025 VICE team, GPL-2 or later see COPYING, ROMs Copyright Commodore Business Machines.
It says whose work it is. VICE's copyright, the version this was read from, the licence the port inherits and whose the ROMs are. The 6510 stops while the panel is up.
The C64 disk
The os8088 file window open on a folder called C64 on drive B, listing C64.O88 at 39,384 bytes, C64.OVL at 2,149 bytes, C64.ROM at 20,480 bytes, COPYING at 17,989 bytes and README.TXT at 3,661 bytes.
Five files on the floppy. The program, the half of it that is only loaded when a menu command needs it, the three Commodore ROMs packed into one file -- and the GPL, which goes where the program goes.

Putting the Pieces Together

The 6510 fits in registers. Its screen has to fit through the PC's graphics hardware.

6510

Keeping the 6510 in Registers

Emulating a processor means reading an instruction, doing its work and moving to the next -- millions of times over. This is the innermost loop, so its 2,304 lines of 8086 assembly keep the 6510's registers in the 8086's own registers instead of in memory.

Every documented instruction is present, along with the accidental combinations that games and demos use. Each costs its proper number of cycles, including the extra cycle for a branch across a page boundary. Those cycles keep the VIC-II and both CIAs on the same clock.

Tests

Making Every Instruction Account for Itself

Klaus Dormann's functional test is a 65,536-byte program that exercises every instruction and addressing mode, stopping at a known address if one is wrong. Loaded into the emulated memory, it reaches its success point.

Decimal addition and subtraction get a separate check of all 262,144 combinations of value, operand, carry and instruction. Twelve test groups run in all, and each is also shown to fail when the behavior it covers is deliberately broken.

Host

Finding Room and Giving It Back

An os8088 program gets just under 60KB for itself, so the Commodore's 64KB cannot live inside it. The system supplies that memory as a separate block and supplies the ROMs as another. Menu commands live in a second file and come off the floppy only when selected.

An emulator also wants the processor forever. The 6510 therefore runs in slices, yielding between them so os8088 can move the mouse and repaint its windows. At an idle READY. prompt, it sleeps until a key arrives.

Display

Drawing Only What Changed

Sending all 1,000 screen characters through the operating system's text call costs about a second on the target machine. The emulator instead keeps a copy of the picture and marks every 256-byte memory page the processor changes.

Changed rows are drawn as pixel bands. A band of 40 characters costs 7.5 milliseconds, compared with 41.4 for the text call. When BASIC scrolls, the graphics hardware shifts the existing pixels and the emulator draws only the rows just uncovered.

Sixteen Colors, Two on the Screen

Monochrome is the result of a timing measurement, not a missing palette.

The C64 has sixteen colours and the PC this runs on can show them. The picture is still black and white, on every screen including VGA, and the reason is arithmetic.

The fast way to put pixels on a VGA screen in this system is to write them a run of one colour at a time. A C64 text screen is between 1,000 and 1,600 such runs, and each costs about 215 microseconds. That is 0.2 to 0.35 seconds for one band of the picture on the target machine, and 0.3 to 0.5 seconds for a whole frame even on a 386. A colour version was priced before it was written and it does not run.

So each of the sixteen colours is resolved to black or white by how bright it is -- and the brightness figures are the VIC-II's own, taken from the table VICE uses for a PAL machine. There are only nine distinct levels for the sixteen colours: blue and brown are the same brightness, so are red and dark grey, so are yellow and light green. Seven pairs vanish into each other, which is exactly what happens on a real C64 plugged into a black-and-white television.

The Conspicuous Omissions

No 1541, no datasette and no raster tricks -- and no attempt to conceal their absence.

Speed

A 386 Is the Practical Minimum

VICE starts on an XT or 286, but testing found both too slow for useful operation. Use a 386 or faster. The status strip prints the speed the machine actually delivers, every time, so a slow host does not masquerade as a full-speed Commodore 64.

Storage

No 1541, no tape, no cartridge

There is no disk drive to LOAD from, so the ROM says so. Programs come in through File > Smart attach instead: pick a .PRG file off the os8088 floppy and it is put into memory and started, which is one of the ways VICE itself does it.

Demos

Nothing that beats the raster

The screen chip is serviced a scan line at a time, not a clock cycle at a time. Text, BASIC and most software of the era do not notice. Demos do: the tricks that change a colour part-way along a line or open the border need timing this does not have, and sprite collision registers read as zero.

Sound

One voice, on the PC speaker

The SID had three voices, filters and ring modulation, through a proper audio chip. A PC of this era has a speaker that plays one square wave. The first voice's pitch is sent to it, so a tune is recognisable and nothing more is claimed.

Setting Up Shop

The browser supplies the quickest look; a 360KB disk supplies the period arrangement.

  1. The quickest way is the browser demo. It boots os8088 with the every-application floppy in the second drive, and the C64 is on it. Double-click the Disk B icon, then the C64 folder, then C64.O88. Give it a few seconds -- it reads 20KB of ROM off the floppy before it starts.

  2. Or take the disk. c64.img in every release is a 1.44MB floppy with the emulator and the ROMs on it; c64360.img is the 360KB version, the one a real IBM PC/XT reads. Either goes in the second drive in place of the software disk. Building from source, make c64disk makes all three sizes.

  3. Type at the prompt. It is a Commodore 64, so BASIC is already running. PRINT 2+2 works. So does the maze one-liner above, and LIST, and RUN. The Run/Stop key is Esc.

  4. The keys worth knowing. Alt+D gives it the whole screen and takes it back. Alt+P pauses. Alt+W runs it as fast as it will go. Alt+F9 resets the machine and Alt+Q closes it. The arrow keys and Ctrl are joystick port 2, which means the arrow keys stop reaching the C64's own keyboard while you are playing something -- Scroll Lock switches that off again.

It is a window like any other. You can drag it, put another program in front of it, and come back. The C64 inside carries on running while you do.