Friday, May 7, 2010

The Art of Emulation – Part 3

In my last couple of posts I briefly explained that emulation is simply taking code written for one platform and making it run on another. This is done by translating the input to the native format, completing the correct processing and then translating the output. This explanation is necessarily lacking in details. If it wasn't it would be a book not a blog post. All this is just a very cursory overview.

To wrap this all up I decided to talk a bit about my personal method of coding an emulator. To start with I consider it best to bring the emulation down to the lowest possible level. For instance, I don't think about how I would emulate an Atari 2600 I think about how I would emulate the 6502 processor. Each piece of the Atari 2600 can be emulated separately. Once each of these pieces is complete they can be “assembled” into a working Atari 2600 emulator. For those of you who are familiar with Object Oriented Programming you understand the concept.

Doing things this way has several benefits. First, it allows you to test each component and do you best to bang out bugs while the situation is less complicated. Second, as each of the pieces are completely separately, several coders can work on the same emulator with very little communication. Once a standard I/O is agreed on each programmer can work on their section independently. Lastly, once a particular chip has been successfully emulated it can be used in other projects. For instance both the Atari 2600 and the NES use a 6502 processor (there are slight differences... but still...). Many systems used the Z80 processor. Once these chips have been developed they can be used across multiple emulators.

Keep in mind all these ideas are being presented by a man who has never successfully completed an emulator, but the theories are sound. Console Classix plans to begin pursuing it's own emulation project in the future. We just have to line up more help. I hope this post has got a few people out there considering the idea.

No comments:

Post a Comment