Emulator
Encyclopedia
In computing
, an emulator is hardware or software or both that duplicates (or emulates) the functions of a first computer system in a different second computer system, so that the behavior of the second system closely resembles the behavior of the first system. This focus on exact reproduction of external behavior is in contrast to some other forms of computer simulation
, in which an abstract model of a system is being simulated. For example, a computer simulation of a hurricane or a chemical reaction is not emulation.
in an electronic device to emulate (imitate) another program or device. Many printers
, for example, are designed to emulate Hewlett-Packard
LaserJet
printers because so much software is written for HP printers. If a non-HP printer emulates an HP printer, any software written for a real HP printer will also run in the non-HP printer emulation and produce equivalent printing.
A hardware emulator is an emulator which takes the form of a hardware device. Examples include the DOS-compatible card installed in some old-world Macintoshes like Centris 610 or Performa 630 that allowed them to run PC programs and FPGA
-based hardware emulator
s.
In a theoretical sense, the Church-Turing thesis implies that any operating environment can be emulated within any other. However, in practice, it can be quite difficult, particularly when the exact behavior of the system to be emulated is not documented and has to be deduced through reverse engineering
. It also says nothing about timing constraints; if the emulator does not perform as quickly as the original hardware, the emulated software may run much more slowly than it would have on the original hardware, possibly triggering time interrupts that alter performance.
to combat obsolescence
. Emulation focuses on recreating an original computer environment, which can be time-consuming and difficult to achieve, but valuable because of its ability to maintain a closer connection to the authenticity of the digital object.
Emulation addresses the original hardware
and software
environment of the digital object, and recreates it on a current machine. The emulator allows the user to have access to any kind of application
or operating system
on a current platform, while the software
runs as it did in its original environment. Jeffery Rothenberg, an early proponent of emulation as a digital preservation
strategy states, "the ideal approach would provide a single extensible, long-term solution that can be designed once and for all and applied uniformly, automatically, and in synchrony (for example, at every refresh cycle) to all types of documents and media". He further states that this should not only apply to out of date systems, but also be upwardly mobile to future unknown systems. Practically speaking, when a certain application is released in a new version, rather than address compatibility
issues and migration
for every digital object created in the previous version of that application
, one could create an emulator for the application
, allowing access to all of said digital objects.
relies heavily on emulation as a preservation strategy. Artists such as Cory Arcangel
specialize in resurrecting obsolete technologies in their artwork and recognize the importance of a decentralized and deinstitutionalized process for the preservation of digital culture.
In many cases, the goal of emulation in new media art is to preserve a digital medium so that it can be saved indefinitely and reproduced without error, so that there is no reliance on hardware that ages and becomes obsolete. The paradox is that the emulation and the emulator have to be made to work on future computers.
While emulation could, if taken to the extreme, go down to the atomic level, basing its output on a simulation of the actual circuitry from a virtual power source, this would be a highly unusual solution. Emulators typically stop at a simulation of the documented hardware specifications and digital logic. Sufficient emulation of some hardware platforms requires extreme accuracy, down to the level of individual clock cycles, undocumented features, unpredictable analog elements, and implementation bugs. This is particularly the case with classic home computers such as the Commodore 64
, whose software often depends on highly sophisticated low-level programming tricks invented by game programmers and the demoscene
.
In contrast, some other platforms have had very little use of direct hardware addressing. In these cases, a simple compatibility layer
may suffice. This translates system calls for the emulated system into system calls for the host system e.g., the Linux compatibility layer used on *BSD to run closed source Linux native software on FreeBSD, NetBSD and OpenBSD.
Developers of software for embedded system
s or video game console
s often design their software on especially accurate emulators called simulators before trying it on the real hardware. This is so that software can be produced and tested before the final hardware exists in large quantities, so that it can be tested without taking the time to copy the program to be debugged at a low level and without introducing the side effects of a debugger
. In many cases, the simulator is actually produced by the company providing the hardware, which theoretically increases its accuracy.
Math coprocessor emulators allow programs compiled with math instructions to run on machines that don't have the coprocessor installed, but the extra work done by the CPU may slow the system down. If a math coprocessor isn't installed or present on the CPU, when the CPU executes any coprocessor instruction it will make a determined interrupt (coprocessor not available), calling the math emulator routines. When the instruction is successfully emulated, the program continues executing.
Most often, an emulator will be composed of the following modules:
Buses are often not emulated, either for reasons of performance or simplicity, and virtual peripherals communicate directly with the CPU or the memory subsystem.
This clearly is the case whenever the emulated hardware allows for advanced memory
management (in which case, the MMU
logic can be embedded in the memory emulator, made a module of its own, or sometimes integrated into the CPU simulator).
Even if the emulated computer does not feature an MMU, though, there are usually other factors that break the equivalence between logical and physical memory: many (if not most) architecture offer memory-mapped I/O
; even those that do not almost invariably have a block of logical memory mapped to ROM
, which means that the memory-array module must be discarded if the read-only nature of ROM is to be emulated. Features such as bank switching
or segmentation
may also complicate memory emulation.
As a result, most emulators implement at least two procedures for writing to and reading from logical memory, and it is these procedures' duty to map every access to the correct location of the correct object.
On a base-limit addressing system where memory from address 0 to address ROMSIZE-1 is read-only memory, while the rest is RAM, something along the line of the following procedures would be typical:
The simplest form of a CPU simulator is an interpreter
, which is a computer program that follows the execution flow of the emulated program code and, for every machine code instruction encountered, executes operations on the host processor that are semantically equivalent to the original instructions.
This is made possible by assigning a variable
to each register
and flag
of the simulated CPU. The logic of the simulated CPU can then more or less be directly translated into software algorithms, creating a software re-implementation that basically mirrors the original hardware implementation.
The following example illustrates how CPU simulation can be accomplished by an interpreter. In this case, interrupts are checked-for before every instruction executed, though this behavior is rare in real emulators for performance reasons.
Interpreters are very popular as computer simulators, as they are much simpler to implement than more time-efficient alternative solutions, and their speed is more than adequate for emulating computers of more than roughly a decade ago on modern machines.
However, the speed penalty inherent in interpretation can be a problem when emulating computers whose processor speed is on the same order of magnitude
as the host machine. Until not many years ago, emulation in such situations was considered completely impractical by many.
What allowed breaking through this restriction were the advances in dynamic recompilation
techniques. Simple a priori translation of emulated program code into code runnable on the host architecture is usually impossible because of several reasons:
Various forms of dynamic recompilation, including the popular Just In Time compiler (JIT) technique, try to circumvent these problems by waiting until the processor control flow jumps into a location containing untranslated code, and only then ("just in time") translates a block of the code into host code that can be executed.
The translated code is kept in a code cache
, and the original code is not lost or affected; this way, even data segments can be (meaninglessly) translated by the recompiler, resulting in no more than a waste of translation time.
Speed may not be desirable as some older games were not designed with the speed of faster computers in mind. A game designed for a 30 MHz PC with a level timer of 300 game seconds might only give the player 30 seconds on a 300 MHz PC. Other programs, such as some DOS programs, may not even run on faster computers. Particularly when emulating computers which were "closed-box", in which changes to the core of the system were not typical, software may use techniques that depend on specific characteristics of the computer it ran on (i.e. its CPU's speed) and thus precise control of the speed of emulation is important for such applications to be properly emulated.
; each I/O device is thus often treated as a special case, and no consistent interface for virtual peripherals is provided.
This can result in a performance advantage, since each I/O module can be tailored to the characteristics of the emulated device; designs based on a standard, unified I/O API
can, however, rival such simpler models, if well thought-out, and they have the additional advantage of "automatically" providing a plug-in service through which third-party virtual devices can be used within the emulator.
A unified I/O API may not necessarily mirror the structure of the real hardware bus: bus design is limited by several electric constraints and a need for hardware concurrency management that can mostly be ignored in a software implementation.
Even in emulators that treat each device as a special case, there is usually a common basic infrastructure for:
They discovered that using microcode
hardware instead of software simulation, to execute programs written for earlier IBM computers, dramatically speeded up simulation. Earlier in 1957, IBM provided the IBM 709 computer with an interpreter
program (software) to execute legacy programs written for the IBM 704
to run on the IBM 709
and later on the IBM 7090 In 1963, when microcode was first used to speed up this simulation process, IBM engineers coined the term "emulator" to describe the concept.
It has recently become common to use the word "emulate" in the context of software. However, before 1980, "emulation" referred only to emulation with a hardware or microcode assist, while "simulation" referred to pure software emulation. For example, a computer specially built for running programs designed for another architecture is an emulator. In contrast, a simulator could be a program which runs on a PC, so that old Atari games can be simulated on it. Purists continue to insist on this distinction, but currently the term "emulation" often means the complete imitation of a machine executing binary code.
or compiler
language, rather than in binary machine code
. By using a functional simulator, programmers can execute and trace selected sections of source code to search for programming errors (bugs), without generating binary code. This is distinct from simulating execution of binary code, which is software emulation.
The first functional simulator was written by Autonetics
about 1960 for testing assembly language programs for later execution in military computer D-17B
. This made it possible for flight programs to be written, executed, and tested before D-17B computer hardware had been built. Autonetics also programmed a functional simulator for testing flight programs for later execution in the military computer D-37C
.
has helped in the spread of console emulators, as most - if not all - would be unavailable for sale in retail outlets. Examples of console emulators that have been released in the last 2 decades are: Dolphin
, Zsnes
, Kega Fusion, Desmume
, Epsxe
, Project64
, Visual Boy Advance, NullDC
and Nestopia
.
operating systems or other host systems such as HP-UX
or OpenVMS
. Terminals such as the IBM 3270
or VT100
and many others, are no longer produced as physical devices. Instead, software running on modern operating systems simulates a "dumb" terminal and is able to render the graphical and text elements of the host application, send keystrokes and process commands using the appropriate terminal protocol. Some terminal emulation applications include Attachmate Reflection
, IBM Personal Communications, Stromasys CHARON-VAX/AXP and Micro Focus Rumba.
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, an emulator is hardware or software or both that duplicates (or emulates) the functions of a first computer system in a different second computer system, so that the behavior of the second system closely resembles the behavior of the first system. This focus on exact reproduction of external behavior is in contrast to some other forms of computer simulation
Computer simulation
A computer simulation, a computer model, or a computational model is a computer program, or network of computers, that attempts to simulate an abstract model of a particular system...
, in which an abstract model of a system is being simulated. For example, a computer simulation of a hurricane or a chemical reaction is not emulation.
Emulators in computing
Emulation refers to the ability of a computer programComputer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
in an electronic device to emulate (imitate) another program or device. Many printers
Computer printer
In computing, a printer is a peripheral which produces a text or graphics of documents stored in electronic form, usually on physical print media such as paper or transparencies. Many printers are primarily used as local peripherals, and are attached by a printer cable or, in most new printers, a...
, for example, are designed to emulate Hewlett-Packard
Hewlett-Packard
Hewlett-Packard Company or HP is an American multinational information technology corporation headquartered in Palo Alto, California, USA that provides products, technologies, softwares, solutions and services to consumers, small- and medium-sized businesses and large enterprises, including...
LaserJet
LaserJet
LaserJet as a brand name identifies the line of dry electrophotographic laser printers marketed by the American computer-company Hewlett-Packard . The HP LaserJet was the world's first desktop laser printer.-Technology:...
printers because so much software is written for HP printers. If a non-HP printer emulates an HP printer, any software written for a real HP printer will also run in the non-HP printer emulation and produce equivalent printing.
A hardware emulator is an emulator which takes the form of a hardware device. Examples include the DOS-compatible card installed in some old-world Macintoshes like Centris 610 or Performa 630 that allowed them to run PC programs and FPGA
Field-programmable gate array
A field-programmable gate array is an integrated circuit designed to be configured by the customer or designer after manufacturing—hence "field-programmable"...
-based hardware emulator
Hardware emulation
In integrated circuit design, hardware emulation is the process of imitating the behavior of one or more pieces of hardware with another piece of hardware, typically a special purpose emulation system. The emulation model is usually based on RTL source code, which is compiled into the format...
s.
In a theoretical sense, the Church-Turing thesis implies that any operating environment can be emulated within any other. However, in practice, it can be quite difficult, particularly when the exact behavior of the system to be emulated is not documented and has to be deduced through reverse engineering
Reverse engineering
Reverse engineering is the process of discovering the technological principles of a device, object, or system through analysis of its structure, function, and operation...
. It also says nothing about timing constraints; if the emulator does not perform as quickly as the original hardware, the emulated software may run much more slowly than it would have on the original hardware, possibly triggering time interrupts that alter performance.
Emulation in preservation
Emulation is a strategy in digital preservationDigital preservation
Digital preservation is the set of processes, activities and management of digital information over time to ensure its long term accessibility. The goal of digital preservation is to preserve materials resulting from digital reformatting, and particularly information that is born-digital with no...
to combat obsolescence
Obsolescence
Obsolescence is the state of being which occurs when an object, service or practice is no longer wanted even though it may still be in good working order. Obsolescence frequently occurs because a replacement has become available that is superior in one or more aspects. Obsolete refers to something...
. Emulation focuses on recreating an original computer environment, which can be time-consuming and difficult to achieve, but valuable because of its ability to maintain a closer connection to the authenticity of the digital object.
Emulation addresses the original hardware
Computer hardware
Personal computer hardware are component devices which are typically installed into or peripheral to a computer case to create a personal computer upon which system software is installed including a firmware interface such as a BIOS and an operating system which supports application software that...
and software
Computer software
Computer software, or just software, is a collection of computer programs and related data that provide the instructions for telling a computer what to do and how to do it....
environment of the digital object, and recreates it on a current machine. The emulator allows the user to have access to any kind of application
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
or operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
on a current platform, while the software
Computer software
Computer software, or just software, is a collection of computer programs and related data that provide the instructions for telling a computer what to do and how to do it....
runs as it did in its original environment. Jeffery Rothenberg, an early proponent of emulation as a digital preservation
Digital preservation
Digital preservation is the set of processes, activities and management of digital information over time to ensure its long term accessibility. The goal of digital preservation is to preserve materials resulting from digital reformatting, and particularly information that is born-digital with no...
strategy states, "the ideal approach would provide a single extensible, long-term solution that can be designed once and for all and applied uniformly, automatically, and in synchrony (for example, at every refresh cycle) to all types of documents and media". He further states that this should not only apply to out of date systems, but also be upwardly mobile to future unknown systems. Practically speaking, when a certain application is released in a new version, rather than address compatibility
Computer compatibility
A family of computer models is said to be compatible if certain software that runs on one of the models can also be run on all other models of the family. The computer models may differ in performance, reliability or some other characteristic...
issues and migration
Data migration
Data migration is the process of transferring data between storage types, formats, or computer systems. Data migration is usually performed programmatically to achieve an automated migration, freeing up human resources from tedious tasks...
for every digital object created in the previous version of that application
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
, one could create an emulator for the application
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
, allowing access to all of said digital objects.
Benefits
- Emulators maintain the original look, feel, and behavior of the digital object, which is just as important as the digital data itself.
- Despite the original cost of developing an emulator, it may prove to be the more cost efficient solution over time.
- Reduces laborWage labourWage labour is the socioeconomic relationship between a worker and an employer, where the worker sells their labour under a formal or informal employment contract. These transactions usually occur in a labour market where wages are market determined...
hours, because rather than continuing an ongoing task of continual data migrationData migrationData migration is the process of transferring data between storage types, formats, or computer systems. Data migration is usually performed programmatically to achieve an automated migration, freeing up human resources from tedious tasks...
for every digital object, once the library of past and present operating systems and application softwareApplication softwareApplication software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
is established in an emulator, these same technologies are used for every document using those platforms. - Many emulators have already been developed and released under GNU General Public LicenseGNU General Public LicenseThe GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
through the open sourceOpen sourceThe term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
environment, allowing for wide scale collaboration. - Emulators allow video games exclusive to one system to be played on another. For example, a PlayStation 2PlayStation 2The PlayStation 2 is a sixth-generation video game console manufactured by Sony as part of the PlayStation series. Its development was announced in March 1999 and it was first released on March 4, 2000, in Japan...
exclusive video game could (in theory) be played on a PCPersonal computerA personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...
or Xbox 360Xbox 360The Xbox 360 is the second video game console produced by Microsoft and the successor to the Xbox. The Xbox 360 competes with Sony's PlayStation 3 and Nintendo's Wii as part of the seventh generation of video game consoles...
using an emulator.
Obstacles
- Intellectual propertyIntellectual propertyIntellectual property is a term referring to a number of distinct types of creations of the mind for which a set of exclusive rights are recognized—and the corresponding fields of law...
- Many technology vendors implemented non-standard features during program development in order to establish their niche in the market, while simultaneously applying ongoing upgrades to remain competitive. While this may have advanced the technology industry and increased vendor’s market shareMarket shareMarket share is the percentage of a market accounted for by a specific entity. In a survey of nearly 200 senior marketing managers, 67 percent responded that they found the "dollar market share" metric very useful, while 61% found "unit market share" very useful.Marketers need to be able to...
, it has left users lost in a preservation nightmare with little supporting documentation due to the proprietary nature of the hardware and software. - CopyrightCopyrightCopyright is a legal concept, enacted by most governments, giving the creator of an original work exclusive rights to it, usually for a limited time...
laws are not yet in effect to address saving the documentation and specifications of proprietary software and hardware in an emulator module.
Emulators in new media art
Because of its primary use of digital formats, new media artNew media art
New media art is a genre that encompasses artworks created with new media technologies, including digital art, computer graphics, computer animation, virtual art, Internet art, interactive art, computer robotics, and art as biotechnology...
relies heavily on emulation as a preservation strategy. Artists such as Cory Arcangel
Cory Arcangel
Cory Arcangel is a Brooklyn, New York artist who makes work in many different media, including drawing, music, video, performance,, and video game modifications, for which he is perhaps best known...
specialize in resurrecting obsolete technologies in their artwork and recognize the importance of a decentralized and deinstitutionalized process for the preservation of digital culture.
In many cases, the goal of emulation in new media art is to preserve a digital medium so that it can be saved indefinitely and reproduced without error, so that there is no reliance on hardware that ages and becomes obsolete. The paradox is that the emulation and the emulator have to be made to work on future computers.
Types of emulators
Most emulators just emulate a hardware architecture—if operating system firmware or software is required for the desired software, it must be provided as well (and may itself be emulated). Both the OS and the software will then be interpreted by the emulator, rather than being run by native hardware. Apart from this interpreter for the emulated binary machine's language, some other hardware (such as input or output devices) must be provided in virtual form as well; for example, if writing to a specific memory location should influence what is displayed on the screen, then this would need to be emulated.While emulation could, if taken to the extreme, go down to the atomic level, basing its output on a simulation of the actual circuitry from a virtual power source, this would be a highly unusual solution. Emulators typically stop at a simulation of the documented hardware specifications and digital logic. Sufficient emulation of some hardware platforms requires extreme accuracy, down to the level of individual clock cycles, undocumented features, unpredictable analog elements, and implementation bugs. This is particularly the case with classic home computers such as the Commodore 64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...
, whose software often depends on highly sophisticated low-level programming tricks invented by game programmers and the demoscene
Demoscene
The demoscene is a computer art subculture that specializes in producing demos, which are non-interactive audio-visual presentations that run in real-time on a computer...
.
In contrast, some other platforms have had very little use of direct hardware addressing. In these cases, a simple compatibility layer
Compatibility layer
A compatibility layer is a term that refers to components that allow for non-native support of components.In software engineering, a compatibility layer allows binaries for a legacy or foreign system to run on a host system. This translates system calls for the foreign system into native system...
may suffice. This translates system calls for the emulated system into system calls for the host system e.g., the Linux compatibility layer used on *BSD to run closed source Linux native software on FreeBSD, NetBSD and OpenBSD.
Developers of software for embedded system
Embedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...
s or video game console
Video game console
A video game console is an interactive entertainment computer or customized computer system that produces a video display signal which can be used with a display device to display a video game...
s often design their software on especially accurate emulators called simulators before trying it on the real hardware. This is so that software can be produced and tested before the final hardware exists in large quantities, so that it can be tested without taking the time to copy the program to be debugged at a low level and without introducing the side effects of a debugger
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator , a technique that allows great power in its ability to halt when specific conditions are encountered but which...
. In many cases, the simulator is actually produced by the company providing the hardware, which theoretically increases its accuracy.
Math coprocessor emulators allow programs compiled with math instructions to run on machines that don't have the coprocessor installed, but the extra work done by the CPU may slow the system down. If a math coprocessor isn't installed or present on the CPU, when the CPU executes any coprocessor instruction it will make a determined interrupt (coprocessor not available), calling the math emulator routines. When the instruction is successfully emulated, the program continues executing.
Structure of an emulator
Typically, an emulator is divided into modules that correspond roughly to the emulated computer's subsystems.Most often, an emulator will be composed of the following modules:
- a CPU emulator or CPU simulator (the two terms are mostly interchangeable in this case)
- a memory subsystem module
- various I/O devices emulators
Buses are often not emulated, either for reasons of performance or simplicity, and virtual peripherals communicate directly with the CPU or the memory subsystem.
Memory subsystem
It is possible for the memory subsystem emulation to be reduced to simply an array of elements each sized like an emulated word; however, this model falls very quickly as soon as any location in the computer's logical memory does not match physical memory.This clearly is the case whenever the emulated hardware allows for advanced memory
management (in which case, the MMU
Memory management unit
A memory management unit , sometimes called paged memory management unit , is a computer hardware component responsible for handling accesses to memory requested by the CPU...
logic can be embedded in the memory emulator, made a module of its own, or sometimes integrated into the CPU simulator).
Even if the emulated computer does not feature an MMU, though, there are usually other factors that break the equivalence between logical and physical memory: many (if not most) architecture offer memory-mapped I/O
Memory-mapped I/O
Memory-mapped I/O and port I/O are two complementary methods of performing input/output between the CPU and peripheral devices in a computer...
; even those that do not almost invariably have a block of logical memory mapped to ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
, which means that the memory-array module must be discarded if the read-only nature of ROM is to be emulated. Features such as bank switching
Bank switching
Bank switching is a technique to increase the amount of usable memory beyond the amount directly addressable by the processor. It can be used to configure a system differently at different times; for example, a ROM required to start a system from diskette could be switched out when no longer...
or segmentation
Memory segment
x86 memory segmentation refers to the implementation of memory segmentation on the x86 architecture. Memory is divided into portions that may be addressed by a single index register without changing a 16-bit segment selector. In real mode or V86 mode, a segment is always 64 kilobytes in size . In...
may also complicate memory emulation.
As a result, most emulators implement at least two procedures for writing to and reading from logical memory, and it is these procedures' duty to map every access to the correct location of the correct object.
On a base-limit addressing system where memory from address 0 to address ROMSIZE-1 is read-only memory, while the rest is RAM, something along the line of the following procedures would be typical:
CPU simulator
The CPU simulator is often the most complicated part of an emulator. Many emulators are written using "pre-packaged" CPU simulators, in order to concentrate on good and efficient emulation of a specific machine.The simplest form of a CPU simulator is an interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
, which is a computer program that follows the execution flow of the emulated program code and, for every machine code instruction encountered, executes operations on the host processor that are semantically equivalent to the original instructions.
This is made possible by assigning a variable
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...
to each register
Processor register
In computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
and flag
Flag (computing)
In computer programming, flag can refer to one or more bits that are used to store a binary value or code that has an assigned meaning, but can refer to uses of other data types...
of the simulated CPU. The logic of the simulated CPU can then more or less be directly translated into software algorithms, creating a software re-implementation that basically mirrors the original hardware implementation.
The following example illustrates how CPU simulation can be accomplished by an interpreter. In this case, interrupts are checked-for before every instruction executed, though this behavior is rare in real emulators for performance reasons.
Interpreters are very popular as computer simulators, as they are much simpler to implement than more time-efficient alternative solutions, and their speed is more than adequate for emulating computers of more than roughly a decade ago on modern machines.
However, the speed penalty inherent in interpretation can be a problem when emulating computers whose processor speed is on the same order of magnitude
Order of magnitude
An order of magnitude is the class of scale or magnitude of any amount, where each class contains values of a fixed ratio to the class preceding it. In its most common usage, the amount being scaled is 10 and the scale is the exponent being applied to this amount...
as the host machine. Until not many years ago, emulation in such situations was considered completely impractical by many.
What allowed breaking through this restriction were the advances in dynamic recompilation
Dynamic recompilation
In computer science, dynamic recompilation is a feature of some emulators and virtual machines, where the system may recompile some part of a program during execution...
techniques. Simple a priori translation of emulated program code into code runnable on the host architecture is usually impossible because of several reasons:
- code may be modified while in RAMSelf-modifying codeIn computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
, even if it is modified only by the emulated operating system when loading the code (for example from disk) - there may not be a way to reliably distinguish dataDataThe term data refers to qualitative or quantitative attributes of a variable or set of variables. Data are typically the results of measurements and can be the basis of graphs, images, or observations of a set of variables. Data are often viewed as the lowest level of abstraction from which...
(which should not be translated) from executableExecutableIn computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...
codeCodeA code is a rule for converting a piece of information into another form or representation , not necessarily of the same type....
.
Various forms of dynamic recompilation, including the popular Just In Time compiler (JIT) technique, try to circumvent these problems by waiting until the processor control flow jumps into a location containing untranslated code, and only then ("just in time") translates a block of the code into host code that can be executed.
The translated code is kept in a code cache
Cache
In computer engineering, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere...
, and the original code is not lost or affected; this way, even data segments can be (meaninglessly) translated by the recompiler, resulting in no more than a waste of translation time.
Speed may not be desirable as some older games were not designed with the speed of faster computers in mind. A game designed for a 30 MHz PC with a level timer of 300 game seconds might only give the player 30 seconds on a 300 MHz PC. Other programs, such as some DOS programs, may not even run on faster computers. Particularly when emulating computers which were "closed-box", in which changes to the core of the system were not typical, software may use techniques that depend on specific characteristics of the computer it ran on (i.e. its CPU's speed) and thus precise control of the speed of emulation is important for such applications to be properly emulated.
I/O
Most emulators do not, as mentioned earlier, emulate the main system busSystem bus
A system bus is a single computer bus that connects the major components of a computer system. The technique was developed to reduce costs and improve modularity....
; each I/O device is thus often treated as a special case, and no consistent interface for virtual peripherals is provided.
This can result in a performance advantage, since each I/O module can be tailored to the characteristics of the emulated device; designs based on a standard, unified I/O API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
can, however, rival such simpler models, if well thought-out, and they have the additional advantage of "automatically" providing a plug-in service through which third-party virtual devices can be used within the emulator.
A unified I/O API may not necessarily mirror the structure of the real hardware bus: bus design is limited by several electric constraints and a need for hardware concurrency management that can mostly be ignored in a software implementation.
Even in emulators that treat each device as a special case, there is usually a common basic infrastructure for:
- managing interruptInterruptIn computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
s, by means of a procedure that sets flags readable by the CPU simulator whenever an interrupt is raised, allowing the virtual CPU to "poll for (virtual) interrupts" - writing to and reading from physical memory, by means of two procedures similar to the ones dealing with logical memory (although, contrary to the latter, the former can often be left out, and direct references to the memory array be employed instead)
Emulation versus simulation
The word "emulator" was coined in 1963 at IBM during development of the NPL (IBM 360) product line, using a "new combination of software, microcode, and hardware".They discovered that using microcode
Microcode
Microcode is a layer of hardware-level instructions and/or data structures involved in the implementation of higher level machine code instructions in many computers and other processors; it resides in special high-speed memory and translates machine instructions into sequences of detailed...
hardware instead of software simulation, to execute programs written for earlier IBM computers, dramatically speeded up simulation. Earlier in 1957, IBM provided the IBM 709 computer with an interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
program (software) to execute legacy programs written for the IBM 704
IBM 704
The IBM 704, the first mass-produced computer with floating point arithmetic hardware, was introduced by IBM in 1954. The 704 was significantly improved over the IBM 701 in terms of architecture as well as implementations which were not compatible with its predecessor.Changes from the 701 included...
to run on the IBM 709
IBM 709
The IBM 709 was an early computer system introduced by IBM in August, 1958. It was an improved version of the IBM 704 and the second member of the IBM 700/7000 series of scientific computers....
and later on the IBM 7090 In 1963, when microcode was first used to speed up this simulation process, IBM engineers coined the term "emulator" to describe the concept.
It has recently become common to use the word "emulate" in the context of software. However, before 1980, "emulation" referred only to emulation with a hardware or microcode assist, while "simulation" referred to pure software emulation. For example, a computer specially built for running programs designed for another architecture is an emulator. In contrast, a simulator could be a program which runs on a PC, so that old Atari games can be simulated on it. Purists continue to insist on this distinction, but currently the term "emulation" often means the complete imitation of a machine executing binary code.
Logic simulators
Logic simulation is the use of a computer program to simulate the operation of a digital circuit such as a processor. This is done after a digital circuit has been designed in logic equations, but before the circuit is fabricated in hardware.Functional simulators
Functional simulation is the use of a computer program to simulate the execution of a second computer program written in symbolic assembly languageAssembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
or compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...
language, rather than in binary machine code
Machine code
Machine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...
. By using a functional simulator, programmers can execute and trace selected sections of source code to search for programming errors (bugs), without generating binary code. This is distinct from simulating execution of binary code, which is software emulation.
The first functional simulator was written by Autonetics
Autonetics
Autonetics was a division of North American Aviation. Through a series of mergers, Autonetics is now part of Boeing.- General Background of the Anaheim Facility :...
about 1960 for testing assembly language programs for later execution in military computer D-17B
D-17B
The D-17B is a computer used in missile guidance systems, specifically the Minuteman I NS-1OQ missile guidance system, which contains a D-17B computer, the associated stable platform, and power supplies. The D-17B weighs approximately , contains 1,521 transistors, 6,282 diodes, 1,116 capacitors,...
. This made it possible for flight programs to be written, executed, and tested before D-17B computer hardware had been built. Autonetics also programmed a functional simulator for testing flight programs for later execution in the military computer D-37C
D-37C
The D-37C is the computer component of the all-inertial NS-17 Missile Guidance Set for accurately navigating to its target thousands of miles away. The NS-17 MGS was used in the Minuteman II ICBM...
.
Video game console emulators
Video game console emulators are programs that allow a computer or modern console to emulate a video game console. They are most often used to play older video games on personal computers and modern video game consoles, but they are also used to translate games into other languages, to modify existing games, and in the development process of home brew demos and new games for older systems. The internetInternet
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite to serve billions of users worldwide...
has helped in the spread of console emulators, as most - if not all - would be unavailable for sale in retail outlets. Examples of console emulators that have been released in the last 2 decades are: Dolphin
Dolphin (emulator)
Dolphin is an open-source Nintendo GameCube, Wii, and Triforce emulator for Microsoft Windows, Linux, and Mac OS X . It is the first emulator to successfully run commercial Nintendo GameCube and Wii games and is the only emulator capable of running commercial Wii games...
, Zsnes
ZSNES
ZSNES is a free software SNES emulator written mostly in x86 assembly with official ports for Linux, MS-DOS, Mac OS X, Windows and an unofficial port for Xbox.-Background:...
, Kega Fusion, Desmume
DeSmuME
DeSmuME is an open source Nintendo DS emulator for Linux, Mac OS and Windows. Its name is derived from emu which is short for emulator, DS and ME.-The original DeSmuME:...
, Epsxe
EPSXe
ePSXe is a PlayStation emulator for x86-based PC hardware with Microsoft Windows or Linux. It was written by three authors, using the aliases "Calb", "_Demo_", and "Galtor"...
, Project64
Project64
Project64 is a proprietary Nintendo 64 emulator for Windows. It employs a plug-in system that allows third-party software developers to create their own implementation of a specified component...
, Visual Boy Advance, NullDC
NullDC
nullDC is an open source Sega Dreamcast and NAOMI videogame systems emulator for Microsoft Windows.After not being updated for almost two years, the project's author drk||Raziel announced his decision to release the source code with his newest build....
and Nestopia
Nestopia
Nestopia is an open source NES/Famicom emulator designed to emulate the NES hardware as accurately as possible. Originally for Windows only, Nestopia has been ported to the Mac OS X and Linux operating systems.-Features:...
.
Terminal emulators
Terminal emulators are software programs that provide modern computers and devices interactive access to applications running on mainframe computerMainframe computer
Mainframes are powerful computers used primarily by corporate and governmental organizations for critical applications, bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.The term originally referred to the...
operating systems or other host systems such as HP-UX
HP-UX
HP-UX is Hewlett-Packard's proprietary implementation of the Unix operating system, based on UNIX System V and first released in 1984...
or OpenVMS
OpenVMS
OpenVMS , previously known as VAX-11/VMS, VAX/VMS or VMS, is a computer server operating system that runs on VAX, Alpha and Itanium-based families of computers. Contrary to what its name suggests, OpenVMS is not open source software; however, the source listings are available for purchase...
. Terminals such as the IBM 3270
IBM 3270
The IBM 3270 is a class of block oriented terminals made by IBM since 1972 normally used to communicate with IBM mainframes. As such, it was the successor to the IBM 2260 display terminal. Due to the text colour on the original models, these terminals are informally known as green screen terminals...
or VT100
VT100
The VT100 is a video terminal that was made by Digital Equipment Corporation . Its detailed attributes became the de facto standard for terminal emulators.-History:...
and many others, are no longer produced as physical devices. Instead, software running on modern operating systems simulates a "dumb" terminal and is able to render the graphical and text elements of the host application, send keystrokes and process commands using the appropriate terminal protocol. Some terminal emulation applications include Attachmate Reflection
Attachmate
Attachmate Corporation is a software company owned by an investment group led by Francisco Partners, Golden Gate Capital, and Thoma Cressey Bravo. Attachmate focuses on terminal emulation, legacy modernization, managed file transfer, and enterprise fraud management software. Attachmate Corporation...
, IBM Personal Communications, Stromasys CHARON-VAX/AXP and Micro Focus Rumba.
Legal controversy
- See article Console emulator — Legal issues
See also
- The list of emulators
- The list of computer system emulators
- Computer simulationComputer simulationA computer simulation, a computer model, or a computational model is a computer program, or network of computers, that attempts to simulate an abstract model of a particular system...
is the larger field of modeling real-world phenomenon (e.g. physics and economy) using computers. - For rewriting a computer program into a different programming language or platform, see PortingPortingIn computer science, porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed...
. - Field-programmable gate arrayField-programmable gate arrayA field-programmable gate array is an integrated circuit designed to be configured by the customer or designer after manufacturing—hence "field-programmable"...
s (FPGAs) - Other uses of the term "emulator" in the field of computer science:
- Console emulator
- Flash emulatorFlash emulatorFour known emulators have been created in Flash :* Chip8* Commodore 64* ZX Spectrum* Nintendo Entertainment System...
- Instruction set simulatorInstruction Set SimulatorAn instruction set simulator is a simulation model, usually coded in a high-level programming language, which mimics the behavior of a mainframe or microprocessor by "reading" instructions and maintaining internal variables which represent the processor's registers.Instruction simulation is a...
- Server emulatorServer emulatorServer emulator, a term that is widely used to describe reimplementation of MMORPG game servers, typically clones proprietary commercial software by a third party. The term "private server" is also used while it may not be accurate as often the legitimate server is also privately owned...
- Terminal emulatorTerminal emulatorA terminal emulator, terminal application, term, or tty for short, is a program that emulates a video terminal within some other display architecture....
- Logic simulationLogic simulationLogic simulation is the use of a computer program to simulate the operation of a digital circuit. Logic simulation is the primary tool used for verifying the logical correctness of a hardware design. In many cases logic simulation is the first activity performed in the process of taking a hardware...
- Functional simulationHigh-level emulationHigh-level emulation is an approach for construction of emulators, especially for video game consoles, which attempts to simulate the response of the system rather than accurately recreating its internal design....
- Translation:
- Binary translationBinary translationIn computing, binary translation is the emulation of one instruction set by another through translation of code. Sequences of instructions are translated from the source to the target instruction set...
- Binary translation
- Antenna emulator
- In-circuit emulatorIn-circuit emulatorAn in-circuit emulator is a hardware device used to debug the software of an embedded system. It was historically in the form of bond-out processor which has many internal signals brought out for the purpose of debugging...
(ICE)- Joint Test Action Group
- Background Debug Mode interfaceBackground Debug Mode interfaceBackground Debug Mode interface is an electronic interface that allows debugging of embedded systems. Specifically, it provides in-circuit debugging functionality in microcontrollers...
- QEMUQEMUQEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures....
- Q (emulator)Q (emulator)Q is a free emulator software that runs on Mac OS X, including OS X on PowerPC. Q is Mike Kronenberg's port of the open source and generic processor emulator QEMU. Q uses Cocoa and other Apple technologies, such as Core Image and Core Audio, to achieve its emulation...
- Hardware emulationHardware emulationIn integrated circuit design, hardware emulation is the process of imitating the behavior of one or more pieces of hardware with another piece of hardware, typically a special purpose emulation system. The emulation model is usually based on RTL source code, which is compiled into the format...
- Hardware-assisted virtualization
- Virtual machineVirtual machineA virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...
- MAMEMAMEMAME is an emulator application designed to recreate the hardware of arcade game systems in software on modern personal computers and other platforms. The intention is to preserve gaming history by preventing vintage games from being lost or forgotten...
- MESSMESSMulti Emulator Super System is an emulator for many game consoles and computer systems, based on the MAME core.The primary purpose of MESS is to preserve decades of computer and console history...
- data migrationData migrationData migration is the process of transferring data between storage types, formats, or computer systems. Data migration is usually performed programmatically to achieve an automated migration, freeing up human resources from tedious tasks...
- backward compatibilityBackward compatibilityIn the context of telecommunications and computing, a device or technology is said to be backward or downward compatible if it can work with input generated by an older device...
- forward compatibilityForward compatibilityForward compatibility or upward compatibility is a compatibility concept for systems design, as e.g. backward compatibility. Forward compatibility aims at the ability of a design to gracefully accept input intended for later versions of itself...
- Keeping Emulation Environments PortableKeeping Emulation Environments PortableKEEP - Keeping Emulation Environments Portable is a European project aiming to preserve digital heritage by emulating all platforms rather than continually converting data to newer formats....
External links
- Emuwiki.com is a repertory of emulators and their respective histories.