How do emulators work?

On a fundamental level, emulators are simply programs that translate assembly language instructions from the emulated platform to the platform on which the emulator is to run. Because computers are little more than machines that execute assembly language, the only difference between different platforms of computers is the different assembly languages that those platforms use. Emulators overcome this difference and permit software of one platform to run on another by translating assembler instructions from one platform to another.

For example, the following is the translation of a Pentium assembler instruction into its PowerPC equivalent generated by Connectix's Virtual PC (a PC emulator for the Macintosh):

Pentium instruction

PowerPC instructions


li rTemp1,20
addco. PF,rTemp1,rEAX
mr rEAX,rPF

While the premise sounds simple, the implementation is definitely not: Virtual PC handles its assembler translation through a "dynamic recompiling emulator" hand-coded in PowerPC assembler. This works by decoding "basic blocks" of x86 assembler and recompiling them, on the fly, into PowerPC assembler. To speed up the process, Virtual PC uses such tactics as "inter-instruction optimization" and a "translation cache."

The point of all this is that writing an emulator is not an easy task -- and Virtual PC is not unique among emulators in its complexity. The difficulty of writing an emulator is interesting when one considers the question of:

How much do emulators cost?

Surprisingly, the vast majority of emulators are distributed as freeware or public domain software; the exceptions are commercial emulators like ARDI Executor (a Macintosh emulator for Windows) or the aforementioned Virtual PC. Most leading emulators are freeware.

If emulators are so hard to write, why do they cost so little?

The short answer is that most emulator authors are in it not for the money but for the technical challenge of producing a program that can simulate one platform on another. The webmaster of Emulators Unlimited, a leading emulation website, was quoted in Wired.com as stating that UltraHLE, a highly controversial Nintendo 64 emulator for Windows, was written "as a stunt to prove [the] technical prowess" of its authors. And the official FAQ of the Wine Project (which aims to emulate Windows on a Unix system) reveals that the project began as the result of a discussion on the comp.os.linux newsgroup. One enterprising programmer wanted to see if he could get Minesweeper and Solitaire to run on his Unix computer -- and the Wine Project was born.

Why are emulators so controversial?

We take more of a look at this in the next section.

NEXT: The Emulation Debate

MPEG Layer 3   |   Search Engines and Directories
Reverse Engineering   |   CD Burners


Ted LeVan   |   Huat Chye Lim   |   Marissa Mayer   |   Ann Rose Van

Computer Science 201 Final Project
Stanford University, March 1999