Amiga Format
This article was originally written by Simon N Goodwin for Amiga Format magazine, and is used by permission of the joint copyright holders. It should not be copied any further without written permission. The free emulators mentioned were included on the accompanying CD with the magazine, and are generally available - often in updated form - from this site. The text is as originally submitted to the magazine - which means there are some differences, mostly extra text which was cut to fit into the pages available - with the addition of hyperlinks to new or updated information which has since become available. This approach has been taken to preserve the structure of the original series, while making new information readily available. Simon welcomes comments from readers, care of Tomas Amsrud, who has generously prepared the material for publication on the Internet.
PrevNext
Main

AER


Commodore 64 Emulators

Simon N Goodwin checks out emulators for the computer
that earned Commodore the cash to buy the Amiga


The Commodore 64 is the world's most successful eight bit computer. Introduced in 1982 to follow-up the million-selling VIC-20, it was a massive step forward in terms of graphics, sound and - most of all - memory capacity, with 64K of dynamic memory and 20K of ROM.

The C64, as it was soon known, was a clear descendent of earlier Commodore machines, from the 1977-vintage PET onwards. Its 1 MHz 6510 processor is closely related to the 6502 which powered the first Apples and Acorns. Originally promoted as the Commodore Max, the '64' in the name came from the memory size, gargantuan at the time and ten times more than the VIC's.

C64 C64 hardware was nifty, from the 'real' keyboard to the abundant built-in ports, based on two CIA chips, similar to those in Amigas. The C64 has two controller ports. Emulators can relay signals from Amiga to C64 ports, optionally swapping them, as most Amigas have a joystick in port 2 which C64 programs expect in port 1.

The C64 is built around two custom chips, VIC for video and SID for sound, designed from the ground up in just six months early in 1981. These chips are not as clever as the Amigas ones but were very impressive in their day, and most amenable to hacking - programmers use them many ways never intended by the original designers. The simple system timing made it possible to synchronise processor, sound and display changes, gaining effects that were stunning at the time and can still impress today.

The firmware was limp by comparison. The 8K built-in Microsoft BASIC interpreter dated back to the PET, making the machine cheap to produce but tough to program. It lacked support for the extra graphics and sound chips and could only access about half the 'elephantine' 64K memory, the rest being hidden by the screen image, ROMs, and custom chip registers.

DigDug In the absence of multi-tasking - indeed, anything that we'd now know as an operating system - a typical C64 program is a lean, tricky, system -hogging tour de force. The only way to program the custom chips is to 'hit the metal', writing bytes directly to the array of 76 custom registers, identified by cryptic five digit numbers, with each address often sharing several functions.

Many C64 programmers moved on to the Amiga, a fact which still upsets some 'system legal' coders. These days the trade goes both ways, with the release of Lunix, a Unix clone (sort of) for the C64! Games remain the main attraction, but there are lots of PD utilities too, if you know where to look.

Programmers can still have fun with a C64, real or emulated, although the 40 by 25 character screen is a bit restrictive. You'll need the user manual, and preferably the Programmers Reference Guide as well, as emulator manuals assume you know how the C64 works.

C64 disk drives and printers use a non-standard interface, with a processor, rather than a peripheral controller, in each box, joined by slow serial links. This idea came from the VIC 20 and earlier Atari computers. It ensured that Commodore made lots of money on add-ons, as well as computers. It kept prices high and performance low, although third-party firms eventually muscled in with clone drives and adapters.

The gratuitous processors cost Commodore little, as they owned the company that made the 6510; in the long run hackers learnt to reprogram the peripherals, trading compatibility for speed, and confusing emulators.

C64 files

The Commodore serial bus uses a 'daisychain' of six-pin DIN connections. You can hook these up to your Amiga parallel port with a trivial interface: one cheap TTL chip and three resistors. The plugs cost more than the components, and if you pay more than a couple off quid for the lot, you've been ripped off!

