Emulator

From Higher Computing Science
Jump to: navigation, search
File:Q(Emulator).png
An emulator on a Mac (QEMU) emulating a computer running the ReactOS system

This article is unfinished. Please consider joining and adding to this article. Read about Page layout beforehand.

Key points

  • An emulator is a software program that simulates a hardware platform including the processor. This means that a computer with one type of processor can run software designed for another type of computer - e.g. a Windows PC with an Intel processor can run Gameboy games, even though the Gameboy has a different set of hardware features and a Z80 processor.
  • Emulators are useful for running executables that use a different hardware platform and means that the software can be tested without the original device. This is used to test Android or iOS applications (running on ARM processors) on Intel computers.

Information

There are many hardware platforms and computer designs, stretching over several decades. Each computer has its own processor, data bus and address bus width, memory set up, and communication protocols. Very few computer platforms are compatible with each other.

Emulators are software programs that attempt to make it possible to run software for one platform on a completely different platform. Emulators take the machine code instructions for a processor and translate them into a form that can run on the host computer. Emulators must also allow the program to access the right type of screen, memory and devices that it expects - some old systems would not be able to utilise an HD screen or stereo sound, for example.

Emulators are very popular with gamers. Almost all the old gaming systems such as the Gameboy, NES, Atari 2600 and Master System are emulated. The hardware from arcade machines have been painstaking emulated, including PacMan and Donkey Kong. Modern systems like the PSP and Nintendo DS are also emulated. There is always a limit to what systems can be emulated - as each line of machine code needs to be translated, emulators will need a processor several times faster than the emulated computer's processor to work well. This is fine for old systems with slow processors, but for modern systems such as Xbox or Playstation, the emulators simply cannot translate the code quickly enough to be usable.

Emulators are also useful for mobile developers. A PC can run an emulated version of an Android or iOS phone, and the emulator can be configured with different OS versions, screen sizes and hardware devices, to allow full testing of an app.

Emulators and legal issues

Emulators need software, such as games or Operating Systems, to be useful. The majority of software created for emulated platforms is still copyright - it is illegal to make copies of the discs and ROMs that stored the games. Though most games can be found online, this is an area where copyright law still applies.

Example of an emulator

The box below will display a Commodore 64. The emulator, written in Javascript, is using the original Commodore 64's ROM and emulating each item of hardware, including CPU, memory, screen buffer and input devices. You can read about this emulator and view its source code on github.

The emulator lets anyone with a PC run games and applications written for the Commodore 64, within the emulator. Try typing in this command and then typing run

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

Difference between Virtual Machine and Emulator

The terms Virtual machine and emulator are often used interchangeably, but there is a significant difference between an emulator and a virtual machine. A virtual machine will not emulate the processor of a computer. Instead it will directly handle instructions in the same instruction set as the host computer. This means an Intel X86-based processor can only run virtual machines that use the X86 processor themselves. Virtual machines may run at almost full speed, as the only translation work they are doing is with any interaction with hardware.

Videos

Further information

Test yourself

Teaching resources