Houlihan

As a change of pace from glitch explication, I want to dissect something that is not a glitch, but it's something everyone immediately labels as one. But it's not a glitch, nor is it necessarily the result of one. There are ways to use glitches to trigger the Houlihan warp, but that just means the code is doing its job. Instead, the Houlihan is an easter egg that's been built in as a failsafe, and it's one of the few general failsafes to exist.

Misconceptions

To start, I'd like to clear up the second biggest misconception, which is that triggering Houlihan is the result of a messed up camera. That's not exactly really true. The camera matters, but only indirectly. What really matters is your X-coordinate, Y-coordinate, and screen ID.

Screen ID

This is the easiest to explain. It's your screen's… ID… Basically "which screen are you on?" Except instead of saying "Oh, I'm in Kakariko.", it's the CPU reading address $8A and saying "Oh, you're on screen $0018."

Coordinates

Your coordinates together are used to calculate a location in the Map16 tile buffer (which, to keep it brief, is how overworld tiles are stored in groups of 4 to keep them, their graphics, and their behaviors "easy" to control. There are more tiles on an overworld screen than in an underworld room, but they have the same buffer size, so concessions must be made). This index is then used in part of the search for where the hole goes.

X-coordinate

This may sound silly, but your X-coordinate is easier to explain than your Y-coordinate. Why? Well, it's taken as what it is when you fall into the hole.

Y-coordinate

Your Y-coordinate is a little trickier. When you fall into a hole, your Y-coordinate is modified to be placed above the screen. Why? It just seems to be some hacky way to prepare Link to fall on the next screen. This probably should have been written to use the Z-coordinate instead.

100% intended

So what exactly makes this not a glitch? A glitch is something that is not intended by the developers. But if you look at this code, it's pretty clearly intended. After all, they promised a Mr. Chris Houlihan his name would appear in the game. What better way to technically fulfill that promise than an obscure failsafe room?

Summary

When Link falls into a hole on the overworld, the destination is determined by both the current screen ID and his X- and Y-coordinates. As a small catch, before this even happens, Link's Y-coordinate is determined by the top of the camera. Although the camera can move after the Y-coordinate is recalculated, but before the destination is. So calling it camera-based is only about one-quarter correct.

Destinations are in a list, which is looked through for a match from the input parameters. If every item is looked at without finding a match, then the Houlihan Room is used as the target destination.

This is one of the few failsafes added to the game. No matter how you slice it, the game is doing exactly what the developers wanted it to do. And because it is possible to trigger the failsafe without doing any actual glitches, calling Houlihan a glitch is patently wrong.