data/claims/ff4.yamlFinal Fantasy IV (everything8215's disassembly)
Game: Final Fantasy IV.
At 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. ff4/action-timer
About: Final Fantasy IV Active Time Battle
Value
{
"numerator": 50,
"denominator": 10,
"min": 1
}battle/init.asm#L493-L503@8d44: clr_axy
stx $c7
@8d49: lda $3540,y
bne @8d5f
lda $c7
bne @8d7a
lda $2000,x
and #$1f
cmp #$01
beq @8d7a
cmp #$0bFinal Fantasy IV Disassembly · battle/init.asm#L518-L550@8d7a: lda $2015,x
…
ldx #$0032
stx $393f
jsr Mult16
…
lda $2015,x
sta $df
lda #$0a
sta $e1
jsr Mult8
…
…Final Fantasy IV Disassembly · notes/ff4j-sfc-ram-map.txt#L722 — Offset $15 of a combatant's battle properties, which init.asm reads as `$2015,x`.$1015 modified agilityChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Active Time Battle, Final Fantasy IV, Turn order
BattleMain waits 1, 2, 4, 6, 8, or 11 frames by the battle speed setting (BattleSpeedTbl plus 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. ff4/battle-tick
About: Final Fantasy IV Active Time Battle
Value
{
"framesPerTick": [
1,
2,
4,
6,
8,
11
],
"normalSpeedModifier": 16
}battle/battle.asm#L1021-L1033BattleMain:
@85d9: lda $16ac ; battle speed
tax
lda f:BattleSpeedTbl,x
inc
sta $3538
stz $38e6
@85e8: lda #$02 ; battle graphics $02: wait one frame
jsr ExecBtlGfx
lda $38d9
ora $38da
bne @85e8 ; branch if paused or wait mode
…Final Fantasy IV Disassembly · battle/battle.asm#L1067-L1085@8649: jsr DecTimers
…
@866d: jsr GetPendingAction
…
jsr DoActionFinal Fantasy IV Disassembly · battle/battle.asm#L1476-L1504; not stopped
@96d6: inx3 ; next timer
lda #6 ; loop through 6 timers
…
dec $2a04,x ; decrement counterFinal Fantasy IV Disassembly · battle/battle_data.asm#L367-L369; battle speed constants
BattleSpeedTbl:
@ff06: .byte 0,1,3,5,7,10Final Fantasy IV Disassembly · battle/timer_dur.asm#L282-L298ApplySpeedMod:
@9fd8: ldx $a9 ; base duration
stx $393d
ldx $3979 ; multiplier
stx $393f
jsr Mult16
…
ldx #$0010
stx $3947
jsr Div16
ldx $3949
stx $ab ; mod. durationFinal Fantasy IV Disassembly · battle/init.asm#L898-L902lda #$01 ; auto-battle speed modifier
sta $203b,x
bra @9086
@9081: lda #$10 ; normal speed modifier
sta $203b,xChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Active Time Battle, Final Fantasy IV, Turn order
A Fight command makes one percentage roll per point of the attacker's attack multiplier and counts the rolls under its hit rate; the target rolls once per point of its defense multiplier and blocks one hit for each roll under its defense rate. The hits left after blocking multiply one damage roll, and none left is a miss. ff4/hits
About: Final Fantasy IV Multi-hit attack
CodeFinal Fantasy IV Disassembly ·battle/damage.asm#L16-L27CalcHits:
@c987: stz $38fd ; clear number of hits
lda $38fb
beq @c99e ; return if no base hits
tay
@c990: jsr Rand99
cmp $38fa ; check vs. hit rate
bcs @c99b
inc $38fd ; increment number of hits
@c99b: dey
bne @c990Final Fantasy IV Disassembly · battle/fight.asm#L114-L120@c55b: lda $38f8
sta $38fa ; set attack rate
lda $269b ; attack multiplier
sta $38fb
jsr CalcHits
lda $38fd
sta $38f8 ; set number of hitsFinal Fantasy IV Disassembly · battle/fight.asm#L147-L203@c59f: lda $2729 ; defense rate
…
lda $2728 ; defense multiplier
sta $38fb
…
@c5e4: jsr CalcHits
lda $38fd
@c5ea: sta $38f9 ; set number of hits defended
sec
lda $38f8
sbc $38f9 ; subtract from number of hits
sta $34c8
…Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy IV
A character's attack multiplier, the number of hit rolls, is strength ÷ 8 + agility ÷ 16 + 1; the defense multiplier is agility ÷ 8 plus level ÷ 16 times the shield's multiplier. ff4/attack-multiplier
About: Final Fantasy IV Multi-hit attack
Value
{
"strengthDivisor": 8,
"agilityDivisor": 16,
"plus": 1
}battle/equip.asm#L240-L252; defense multiplier
…
lda $396b ; shield multiplier
…
lda $3967 ; agility / 8
jsr Lsr_3
clc
adc $e3 ; add level / 16 * shield multiplier
sta ($80),y ; set defense multiplierFinal Fantasy IV Disassembly · battle/equip.asm#L546-L555lda $3966 ; strength / 8
jsr Lsr_3
sta $a9
lda $3967 ; agility / 16
jsr Lsr_4
clc
adc $a9
inc
ldy #$001b
sta ($80),y ; attack multiplierChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy IV, Multi-hit attack
CalcDmg takes attack power plus a random 0 to half of it, applies the elemental and creature-type multipliers, adds the crit bonus on a critical, and subtracts defense (floored at 0); that times the net hits, divided by the number of targets, is held to 1–9,999. A Fight command has one target. ff4/damage
About: Final Fantasy IV Damage formula
Value
{
"spread": 0.5,
"cap": 9999,
"min": 1
}battle/damage.asm#L33-L99CalcDmg:
@c99f: ldx $3902 ; base attack
stx $3956
stx $3958
lsr $3957
ror $3956
…
lda $3956
jsr RandXA
…
jsr Add16
…
…Final Fantasy IV Disassembly · battle/fight.asm#L341-L342@c75f: lda #$01
sta $3906 ; single target (don't divide damage)Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Damage formula, Final Fantasy IV
A Fight command rolls once for a critical: a percentage roll under the attacker's crit rate adds its crit bonus to the damage before defense. Each character carries a crit rate and bonus of their own (the field code loads Cecil's from CharProp); dual-wielding doubles the rate, which falls to 99 only when the doubling overflows a byte (a rate of 50–127 doubles to 100–254), and adds half the left hand's attack to the bonus, and a bow triples a rate capped at 33 and adds the arrows' attack. ff4/critical
About: Final Fantasy IV Critical hit
Value
{
"dualWieldRate": 2,
"bowRate": 3,
"maxRate": 99
}battle/fight.asm#L311-L318@c710: jsr Rand99
cmp $26ad ; compare to crit rate
bcs @c723
inc $3900 ; set crit flag for damageFinal Fantasy IV Disassembly · battle/fight.asm#L343-L345lda $26ae ; set crit bonus
sta $3901
jsr CalcDmgFinal Fantasy IV Disassembly · battle/equip.asm#L684-L734lda ($80),y ; crit rate
…
lda ($80),y ; crit bonus
…
; bow and arrow
lda $a9
cmp #$21
bcc @9d48
lda #$21
@9d48: sta $df
lda #$03 ; crit rate * 3
…
…Final Fantasy IV Disassembly · field/field.asm#L2335-L2351; [ init character properties ]
; initializes cecil only
…
@9505: lda f:CharProp,x ; crit rate, bonus, and ???
sta $102d,yChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Critical hit, Final Fantasy IV
A physical attack's element is tested against the target's very weak, weak, immune, and strong elements in that order, and the first match sets a damage multiplier of 4×, 2×, 0, or ½. ff4/elements
About: Final Fantasy IV Elemental weakness
Value
{
"veryWeak": 4,
"weak": 2,
"immune": 0,
"strong": 0.5
}battle/fight.asm#L222-L247; get elemental multiplier
lda $2699 ; attack element
sta $3600
and $2721
beq @c65a ; branch if not very weak
lda #$08 ; 4x elemental damage multiplier
…
and $2720 ; branch if not weak
beq @c669
lda #$04 ; 2x elemental damage multiplier
…
and $2726 ; branch if not immune
…Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy IV
Holding L and R escapes, with no roll, once the run counter reaches 0, if the battle allows running and some party member can act. The counter starts at $FF (no escape) and a character's turn sets it to 0, except against a monster of level 97, 98, or 99, where it starts at 3, 7, or 10 and drops by one each battle tick while L and R are held; at level 99 it resets to 15 whenever they are let go. ff4/run
About: Final Fantasy IV Fleeing
Value
{
"level97": 3,
"level98": 7,
"level99": 10,
"level99Reset": 15
}battle/battle.asm#L1694-L1730lda $352d
beq @a0f6 ; return if l and r buttons are not pressed
@a08d: lda $38d6
cmp #$ff
beq @a0f6
lda $38d6
beq @a0a3
lda $38f3
bne @a0a3 ; branch if used escape ???
dec $38d6
bra @a0f6
@a0a3: lda $38e5
…Final Fantasy IV Disassembly · battle/battle.asm#L1073 — Called once per pass of BattleMain; the run check above sits in CheckBattleEnd (L1642).@8659: jsr CheckBattleEndFinal Fantasy IV Disassembly · battle/battle.asm#L385-L392lda $2282
cmp #97
bcc @8219 ; branch if monster level is less than 97
sec
sbc #97
tax
lda f:MonsterRunTbl,x ; run difficulty
sta $38d6Final Fantasy IV Disassembly · battle/battle_data.asm#L379-L394; monster run difficulty (based on monster level)
…
MonsterRunTbl:
@ff0f: .byte 3,7,10Final Fantasy IV Disassembly · battle/battle.asm#L1060-L1066@8638: lda $2282
cmp #$63
bne @8649 ; branch if not level 99 monster
lda $352d
bne @8649 ; branch if l and r buttons are pressed
lda #$0f
sta $38d6 ; reset run counter to 15Final Fantasy IV Disassembly · battle/char.asm#L344-L361GetCharAttack:
…
lda $2282
cmp #$63
beq @a399
cmp #$62
beq @a399
cmp #$61
beq @a399
@a396: stz $38d6Final Fantasy IV Disassembly · battle/battle.asm#L409-L447InitRAM:
…
sta $d0 ; init #$ff
…
sta $38d6Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy IV, Fleeing
On the overworld, each step reads a rate from an 8 × 8 grid of map regions (7, 8, or 10) and starts a battle when a byte from a fixed random table, plus an offset that grows by $11 each time the step counter wraps, is below it. ff4/encounter-rate
About: Final Fantasy IV Random encounter
Value
{
"overworldRates": [
7,
8,
10
],
"of": 256
}field/rand_battle.asm#L19-L27OverworldBattleRate:
.byte 10,10,10, 8, 8,10,10,10
.byte 10,10,10, 8, 8,10,10,10
.byte 10,10,10, 8, 8,10,10,10
.byte 10,10, 7, 8, 8, 8,10,10
.byte 8, 8, 7, 7, 8, 8,10,10
.byte 8, 8, 7, 7, 8,10,10,10
.byte 8, 8, 8, 8, 8,10,10,10
.byte 8, 8, 8, 8, 8,10,10,10Final Fantasy IV Disassembly · field/rand_battle.asm#L93-L129@8b6b: inc $88
inc $86
bne @8b7a
lda $17ef
clc
adc #$11
sta $17ef
…
; overworld
…
lda f:OverworldBattleRate,x
sta $06
…Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy IV, Random encounter
Final Fantasy IV keeps Final Fantasy III's physical attack: percentage rolls per point of an attack multiplier, the target's successful evade rolls subtracted, and one damage roll of attack plus 0 to half of it, with the crit bonus added before defense, multiplied by the net hits and capped at 9,999. ff4/keeps-ff3-hits
About: Final Fantasy IV Multi-hit attack
CodeFinal Fantasy III (NES) disassembly and ROM info ·ff3j.asm#L11959-L1197031/BB30: A9 63 LDA #$63
31/BB32: 20 B4 BE JSR $BEB4 ; random (0..A)
31/BB35: C5 25 CMP $25 ; hit %Final Fantasy III (NES) disassembly and ROM info · ff3j.asm#L11985-L1206231/BB50: 85 18 STA $18 ; +$18 = attack * (1..3/2)
…
31/BB89: 85 18 STA $18 ; +$18 = attack + crit bonus
…
31/BB9D: E5 26 SBC $26 ; subtract defense
…
31/BBB3: AD 7C 00 LDA $007C ; total no. of hits
…
31/BBDD: A9 27 LDA #$27 ; max damage is 9999Final Fantasy IV Disassembly · battle/damage.asm#L16-L27@c990: jsr Rand99
cmp $38fa ; check vs. hit rateFinal Fantasy IV Disassembly · battle/damage.asm#L33-L99CalcDmg:
@c99f: ldx $3902 ; base attack
…
adc $3901 ; add crit bonus
…
sbc $3904
…
lda $38fc
…
cpx #$270fChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Damage formula, Final Fantasy IV, Hit chance, Multi-hit attack
Final Fantasy III's physical attack has two elemental outcomes besides normal, double for a weakness and half for the target's other element byte; Final Fantasy IV adds very weak (4×) and immune (0) to weak (2×) and strong (½). ff4/elements-changes-ff3
About: Final Fantasy IV Elemental weakness
CodeFinal Fantasy III (NES) disassembly and ROM info ·ff3j.asm#L8216-L822830/9FF3: B1 70 LDA ($70),Y ; target's weak elements
…
30/9FFA: A9 04 LDA #$04 ; 4x multiplier
…
30/9FFE: AD 2A 74 LDA $742A ; absorbed elements
…
31/A00A: A9 01 LDA #$01 ; 1x multiplier
…
31/A00E: A9 02 LDA #$02 ; 2x multiplierFinal Fantasy IV Disassembly · battle/fight.asm#L222-L247beq @c65a ; branch if not very weak
lda #$08 ; 4x elemental damage multiplier
…
lda #$04 ; 2x elemental damage multiplier
…
lda #$00 ; 0x elemental damage multiplier
…
lda #$01 ; 1/2x elemental damage multiplierChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Elemental weakness, Final Fantasy IV