Monday, May 3, 2010

The Art of Emulation – Part 1

So, how does emulation work? What exactly is emulation? This subject may or may not be of much interest to the few readers of this blog, but it is of interest to us here at Console Classix. Because of this I've decided to discuss it. At least, I've decide to give a cursory overview here. Many of our fans are programmers and we are always looking for people to help us do what we do. I hope that some of these coding fans may take a look at this and think to themselves “That sounds easy! I could help with that!” Still, my motivations aren't entirely selfish. Anyone who is interested in the subject needs a place to start. The small amount of information I put up here may help them get the ball rolling. I will warn you guys that this may get a bit long. There are some interesting things in it, you just have to plow through and try to keep your brain from going numb.

To start with, emulation is the process of making one computer system act like another (at least for the sake of this explanation). When you consider a modern PC you have several elements that make the machine useful to people. A computer allows input, processes data and then provides output. These are the first three elements we have to look at when we begin to plan an emulator. The forth element is software. The magic of software is that it takes the three hardware elements and makes the machine do something useful. So, for an emulator to do anything it has to be able to read software for one platform and make the hardware of a different platform act the correct way.

We have to start by looking at each of the three elements.

Input: The NES has two controllers that have a D-Pad and four buttons. The modern PC has a least a keyboard and mouse and possibly has a number of controllers plugged into it as well. The NES controls place input at a certain memory block. So, when you push the A button it updates a memory location that the game programmer can read. In order to use PC control to represent this an emulation coder has to catch the input and translate it into the form the NES uses. We'll come back to this, for now you just need to understand that you catch the PC input and translate it.

Processing: The NES has a CPU just like the PCs our clients use. I am going to give some detailed information on the CPU so we'll skip it for now. The NES also has video and sound processors. They take the data coming from the game and prepare it to be displayed on a TV and played on TV speakers respectively. The emulator has to make the PC process data in exactly the same way as the system being emulated.

Output: Here the emulation author has to take the data output by the NES and translate it in order to display the video and play the sound. As I said, this is just a cursory glance. I plan to add some detail before I'm done.

More Soon...

3 comments: