When you enter a boss room in TP, there is always a cutscene before the fight starts, either immediately after entering or tied to a trigger. If you skip a cutscene in TP, it often reloads the area with a fadeout, in order to avoid bad-looking transitions. However, this creates an issue. Since the area is reloaded, it's treated as though the cutscene never played, and, as a result, the cutscene would end up playing again (either immediately or through the trigger). This ends up creating an endless loop that couldn't be broken except by not skipping the cutscene.
To avoid this, the programmers used flags for breaking out of this loop. When you skip the cutscene, while the area still reloads, it also sets a flag to a high number and quickly counts it down to zero. When the area reloads, the cutscene that wants to play checks the flag, and if it's nonzero, then the cutscene will not play again. This starts the fight immediately, breaking out of the loop. This flag is also used in the same way if the player voids during the fight, to avoid the same issue.
The bug that exists in this flag's use is that when the player resets, the flag stops counting down and is therefore held at a nonzero value. As the reset fails to clear the flag either, we can therefore reset after the flag is set to a nonzero value before it returns to zero and keep it. This is the basis for all of the Early Boss Fights (EBF) used in Twilight Princess.
As a note, while this flag is mainly used for boss introdcution cutscenes, it does have uses elsewhere. The Sacred Grove utilizes the flag as a binary check. When you start the Skull Kid chase in either Grove 1 or Grove 2, it sets the flag to 1, with the facet that voiding or dying in the Grove will reset the flag to 0, forcing the player to start the sequence again. However, the game fails to clear the flag once the player clears the Skull Kid chase, thus leaving the flag at 1. And as with the boss fights, resetting while this flag is 1 will retain it.
Reset such that you skip the introduction cutscene after the reset happens but prior to the reset fully taking effect will also give the flag a high number for the same reason as above.
A fast method for performing this using the introduction cutscene of King Bulblin 1 is to hold X and B entering the cutscene, then hold START in order to trigger the reset. After the reset triggers, mash START to skip the cutscene. On Wii versions, wait until the cutscene is skippable, then reset the console through either the HOME Menu or the console's reset button, then mash - to skip the cutscene.
To save memory, the game uses the boss fights flag to check how many monkeys you saved. Using the King Bulblin 1 Fight will set EBF high enough to get four monkeys from the start (as four is the maximum), which allows you to swing over to Ook the first time you visit the outside area. Note that skipping the cutscene will reduce the flag by 4, so the flag needs to be high enough that you have at least 4 monkeys afterwards.
The Deku Toad miniboss fight also utilizes the flag. It may seem as though the fight has not started, however, what having EBF set does is skip the cutscene where the vault shuts behind Link and the tadpoles drop. This allows you to actually trigger the fight from the exit of the room by looking up at the ceiling (using C-Up or C), as Deku Toad is already on the ceiling due to the vault door cutscene having been skipped. Any form of EBF will work here, as you only need EBF to be nonzero in this case. Note that on the USA Wii 1.0 and the PAL Wii versions, having EBF set prevents you from entering the room via the normal entrance, as the vault door will be drawn. This behavior was fixed for all other versions of the game, including all GCN versions.
Having EBF set in a few cases can be a detriment, as some things fail to play out as intended due to the presence of the EBF flag being nonzero. Some examples:
In addition, some fights ignore EBF entirely.