pmorinerie (on Mastodon @firstname.lastname@example.org) has been working on a full disassembly of the fourth Legend of Zelda game, Link’s Awakening on the Game Boy, and has a series of articles they’ve written about interesting technical aspects they’ve found.
One of their discoveries is of a hidden structure to the overworld of that game. Their discussion of this is fascinating, and should be referred to if you have an interest in such things. I will give a broad summary here.
The Game Boy was not given much VRAM for storing graphics. To avoid bus conflicts, the CPU that runs the system only has access to VRAM, to store new background tile information, either during VBLANK, a specific time each frame when the PPU circuitry isn’t accessing memory, or by blanking the screen entirely, which is only really feasible during major transitions, like through a door or into a hole. So, the system is limited in how quickly it can store new tiles during play.
Link’s Awakening stores two kinds of tiles in its VRAM. Most of them are from a set that’s used throughout the overworld, but a small number are overwritten, used for different purposes as Link explores the landscape. The overworld is separated into 2×2 blocks, and each can have its own set of these customized tiles.
There is a problem with this setup, however. When Link changes screens, like in the original Legend of Zelda and A Link to the Past, the screen transition scrolls smoothly between the areas. During the scroll, briefly, it’s possible for elements from two different screens to be displayed at once. How does the program handle situations where the custom tiles have two different definitions between screens?
The answer is that the overworld is cleverly designed so that there aren’t adjacent screens with walkable passages between them that use different sets of custom tiles. There are screens in the game that only use tiles from the main overworld set, and all of the places with passages between the screens with custom tiles have one of them, as a kind of memory airlock, to prevent glitches during transitions. It’s pretty clever.
If this is interesting to you, I encourage you to read the whole article, especially for the exceptional cases where the system breaks down and they had to find other ways to keep the screen from glitching.