Blog/ALttP/🧠Advanced Strategy

A Link to the Past I-Frames: 58 Frames After a Hit

One byte at $031F runs the mercy window. It gets loaded with 58 after an enemy touches you, and while it is counting down, contact damage, projectile trails, electric shocks, your own bombs and the spike tiles all skip their damage check. Here is what that buys you, and where it quietly runs out.

Published September 12, 2026·11 min read·By Mythras
Official A Link to the Past artwork of Link standing with the Master Sword and his shield raised.

Action games hand you a mercy window after a hit. A Link to the Past's is unusually easy to pin down, because it is not a system — it is a single byte that gets loaded with one number and decremented once a frame, and damage routine after damage routine asks the same question about it before doing anything.

The number is 58. Here is what it buys.

The timer is one byte, and it holds 58

The byte lives at RAM address $031F. The disassembly's own RAM notes describe it as a "countdown timer that, when it's set, causes Link's sprite to blink, i.e. flash on and off" — which undersells it, because the blinking is the cosmetic half. The damage routines care about the same byte.

When an enemy lands contact damage, the player's control handler runs this:

  • if $031F is already non-zero, leave it alone
  • otherwise load it with #$3A — 58 in decimal
  • play the hurt sound, then subtract the damage from Link's health at $7EF36D

That is the whole setup. The disassembly and the zelda3 decompilation agree byte for byte here: the C rewrite's control handler reads if (countdown_for_blink == 0) countdown_for_blink = 58;, in the same order, in the same routine.

The decrement happens once per frame inside the routine that builds Link's sprite, and it is gated on submodule_index being zero — normal play. The counter does not tick while the game is running a transition or a menu submodule, so a mercy window does not quietly burn off while you are reading a text box.

At the SNES's roughly 60 frames a second, 58 frames is about 0.97 seconds. Call it a second and you will not be far wrong.

Official A Link to the Past artwork of Link mid-slash with his sword drawn.

What 58 frames of flashing switches off

This is the part worth internalising, because the window is wider than "enemies can't touch you". It also covers several hazards that look environmental, and are handled by routines that consult the same byte.

What is trying to hurt youThe routineBehaviour while $031F is non-zero
Enemy contact damageSprite_AttemptDamageToPlayerPlusRecoilAborts before dealing damage, recoil or stun
Lightning trails and Ganon's bat flames — the two effects that call itGarnish_CheckPlayerCollisionReturns immediately; no collision test is run
Electrocution on touchSprite_AttemptZapDamageSkips the zap branch entirely
Your own bomb blastthe bomb ancilla's player-damage checkDamage is skipped
Spike floor tilesthe tile-behaviour handlerJumps to its .noSpikeFloorDamage label
Spiked and cactus tilesthe movement collision handlerJumps to its .ignoreSpikeBlocks label
A trigger-activated chest room tagdungeon tag routine $27Returns immediately, and the disassembly annotates the branch as being there because Link is flashing

Two of those are worth saying out loud. Your own bombs obey your i-frames — the bomb routine loads the same 58 and tests it the same way, so a second blast that goes off inside the first one's window does nothing to you. And the spike tiles are not a special environmental damage type with rules of their own; they query the same byte as a Moblin's spear.

That last row is the odd one. Being hit does not only protect you, it also suspends a dungeon room tag: while the flash timer is running, the "trigger activated chest" tag routine returns without doing its work. Getting clipped on the way into a room can stall the thing you came in to trigger.

Nineteen frames stunned, fifty-eight frames safe

There are two timers doing two different jobs here, and they are easy to conflate.

When a sprite damages you, the routine sets $46 to #$13 — 19 and applies recoil at strength #$18 (24). The RAM notes call $46 "a countdown timer that incapacitates Link when damaged or in recoil state. If nonzero, no movement input is recorded for Link." That is the knockback: you are launched, and for 19 frames the game ignores your d-pad.

The invulnerability byte was set to 58 in the same exchange. So the arithmetic is:

PhaseFramesWhat you can do
Stunned and invulnerable19Nothing. Input is discarded
Free and invulnerable39Walk, dash, swing, cross anything that reads $031F
Flashing overBack to normal rules

Thirty-nine frames of free invulnerable movement is the real prize — about two-thirds of a second in which no contact damage routine will touch you and your inputs are being read again. That is enough to walk straight through the thing that just hit you instead of backing away from it.

Note the damage amount itself is a separate lookup — the routine builds an index from the sprite's bump-damage class and your mail level and reads a table. The damage guide has those numbers; this post is about the clock, not the size of the hit.

The flashing stops before the protection does

The blink is drawn in Link's sprite routine, and the logic is specific: after decrementing, the game hides Link only when the counter is 4 or higher and even. Below 4, he is drawn normally.

