I remember finding out there was a secret area in both games that you could only get to if you were playing on a Game Boy Advance. Even the 3DS releases don't allow access to them. My question is, how did the games know they were running on a Game Boy Advance? I thought that the ARM CPU in the Game Boy Advance was disabled in Game Boy Color mode...


1 Answer 1


Probably the easiest way to discover whether a cartridge was started on a GameBoy Advance is to look at the initial register state. According to nitro2k01 at gbdev.gg8.se:

cgb_agb_boot.bin - Gameboy Color boot ROM used in GBA's GBC mode

This revision of the GBC boot ROM was used in GBA's GBC compatibility mode and has the following changes from the most common GBC boot ROM revision:

  • […]
  • CGB-AGB contains an additional "inc B" instruction right before control is handed over to the cartridge, which allows the game to detect that it's running on GBA and for example fix its color palette to improve visibility on the darker GBA LCD screen. This also leads to a minor reorganization of the code in this area.

In other words, on a GameBoy Advance the B register should be 1 after the boot ROM runs, where it would otherwise be zero. This behaviour is emulated in mGBA. The Pan Docs reference describes the initial register state similarly, though it also mentions some other possibilities.

A disassembly of Oracle of Ages/Seasons I found online confirms this is the method they used:

; The game's entrypoint.
    cp $11
    ld a,$00
    jr nz,+

    ; Check GBA Mode
    inc a
    bit 0,b
    jr z,+
    ld a,$ff
    ldh (<hGameboyType),a

(The earlier test checks for a Game Boy Color, also agreeing with the Pan Docs.)

  • Does the Game Boy boot rom also set all registers to zero before the inc B? I was under the impression that a register's contents could never be assumed to contain any specific value upon booting up. But that may just be for systems with no BIOS like the NES Commented Oct 22, 2021 at 15:13
  • 1
    It’s not a bad stance to adopt in general, but I think the B register value has been deliberately set up that way (though only official documentation can confirm for sure). And at this point we should consider the Game Boy ABI effectively frozen anyway. I don’t expect any more versions of the boot ROM, they all behave more-or-less deterministically (emulators also faithfully follow their behaviour), so one might as well take any useful behaviour exhibited as promised. Commented Oct 22, 2021 at 16:24
  • I got it to work. I had mistakenly cleared the work ram after the test, which is why my in-software hexdump was showing a zero value. Commented Oct 24, 2021 at 2:14
  • Sorry, "b register"? Do you mean r1 or something? Aside from abbreviations for stack pointer etc. registers, I've only ever known the registers on GBA to be numbered. Commented Sep 7, 2022 at 1:04
  • 1
    @KarlKnechtel Given that it's a GBC cartridge, the game doesn't run on the ARM CPU, but on the 8080-ish GBZ80/LR35902/SM83. Commented Sep 7, 2022 at 4:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .