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 machine's language, some other hardware (such as input
or output devices) must be provided in virtual form as well; if
writing to a specific memory location should influence the screen,
for example, this will have to be emulated. Sufficient emulation of
some hardware platforms requires extreme accuracy, down to the level
of individual clock cycles, undocumented features 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.
Developers of software for embedded systems or video game consoles
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 the hardware, or so that it can be
debugged at a low level 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.
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)
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.
A detailed description of the internals of a specific emulator can
be found in the ElectrEm article. |
|