Report #5 · Final Fantasy (NES) · Dragon Warrior (NES)
Dice You Can't See
Every miss, critical hit and “The Dragonlord is asleep” in these two NES classics comes out of a few lines of assembly. We read that code, rebuilt its dice exactly, then replayed two tool-assisted speedruns on a real cartridge dump to check the math against the game itself.
1Are the dice fair?
Final Fantasy doesn't compute random numbers at all. It keeps a 256-byte list inside the cartridge and reads the next entry every time the battle engine needs a roll. The list is never shuffled or reseeded — the reading position just moves forward by one. The list is supposed to contain every value from 0 to 255 exactly once. It doesn't.
FF1's battle dice contain $00 twice and never roll $95
The 256 entries of the battle table, one cell per possible value (row = high digit, column = low digit)
- Appears twice
- Appears once
The walking-map dice use a different list that is a clean shuffle of 0–255. In battle, one value is missing and one is doubled — harmless for a single roll, but it means a "0% chance" is never quite zero (question 2). A comment in the Chaos death animation even warns that it depends on seeing every value once; the animation survives only because each tile it erases has two or three chances.
The list never changes, so the only thing that decides your roll is where you are in it — and the battle menu burns one entry every time it checks the controller. Replaying TheAxeMan's tool-assisted run, we counted 3,713 draws spent purely on menu input. A TAS picks its roll by choosing when to press A. Against Kraken it steered the dice back to position 61 on 9 separate turns — and got the same two-hit critical for the same 81 damage every time.


Dragon Warrior does compute its dice: a 16-bit formula, next = 771 × state + 129, whose top byte is the roll. Over a full cycle every roll from 0 to 255 comes up exactly 128 times — perfectly fair one roll at a time. But the formula splits its 65,536 states into two separate loops of 32,768, a game stays on whichever loop it starts in, and consecutive rolls are tied together: most pairs can never happen.
Only 21,760 of 65,536 back-to-back roll pairs can ever happen in Dragon Warrior
Each blue pixel is a (this roll, next roll) pair the generator can produce
Your save file picks the dice. The two bytes that hold Dragon Warrior's dice are the same two bytes the game uses to checksum your adventure log. Every time it saves or verifies a log, the checksum is left behind as the new dice. In the TAS, the game checksums the brand-new log at frame 124 and the dice become exactly 43,321 — the value we get by running the game's checksum over those 30 save bytes ourselves. The hero's name is part of that data.

2What does "0 to 200" really mean?
Every physical swing in Final Fantasy rolls a number from 0 to 200. Roll at or under your hit chance and you connect; roll at or under the crit threshold and you crit; roll exactly 200 and you miss no matter what. But the game builds that roll by squeezing one byte (256 possibilities) into 201 slots. Something has to give: 55 of the outcomes get two bytes instead of one. On the real table it's lumpier still — the missing $95 knocks one of those back to a single byte (53 doubled), and the extra $00 gives roll 0 a third.
53 of FF1's 201 hit rolls are twice as likely as the rest — and roll 0 is three times as likely
How many of the 256 battle-dice values produce each 0–200 roll (the real cartridge table)
- Cartridge
- Perfectly fair (256 ÷ 201)
Three consequences you can feel in play. The automatic miss (roll 200) happens 1 time in 256, not 1 in 201, so the best possible hit chance is 99.61%. Roll 0 gets three of the 256 values — the doubled $00 from question 1 — so even a 0% crit rate or a spell with no chance to land still succeeds 1.17% of the time. And because of the squeeze, your real hit chance is never lower than a fair roll would give — it runs up to 0.78 percentage points higher.
FF1's dice are never stingy: your real hit chance is always at or above a fair roll's
Real chance to hit minus a perfectly fair 0–200 roll, in percentage points, for every hit chance
- Real minus fair

3Who goes first?
Each Final Fantasy round, the game lines up all 13 possible fighters — nine enemy slots, then your four heroes at the very back — and "shuffles" them by swapping two random slots, again and again. The comment in the code says it does this 16 times and admits the method is biased: a slot that never gets picked stays where it started. The loop actually runs 17 times (the counter starts at 17 and counts down to zero).
We checked this against the real game. In every one of the 213 battle rounds of TheAxeMan's run, we read the dice position when the shuffle started, ran 17 swaps ourselves, and got the exact order the game wrote into memory. Assume 16 swaps and the prediction is right only 16 times.
A fighter stays in its starting slot 12.9% of the time — a fair shuffle would say 7.7%
Chance that each fighter (row) acts in each position (column); heroes start in positions 10–13. Lighter = more likely (the brightest cells are about 14%).
- Rare
- Common
With fair dice the damage is modest: heroes end up in the last four positions 34.9% of the time instead of 30.8%. On the real cartridge it's lumpier. The 34 rolls a shuffle uses are consecutive entries of the same fixed list, so there are only 255 possible shuffles in the whole game — and in none of them do your four heroes take positions 1 through 4.

