Professor Oak's lab tilemap corruption glitch: Difference between revisions

Jump to navigation Jump to search
no edit summary
>Bbbbbbbbba
No edit summary
>Bbbbbbbbba
No edit summary
Line 7:
==Explanation==
 
The cause of the glitch is related to the number of sprites on the screen. The GameBoy OAM can hold 40 tiles, and each sprite in {{RB}} consists of 4 tiles, so only 10 visible sprites are allowed on the same screen. In this scene, there are 11 sprites in total: the player, the rival, three Poké Balls, Prof. Oak, two Pokédexes, and three of Professor Oak's aides. In normal cases, either the two male aides on the bottom of the screen are invisible, or the two Pokédexes on the top of the screen are invisible, limiting the number of visible sprites to 9. However, while transitioning between those two states, some race condition {{clarify}} may cause all 11 sprites to be considered visible when the OAM buffer is prepared.
 
Trying to leave Oak's Lab without picking a Pokémon makes the game transition between those two states. In particular, when the game forces the player to walk back up, on the frame the move animation is done, the game marks the two Pokédexes as visible, and then the two male aides as invisible, in the same round of sprite update. If this round of sprite update takes too long to complete, the V-Blank interrupt (during which the OAM buffer is prepared) may occur before it is finished, at which point all 11 sprites are considered visible.
 
When this happens, the eleventh sprite overflows the OAM buffer and is written into the tilemap buffer, which is immediately after the OAM buffer in the WRAM layout. Furthermore, after populating the OAM buffer, a loop clears the unused portion of the OAM buffer, which runs from the last OAM entry written to the first address with the lower byte $a0. With an OAM overflow, this would not be $c3a0 as intended, but $c4a0, meaning that the corruption extends to the first 256 bytes of the tilemap buffer. The vertical "a" lines come from changing the first byte of every 4-byte block to hex A0, which is the recommended way to remove tiles from the GameBoy OAM (by putting them below the screen).
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu