A Blast from the Past
Hello again! I really don’t know how to write creative intros for these posts… Anyways, I’ve got some more fun things to share with you all this month, so let’s just get right into it.
Before the DS, there was the Game Boy Advance (GBA). The GBA was considerably less complex than the DS, but it shared a lot of the same hardware. Consequently, the DS came with a GBA backwards-compatability mode to allow playing the older console’s games without having to carry around two systems. When the DS enters GBA mode, most of its hardware is disabled, and the secondary processor, which happens to be the same ARM7 CPU that the GBA has, starts executing the GBA BIOS. The DS takes on a different memory map, and allows access to its built-in GBA sound hardware; aside from that, the rest of the GBA hardware (2D graphics, DMA, and timers) is more or less the same as on the DS.
So why am I talking about this? Well, as you may have guessed, NooDS now has support for GBA games! Now, I’m not the first one to add GBA support to a DS emulator. PSISP beat me to it with CorgiDS (although I don’t think it was ever finished), and there are of course NO$GBA and medusa (but they started as GBA emulators and later got DS support, so it’s not exactly the same). Regardless, it’s still pretty cool, if I do say so myself! You can boot GBA games directly or through the DS firmware, and optionally have the screen layout automatically crop out the unused screen and border. If you’d rather have a border, NooDS also displays the VRAM border around the GBA screen when in non-crop mode. Although nothing official actually uses this (to my knowledge), so you’d have to write a homebrew that copies your border into memory before entering GBA mode :P
Because of how GBA mode works on an actual DS, it was relatively simple to get it working on NooDS. I set up a new memory map, disabled the ARM9 and other unnecessary hardware, and that was more or less enough to get things going! I had to tweak the 2D GPU a bit, and the GBA audio and save protocols had to be implemented, but other than that everything is mostly reused from the DS code. After only a few days I had a fully functional GBA emulator on my hands, and it felt pretty good!
Implementing the GBA save types was relatively straightforward, and as a bonus the save type is actually detectable from the ROM, unlike with the DS. Audio, on the other hand, was a bit more tricky. I had no problem with the DMA channels and their nice, simple 8-bit PCM data, but the other channels were where the real trouble laid. These channels are essentially the same as what the original Game Boy has, and allow games to specify frequencies and other parameters for waveforms that are then generated by the hardware. There are additional features, such as frequency sweeping and volume envelopes, to make this even more fun. It reminded me of when I was emulating the NES’ audio, back when I had no idea what I was doing. Luckily I have a bit more understanding of how audio works now, so this didn’t turn out to be as much of a trainwreck as it did back then. In the end I got audio sounding close enough to the real thing, but it won’t be entirely accurate due to the analog nature of the hardware. Generating sample-perfect audio is something that might be fun to look into in the future, but for now I’m happy with what I have.
Aside from GBA support, a few other noteworthy things got done. Shadow polygons were properly implemented for the 3D renderer, and I finally got Mario Kart DS to boot! Still no luck with the Zelda games, though. I would have liked to get more done on the DS side, but my motivation was lacking, as usual. Part of the reason why I decided to work on GBA support was because the feedback of getting all those new games to boot is much more rewarding than the minor visual progress I would get from working on anything DS-related at this point. That’s not to say I don’t want to keep working on DS emulation, though; there are still a lot of things I’d like to do with this project, so stick around! I’ll leave you now with these last screenshots, becuase trying to speculate what I’ll work on next usually ends up being totally wrong. Bye for now!