Turn order
The rule that decides who acts first in each round of a turn-based battle.
On this page
Turn order decides who acts first in each round of a turn-based battle. The Gameplay Design Patterns wiki defines turn taking as “Letting one player do some action or actions before letting other players act”, and notes that randomness may set the order1.
The earliest game read in each of the three series uses its own scheme. Dragon Warrior rolls once for the first turn, and then the hero and the monster alternate2,3. Final Fantasy shuffles everyone at random every round, with no stat involved4. Pokémon sorts by the moves’ priority, then by Speed5,6,7.
- Side by sideGenghis Khan (1987). The attacker orders all his units, then the defender, and a day ends.8
- AlternatingDragon Warrior (1986). A quick hero usually strikes first, and then hero and monster take turns.2,3
- ShuffledFinal Fantasy (1987). Everyone acts in a fresh random order each round, and no stat moves a character up.4,9,10
- Shuffled, agility within the partyFinal Fantasy III (1990). Party and monsters act in a random order each round; agility only decides which party member goes before another.11
- Stat plus a rollDragon Warrior II (1987). Quick fighters tend to act early in a round, but luck can put anyone first.12,13,14Dragon Warrior III (1988). Quick characters usually act early in a round, but luck can put a slow one first.15,16EarthBound Beginnings (1989). Each pick rolls every waiting combatant's Speed through a ±0–24% spread, and the highest acts.17,18EarthBound (1994). Speed ±50%, rolled once per turn, highest first.19
- By a statGenghis Khan II: Clan of the Gray Wolf (1992). On the combat display units act in order of mobility; on the campaign map the attacker moves, then the defender.20,21
- Priority, then SpeedPokémon Red and Blue (1996). Quick Attack goes first and Counter last, then the higher Speed, with a tie split evenly.5Pokémon Yellow (1998). Red and Blue's Quick Attack, Counter, and Speed rule, unchanged.22Pokémon Gold and Silver (1999). Move priority from 0 to 3, then a held Quick Claw's roll, then Speed.23Pokémon Crystal (2000). Move priority from 0 to 3, then a held Quick Claw's roll, then Speed.6Pokémon Ruby and Sapphire (2002). Priority, then adjusted Speed, with a Quick Claw that puts its holder first on 20% of turns at equal priority.24Pokémon Emerald (2004). Priority, then Speed after stages, weather abilities, the badge, items, and paralysis.7Pokémon FireRed and LeafGreen (2004). Emerald's priority and Speed rule.25
- Active timeFinal Fantasy IV (1991). Every fighter waits on its own clock, so a quicker character gets more turns.26,27Final Fantasy V (1992). Each fighter waits on its own clock, and more agility shortens the wait.28Final Fantasy VI (1994). Each combatant's gauge fills in real time by its speed.29
#How it works
Dragon Warrior: at the start, a roll picks who acts first; then the sides alternate
Final Fantasy: every round, shuffle all 13 slots; act in that order
Pokémon: every turn, sort the two moves by priority, then Speed; a tie is a coin flip
| Decided | Stats | Ties | Ambush | |
|---|---|---|---|---|
| Dragon Warrior | once per battle, then alternating2,3 | Agility against the monster’s defense byte2 | — | the monster may act first2 |
| Final Fantasy | every round4 | none4 | — | surprise or first strike, from the leader’s Agility and Luck10 |
| Red and Blue | every turn5 | Speed; Quick Attack first, Counter last5 | 1/25 | — |
| Crystal | every turn6 | priority 0–3, Quick Claw, then Speed6 | 1/26 | — |
| Emerald | every turn7 | priority, then Speed after its modifiers7 | 1/27 | — |
#Implementations
#Dragon Warrior
At the start of a battle, CalcWhoIsNext gives the hero the first turn when Agility times a random byte is at least the monster’s defense byte times a roll of 0–632. Otherwise the monster acts first2. With Agility 40 against a defense byte of 40, the hero goes first 87.70% of the time, measured in the ROM over every generator state30.
After that, the sides alternate. Each of the hero’s actions ends by jumping to the monster’s turn, and each of the monster’s to the hero’s; a menu the hero backs out of re-prompts without spending the turn3. The NES manual says Agility makes the hero “faster”31.
#Dragon Warrior II and III
The North American Dragon Warrior II replaces the alternation with a round order14,3. Each round sorts every living hero and monster by ⌊agility/2⌋ + random byte (+0 or 1), highest first12,12. A battle opens with a surprise roll, 1/32 each way13, in which either side can lose its first round13. The North American Dragon Warrior III scales the agility itself, agility × 1/4 to 1, highest first15, where Dragon Warrior II adds a roll to half of it16.
#Final Fantasy
Every round, DoBattleRound lists the 9 enemy slots and the 4 characters and shuffles them with 16 swaps of two random positions4. No stat enters the order. Disch calls the shuffle suboptimal: an entry stays where it started more often than a full shuffle would leave it, and the characters start last4.
The NES manual says otherwise: “Each character’s agility, regardless of enemy or ally, dictates the order of execution”9. In battle, Agility is read only by a check at the start, although a level-up that raises it also raises evade10,32,33. That check draws from the leader’s Agility and Luck and the formation’s surprise rate; below 11 the party is surprised and loses its first round of commands, and from 90 the party strikes first and the enemies skip the first round10.
#Final Fantasy III to VI
Final Fantasy III still places every slot by a random key, but then orders the four characters among themselves by agility plus a random 0 to twice agility11,4.
The next three games use active time. In Final Fantasy IV, each combatant’s timer counts down once per battle tick27. Its base duration is 5 × reference agility ÷ own agility26, so a combatant with twice the agility waits half as long26. Final Fantasy V sets the timer to 120 + weight/8 − agility ticks28, counted down one a tick28. Final Fantasy VI fills a gauge instead, by (speed + 20) × 1.5 × 64 ÷ 16 per 2 frames29 at normal speed, and a combatant acts when its gauge overflows29. Its battle speed setting slows only the monsters29.
#Pokémon Red and Blue
Quick Attack moves first and Counter last, unless both sides chose the same one5. Otherwise the Pokémon with the higher Speed moves first, and a tie goes either way with probability 1/25. The player’s item, switch, or run attempt happens in the battle menu, before either move5.
Pokémon Yellow keeps this order unchanged22,5.
#Pokémon Crystal
Crystal turns the two special cases into a priority table: 3 for Protect and Endure, 2 for Quick Attack, Mach Punch, and ExtremeSpeed, 1 for most moves, and 0 for Roar, Whirlwind, Counter, Mirror Coat, and Vital Throw6. At equal priority, a held Quick Claw goes first on a random byte below 60, then higher Speed, then a coin flip6. The player’s switch or item always comes first6.
Pokémon Gold and Silver already have the priority table and the Quick Claw, and Crystal keeps their routine23,6.
#Pokémon Emerald
Emerald compares each move’s priority, then a Speed adjusted by stat stages, Swift Swim or Chlorophyll in their weather, a badge bonus for the player, Macho Brace, paralysis, and a Quick Claw that triggers7. A tie is a coin flip7.
Pokémon Ruby and Sapphire’s GetWhoStrikesFirst applies the same priority and Speed adjustments24,7. Its Quick Claw sets the holder’s Speed to the maximum when a per-turn random number is below 20% of 0xFFFF24. Pokémon FireRed and LeafGreen run Emerald’s rule, except that they withhold the third badge’s ×1.1 Speed only in link battles, where Emerald also withholds it in recorded-link and Frontier battles25.
#EarthBound Beginnings and EarthBound
In the English build of EarthBound Beginnings, the next combatant is picked one at a time, by Speed ±0–24%, rerolled each pick17, highest first17. In the US release of EarthBound, initiative is rolled once a turn instead of once a pick, Speed ±50%, once per turn19, and ties go to the later slot19,17.
#Variants and combinations
- Fleeing. Dragon Warrior’s run test is its first-turn test with a wider roll for later monsters34. In Final Fantasy, striking first makes a RUN certain32.
- Random number generator. Final Fantasy’s shuffle draws its 32 positions from the battle table4,35.
#History
The games read here run from Dragon Quest (Famicom, 1986) to Emerald (2004)36,37.
Games
| Game | Year | How | Note |
|---|---|---|---|
| Nobunaga's Ambition | 1986 | Side by side | the defender orders all its units, then the attacker, and a day passes |
| Genghis Khan | 1987 | Side by side | the attacker orders all his units, then the defender, and a day ends |
| Dragon Warrior | 1986 | Alternating | a quick hero usually strikes first, and then hero and monster take turns |
| Final Fantasy | 1987 | Shuffled | everyone acts in a fresh random order each round, and no stat moves a character up |
| Final Fantasy III | 1990 | Shuffled, agility within the party | party and monsters act in a random order each round; agility only decides which party member goes before another |
| Dragon Warrior II | 1987 | Stat plus a roll | quick fighters tend to act early in a round, but luck can put anyone first |
| Dragon Warrior III | 1988 | Stat plus a roll | quick characters usually act early in a round, but luck can put a slow one first |
| EarthBound Beginnings | 1989 | Stat plus a roll | each pick rolls every waiting combatant's Speed through a ±0–24% spread, and the highest acts |
| EarthBound | 1994 | Stat plus a roll | Speed ±50%, rolled once per turn, highest first |
| Genghis Khan II: Clan of the Gray Wolf | 1992 | By a stat | on the combat display units act in order of mobility; on the campaign map the attacker moves, then the defender |
| Pokémon Red and Blue | 1996 | Priority, then Speed | Quick Attack goes first and Counter last, then the higher Speed, with a tie split evenly |
| Pokémon Yellow | 1998 | Priority, then Speed | Red and Blue's Quick Attack, Counter, and Speed rule, unchanged |
| Pokémon Gold and Silver | 1999 | Priority, then Speed | move priority from 0 to 3, then a held Quick Claw's roll, then Speed |
| Pokémon Crystal | 2000 | Priority, then Speed | move priority from 0 to 3, then a held Quick Claw's roll, then Speed |
| Pokémon Ruby and Sapphire | 2002 | Priority, then Speed | priority, then adjusted Speed, with a Quick Claw that puts its holder first on 20% of turns at equal priority |
| Pokémon Emerald | 2004 | Priority, then Speed | priority, then Speed after stages, weather abilities, the badge, items, and paralysis |
| Pokémon FireRed and LeafGreen | 2004 | Priority, then Speed | Emerald's priority and Speed rule |
| Final Fantasy IV | 1991 | Active time | every fighter waits on its own clock, so a quicker character gets more turns |
| Final Fantasy V | 1992 | Active time | each fighter waits on its own clock, and more agility shortens the wait |
| Final Fantasy VI | 1994 | Active time | each combatant's gauge fills in real time by its speed |
Every claim about this mechanic, by game (34)
References
- ^The Gameplay Design Patterns wiki defines Turn Taking as "Letting one player do some action or actions before letting other players act," and lists randomness among the ways to set the order.WikiGameplay Design Patterns wiki, “Turn Taking”
How we know
Letting one player do some action or actions before letting other players act.
lead · archived copy ↗ Finally, Randomness may be used to determine turn order.
Using the pattern · archived copy ↗ The quote matches our archived copy.
- ^ abcdefgAt the start of a battle,
CalcWhoIsNextgives the hero the first turn when Agility × a random byte is at least the monster's defense byte × a roll of 0–63; otherwise the monster attacks first.Codenmikstas/dragon-warrior-disassemblyHow we know
6655LE5BF: JSR CalcWhoIsNext ;($EEC0)Randomly calculate who attacks next. ⋮ 6657LE5C2: BCS StartPlayerTurn ;($E5CE)It's the player's turn to attack.
source_files/Bank03.asm lines 6654–6663 at ebe6a13 · upstream ↗ 8293LEEC5: AND #$3F ;Keep only lower 6 bits(0-63). ⋮ 8297LEEC9: LDA EnBaseDef ; ⋮ 8313LEEE6: LDA DisplayedAgi ; ⋮ 8321LEEF5: SEC ;Subtract the enemy's defense*rnd from player's agility*rnd.
source_files/Bank03.asm lines 8290–8325 at ebe6a13 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdeAfter the first turn, the hero and the monster alternate; each of the hero's actions ends by jumping to
StartEnemyTurn, and each of the monster's toStartPlayerTurn.Codenmikstas/dragon-warrior-disassemblyHow we know
6804LE68D: JSR DoDialogHiBlock ;($C7C5)It is dodging!... 6805LE690: .byte $0A ;TextBlock17, entry 10. ⋮ 6807LE691: JMP StartEnemyTurn ;($EB1B)It's the enemy's turn to attack.
source_files/Bank03.asm lines 6803–6807 at ebe6a13 · upstream ↗ 7774LEBE2: JSR DoDialogLoBlock ;($C7CB)A miss! no damage hath been scored... 7775LEBE5: .byte $FB ;TextBlock16, entry 11. ⋮ 7777LEBE6: JMP StartPlayerTurn ;($E5CE)It's the player's turn to attack.
source_files/Bank03.asm lines 7772–7777 at ebe6a13 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefghEach round,
DoBattleRoundlists the 9 enemy slots and 4 characters and shuffles them with 16 swaps of two random positions; no stat enters the order.CodeDisch, FF1 disassemblyHow we know
3181lut_InitialTurnOrder: 3182 .BYTE $00, $01, $02, $03, $04, $05, $06, $07, $08 ; enemy IDs 3183 .BYTE $80, $81, $82, $83 ; character IDs
Final Fantasy Disassembly/bank_0C.asm lines 3181–3183 at cbb87d3 · upstream ↗ 3199DoBattleRound: 3200 LDY #$0D ; initialize turn order buffer ⋮ 3211 ; Shuffle the turn order. This is done by looping 16 times, each time 3212 ; it will pick 2 random entries in the turn order table and swap them. ⋮ 3214 ; Note that this is suboptimal, since it's more likely for an entry to ⋮ 3227 JSR RandAX ; pick two random indexes ⋮ 3231 JSR RandAX ⋮ 3236 LDA btl_turnorder, Y ; swap those entries in the turn order
Final Fantasy Disassembly/bank_0C.asm lines 3199–3244 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefghiQuick Attack moves first and Counter last unless both sides chose the same one; otherwise the Pokémon with higher Speed moves first, and a tie goes either way with probability 1/2.Codepret/pokered
How we know
371 cp QUICK_ATTACK 372 jr nz, .playerDidNotUseQuickAttack ⋮ 374 cp QUICK_ATTACK ⋮ 377.playerDidNotUseQuickAttack ⋮ 379 cp QUICK_ATTACK ⋮ 382 cp COUNTER ⋮ 385 cp COUNTER 386 jr z, .compareSpeed ; if both used Counter 387 jr .enemyMovesFirst ; if player used Counter and enemy didn't ⋮ 390 cp COUNTER ⋮ 392.compareSpeed ⋮ 396 call StringCmp ; compare speed values ⋮
engine/battle/core.asm lines 369–412 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefghiCrystal ranks moves by priority: 3 for Protect and Endure, 2 for Quick Attack, Mach Punch, and ExtremeSpeed, 1 for most moves, and 0 for Roar, Whirlwind, Counter, Mirror Coat, and Vital Throw; at equal priority a held Quick Claw goes first on a random byte below 60, then higher Speed, then a coin flip.Codepret/pokecrystal
How we know
477.use_move 478 ld a, [wBattlePlayerAction] 479 and a ; BATTLEPLAYERACTION_USEMOVE? 480 jp nz, .player_first 481 call CompareMovePriority 482 jr z, .equal_priority ⋮ 486.equal_priority ⋮ 493 cp HELD_QUICK_CLAW ⋮ 496 cp HELD_QUICK_CLAW ⋮ 498 call BattleRandom 499 cp e 500 jr nc, .speed_check ⋮
engine/battle/core.asm lines 477–540 at 97187cd · upstream ↗ 829GetMovePriority: 830; Return the priority (0-3) of move a. ⋮ 834 ; Vital Throw goes last. 835 cp VITAL_THROW ⋮ 849 ld a, BASE_PRIORITY
engine/battle/core.asm lines 829–850 at 97187cd · upstream ↗ 1MoveEffectPriorities: 2 db EFFECT_PROTECT, 3 3 db EFFECT_ENDURE, 3 4 db EFFECT_PRIORITY_HIT, 2 5 db EFFECT_FORCE_SWITCH, 0 6 db EFFECT_COUNTER, 0 7 db EFFECT_MIRROR_COAT, 0
data/moves/effects_priorities.asm lines 1–8 at 97187cd · upstream ↗ 156 item_attribute 100, HELD_QUICK_CLAW, 60, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSEdata/items/attributes.asm lines 155–156 at 97187cd · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefgh
GetWhoStrikesFirstputs the higher-priority move first; at equal priority the higher Speed goes first, after stat stages, Swift Swim or Chlorophyll in their weather, the third badge's ×1.1 for the player, Macho Brace, paralysis's ×¼, and a Quick Claw that triggers; a tie is a coin flip.Codepret/pokeemeraldHow we know
4595u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) ⋮ 4609 else ⋮ 4615 else ⋮ 4618 else ⋮ 4633 else ⋮ 4644 speedBattler1 = (speedBattler1 * 110) / 100; ⋮ 4650 if (gBattleMons[battler1].status1 & STATUS1_PARALYSIS) 4651 speedBattler1 /= 4; ⋮ 4653 if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100) 4654 speedBattler1 = UINT_MAX; ⋮ 4667 else ⋮ 4687 if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100) ⋮
src/battle_main.c lines 4595–4750 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^In battle the attacker gives orders to all of his units, then the defender to all of his, and one day ends.ManualKoei, Genghis Khan NES manual · Koei, Genghis Khan Famicom manual (JP)
How we know
After both sides have deployed, the attacking side will issue orders to all of his units. The defending side then follows suit, with one day ending after both sides have given orders to all of their units.
p. 27, Combat · archived copy ↗ 1ターンは1日にあたり、各部隊に命令を1回ずつ出せます。
p. 5 (PDF p. 7) · archived copy ↗ The quote matches our archived copy.
- ^ abThe NES manual says agility sets the order: "Each character's agility, regardless of enemy or ally, dictates the order of execution."ManualFinal Fantasy NES manual
How we know
Each character's agility, regardless of enemy or ally, dictates the order of execution.
p. 26, Battle Techniques, Run as a Strategy · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdAt the start of a battle, unless the formation is marked no-run, the game draws with of the party leader: below 11 the party is surprised and loses its first round of commands, and from 90 the party strikes first and the enemies skip the first round.CodeDisch, FF1 disassembly
How we know
383 AND #$01 ; see if "no run" bit is set. If it is, there is no strike first/surprised check ⋮ 389 ; S = (leaders_agility + leaders_luck) / 8 390 ; V = random[S+S, S+100] - surpised_rate ⋮ 393 ; if V >= 90, party strikes first ⋮ 399 LDA ch_agil 400 CLC 401 ADC ch_luck ⋮ 422 CMP #11 423 BCC @Surprised ; if < 11, SURPRISED! 424 CMP #90 ⋮ 430 INC btl_strikingfirst ; set flag ⋮ 437 JMP BattleLogicLoop_DoCombat ; skip over first round of player input, and just do combat
Final Fantasy Disassembly/bank_0C.asm lines 381–437 at cbb87d3 · upstream ↗ 3259 LDA btl_strikingfirst ; if the party is striking first 3260 BNE @NextTurn ; skip their turn
Final Fantasy Disassembly/bank_0C.asm lines 3259–3260 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ ab
determine attack ordergives each of the 12 battle slots a random key of 0–255 and passes the list to a routine the disassembly calls "sort attack order list ???"; it then gives each of the four characters a key of agility plus a random 0 to twice agility, sorts those the same way, and writes the characters in that order into the character entries of the first list. Chance places each character among the monsters, and agility orders the characters among themselves.Codeeverything8215, FF3 disassemblyHow we know
24351; [ determine attack order ] ⋮ 2435334/9777: A0 00 LDY #$00 2435434/9779: A9 FF LDA #$FF 2435534/977B: 20 64 A5 JSR $A564 ; random (0..A) 2435634/977E: 99 00 74 STA $7400,Y ⋮ 2437434/97A2: 20 57 8F JSR $8F57 ⋮ 2438834/97BF: B1 57 LDA ($57),Y ; agility 2438934/97C1: 85 3C STA $3C 2439034/97C3: 0A ASL 2439134/97C4: 20 64 A5 JSR $A564 ; random (0..A) 2439234/97C7: 18 CLC 2439334/97C8: 65 3C ADC $3C ⋮
ff3j.asm lines 24351–24425 at 1acef81 · upstream ↗ 23241; [ sort attack order list ??? ] ⋮ 23243; recursive subroutine
ff3j.asm lines 23241–23243 at 1acef81 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abcIn Dragon Warrior II (NA NES), each round every living hero and monster gets a key of half its agility, rounded down, plus a random byte plus a random 0 or 1, capped at 255, and a selection sort sets the order from the highest key down.CodeNathan-R-Og/dq2revised
How we know
9168B04_B6DC: ⋮ 9176 lda ($B9), y ⋮ 9180 sta $06C7, x 9181 ldy #$0A 9182 lda ($B9), y 9183 jsr B04_B790 ⋮ 9207 sta $06C7, x 9208 ldy #$04 9209 lda ($BB), y 9210 jsr B04_B790
src/us/prg/bank4.asm lines 9168–9210 at 0fb64a4 · upstream ↗ 4814 ldy #$09 ; offset for STR ⋮ 4820 iny 4821 lda $9A ; current AGI ⋮ 4823 sta ($C3), y ; update hero's current AGI
src/us/prg/bank4.asm lines 4814–4823 at 0fb64a4 · upstream ↗ 732B0F_C3B6: 733 ldy #$08 ⋮ 744 asl 745 bcc B0F_C3D1 ⋮ 757B0F_C3D1: 758 dey 759 bne B0F_C3B8 760 rts
src/us/prg/constant.asm lines 732–760 at 0fb64a4 · upstream ↗ 9235B04_B74E: 9236 ldx #$00 9237B04_B750: 9238 lda $06D2, x ⋮ 9244B04_B75A: 9245 lda $A8 9246 cmp $06D2, y 9247 bcs B04_B768
src/us/prg/bank4.asm lines 9235–9250 at 0fb64a4 · upstream ↗ 9274B04_B790: 9275 lsr 9276 sta $99 ⋮ 9281 adc $99 9282 bcc B04_B79E 9283 lda #$FF
src/us/prg/bank4.asm lines 9274–9286 at 0fb64a4 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcIn Dragon Warrior II (NA NES), a battle opens with a roll of 0–31: on 0 the monsters "did not see" the party and lose their first round, and on 1 they attack "before [the hero] was set for battle" and the heroes lose theirs.CodeNathan-R-Og/dq2
How we know
3120 lda #$20 ⋮ 3123 sta $06DD 3124 cmp #$01 3125 bcc B04_957D 3126 bne B04_9585 3127 lda #$03 ; String ID #$0003: [name] attacked![end-FC] ⋮ 3132 lda #$04 ; String ID #$0004: Before [name] was set for battle.[end-FC] ⋮ 3143B04_957D: 3144 lda #$05 ; String ID #$0005: But the [name] did not see thee.[end-FC]
src/us/prg/bank4.asm lines 3120–3146 at 0fb64a4 · upstream ↗ 3241 lda $06C7, x 3242 cmp #$18 3243 bcs B04_963C 3244 cmp #$03 3245 bcc B04_962E 3246 and #$07 3247 ldy $06DD 3248 cpy #$00 3249 beq B04_963C ⋮ 3253 beq B04_963C ⋮ 3255B04_962E: 3256 ldy $06DD ⋮
src/us/prg/bank4.asm lines 3241–3258 at 0fb64a4 · upstream ↗ 3298 lda #$FF 3299 sta $06DD
src/us/prg/bank4.asm lines 3298–3299 at 0fb64a4 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abDragon Warrior II (NA NES) changes Dragon Warrior's battle rules: the hero's 1-in-32 "excellent move" becomes a 1-in-64 "tremendous blow", the fixed alternation of hero and monster becomes a round order sorted by half the agility plus a roll, and running no longer weighs the hero's Agility against the monster.Codenmikstas/dragon-warrior-disassembly · Nathan-R-Og/dq2revised
How we know
6733LE624: AND #$1F ;Did player get an excellent move(1/32 chance)?source_files/Bank03.asm lines 6724–6759 at ebe6a13 · upstream ↗ 6249 lda #$40 6250 sta $A6
src/us/prg/bank4.asm lines 6249–6250 at 0fb64a4 · upstream ↗ 6807LE691: JMP StartEnemyTurn ;($EB1B)It's the enemy's turn to attack.source_files/Bank03.asm lines 6803–6807 at ebe6a13 · upstream ↗ 7777LEBE6: JMP StartPlayerTurn ;($E5CE)It's the player's turn to attack.source_files/Bank03.asm lines 7772–7777 at ebe6a13 · upstream ↗ 9274B04_B790: 9275 lsr 9276 sta $99
src/us/prg/bank4.asm lines 9274–9286 at 0fb64a4 · upstream ↗ 8313LEEE6: LDA DisplayedAgi ;source_files/Bank03.asm lines 8290–8325 at ebe6a13 · upstream ↗ 3191B04_95BF: 3192 lda $06DD 3193 beq B04_95CB 3194 lda #$03
src/us/prg/bank4.asm lines 3191–3197 at 0fb64a4 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abIn Dragon Warrior III (NA NES), each round every hero and monster gets a key of a quarter of its agility plus a random share of the other three quarters, so from a quarter to all of it, and a selection sort sets the order from the highest key down.Code“Dragon Warrior III (USA)” · zeromus/DragonWarrior3
How we know
In the cartridge (“Dragon Warrior III (USA)”): bank 4 $8183-$8214, the keys for four heroes and eight monsters, the sort, and the randomizer. We don't reproduce the bytes.
242sub_68183: ⋮ 250 LDA _players_rAGI,Y 251 STA word_4 252 JSR _randomize_75_percent ⋮ 270 JSR sub_6B73E ; load enemy's agility ⋮ 272 STA word_4 273 JSR _randomize_75_percent ⋮ 296;look for maximum unused agility in table at byte_54C
disassembly/bank04.inc lines 242–300 at b35d5fd · upstream ↗ 333_randomize_75_percent: 334 LDA word_4 335 LSR 336 LSR 337 STA word_4+1 338 LDA word_4 339 SEC 340 SBC word_4+1 341 JSR _b4_sF_rand_mul_A 342 CLC 343 ADC word_4+1
disassembly/bank04.inc lines 333–345 at b35d5fd · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abDragon Warrior III (NA NES) changes Dragon Warrior II's round order: Dragon Warrior II adds a random byte (and a random 0 or 1) to half the agility, while Dragon Warrior III scales the agility itself by a random factor from a quarter to one.CodeNathan-R-Og/dq2 · zeromus/DragonWarrior3 · “Dragon Warrior III (USA)”revised
How we know
9274B04_B790: 9275 lsr 9276 sta $99 ⋮ 9281 adc $99
src/us/prg/bank4.asm lines 9274–9283 at 0fb64a4 · upstream ↗ 333_randomize_75_percent: ⋮ 341 JSR _b4_sF_rand_mul_A 342 CLC 343 ADC word_4+1
disassembly/bank04.inc lines 333–345 at b35d5fd · upstream ↗ In the cartridge (“Dragon Warrior III (USA)”): bank 4 $8201, the retail randomizer. We don't reproduce the bytes.
Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcdIn EarthBound Beginnings (English build), the next combatant to act is picked one at a time: every combatant yet to act this round rolls its Speed through the ±0–24% spread, capped at 255, and the highest goes; the rest roll again for the next pick.CodeNathan-R-Og/mother
How we know
2305BattleTurnEngine: 2306 jsr ConcludeBattle 2307 bcs @TurnEngineReturn 2308 ldx #8 2309@TurnEngineSort_LS: 2310 txa 2311 pha 2312 jsr SortTurnOrder 2313 jsr DoBattlerTurn 2314 lda #$ff 2315 ldy attacker_offset 2316 sta BATTLER_ACTION_ID, y
src/global/prg/battle.asm lines 2305–2316 at e0b3e3f · upstream ↗ 2349SortTurnOrder: ⋮ 2351 sta battle_wordvar60 2352 sta battle_wordvar60+1 ⋮ 2355 lda BATTLER_ACTION_ID, y 2356 cmp #BA_COMPLETE 2357 beq @SortTurnOrder_INC ⋮ 2360 lda BATTLER_SPD, y 2361 jsr RNGifySpeed 2362 cmp battle_wordvar60+1 2363 bcc @SortTurnOrder_INC 2364 sta battle_wordvar60+1 ⋮ 2371 sta battle_wordvar60 ⋮
src/global/prg/battle.asm lines 2349–2376 at e0b3e3f · upstream ↗ 9972; used in Turn Order sorting to randomize speed (theorized effect) 9973; should be +-25% 9974; A should have the Speed value to modify 9975RNGifySpeed: ⋮ 9977 lda UNK_60+1 ⋮ 9979 lda UNK_60 ⋮ 9984 jsr RNG_WORD 9985 lda UNK_60+1 9986 beq @B31_1415 9987 lda #$ff 9988 sta UNK_60
src/global/prg/constant.asm lines 9972–9988 at e0b3e3f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^In EarthBound Beginnings (the English build that the 2015 Virtual Console release uses), a shared routine adds random spread to a value: it moves the value by a weight in percent drawn from a 128-entry table by a random byte, up or down at even odds. The weights run from 0 to 24, and 92 of the 128 entries are 10 or less, so most rolls move the value by a few percent. Damage and the turn-order Speed roll both use it.CodeNathan-R-Og/mother · “EarthBound Beginnings (USA, Europe) (Virtual Console)”
How we know
9867 ldx #6 9868 @B31_130b: 9869 asl UNK_60 9870 rol UNK_60+1 9871 dex 9872 bne @B31_130b ; UNK_60 =<< 6 (multiply by 64) ⋮ 9880 lda #$64 9881 sta UNK_64 9882 jsr B31_113d 9883 jsr RNG_BYTE 9884 lsr a 9885 php ; PUSH SIGN ⋮
src/global/prg/constant.asm lines 9867–9918 at e0b3e3f · upstream ↗ 9943; $F37D - This table is indexed by (rand() >> 1) -- wtf is this layout 9944; WEIGHT 9945B31_137d: 9946 .byte 0, 0, 0, 0, 0 ; 5 9947 .byte 12, 12, 12, 12, 12 ; 5 9948 .byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ; 10 ⋮ 9968 .byte 22 ; 1 9969 .byte 23 ; 1 9970 .byte 24 ; 1
src/global/prg/constant.asm lines 9943–9970 at e0b3e3f · upstream ↗ In the cartridge (“EarthBound Beginnings (USA, Europe) (Virtual Console)”): the fixed bank's $F37D, the 128 weights as the ROM has them. We don't reproduce the bytes.
5285MOV_input_output: 5286 lda battle_input_num 5287 sta battle_wordvar60 5288 lda battle_input_num+1 5289 sta battle_wordvar60+1 5290 jmp RNG_WORD
src/global/prg/battle.asm lines 5285–5290 at e0b3e3f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abcIn EarthBound (US release), every conscious combatant's initiative is rolled at the start of each turn: its Speed moved up or down by up to 50% (the 25% spread's method without the final halving), at least 1. Then the conscious combatant yet to act with the highest initiative goes next, ties going to the later slot.CodeHerringway/ebsrc
How we know
1127 LDA a:battler::consciousness,Y 1128 AND #$00FF 1129 BEQ @UNKNOWN73 1130 TYA 1131 CLC 1132 ADC #battler::initiative 1133 STA @VIRTUAL02 1134 LDA a:battler::speed,Y 1135 JSR FIFTY_PERCENT_VARIANCE 1136 LDX @VIRTUAL02 1137 STA __BSS_START__,X 1138 CMP #0 ⋮
src/battle/main_battle_routine.asm lines 1127–1142 at 68aec5c · upstream ↗ 67 LDX @VIRTUAL04 68 TYA 69 SEP #PROC_FLAGS::ACCUM8 70 JSR TRUNCATE_16_TO_8 71 STA @VIRTUAL02 72 LDA @VIRTUAL04 73 SEC 74 SBC @VIRTUAL02
src/battle/50_percent_variance.asm lines 66–76 at 68aec5c · upstream ↗ 2126 LDA BATTLERS_TABLE+battler::consciousness,Y 2127 AND #$00FF 2128 BEQ @UNKNOWN149 2129 LDA BATTLERS_TABLE+13,Y 2130 AND #$00FF 2131 BNE @UNKNOWN149 2132 LDA BATTLERS_TABLE+70,Y 2133 TAY 2134 STX @VIRTUAL02 2135 TYA 2136.ENDIF 2137 CMP @VIRTUAL02 ⋮
src/battle/main_battle_routine.asm lines 2126–2138 at 68aec5c · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^Legions that meet fight on a combat display, where units act in order of mobility, set by basic mobility, legion level, and the commander's leadership, to a maximum of 15; the weather sets how many combat turns there are.ManualKoei, Genghis Khan II SNES manual
How we know
The number of turns in this mode depends on the weather.
p. 50, The Combat Display · archived copy ↗ Commands are executed by Units in the order of highest mobility. … The mobility of each Unit is determined by its basic mobility, Legion level, and leadership of its commander. The maximum mobility is 15.
p. 51, Combat Command Menus · archived copy ↗ The quote matches our archived copy.
Checked by a second AI model, 2026-10-21.
- ^In battle the attacker moves first and then the defender, each turn is one day, the battle ends after 30 days, and the commander's leadership sets how many commands he can give in a day.ManualKoei, Genghis Khan II SNES manual
How we know
In battle, the attacking side has the first turn, then the defending side issues its commands. Each turn is one day in length. The battle automatically ends after 30 days. The number of commands you can issue in one day depends on the leadership of the Army's commander.
p. 46, The Battle Display · archived copy ↗ The quote matches our archived copy.
Checked by a second AI model, 2026-10-21.
- ^ abYellow keeps Red and Blue's turn order, Quick Attack first and Counter last unless both chose it, then the higher Speed, with a tie split evenly.Codepret/pokeyellow · pret/pokered
How we know
380 cp QUICK_ATTACK ⋮ 383 cp QUICK_ATTACK ⋮ 388 cp QUICK_ATTACK ⋮ 391 cp COUNTER ⋮ 394 cp COUNTER ⋮ 399 cp COUNTER ⋮ 401.compareSpeed ⋮ 413 call BattleRandom 414 cp 50 percent + 1 ⋮ 418 call BattleRandom 419 cp 50 percent + 1
engine/battle/core.asm lines 380–419 at b6696f2 · upstream ↗ engine/battle/core.asm#L371-L410 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abGold and Silver order moves by priority, 3 for Protect and Endure, 2 for the priority-hit moves, 0 for Vital Throw and the force-switch, Counter, and Mirror Coat effects, and 1 for the rest; at equal priority a held Quick Claw goes first when a random byte is below its value, 60, about 23% of the time, and otherwise the higher Speed goes first, with a tie split evenly; Crystal keeps the routine.Codepret/pokegoldrevised
How we know
433 call CompareMovePriority ⋮ 445 cp HELD_QUICK_CLAW ⋮ 448 cp HELD_QUICK_CLAW ⋮ 450 call BattleRandom 451 cp e
engine/battle/core.asm lines 431–452 at fc702b6 · upstream ↗ 781GetMovePriority: 782; Return the priority (0-3) of move a. ⋮ 786 ; Vital Throw goes last. 787 cp VITAL_THROW
engine/battle/core.asm lines 781–792 at fc702b6 · upstream ↗ 1MoveEffectPriorities: 2 db EFFECT_PROTECT, 3 3 db EFFECT_ENDURE, 3 4 db EFFECT_PRIORITY_HIT, 2 5 db EFFECT_FORCE_SWITCH, 0 6 db EFFECT_COUNTER, 0 7 db EFFECT_MIRROR_COAT, 0
data/moves/effects_priorities.asm lines 1–8 at fc702b6 · upstream ↗ 155; QUICK_CLAW 156 item_attribute 100, HELD_QUICK_CLAW, 60, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
data/items/attributes.asm lines 155–156 at fc702b6 · upstream ↗ 485.speed_check 486 ld de, wBattleMonSpeed 487 ld hl, wEnemyMonSpeed 488 ld c, 2 489 call CompareBytes 490 jr z, .speed_tie 491 jp nc, .player_first 492 jp .enemy_first ⋮ 494.speed_tie ⋮ 498 call BattleRandom 499 cp 50 percent + 1 ⋮ 501 jp .enemy_first
engine/battle/core.asm lines 485–501 at fc702b6 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcRuby and Sapphire's
GetWhoStrikesFirstputs the higher-priority move first; at equal priority the higher adjusted Speed goes first, and a tie is a coin flip. Adjusted Speed applies stat stages, doubles for Swift Swim in rain or Chlorophyll in sun, takes ×1.1 for the player's Pokémon with the third badge outside link battles, halves with a Macho Brace, and quarters under paralysis; a held Quick Claw sets it to the maximum when a per-turn random number is below its parameter, 20, as a percent of 0xFFFF.Codepret/pokerubyrevisedHow we know
4594 // Check for abilities that boost speed in weather. ⋮ 4599 bank1SpeedMultiplier = 2; ⋮ 4615 // Calculate adjusted speed for first mon. 4616 bank1AdjustedSpeed = (gBattleMons[bank1].speed * bank1SpeedMultiplier) 4617 * gStatStageRatios[gBattleMons[bank1].statStages[STAT_STAGE_SPEED]][0] / gStatStageRatios[gBattleMons[bank1].statStages[STAT_STAGE_SPEED]][1]; ⋮ 4631 if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && FlagGet(FLAG_BADGE03_GET) && GetBattlerSide(bank1) == 0) 4632 bank1AdjustedSpeed = (bank1AdjustedSpeed * 110) / 100; ⋮ 4634 if (heldItemEffect == HOLD_EFFECT_MACHO_BRACE) 4635 bank1AdjustedSpeed /= 2; ⋮ 4637 if (gBattleMons[bank1].status1 & STATUS1_PARALYSIS) 4638 bank1AdjustedSpeed /= 4; ⋮ 4640 if (heldItemEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (heldItemEffectParam * 0xFFFF) / 100) ⋮
src/battle_main.c lines 4594–4641 at 5784633 · upstream ↗ 4701 if (gBattleMoves[bank1Move].priority != 0 || gBattleMoves[bank2Move].priority != 0) ⋮ 4703 if (gBattleMoves[bank1Move].priority == gBattleMoves[bank2Move].priority) ⋮ 4705 if (bank1AdjustedSpeed == bank2AdjustedSpeed && (Random() & 1)) 4706 strikesFirst = 2; 4707 else if (bank1AdjustedSpeed < bank2AdjustedSpeed) 4708 strikesFirst = 1; ⋮ 4711 strikesFirst = 1; ⋮ 4713 else ⋮ 4715 if (bank1AdjustedSpeed == bank2AdjustedSpeed && (Random() & 1)) 4716 strikesFirst = 2; 4717 else if (bank1AdjustedSpeed < bank2AdjustedSpeed) 4718 strikesFirst = 1;
src/battle_main.c lines 4701–4718 at 5784633 · upstream ↗ 2932 .name = _("QUICK CLAW"), ⋮ 2935 .holdEffect = HOLD_EFFECT_QUICK_CLAW, 2936 .holdEffectParam = 20,
src/data/items_en.h lines 2932–2936 at 5784633 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abFireRed and LeafGreen's
GetWhoStrikesFirstis Emerald's rule: the higher-priority move first, then the higher adjusted Speed, with a tie a coin flip, and a Quick Claw that sets Speed to the maximum on its roll. It differs only in withholding the third badge's ×1.1 Speed in link battles alone, where Emerald also withholds it in recorded-link and Frontier battles.Codepret/pokefirered · pret/pokeemeraldrevisedHow we know
3442 // badge boost 3443 if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) ⋮ 3451 if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100) 3452 speedBattler1 = UINT_MAX;
src/battle_main.c lines 3442–3452 at ce6406d · upstream ↗ 3505 if (gBattleMoves[moveBattler1].priority != 0 || gBattleMoves[moveBattler2].priority != 0) ⋮ 3508 if (gBattleMoves[moveBattler1].priority == gBattleMoves[moveBattler2].priority) ⋮ 3510 if (speedBattler1 == speedBattler2 && Random() & 1) ⋮ 3516 else if (gBattleMoves[moveBattler1].priority < gBattleMoves[moveBattler2].priority) 3517 strikesFirst = 1; // battler2's move has greater priority
src/battle_main.c lines 3505–3517 at ce6406d · upstream ↗ 4639 // badge boost 4640 if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) ⋮ 4653 if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100) 4654 speedBattler1 = UINT_MAX;
src/battle_main.c lines 4639–4654 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcAt the start of a battle, each combatant's base timer duration is 50 times a reference party member's modified agility over 10 times its own modified agility, at least 1; the reference is the first present party member whose character ID is 1 or $0B, or failing that the first present one, so a combatant with twice the agility waits half as long between turns.Codeeverything8215, FF4 disassembly
How we know
493@8d44: clr_axy 494 stx $c7 495@8d49: lda $3540,y 496 bne @8d5f 497 lda $c7 498 bne @8d7a 499 lda $2000,x 500 and #$1f 501 cmp #$01 502 beq @8d7a 503 cmp #$0b
battle/init.asm lines 493–503 at a360e2e · upstream ↗ 518@8d7a: lda $2015,x ⋮ 521 ldx #$0032 522 stx $393f 523 jsr Mult16 ⋮ 533 lda $2015,x 534 sta $df 535 lda #$0a 536 sta $e1 537 jsr Mult8 ⋮ 542 jsr Div16 543 ldx $3949 544 bne @8dbf ⋮
battle/init.asm lines 518–550 at a360e2e · upstream ↗ $1015 modified agility
notes/ff4j-sfc-ram-map.txt#L722 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ ab
BattleMainwaits 1, 2, 4, 6, 8, or 11 frames by the battle speed setting (BattleSpeedTblplus one), holding while the game is paused or in wait mode, then decrements every combatant's timers (DecTimers) and runs a pending action. An action timer's duration is the base duration times a speed modifier over 16, and 16 is the normal modifier.Codeeverything8215, FF4 disassemblyHow we know
1021BattleMain: 1022@85d9: lda $16ac ; battle speed 1023 tax 1024 lda f:BattleSpeedTbl,x 1025 inc 1026 sta $3538 1027 stz $38e6 1028@85e8: lda #$02 ; battle graphics $02: wait one frame 1029 jsr ExecBtlGfx 1030 lda $38d9 1031 ora $38da 1032 bne @85e8 ; branch if paused or wait mode ⋮
battle/battle.asm lines 1021–1033 at a360e2e · upstream ↗ 1067@8649: jsr DecTimers ⋮ 1081@866d: jsr GetPendingAction ⋮ 1085 jsr DoAction
battle/battle.asm lines 1067–1085 at a360e2e · upstream ↗ 1476; not stopped 1477@96d6: inx3 ; next timer 1478 lda #6 ; loop through 6 timers ⋮ 1504 dec $2a04,x ; decrement counter
battle/battle.asm lines 1476–1504 at a360e2e · upstream ↗ 367; battle speed constants 368BattleSpeedTbl: 369@ff06: .byte 0,1,3,5,7,10
battle/battle_data.asm lines 367–369 at a360e2e · upstream ↗ 282ApplySpeedMod: 283@9fd8: ldx $a9 ; base duration 284 stx $393d 285 ldx $3979 ; multiplier 286 stx $393f 287 jsr Mult16 ⋮ 290 ldx #$0010 291 stx $3947 292 jsr Div16 293 ldx $3949 294 stx $ab ; mod. duration
battle/timer_dur.asm lines 282–298 at a360e2e · upstream ↗ 898 lda #$01 ; auto-battle speed modifier 899 sta $203b,x 900 bra @9086 901@9081: lda #$10 ; normal speed modifier 902 sta $203b,x
battle/init.asm lines 898–902 at a360e2e · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abcA combatant's ATB timer is set to 120 + equipment weight ÷ 8 − agility, at least 1, adjusted for haste or slow, and
UpdateTimercounts it down by one each tick and flags it when it reaches 0, when the turn comes due. The battle speed setting sets a wait of 0, 15, 30, 60, 120, or 240 when a character's turn arrives.Codeeverything8215, FF5 disassemblyHow we know
5397;initialize ATB (A: character index 0-12) 5398.proc ResetATB ⋮ 5406 lda CharStruct::EqWeight,X 5407 jsr ShiftDivide_8 ;weight/8 5408 clc 5409 adc #$78 ;+120 5410 sec 5411 sbc Agility ;-agi 5412 beq :+ 5413 bcs :++ 5414: lda #$01 ;min 1 5415: jsr HasteSlowMod ⋮
src/battle/battle-main.asm lines 5397–5416 at 997c87d · upstream ↗ 4721;Advances a status/atb timer if that status is supposed to be checked this tick ⋮ 4725.proc UpdateTimer ⋮ 4740 lda CurrentTimer,X 4741 beq FlagTimer 4742 dec CurrentTimer,X 4743 lda CurrentTimer,X 4744 bne TimerActive 4745FlagTimer: ;flag EnableTimer when CurrentTimer hits 0
src/battle/battle-main.asm lines 4721–4748 at 997c87d · upstream ↗ 11470 and #$0F ;battle mode and speed 11471 tax 11472 lda f:BattleSpeedTbl,X 11473 sta ATBWaitTime
src/battle/battle-main.asm lines 11470–11473 at 997c87d · upstream ↗ 5336;Waits when a character's turn arrives (amount depending on battle speed setting) 5337.proc ATBWait ⋮ 5342 lda ATBWaitLeft 5343 beq DoneWaiting 5344 dec 5345 sta ATBWaitLeft
src/battle/battle-main.asm lines 5336–5349 at 997c87d · upstream ↗ 24789; d0/ecf2: battle speed constants 24790BattleSpeedTbl: 24791 .byte 0,15,30,60,120,240,0,0 ; active 24792 .byte 0,15,30,60,120,240,0,0 ; wait
src/battle/battle-main.asm lines 24789–24792 at 997c87d · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-25.
Checked by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
- ^ abcdEach combatant's ATB gauge constant is (speed + 20) times 1.5 times a haste, normal, or slow constant of 84, 64, or 32, over 16; for monsters the speed term is first scaled by 255 − 24 × the battle speed setting, over 255, so the setting slows only the monsters. Every 2 frames
UpdateBattleTimeadds each present combatant's constant to its gauge, and a gauge that overflows gives that combatant a turn. It skips the update only when wait mode is on and the battle-time-stopped flag is also set, since it ANDs the two.Codeeverything8215, FF6 disassemblyrevisedHow we know
1437; [ update atb gauge constant ] ⋮ 1439CalcSpeed: 1440@09d2: php 1441 ldy #$20 1442 lda near wTargetProp3::w7e3ef8,x 1443 bit #STATUS3::SLOW 1444 bne @09e4 1445 ldy #$40 ; y = haste/normal/slow constant (32/64/82) 1446 bit #STATUS3::HASTE 1447 beq @09e4 1448 ldy #$54 ⋮ 1454 lsr ⋮
src/battle/action_1.asm lines 1435–1470 at 8130132 · upstream ↗ 4; [ update battle time ] ⋮ 6UpdateBattleTime: ⋮ 10 lda near w7e2f41 ; check if battle time is stopped by battle program 11 and near w7e3a8f ; wait mode 12 bne @118b 13 lda near w7e3a6c ; previous frame counter value 14 ldx #2 15@112e: cmp $0e ; current frame counter value 16 beq @1190 ; return if less than 2 frames have elapsed
src/battle/atb.asm lines 4–16 at 8130132 · upstream ↗ 91; [ increment atb gauge counter ] ⋮ 97 lda near wTargetProp1::w7e3218,x ; atb gauge % 98 adc near wTargetProp2::w7e3ac8,x ; add atb constant 99 sta near wTargetProp1::w7e3218,x 100 shorta 101 bcc _11ba ; return if it didn't overflow ⋮ 105@11d1: stz near wTargetProp1::w7e3218_H,x ; clear atb gauge % ⋮ 116 jsr SetFlag0 ; set $3aa0.7 (allow battle menu to open) ⋮ 121; [ open battle menu (character) or add action to advance wait queue (monster) ] ⋮ 149_120e: jmp _c24e66 ; add action to advance wait queue
src/battle/atb.asm lines 91–149 at 8130132 · upstream ↗ 75@2481: and #$07 ; battle speed 76 asl3 77 sta $ee 78 asl 79 adc $ee 80 not_a 81 sta near w7e3a90 ; set battle speed constant
src/battle/init.asm lines 75–81 at 8130132 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^Measured in the ROM over all 65,536 generator states, with Agility 40 against a defense byte of 40, the hero escapes 87.70% of the time from the first group, 81.64% from the second, 75.20% from the third, and 50.20% from the fourth; the hero takes the first turn 87.70% of the time.Verified“Dragon Warrior (USA) (Rev 1)” · nmikstas/dragon-warrior-disassembly
How we know
In the cartridge (“Dragon Warrior (USA) (Rev 1)”): bank 3 $EE91-$EEFC, TryRun through CalcNextOdds, the code the probe calls. We don't reproduce the bytes.
LDA RandNumUB AND #$7F … LDA EnBaseDef … JSR WordMultiply … LDA DisplayedAgi … SBC GenWord42LB LDA MultRsltUB SBC GenWord42UB
source_files/Bank03.asm#L8256-L8325 · upstream ↗ Measured by a script in MesenCE 2.2.1 (build 4b8a196), on Dragon Warrior (USA) (Rev 1) (SHA-1
66809063b828…). It fails if the result disagrees with the claim.The numbers come from the run; its author, an AI model, checked the script measures what the claim says, 2026-10-25.
Checked by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
- ^The NES manual says Agility helps the hero escape: "This means that you can more easily avoid the enemy or run away."ManualDragon Warrior NES manual
How we know
Your character becomes faster at higher levels. This means that you can more easily avoid the enemy or run away.
p. 15, Agility · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abA character's RUN always succeeds when the party strikes first and always fails in a formation marked no-run; otherwise it succeeds when the character's Luck exceeds
RandAX(0, level + 15), but the level is read from the wrong place: Disch notes the code reads another character's ailment byte or unrelated memory.CodeDisch, FF1 disassemblyHow we know
3755Battle_PlayerTryRun: ⋮ 3762 LDA btl_strikingfirst ; are we striking first? 3763 BNE @Success ; If yes, run success is guaranteed ⋮ 3766 AND #$01 ; if the 'no run' bit is set in the formation, 3767 BNE @Fail ; then failure is guaranteed. ⋮ 3771 ; Run if: Luck > random[0, level+15] ⋮ 3773 ; The problem is... the game is BUGGED and reads the wrong value for the level.. it ends up reading 3774 ; the ailment byte for 2 players after this one (for top 2 slots) or other garbage memory for the ⋮ 3781 LDA (btl_ib_charstat_ptr), Y ; BUGGED - Reading wrong value -- should be OB, not IB ⋮ 3788 JSR RandAX ; random[ 0, level+15 ]
Final Fantasy Disassembly/bank_0C.asm lines 3755–3790 at cbb87d3 · upstream ↗ 3807 LDA btl_mathbuf+2 ; success if low byte was nonzero (if luck > randomval) 3808 BNE @Success ; failure if zero (luck <= randomval) ⋮ 3811 LDA #BTLMSG_CANTRUN ; on failure, print 'Can't Run' ⋮ 3815 LDA #BTLMSG_CLOSECALL ; on success, print 'Close Call....' ⋮ 3819 STA btl_result ; Set the battle result to 3 (party ran)
Final Fantasy Disassembly/bank_0C.asm lines 3807–3819 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^A level-up that raises a character's Agility also raises their evade by 1, up to 200.CodeDisch, FF1 disassembly
How we know
1074 : LDY #ch_evade - ch_stats ; evade goes up 1 if agility went up 1075 LDA @statupbuffer+1 1076 BEQ :+ ; did agility go up? ⋮ 1080 CMP #201 ; cap at 200 1081 BEQ :+
Final Fantasy Disassembly/bank_0B.asm lines 1074–1082 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^
TryRunlets the hero escape when Agility × a random byte is at least the monster's defense byte × a roll whose range grows with the monster: 0–63 from Slime to Druinlord, 0–94 from Drollmagi to Werewolf, 0–127 from Green Dragon to Blue Dragon, and 0–255 from Stoneman on. Running from a sleeping monster always works.Codenmikstas/dragon-warrior-disassembly · Ryan8bit, DW FormulasHow we know
7191LE894: BIT PlayerFlags ;Is the enemy asleep? 7192LE896: BVS RunSuccessful ;If so, branch for a successful run. ⋮ 7194LE898: JSR TryRun ;($EE91)Determine if player can run.
source_files/Bank03.asm lines 7191–7195 at ebe6a13 · upstream ↗ 8260LEE96: CMP #EN_STONEMAN ;Dragonlord 1 or Dragonlord 2? ⋮ 8263LEE9A: LDA RandNumUB ;Load a random number and keep all the bits(0-255). ⋮ 8276LEEAC: BCC CalcWhoIsNext ;If not, branch. ⋮ 8279LEEB0: AND #$3F ; ⋮ 8284LEEB9: AND #$1F ;previous number to get a range of 0-95. 8285LEEBB: ADC MultNum2LB ;
source_files/Bank03.asm lines 8256–8293 at ebe6a13 · upstream ↗ 970.alias EN_DRUINLORD $13 ;Druinlord. 971.alias EN_DROLLMAGI $14 ;Drollmagi. ⋮ 981.alias EN_GDRAGON $1E ;Green dragon. ⋮ 986.alias EN_STONEMAN $23 ;Stoneman.
source_files/Dragon_Warrior_Defines.asm lines 970–986 at ebe6a13 · upstream ↗ Group 1: #00 (Slime) - #19 (Druinlord)
II.B, Running · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^
BattleRNGreturns the next byte of a 256-byte table, indexed by a counter (btl_rngstate) that wraps, so battle draws repeat every 256 calls.CodeDisch, FF1 disassemblyHow we know
13817BattleRNG: 13818 LDX btl_rngstate 13819 INC btl_rngstate 13820 LDA @Scramble_lut, X 13821 RTS
Final Fantasy Disassembly/bank_0F.asm lines 13817–13824 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^Dragon Quest (developer Chunsoft, publisher Enix) came out for the Famicom in Japan on 27 May 1986, and Dragon Warrior for the NES in North America in August 1989.WikidataWikidata
How we know
+1986-05-27T00:00:00Z … +1989-08-00T00:00:00Z
Q2313869, P178 developer, P123 publisher, and P577 publication date qualified by P291 place and P400 platform · archived copy ↗ The quote matches our archived copy.
Checked by a second AI model, 2026-10-21.
- ^Pokémon Emerald (developer Game Freak, publisher Nintendo, Game Boy Advance, and Generation III core series) came out in Japan on 16 September 2004 and North America on 1 May 2005.WikiBulbapedia, “Pokémon Emerald Version”
How we know
Developer: Game Freak … Publisher: Nintendo … Part of: Generation III core series … Japan: September 16, 2004 … North America: May 1, 2005
infobox, Basic info and Release dates · archived copy ↗ The quote matches our archived copy.
Sources
Code
- nmikstas. 2023. “dragon-warrior-disassembly: NES Dragon Warrior software disassembly.” Commit ebe6a13. nmikstas/dragon-warrior-disassembly @ ebe6a13 · licence, all uses
- Disch. 2019. “Final Fantasy Disassembly.” Commit cbb87d3. BenWenger/FinalFantasyDisassembly @ cbb87d3 · licence, all uses
- pret contributors. 2026. “pokered: disassembly of Pokémon Red and Blue.” pret. Commit af51989. pret/pokered @ af51989 · licence, all uses
- pret contributors. 2026. “pokecrystal: disassembly of Pokémon Crystal.” pret. Commit 97187cd. pret/pokecrystal @ 97187cd · licence, all uses
- pret contributors. 2026. “pokeemerald: decompilation of Pokémon Emerald.” pret. Commit 731ad5b. pret/pokeemerald @ 731ad5b · licence, all uses
- 1989. “Dragon Warrior (USA) (Rev 1).” · licence, all uses
- Nathan-R-Og. 2026. “dq2: Disassembly of NES Dragon Warrior II.” Commit 0fb64a4. Nathan-R-Og/dq2 @ 0fb64a4 · licence, all uses
- n.d. “Dragon Warrior III (USA).” · licence, all uses
- zeromus and CaH4e3. 2024. “DragonWarrior3: Dragon Warrior III Reverse Engineering & Reconstructing.” Commit b35d5fd. zeromus/DragonWarrior3 @ b35d5fd · licence, all uses
- everything8215. 2022. “Final Fantasy III (NES) disassembly and ROM info.” Commit 1acef81. everything8215/ff3 @ 1acef81 · licence, all uses
- everything8215. 2022. “Final Fantasy IV Disassembly.” Commit a360e2e. everything8215/ff4 @ a360e2e · licence, all uses
- everything8215. 2026. “Final Fantasy V Disassembly.” Commit 997c87d. everything8215/ff5 @ 997c87d · licence, all uses
- everything8215. 2026. “Final Fantasy VI Disassembly.” Commit 8130132. everything8215/ff6 @ 8130132 · licence, all uses
- pret contributors. 2026. “pokeyellow: disassembly of Pokémon Yellow.” pret. Commit b6696f2. pret/pokeyellow @ b6696f2 · licence, all uses
- pret contributors. 2026. “pokegold: disassembly of Pokémon Gold and Silver.” pret. Commit fc702b6. pret/pokegold @ fc702b6 · licence, all uses
- pret contributors. 2026. “pokeruby: decompilation of Pokémon Ruby and Sapphire.” pret. Commit 5784633. pret/pokeruby @ 5784633 · licence, all uses
- pret contributors. 2026. “pokefirered: decompilation of Pokémon FireRed and LeafGreen.” pret. Commit ce6406d. pret/pokefirered @ ce6406d · licence, all uses
- Nathan-R-Og. 2026. “mother: Disassembly of Mother/Earthbound Zero/Earthbound Beginnings for the NES.” Commit e0b3e3f. Nathan-R-Og/mother @ e0b3e3f · licence, all uses
- Herringway. 2026. “ebsrc: Source code recreation for the game Earthbound.” Commit 68aec5c. Herringway/ebsrc @ 68aec5c · licence, all uses
Primary
- America, Nintendo of. 1989. “Dragon Warrior instruction booklet (NES, North America).” Nintendo of America. original · archived · licence, all uses
- America, Nintendo of. 1990. “Final Fantasy Explorer's Handbook (NES instruction booklet, North America).” Nintendo of America. original · archived · licence, all uses
Secondary
- Björk, Staffan. 2016. “Turn Taking.” Gameplay Design Patterns wiki (gdp3, Chalmers University of Technology). revision 25578. original · archived · licence, all uses
- Ryan8bit. 2011. “Dragon Warrior (NES) Formulas.” GameFAQs. v1.0. original · archived · licence, all uses
- Wikidata contributors. 2026. “Wikidata.” Wikimedia Foundation. original · licence, all uses
- Bulbapedia contributors. 2026. “Pokémon Emerald Version.” Bulbapedia (Bulbagarden). revision 4629817. original · archived · licence, all uses