Monday, 30 August 2010

Writing an emulator

In this quick post, I'll go over the processes that led up to me writing emulators.

*First of all, a disclaimer. I am not an expert, or even a particularly advanced emulator author, but I am learning more everyday and really enjoying it. If you want to speak to expert emulator authors, go to a site like These people deserve enormous respect in my humble opinion.

From the very first time I used an emulator, I knew that I wanted to learn more about them, I don't even think I was a programmer at that time, it was the interest that motivated me from the start. The reason I chose to actually attempt to write emulators is simple, I love playing games, and I love low level programming tasks and learning what makes machines "tick", emulation is ideal for me. Unfortunately, I noticed that learning the theory behind emulation is easier said than done, not to mention that lack of simple documentation on the basics which can be maddening. Emulating a games machine, or any machine is not a simple thing to do (in my opinion), although obviously writing a PS2 emulator is going to be alot harder than writing a Gameboy emulator for example, so it's subjective.

Here's a few suggestions.
  • First of all, you obviously need to learn a programming language, i recommend C and/or C++ as most software, including most emulators will be written in this language, even Windows is written almost entirely in C.
  • Emulation is not really a good project for learning your language of choice, be confident in your language before you attempt writing any emulator, as you don't want to be discouraged from emulation by your lack of knowledge of a language, a language should be used like any other tool, which you should know how to make full use of before attempting projects like this. Although, I have heard of people saying that they learned to program by writing emulators, but I digress.
  •  Don't ever just copy somone elses source code because you can't figure it out yourself, this is a huge mistake and will ultimately screw you over, it feels so much better to know you have witten it all yourself.
  • Learn about the system you're trying to emulate before writing any code.
  • Learn about computer architecture before trying ti write an emulator.
  • Learn about bitwise operators like OR, EOR and AND. Also, learn about different numeral systems like binary and hexadecimal.
  • Find as much documentation as you can on the system you're trying to emulate.
  • Don't give up.
  • Have fun. :) 
  • ???
  • Profit!
Here are some links that will get you started writing emulators.

Don't know how to program in C++? Here's a good tutorial. 
Don't know how to program graphics and GUI in C++? Here's a good tutorial. 

Take a look at this video before writing an emulator, it will help you understand what the basics are. (not sure about the copyright, but I tried to contact the author, no response). If the link goes down, please tell me, i will re-upload it for you.

Confident in your language of choice? This is an awesome blog taking you step by step through how to write an emulator. From the Chip8, to the Gameboy Classic, to the Master System, to infinity... and beyond!

A great site for emulator source code and such.

The NO$ series of emulators and documentation. (great, great documentation on various systems like the Gameboy Advanced, Nintendo DS and the NES etc...). this will probably be your main source of documentation for a few emulators.

And of course, if you want more documentation, don't be afraid to use the official documentation released by the system vendors (if they have of course). For example, the 6502 processor used in the NES has a whole manual.  Same with the GBA CPU, the ARM7TDI manual.

One last thing, don't forget to actually play emulators, they are so much fun. try the latest ones, the PCSX2 and Dolphin, they be bitchin!



  1. The link for the emulation video is down. Could you please re upload it.

  2. this needs lots of determination and hard work,
    I used to know nothing, currently learning SDL to make a GUI for chip8 -_- hope it works

  3. Link is down and thanks.

  4. Can you please re-upload the video, or at least where I can find it?

  5. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet
    my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

    Feel free to surf to my web-site - com porn portail (

  6. Fantastic beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog website?
    The account helped me a acceptable deal. I had
    been tiny bit acquainted of this your broadcast provided bright clear concept

    Feel free to surf to my web blog ... Blowjob Videos (

  7. Hey Ryan, I came across your blog while surfing for emulation-related content. I realized that your sendspace link has gone down. I would much appreciate it if you'd re-upload it again.