TAG | gaming
NES emulation is something that has been done and done again. At this point in time, there’s really no good reason to write a NES emulator other than to educate yourself; however, that’s exactly what I want to do.
I decided I wanted to learn more about how emulation works, so I started reading other people’s articles on emulation and their source code. In doing this, I noticed one consistent thing: these emulators were coded for speed and accuracy in emulation. Speed and accuracy are both wonderful things, but these jumbled messes of highly-optimized code strewn across poorly-documented files were hard for a beginner to understand. The way things are now, it’s quite hard for somebody with no prior knowledge or experience to jump right in to emulation, and I want to change that.
I am currently working on a NES emulator (it doesn’t have a name yet, but I’m sure it will be stupid). The main design goals behind this emulator are not speed and accuracy. Modern CPUs are fast enough to handle a very inefficient NES emulator, and accuracy (emulation of specific hardware quirks) can be added later as bug reports come in for different games. The purpose of this emulator is to be extremely readable and accessible to anyone with a good grasp of the C language. In my opinion, this means highly modular code (each hardware component should have its own .c file), no huge abstractions and macros to hide what work is really being done, and no cryptic-named files full of #defines or strange functions that don’t really belong anywhere.
Most importantly, I am going to document every function in every file. I want for somebody with a decent understanding of the NES hardware to be able to immediately understand what my program is doing and how.
This post has mostly been a note to myself of goals I need to keep sight of, but there will be real code to see shortly. As soon as I get the emulator in a somewhat-working state, I’ll upload the code and begin explaining EVERYTHING.
I’m slowly, part-by-part building myself a new gaming rig. Currently I’ve got a strange mesh of nice parts in a crappy old computer, but hopefully I will have something nice built by the end of the year. In my old Dell Dimension 4700 (3.2 GHZ Pentium 4) I currently have a brand-spankin’-new Radeon 4890 graphics card and an Antec Earthwatts 650W PSU.
It’s hilarious playing games on this computer- I can play a lot of games (Source engine and more) at maxed out settings with silky-smooth frame rates, but as soon as I have to load a level or save or ANYTHING that depends on CPU/HDD/any other component, I better prepare for a 10 minute wait. I’m looking to take advantage of Intel’s RetailEdge deal this winter to eventually build a sweet Core i7 rig, but we’ll see how that works out.