The required circuit is in Frodo's documentation. Strangers to soldering can get a ready-made interface as part of the registered A64 package, but faster Amigas may outrun the serial link; this is a software problem, first found on the A3000.

C64 files can be stored individually on Amiga disks, with a small header containing system-specific information, on genuine C64 drives, or in special emulator files. D64 files are images of a whole C64 disk in one file, supported by Frodo, Magic64, PD compilers and emulators on other platforms.

The T64 format was also introduced by C64S, an excellent shareware emulator for PCs. It contains a stream of files as they would be read from tape. Current Amiga emulators do not support direct cassette loading, but that's probably a blessing in disguise. The P00 format is a single-file format from the PC64 emulator. Various PD programs will unwrap D64, T64 and P00 files for use with A64.

C64 emulators

The 64 Emulator, sometimes known simply as C64, was written a decade ago by Randy Linden; version 2 still circulates. It's old and lacks bells and whistles, but it works. You can run files from Amiga disks at slow but bearable speed on an A500. It was written for 68000s with Kickstart 1.2 or 1.3, so it will not run without patches on faster machines. If you've got a modern Amiga there are better alternatives.

A64

A64 is the most long-lived of the emulators, currently at version 3; it was preceded by two versions of GO-64, an early emulator, no longer available. A64 is shareware, and the current demo only runs for ten minutes. Earlier demos are less restrictive.

Registered owners pay $70 for the Commodore peripheral interface, many utilities, and over 100 pages of documentation. The full A64 comes on two disks. Sadly the demo lacks most of the documents.

A64 A64 can use Amiga serial and parallel ports as well as C64 specific -peripherals. It converts characters between PET ASCII and Amiga ANSI codes, and allows access to C64 disks and printers from the Amiga shell.

The F1 key saves a C64 screen in Amiga ILBM or ACBM format, although sprites do not appear, which is why the ghosts have disappeared in the shot of Side PacMan. F2 changes the font used for C64 displays, and you can tweak the 16 preset colours when they become over-familiar. Its assembly language debugger A64Mon runs on a second custom screen.

In many ways A64 is the most polished C64 emulator, but it falls down on emulation of the VIC chip, particularly as used in modern programs. BASIC works well, even on slow Amigas, as A64 includes a re-write of the C64 ROMs in 68000 machine code, making it much the fastest emulator when running BASIC, as long as you avoid direct ROM calls, which must interpret a copy of the real, copyright code.

The converter that translates 6502 code to a verbose 68000 is included, and can be used on other programs. This requires patience and specialist knowledge as it can't cope with self-modifying code, common in C64 games.

A64 is showing its age. It's not been updated for a couple of years, and AGA users must disable mode promotion and high-res sprites before startingit up. Sprites flicker because A64 doesn't use the AGA scheme which allows sprites up 64 pixels wide; it re-uses 16 pixel ECS ones to get the VIC's 24 and 48 (doubled) widths.

Magic64

Magic64 is a shareware emulator, with good Amigaguide documentation and all the usual features, including a built-in monitor and debugger reminiscent of Action Replay. It's quite new and runs well on modern Amigas, although screen handling is a bit shaky unless you own Workbench 3 and disable mode promotion. It supports all the common file formats, and files on C64 drives too, as long as they don't use special loaders.

Magic64 has excellent configuration menus, similar to those on Shapeshifter but available whenever you press ESC. It has joystick emulation, with autofire, from the Amiga's numeric keypad or either controller port. Early demos lacked sound unless registered, but were otherwise usable. The current version 1.5 demo supports sound, if you've got the necessary PD library, but stops automatically after ten minutes. The shareware fee is $20 or 30 DM.

AXF-64

This is the only emulator that refused to work properly. It starts alright on the 68060 but the cursor zooms off across the screen, leaving a trail of semi-random characters in its wake. You can insert valid keys by typing as it goes along, but the gibberish spews too fast for you to be able to scrub it out and insert a real command.

On an A4000/030 the random characters disappeared, but keyboard handling was still dodgy, locking up periodically until you retype the last recognised key. To make things worse it assumed a German keymap so I had to resort to

