DrilNES – This Space Intentionally Left AWESOME


Inspired by Scet’s Tub of Awesome, I opted to continue work on my old emulator, DrilNES.
And here it is! DrilNES in all its glory! Note that it does not support PAL NES timing, it only runs NTSC games (so US and Japanese games only).

A Brief History of the World

I first attempted to tackle NES emulation back in 1999. I had the goal of getting three games to be playable: Castlevania 3, Startropics, and Crystalis. Turns out, these three games are some of the harder games to emulate, due to the tricky nature of the cartridge hardware that they run on. However well it ran at the time, it was woefully inaccurate, and this bothered me. In mid-2004, I apparently decided to try again.

Emulator Action

The great thing about having started this project over in 2004 is that I have the entire history of the emulator’s development in SVN, so I can see exactly what I did, and in what order. Here’s a quick list of the hilights:

  • Wrote the CPU emulation code (runs opcodes, etc).
  • Got the PPU (pixel processing unit) up and running
  • Rewrote the CPU emulation code to be more accurate with regards to instruction length counting (all instructions now emulate every read and write of the instruction, even the unnecessary ones, and the CPU cycle is clocked on each memory access).
  • Added input and mappers. Mappers are emulators of the hardware that came IN the various cartridges. Originally mappers were just for memory mapping, but the hardware eventually added additional graphical, sound, and interrupt capabilities as well.
  • Added more mapper support
  • Added support for the color emphasis bits which…tweak the output color from the NES in various ways.
  • Added sound output.
  • Got various IRQs running (for interrupting the CPU at certain points in the audio playback or at certain scanlines)
  • Added savestates.
  • Added a custom rom open dialog, with a treeview and stuff
  • Even more mappers
  • Two-player support
  • Rewrote the MMC3 mapper from scratch, because the MMC3 code was nasty and ugly and I hated it. And it insulted my mother. And your mother.
  • IRQ fixes. At this point, judging from some…colorful SVN log comments, I was starting to hate IRQ work.
  • Set down the code for a year.
  • Complete PPU rewrite to be way more accurate. This was the point at which I was starting to hate Battletoads, which is probably the most touchy game when it comes to accurate timing.
  • Complete PPU rewrite. Yes, I know that is also on the previous line. I rewrote it again. Seriously.
  • Rewrote the PPU’s sprite access logic. STOP REWRITING ALREADY SERIOUSLY WHAT THE HELL
  • Rewrote the IRQ logic again. Ugh.
  • Rewrote the CPU. This time the CPU is awesome and infallible and will never need to be rewritten or even fixed ever again. Also, I think I was slowly losing my sanity.
  • Added a faster read of guaranteed in-ROM memory, without going through all of the IO handling code. I didn’t notice for over a year and a half, but this totally broke the accurate CPU timing that I had going for me.
  • Rewrote the CPU again. Apparently last time I was wrong. Boy this is awesome!
  • Stopped working on DrilNES for a year and a half. I’m not sure but I think I’d had enough.
  • Started last weekend! Multithreaded the emulator.
  • Added a whole bunch of GUI features (including ripping out the now-hideous custom rom open dialog that I added back in early 2005)
  • Added XInput support for 360 gamepads
  • Added the VRC6 mapper (with its additional sound channels) so that Akumajou Densetsu (Castlevania 3 Japanese) works!

As you can see, development was a tortured path, filled with rewrite…after rewrite…after rewrite…

The upside is that now it’s pretty accurate. It’s not perfect, I’m sure, but it’s pretty good and better than a large majority of emulators out there.

Vista-Specific Functionality

One thing that was fun to add was some Windows Vista-specific functionality. Mainly, when you load roms or save state, there are little popup windows that notify you. In Vista, they look like this:

instead of just a generic yellow-on-black window. It’s nice to be able to see through them.

Also custom is the Rom load dialog (link to the screenshot, I was too lazy to make a thumbnail for this screenshot), though there is a custom one in XP as well. Basically, it lets you see relevant information about a ROM before you load it (and will also prevent you from loading unsupported ROMs).

But, in general, it’s nice to be “done” with it (though there are tons of things that I would like to do with it still).

Leave a Reply

Your email address will not be published. Required fields are marked *