STM, which stands for “store multiple”, is a class of instructions that are meant to pack the values of multiple CPU registers into consecutive memory. The next trick they pull is a very unorthodox use of the STM instructions. Using VRAM for something it’s very clearly not intended for definitely threw me off at first, but once I let the games do that, I ran into a few more problems. There were several remaining problems, but this was clearly a tactic to throw off emulation.
Upon deeper inspection, I discovered that if I allowed the game to actually run code in VRAM, it would not crash, and seem to be relatively stable. Jumping to an invalid address is a common symptom of a bug in the emulation gone sour, and it tends to happen when copying over addresses or memory that’s being executed. The first time I saw the games do this, I thought I must have done something very wrong. What the games do next is far more interesting: they start copying data into video RAM, which alone is perfectly normal, but then it jumps execution into this copied data in VRAM: it was copying code into a region of RAM that is usually reserved for graphics, and then executing it in place.
However, this is by far the least troublesome trick that the Classic NES series pulls. This tends to confuse some emulators, but it’s never been a problem in mGBA, due to how it implemented memory regions. What the Classic NES Series does with mirrored memory isn’t particularly special: it copies code into main RAM and then jumps to one of these mirror addresses. Some emulators refer to this as “mirrored” memory. This means that if you try to access anything above the valid regions of memory in main RAM, the top bits are effectively masked out and you’re left with a valid address once more. These unused bits are actually just ignored. Since the top 8 bits are used for selecting the device, and the bottom 18 are used for addressing into the device, there are 6 bits in the middle that are unused. However, the GBA does not support data aborts, and what happens in this particular case is interesting. On a typical ARM device, accessing invalid addresses results in something called a data abort. This means that the addresses for this region of memory are from 02000000 to 0203FFFF, leaving everything from 02040000 to 02FFFFFF unaddressed.
That equates to 18 bits of address space. However, since only the top 8 bits signal the device, and most of the devices have a very limited (less than 16 MiB) address space, bits in between the top 8 bits and the low bits that signal the address within the device have no defined purpose.įor example, the main RAM is 256 KiB. 00 is the BIOS, 02 is the main RAM, 03 is the on-chip RAM, etc. The Game Boy Advance has a flat (non-segmented) memory address space, however, the top eight bits of the address signal to the bus as to which device should have access to it at that time. The first trick that the games pull involves the Game Boy Advance’s memory layout. In the interest of accuracy, I have painstakingly investigated, implemented and chronicled all of the unusual things I’ve found these games to do. This appears to be a deliberate attempt to dissuade copying these games. As it turns out, these games exploit several tricks and undefined behaviors that make emulating them challenging. If you’ve tried to load one in some older emulators, you’ve probably been confronted with a Game Pak Error screen, as seen above. However, the Classic NES Series goes above and beyond the average game in an attempt to ensure they don’t work in emulators. As a result, emulators tend to need to be bug-compatible with the original hardware to ensure that the games actually work. The average Game Boy Advance game is extremely buggy, and the platform itself contains a number of safeguards to prevent games from crashing. Dubbed the Classic NES Series in the United States, these games were interesting for a number of reasons.įrom a GBA emulation perspective, the games were especially interesting. In stark contrast with the usual dark grey cartridges with colorful labels, a set of light grey cartridges with simple labels were released containing games ported from the original Nintendo Entertainment System. Some of you may remember a series of peculiar Game Boy Advance games that came out over the course of 2004.
Classic NES Series Anti-Emulation Measures