PRINT ,CHR$(61);

to get an equals sign on the screen - vital for BASIC programming - and use the screen editor to type other characters around it.

Unlike rivals, AXF-64 does not implement all the Amiga cursor keys. You must press the down arrow to move the cursor right, and left arrow to move down. Add Shift, to go left and up respectively. If you've used a real C64 this is what you'd expect - the real machine has one key each for vertical and horizontal movements - but it takes some getting used to!

If you manage to load a program, AXF-64 runs quite fast - more than 50 per cent faster than Magic64. It's not much good for games yet as it does not emulate sprites or sound. The short accompanying document warns that the keyboard and timer handling is not system-friendly and promises an update. AXF-64 shows promise, but the current version - alpha 23 - is half-baked.

Frodo

Frodo comes from Christian Bauer, author of Shapeshifter. It's well presented and well documented, with plenty of features, and easy to get working once you've got the C64 ROM images, which are vital but not included.

The problem with Frodo is its sloth. At the default setting it crawls along at about a tenth the speed of a real C64 - on an A4000/030! You can push this up to a third of full speed by reducing the display update to one tenth - a flickery five frames per second - but keyboard handling is still so sluggish that it's tough to type in a single command. You must wait after every key-press to see if it registered.

Even on a 68040, Frodo is slow. On the plus side, it supports retargetable graphics cards - in fact it rather expects one - and work on a Power PC version is well under way, ready for the touted Power Amigas. The screen shot shows version 3, currently running on Be/OS. Notice that this is running (more likely walking) six C64 windows at once. Don't try it on your Amiga, or you'll be in for a long wait.

Frodo's good points are that it's free, with full source code, and includes a machine code monitor and assembler, SAM, which runs in an Amiga window. One day we'll have machines powerful enough to appreciate it's painstaking emulation.


Emulators compared
A64C64AXF-64Magic64Frodo
StatusSFFSF
Speed85431
Features83376
Amiga compatibility73278
C64 compatibility43278
ROMs requiredNNYNY
Assembler/monitorYNNYY
Emulator version3.12a261.52.3
Workbench version1.3+1.32+2+2+
RAM needed (K)5005008001800700
S = Shareware, F = Freely distributable.

VIC and SID

The custom chips are the real test of C64 emulation, and it takes a lot of processor power to impersonate them accurately. Bob Yannes, the designer of the C64 sound chip did a brilliant job and went on to found the synthesizer firm Ensoniq.

SID is a synth, not a sampler, based around three phase accumulating oscillators. Each can produce a separate note in various timbres. Programmers also used the channel volume controls to replay samples, but the quality was limited by the four bit resolution.

SID was the first micro sound chip that could play in tune - a big step up from the Atari effort, and General Instruments chips used in MSX, Beebs, Orics, STs and Spectrum 128s, all increasingly inaccurate as they progressed through a scale. SID also supports envelope shaping, filtering and ring modulation.

SID has a distinctive computer sound caused by the preset digital waveforms, but was far more expressive than the square waves which were all the earlier chips could manage. It's signal to noise ratio is not as good as the twelve bit internal resolution would suggest. It varies from average to awful between individual SID chips due to nuances of the production process and the mixed analogue and digital design.

Sound chip emulation on the Amiga is pretty good, although the real thing has so many quirks that perfectionists will opt for the Zorro board with a real SID chip, supported by Frodo. A64 comes with 6581sid.library, which can reproduce most SID effects but not the hardware filter.

The alternative is PlaySID.library, which is more compatible but consumes a lot of processor power, and ironically needs patches to run at all on a 68060. PlaySID is shareware that also works as an Amiga task, playing C64 tunes independently of any emulator.

Graphics trickery

Even the best Amiga emulators have trouble with hacks that re-program the chips in the middle of a display line; we'll need much faster processors, or hardware help, to capture the most subtle nuances of C64 demos.

