P. 1
Study of the techniques for emulation programming by Victor Moya del Barrio

Study of the techniques for emulation programming by Victor Moya del Barrio

4.4

|Views: 12,422|Likes:
Published by Moe B. Us
In the time I started to learn about how an emulator is programmed I found that there was a limited amount of documentation. Documentation about how an emulator should be programmed or about the characteristics of the machines to be emulated. Thinking about how to contribute to the emulation I found that the second part would mean the construction of a database with all the information available of a large amount of computers and systems. This wasn’t very suited neither with a university project for
with my own preferences, and there are a few sites in Internet which more or less serve to that purpose. The first part meant to study and learn the various techniques and knowledges related to emulator programming. Since I like a lot learning and also writing I thought that could be my way to contribute. So I thought it would be nice to have a large, ordered and precise documentation about how to program an emulator. That is the purpose of this document and my work in the last months
In the time I started to learn about how an emulator is programmed I found that there was a limited amount of documentation. Documentation about how an emulator should be programmed or about the characteristics of the machines to be emulated. Thinking about how to contribute to the emulation I found that the second part would mean the construction of a database with all the information available of a large amount of computers and systems. This wasn’t very suited neither with a university project for
with my own preferences, and there are a few sites in Internet which more or less serve to that purpose. The first part meant to study and learn the various techniques and knowledges related to emulator programming. Since I like a lot learning and also writing I thought that could be my way to contribute. So I thought it would be nice to have a large, ordered and precise documentation about how to program an emulator. That is the purpose of this document and my work in the last months

More info:

Published by: Moe B. Us on Jun 04, 2007
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

01/04/2016

pdf

text

original

The standard definition for emulation is “try to be equal or better than someone or something”. An
emulator is thus someone or something who or which emulates someone or something else.

Emulation in computers is the same, to emulate the behaviour of a hardware device in software or with a
different hardware, or to emulate the behaviour of a piece of software either with another hardware or
software. That is still a too general definition, because you can emulate from an OS to a sound card. And
the techniques used are absolutely different. Emulating a hardware device with another hardware device
just has to care about to output the same values than the original hardware for the same input values. That
is a task for electronic or VLSI design. But if you are emulating an OS over another OS that is a software
problem.

The kind of emulators which this document talks about are software emulators of computers. A
software computer emulator has to emulate all the components in a real computer using software
programs over another computer. The typical, Von Neumman, computer architecture is formed by one or
more CPUs which are the core of the computer and perform calculations, a bus, to which are attached
devices and memory, and the memory and devices. All those components must be emulated by software.
We will talk in this document about how each of those components could be emulated.

This definition is related with the concept of virtual machines (VM) like Java and others. A virtual
machine is any kind of computer which does not exists as a real hardware but it is implemented by
software over a real computer. A virtual machine has many uses like providing code portability or hiding
specific hardware characteristics to the software (for example the OS provides a virtual machine to the
user programs). And of course a virtual machine can be implemented to emulate another computer over
our computer. So an emulator can be viewed as a virtual machine.

With the purpose of being a bit more specific about what kind of emulators we are going to talk in this
document it is necessary to talk about our target and source computers. The target computer uses to be a
standard x86 based home PC running Windows 9X or DOS. This has changed lately and emulators are
being ported now to another PC systems like Macs and also to videogames consoles like DreamCast or
PlayStation. But the standard system is still a PC. The target machine determines the maximum
capabilities of the system in terms of calculation power, and thus the maximum hardware that will be
emulated correctly. A good approach for knowing the minimum hardware that is needed for emulating a
machine is multiplying the emulated machine capabilities by 10.

Our source computers can be divided in three groups: old or even new home computers, for example
Sinclair Spectrum, MSX, Commodore 64, Amiga or even Macintosh or PC; videogame consoles like
Sega Master System, Nintendo NES (8-bit), Super Nes, Mega Drive or even PSX, N64 and DC; and
video arcade machines like the old Space Invaders, Pacman, more modern SNK Neo Geo or Capcom
CPS1, to the newer Sega Model 1 and other 3D arcade machines.

All those computers share some characteristics, some more than others do of course. All of them use
cheap chips from the 8-bit era (6502, Zilog Z80, Intel 8080 and 8085, Motorola 6809), or from the 16-bit
era (Motorola 68000 and other versions, i8086) and the more modern ones use even middle level RISC
CPU (Mips, SH, Nec, ARM). Videogames consoles, arcade machines and some of the home computers
more related with videogames have powerful (in comparison with the CPU) hardware for producing
graphics and sound. And they only use a few more hardware for user input. Home computers use more
different hardware devices such keyboards, disk drives and communication ports.

Arcade machines use to be more powerful versions of the videogame consoles, with more memory and
extended capabilities. While a videoconsole can have hundred or thousands of games an arcade machine
has perhaps just ten to twenty games. The arcade machine hardware can also change a bit from one game
to the another while the console remains equal. So for an arcade machine is easier to test all the games to
see if they work correctly and correct problems in the emulator. In a console that is almost impossible
because it would be very time expensive to test thousands of games. Therefore console emulators usually
don’t support all the games.

Another characteristic of the machines to be emulated is the lack of ‘official’ information about its real
architecture and the characteristics of its hardware components. In almost all cases those machines are

11

proprietary. The information for building an emulator for those machines will come then from other
sources like schematics or reverse engineering.

The performance of our emulators is very important because both videogame consoles and arcade
machines are ‘real time machines’ (the games are time dependant) and game programmers use many
times the 100% of the capacity of the system. The game must run exactly at the same speed in the
emulator than in the original system. That means that if the emulator is too fast it must synchronize with
the original timing, and if the emulator is slow try to reduce the calculations (for example reduce the
number of frames displayed) to keep the original speed of the emulated machine. For computer emulators
this problem depends of the kind of programs that the computer is running, for example a word processor
is not a real time application, while a game uses to be.

Lately as PCs grown in power and GHz more modern machines are beginning to be emulated. Such
computers, like Nintendo 64, DreamCast or 3D arcade machines use powerful CPUs up to 200 MHz and
powerful 3D graphic chips. Those machines require more advanced techniques to be used to achieve
enough performance. They require a fast and accurate translation of the 3D directives of the machine 3D
hardware to the 3D PC directives (Direct3D or OpenGL). They also need from the more efficient
possible CPU emulation techniques like dynamic binary translation (or dynarec in short).

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->