So the visible flicker is 30 Hz — on one frame, off the next — and it runs from the top of the window down to 4. Frames 3, 2 and 1 are still invulnerable and no longer flashing. It is not much, and it only runs in your favour, but it means the obvious reading is wrong: the animation stopping is not the signal that your protection stopped. If you want the precise end of the window, count frames, not flickers.

The Magic Cape is a separate flag ($55) and behaves differently — it is checked first, and when it is active the control handler throws the incoming damage away and clears the stun timer instead of starting a countdown. Its magic drain is covered in the magic guide.

The rolling spike trap sprite sheet from A Link to the Past, shown enlarged.

Spike floors and spiked tiles read the same byte

This is the practical payoff, and it is why the walk to the Cane of Byrna's chest is survivable on hearts alone.

The spike floor handler runs four checks in order before it hurts you:

  1. Is the Magic Cape flag set? If so, no damage.
  2. Is there a Cane of Byrna spark active? If so, no damage.
  3. Is $031F non-zero? If so, no damage.
  4. Otherwise, look up the damage by mail level and apply it.

The spiked and cactus tiles you bump into while walking — zelda3 calls the bitfield bitfield_spike_cactus_tiles — run the same idea with an extra term: the check is $46 or $031F or $55, stun timer or flash timer or cape, and any of the three makes the game ignore the tile. There is a grid quirk in there too; the disassembly's own annotation on the 4-pixel alignment test is "this is a tad strange, seems like more of a tweak than anything else", which is as good a description as any.

To be clear about which hazards this is: these are the two tile routines. Spiked enemies and traps that exist as sprites — the rolling spike trap, Big Spikes, Beamos, Sparks — take the ordinary sprite path instead, and their damage comes out of the bump-damage class table the damage guide lays out. They are still gated by $031F, because everything on the sprite path is. They just do not use these two routines.

The consequence is that a spike corridor does not drain you continuously. It charges you once, gives you 58 frames, charges you again. Walking spikes is a pacing problem, not an attrition problem, and the ALttP Speedrunning Wiki puts a number on one of them: to cross the spike floor guarding the Cane of Byrna chest on Dark World Death Mountain, it says you want 14 full hearts, or mail upgrades, or the Cape, or a refill in a bottle.

Both tile routines index their damage by your armour value at $7EF35B, so mail upgrades do reduce what they take. There are no per-mail numbers in this post, because the two sources do not settle them: the disassembly reads the values out of a ROM table the repository does not decode, and the zelda3 rewrite hardcodes the green-mail figure in both places. The mechanism is not in doubt — the lookup is armour-indexed in both routines, and the speedrunning wiki independently lists mail upgrades as a mitigation for that same spike floor. The size of the reduction is not something I can source, so I am not claiming one.

Official A Link to the Past artwork of the Cane of Byrna.

The 144-frame windows

58 is the combat number. There is a second, much longer value — #$90, 144 frames, about 2.4 seconds — that the game hands you when it puts you somewhere you did not walk to. In the decompilation it is written into the same byte by:

SituationFrames
Recovering after drowning, or after a damaging pit fall — indoors or out144
Arriving from a Magic Mirror warp144
Arriving out of a whirlpool144
Being set down by the flute duck144
Ordinary enemy contact, bombs, spikes58

One routine covers two of those rows. The indoor and outdoor pit-recovery submodules both hand off to the same recovery routine the game uses after you go into deep water without the Flippers, and that routine is where the 144 is written — which is why a hole in a dungeon and a hole on the overworld pay out the same number.

The pattern across the table is that none of these are arrivals you walked into: the screen resolves around you, and you get roughly two and a half times the normal grace period to read it. Note which way the Magic Mirror row runs, though — the Mirror carries you out of the Dark World and back to the Light World, so those 144 frames land on the Light World screen you arrive on, not the one you left.

What it will not save you from

The window governs damage routines. It does not govern the things that are not damage routines, and the list of exclusions is short but sharp:

  • Falling in a hole. The pit branch runs before the spike-tile check in the same handler and never looks at $031F. Flashing does not let you skate over a hole.
  • The heart the hole costs you. Pit damage does not go through the damage routine at all. TakeDamageFromPit subtracts 8 — one heart — straight out of Link's health, with no mail lookup and no invulnerability check in front of it. A pit costs the same heart in Red Mail as in Green.
  • The death check itself. If the subtraction takes you to zero, the game switches to the death module and zeroes $031F on the way out. There is no i-frame window that saves you from the hit that kills you. Where you wake up afterwards is the subject of the death guide.
  • Getting shocked again. The electrocution routine sets its own 64-frame timer on contact — six frames longer than the invulnerability it triggers. On paper, the shock outlasts the mercy.

And one genuinely funny exclusion in the other direction: the bomb routine checks whether the room's boss is already dead before it damages you, and skips the damage if it is. The disassembly's comment is "If the boss is beaten Link is invincible!" Your own bombs cannot hurt you in a cleared boss room.