Frodo comes closest to full compatibility, splitting its time between interpreting processor instructions and custom chippery. Every 64 microseconds it swaps between 6510 and VIC emulation, generating graphics one line at a time to account for hacks which re-use resources as the beam paints the screen.

This makes Frodo very, very slow. On a 25 MHz 68040, it runs at about half the speed of a real C64. A 50 MHz 68060 can keep up, but a fast Zorro graphics card is still desirable, as AGA is not quite fast enough to handle the 7 Mb or so of graphics that Frodo spews out every second.

QBert DokeyKong A new Amiga version of Frodo, code-named CS for Single Cycle, is even slower but supports more hacks because it emulates processor and display on a cycle-by-cycle basis. This is part of the current release 2.3, but I doubt if anyone in the world has a computer fast enough to do it justice.

Magic64 follows a similar but less rigorous approach. It runs the majority of C64 games but hiccups on a few trick-mixing demos. It's slower than A64, but runs at a reasonable speed on a fast 68030 or 68040 system, and supports CyberGFX.

Older emulators do a surprisingly good job on a 68000, but they're still hardly a substitute for a real C64. Games are slow and compatibility is limited; special effects often dissolve into flicker.


C64 facts: Screen display:
320x200 pixels with two colours per 8x8 square
160x200 pixels with four colours per 8x8 square
40x25 colour text, character-mapped
Eight independent sprites, each up to 24 pixels wide
Maximum of 16 preset colours on any screen
Hardware scrolling, panning & beam synchronisation
Memory:
64K paged DRAM
1/2K static colour RAM
8K PET BASIC 2 ROM
8K KERNAL (system) ROM
4K Character display ROM
Processor:
1 MHz MOS Technology 6510

Sound:
Mono, 3 channel 9 octave direct synthesis

The bottom line

If you're nostalgic for C64 games and demos, there's no shortage of emulators for them on Amigas. Alas you'll need a very powerful system to run them all. The serial hardware interface is neat, and one of the strengths of Amiga C64 emulation. It helps if you've still got an original C64, or at least the disk drive, because that's much the easiest way to transfer your old programs to the emulator. You can even work the other way, setting up your Amiga as a file-server for the C64, using EMUL_1541 from the AF cover CD.

Ironically, the Amiga does a better job of emulating a relatively modern machine like a Mac than a vintage C64. That reflects the straight-forward Mac design, and the quirky, bells and whistles background of the C64. The C64 scene is still buzzing, and new demos continue to be released, although commercial games are thin on the ground these days. So get emulating, and join in!


C64 resources:
Usenet resources:
Commodore 8 bit newsgroup - comp.sys.cbm
Commodore 8 bit programs - comp.binaries.cbm
Commodore emulator news - comp.emulators.cbm

Web pages & links:
http://www.aloha.net/~bstaggs/c64.html
http://commodore64.net
http://www.cucug.org/c64128.html
http://www.msen.com/~brain/cbmhome.html

Internet FTP sites:
ftp.funet.fi/pub/cbm/c64
ftp.uni-heidelberg.de/pub/C64
wilbur.standord.edu/pub/emulators/C64
Aminet and most Amiga PD libraries carry Frodo and demos of A64 and Magic64, generally with a collection of programs that run on them. Get the old A500 64 emulator from diehards like Oasis Computer Systems and Smash PD.

C64 Sensations is a Commodore 64 compilation CD for Amiga and PC users. It includes the full A64 version 2, unregistered Magic64 1.3, loads of demos and SID tunes. The Emulators Unlimited CD includes the version 3 and Magic64 demos, an old release of Frodo and a spoof, C64EMU, as well as ROM images and hundreds of C64 games.

There's a gold-disk compilation of C64 software doing the rounds, with lots of games in various formats, culled from the Internet. It costs more and is legally dodgy, which is why it's only duplicated to special order. It's a good buy if you've got a large (legal) collection of C64 programs and no access to the Net.

Web page design Copyright © Tomas Amsrud
Articles Copyright © 1996-2002 Simon Goodwin