Yet another crazy project of mine. Actually the project aims to create an emulator for the Super Nintendo console. “Why?” you say? And then “there are tons of emulators already!”. You are right, but let’s not forget that doing this kind of stuff is fun, and teaches you a lot. I don’t want to create the next best emulator ever, I just want to see how far I can get and challenge myself a bit. That’s all.

So far I reached the first milestone, which is emulating the CPU. Super Nintendo was based on the 65816 CPU, which is a 16 bit extension of the super popular 6502 CPU (NES, Commodore, Atari, Terminator, Bender, …).
After reaching the first milestone I decided to stabilize it in case I later give up on the SNES emulator, and I made a C++ library out of it.

The library provides all the bits needed to build a basic system based on 65816, I will soon write more details on how to use it, for now I’ll just add one small example of how it is used. There is a sample application using the library on my GitHub. All it does is wiring up a very basic system with the CPU and some RAM, load a bunch of instructions, set up the debugger and run the instructions. It’s all very basic but it works.

You can find the library on GitHub. Following is the output from running a very basic program.