Useful mental model for all of it: the game is not really tracking your invulnerability. It is tracking whether Link's sprite should be blinking, and a whole set of separate routines have quietly agreed to treat "is he blinking" as "leave him alone".

Frequently Asked Questions

How long are you invincible after taking a hit in A Link to the Past?
In A Link to the Past the invulnerability window after being damaged is 58 frames — the game loads the byte at RAM address $031F with #$3A and decrements it once per frame. At the SNES's roughly 60 frames a second that is about 0.97 seconds. Any damage routine that finds that byte non-zero aborts before hurting you.
Can you walk across a spike floor in A Link to the Past without taking damage every frame?
Yes. The spike floor handler in A Link to the Past checks the same 58-frame invulnerability byte that enemy hits use, so spikes charge you once and then cannot touch you again until the timer expires. The Magic Cape and an active Cane of Byrna spark are both checked before that and stop the damage outright. The ALttP Speedrunning Wiki recommends 14 full hearts, mail upgrades, the Cape or a bottled refill to cross the spike floor guarding the Cane of Byrna chest.
Why does Link stop flashing before the invulnerability ends in A Link to the Past?
Because the flicker and the protection use different thresholds on the same byte. A Link to the Past hides Link's sprite only while the countdown at $031F is 4 or higher and even, but the damage routines treat any non-zero value as invulnerable. That leaves three frames at the end of the window where Link is drawn solid and still cannot be hit.
How long is Link stunned after being hit in A Link to the Past?
Nineteen frames. Enemy contact damage in A Link to the Past sets the incapacitation timer at $46 to #$13 (19) and applies recoil at strength 24, and while that timer is non-zero the game records no movement input. Since the invulnerability timer is set to 58 in the same exchange, 39 frames of the window are free, invulnerable movement.
Do your own bombs hurt you in A Link to the Past?
Yes, and they obey the same rules as enemy damage. A bomb blast in A Link to the Past sets the invulnerability byte to 58, looks its damage up by your mail level, and does nothing at all if you were already flashing. It also skips the damage entirely when the room's boss has already been defeated.

Keep Reading

Sources & Further Reading
Last updated September 12, 2026.

Related Guides

Official A Link to the Past artwork of Link braced shoulder-first at speed, motion lines trailing behind him and a yellow impact burst at the point of contact.
🧠Advanced StrategySep 2, 2026·10 min read

A Link to the Past Movement Speed: When Dashing Is Slower

A Link to the Past does not simulate movement. It looks it up. One byte picks your speed, the byte divided by sixteen is your pixels per frame, and every surface and every held item swaps the byte for a worse one. Here is the table, and the arithmetic that says the Pegasus Shoes are a loss under four and a half tiles.

Read article
The A Link to the Past Game Over screen, showing the GAME OVER lettering above the Save And Continue, Save And Quit and Do Not Save And Continue options.
🧠Advanced StrategyAug 30, 2026·9 min read

A Link to the Past Death Guide: Every Respawn Point

A Game Over in A Link to the Past does not cost you a rupee, a bomb, an arrow or a small key. It costs you position, four escort quests, and a number the credits will read back to you at the end. Here is the whole death routine, read off the code that runs it.

Read article
Official A Link to the Past artwork of Link swinging his sword at a Geldman, a sand creature bursting out of the desert ground.
🧠Advanced StrategyAug 17, 2026·12 min read

A Link to the Past Enemy Drops: All 7 Prize Packs Explained

Zoras pay out bombs on every single kill. Wizzrobes drop hearts. A Keese drops nothing in the Light World and pulls the best table in the game in the Dark World. Here is the entire drop system, out of the ROM.

Read article
Official A Link to the Past artwork of Link swinging his sword and raising his shield against two Stalfos Knights in a dark castle interior.
🧠Advanced StrategyAug 15, 2026·13 min read

A Link to the Past Damage Guide: Every Weapon Number and What Your Mail Really Does

The Golden Sword spin attack deals exactly what a Golden Sword swing deals. The Magic Hammer hits as hard as a Tempered Sword. And the Blue Mail does nothing whatsoever about a Beamos. Here are the real numbers, out of the ROM.

Read article
Official A Link to the Past artwork of Link holding his sword and Fighter Shield, the loadout you carry out of Hyrule Castle.
🌱Beginner GuidesJul 20, 2026·12 min read

A Link to the Past Beginner Guide: Your First Ten Hours

A Link to the Past hands you a sword and a rainstorm and then says almost nothing else. Here is the route, the combat, and the item order that turn a confusing first hour into a game you can actually finish.

Read article
Official A Link to the Past artwork of a Small Key, the ornate golden key used to open locked dungeon doors.
🎮Game GuidesAug 20, 2026·10 min read

A Link to the Past Small Keys: All 61, Dungeon by Dungeon

Palace of Darkness keeps all six of its keys in treasure chests. Desert Palace keeps none of its four in a chest at all. Here is the key count for every dungeon in the game, and where the ones you cannot find are actually hiding.

Read article