Dragon Warrior has no shuffle. Our earlier notes said it did — it doesn't. It's always one hero against one monster: a single roll at the start (your Agility × a random byte against the monster's Defense × another) decides who moves first, and then the two of you strictly alternate.
4The bugs that change the odds
Final Fantasy's source is famous for its bugs, and several of them rewrite the math quietly — no glitchy graphics, just different odds.
Your crit rate is your weapon's catalog number
Every weapon has a crit value in its data. The battle code never reads it. Instead it stores the weapon's position in the item list — 1 for Wooden Nunchucks up to 40 for the Masmune — as your crit threshold. The Masmune, listed at 10, crits on 54 of 256 rolls (21.1%) instead of 16 (6.3%). Late-game weapons get a huge boost; early ones barely change.
The Masmune crits 21.1% of the time — its own data says 6.3%
Chance per swing to crit: using the weapon's listed crit value vs. what the game actually uses (its item number)
- Listed crit value
- What the game uses
We watched it happen. During TheAxeMan's run, the fighter's in-battle crit value in memory was 6 with the Short Sword (listed 5), 20 with the Flame Sword (listed 5) and 22 with the Dragon Sword (listed 10) — every round, the weapon's number.
Two more physical-attack bugs in the same routine: weapon slayer and elemental bonuses are wiped before the attack is calculated, so no weapon ever gets its +40 accuracy or +4 damage against the monsters it was designed for. FROM CODE
Running away ignores your level
The escape check was meant to compare your Luck against a random number from 0 to your level + 15. A bug reads a different byte instead — one that is 0 whenever your party is healthy — so the range is always 0 to 15. Luck 16 or more always escapes. The designers apparently wanted high-level characters to find running harder; instead it's flat forever.
With 15 Luck you escape 93.8% of the time at any level — as intended it would fall to 23.4% by level 50
Chance to run away for a character with 15 Luck, healthy party, by character level
- What the game does
- Intended formula

A miss can still stun you
Some monsters' attacks carry a status effect. The code is supposed to roll for it only when that swing connects — but it actually rolls whenever any earlier swing in the attack connected. Against CRAWL's eight-hit stunning attack, the better you are at dodging, the more the bug costs you: at 160 evade the stun lands 54.2% of the time instead of 27.1%.
High evade barely protects you from CRAWL's stun: 54.2% instead of 27.1% at 160 evade
Chance CRAWL's 8-hit attack stuns a party member with 50 magic defense, by the target's evade (ideal dice)
- What the game does
- Intended
5When more attack means less damage
Dragon Warrior's hit formula starts from your margin: your Attack minus half the monster's Defense. With a margin of 2 or more, damage is a random amount between a quarter and half of it. Below 2, the game switches to a "weak" formula: a coin flip between 0 and 1 damage. The two formulas don't line up — so at the bottom of the scale, adding attack makes you worse.
A margin of 2 averages 0.33 damage — less than a margin of 1 (0.50)
Average damage per hit by margin (your Attack − half the monster's Defense), before excellent moves and dodges
- Average damage
The same trick runs the other way, and it matters much more. When a monster attacks you, the game switches to a weak formula once your Defense reaches twice its (rounded-up) half-Attack. There is no gradual slope — one point of Defense flips the formula. Against an Axe Knight (Attack 94), going from 93 to 94 Defense drops its average hit from 17.6 to 8.1 and its best hit from 24 to 16.
One point of Defense halves an Axe Knight's hits: 17.6 → 8.1 average at 94 Defense
Axe Knight's damage per hit by your Defense: average (line) and full range (band)
- Average hit
- Range (min–max)
And then there's the excellent move: 1 swing in 32 ignores the monster's Defense entirely and deals between half and all of your Attack. It's the only practical way a low-level hero hurts a Metal Slime (Defense 255) — which is exactly how the TAS levels up. Every hit we logged in the run matched the formulas exactly: 21 of 21, including all 8 excellent moves.


6What the comments say vs. what the code does
Disassemblies come with comments written by the people who reverse-engineered them — and sometimes the comment and the instruction under it disagree. We also check our own earlier notes. Here is every mismatch we found that changes a number.
| Game | Topic | The note says | The code does | Where |
|---|---|---|---|---|
| DW1 | Monster wakes up | 1 in 4 | 93 in 256 (36.3%) | Bank03.asm:7654-7660 |
| DW1 | Monster HURT damage | 7 to 10 | 3 to 10 | Bank03.asm:7821-7830 |
| DW1 | Best monster dodge | 22% (14/63) | 23.4% (15/64) | Bank03.asm:6783-6796 |
| DW1 | Weak monster hit multiplier | Attack - Defense/2 | Attack/2 + 1 | Bank03.asm:8502-8531 |
| FF1 | Turn-order shuffle | 16 swaps | 17 swaps | bank_0C.asm:3211-3244 |
| FF1 | Battle dice cover every value | every value once per 256 calls | $00 twice, $95 never | bank_0F.asm:13811-13813 |
| DW1 | "Biased turn-order shuffle" (our notes) | exists (our walkthrough 004) | no shuffle in DW1 at all (it's FF1's bug) | Bank03.asm (whole battle engine) |
| DW1 | "Escape uses the wrong level" (our notes) | bug (our walkthrough 004) | no level is read; monster Defense is the evasion stat | Bank03.asm:8256-8325 |
The sleep comment is the best example. A sleeping Dragon Warrior monster rerolls until the last two bits of a random byte aren't both zero, then wakes on a 1. The comment calls that 1 in 4. With fair dice it's 1 in 3. On the game's actual generator — where each roll depends on the one before — it's 93 in 256.
A sleeping monster wakes 36.3% of the time — the comment says 25%
Chance a sleeping Dragon Warrior monster wakes up on its turn
- The real generator
- Comment / fair dice
"Immune" is never immune
Dragon Warrior's spell resistances run from 0 to 15, and a spell fails when a 0–15 roll comes in under the resistance. Even the maximum, 15, leaves one roll that lands: 1 in 16. The Dragonlord's true form has maximum resistance to SLEEP and HURT. The TAS beats him at level 7 with 4 HP anyway — by landing that 1-in-16 roll 13 times in a row: one SLEEP, then 12 HURTs for 12, 12, 12, 11, 9, 11, 11, 11, 11, 9, 9, 12 damage. That adds up to exactly 130, his entire HP bar. With fair, unmanipulated dice, thirteen straight successes happen about once in 4,503,599,627,370,496 tries.


Dice Lab
Plug in your own numbers. Both calculators use the exact formulas above (tested to match our analysis code case for case) and open on stats read straight from the speedruns' memory.
Preset: TheAxeMan's fighter vs KRAKEN — Flame Sword, Damage 39, Hit% 51, read from RAM at frame 170,492 of TAS 2079M.
Damage per attack against KRAKEN: 19.3 on average
All 2 swings combined; crit value 20 (weapon number); real cartridge dice
- Chance
How we know
Two kinds of evidence
FROM CODE means the number comes from reading the disassembled game code and computing every possible outcome exactly. ✓ EMULATOR E# means we also watched it happen: we replayed a published TAS from power-on on our own cartridge dumps in the FCEUX emulator, with a script that only reads the game's memory — it never changes anything — and compared what the game did with what our model predicted.
- E1 — FF1 turn order: 213/213 rounds predicted exactly (16-swap control: 16).
- E2 — FF1 battle dice: 19,957 draws, each exactly one step along the table.
- E3 — DW1 generator: 34,330 of 34,342 calls follow 771 × state + 129; 10 are the known dodge-roll write-back and 1 is the save-checksum seed.
- E4 — DW1 damage and spells: 21/21 hits recomputed exactly; 13/13 maximum-resistance rolls passed against the Dragonlord.
- E5 — FF1 crit bug: the fighter's crit value in memory equals the weapon's item number in every logged round.
Dice models
- Real cartridge (FF1): every position in the 256-entry battle table is equally likely when an action starts; values follow the table, including its doubled $00 and missing $95.
- Exact (DW1): every state on the generator's 32,768-step loop is equally likely; consecutive calls are chained.
- Ideal: every byte 0–255 equally likely and independent — used for comparison.
Where the position is “equally likely”, that is an assumption: in real play it is set by your button timing, which is exactly what a TAS controls.
Sources
- Final Fantasy (NES, 1990): Entroper/FF1Disassembly at commit
ea16eae(accessed 2026-09-25). - Dragon Warrior (NES, 1989): nmikstas/dragon-warrior-disassembly at commit
ebe6a13(accessed 2026-09-25). - TAS: TASVideos 2079M — NES Final Fantasy by TheAxeMan (replayed on FCEUX 2.6.6).
- TAS: TASVideos 4050M — NES Dragon Warrior by RationalMonkey (replayed on FCEUX 2.2.3, the version it was recorded on; it drifts out of sync on newer versions).
Every screenshot on this page is a real frame from those replays, scaled 4× with no smoothing. Nothing was edited, patched or hacked into place; frames the runs never reach are simply not shown.