data/claims/ff6.yamlFinal Fantasy VI (everything8215's disassembly)
Game: Final Fantasy VI.
Each 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 UpdateBattleTime adds 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. ff6/atb-gauge
About: Final Fantasy VI Active Time Battle
Value
{
"speedPlus": 20,
"haste": 84,
"normal": 64,
"slow": 32,
"framesPerUpdate": 2,
"battleSpeedStep": 24
}src/battle/action_1.asm#L1435-L1470; [ update atb gauge constant ]
CalcSpeed:
@09d2: php
ldy #$20
lda near wTargetProp3::w7e3ef8,x
bit #STATUS3::SLOW
bne @09e4
ldy #$40 ; y = haste/normal/slow constant (32/64/82)
bit #STATUS3::HASTE
beq @09e4
ldy #$54
…
…Final Fantasy VI Disassembly · src/battle/atb.asm#L4-L16; [ update battle time ]
UpdateBattleTime:
…
lda near w7e2f41 ; check if battle time is stopped by battle program
and near w7e3a8f ; wait mode
bne @118b
lda near w7e3a6c ; previous frame counter value
ldx #2
@112e: cmp $0e ; current frame counter value
beq @1190 ; return if less than 2 frames have elapsedFinal Fantasy VI Disassembly · src/battle/atb.asm#L91-L149; [ increment atb gauge counter ]
…
lda near wTargetProp1::w7e3218,x ; atb gauge %
adc near wTargetProp2::w7e3ac8,x ; add atb constant
sta near wTargetProp1::w7e3218,x
shorta
bcc _11ba ; return if it didn't overflow
…
@11d1: stz near wTargetProp1::w7e3218_H,x ; clear atb gauge %
…
jsr SetFlag0 ; set $3aa0.7 (allow battle menu to open)
…
…Final Fantasy VI Disassembly · src/battle/init.asm#L75-L81@2481: and #$07 ; battle speed
asl3
sta $ee
asl
adc $ee
not_a
sta near w7e3a90 ; set battle speed constantChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy VI, Turn order
Unless the target has Image, which a physical attack instead tests with a random byte under $40 (a miss that may remove the Image), an attack that can miss hits when a roll of 0–99 is under its hit rate times the target's stored evade, over 256, where the stored value is 256 − 2 × the evade % (255 for 0). The branch meant to pick Evade for a physical attack tests a carry flag that the check before it has cleared, so every such attack is checked against the target's magic evade (MBlock) and skips the Blind and status adjustments; the disassembly carries a BUGFIX_EVADE option, credited to Terii Senshi, that restores Evade. ff6/hit-check
About: Final Fantasy VI Hit chance
CodeFinal Fantasy VI Disassembly ·src/battle/check_hit.asm#L138-L210lda $11a2
lsr
bcc @233f ; branch if a magic attack
lda near wTargetProp2::RetalFlags,y ; RETAL_FLAGS::RETORT
lsr
bcs @22e8 ; branch if $3e4c.0 is set (retort)
lda near wTargetProp3::w7e3ee5,y
bit #STATUS2::IMAGE
.if BUGFIX_EVADE
beq @2346
.else
beq @233f
…Final Fantasy VI Disassembly · src/battle/init_attacker.asm#L121-L132; [ invert evade/mblock ]
_evasionconv:
InvertEvade:
@2861: .a8
asl
bcc @2866
lda #$ff
@2866: neg_a
bne @286c
decFinal Fantasy VI Disassembly · src/common/const.inc#L41-L42; evade bugfix by Terii Senshi
def_config BUGFIX_EVADE, 0Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy VI, Hit chance
CalcDmgMod multiplies the damage by a random variance and then by 255 − the target's Defense (Magic Defense for a magic attack), each over 256 plus 1. The variance is a random byte ORed with $E0, so 224–255; the routine's comment says 240–255. ff6/damage-mod
About: Final Fantasy VI Damage formula
Value
{
"varianceMin": 224,
"varianceMax": 255,
"defenseFrom": 255
}src/battle/calc_dmg.asm#L153-L193; [ calculate damage modification ]
; random variance, defense stat, shell/safe, defending, row, morph, friendly fire
CalcDmgMod:
…
jsr Rand
ora #$e0 ; random variance (240..255)
sta $e8
jsr MultDmg
…
lda near wTargetProp2::MagicDefense,y
bcc @0cd4
lda near wTargetProp2::Defense,y
…Final Fantasy VI Disassembly · src/battle/calc_dmg.asm#L239-L248; [ multiply damage by fraction ($e8 / 255) ]
MultDmg:
@0d3d: php
longa
lda $f0
jsr Mult24
inc
sta $f0Final Fantasy VI Disassembly · src/battle/math.asm#L41-L45; [ +a *= $e8 / 256 ]
; ++$e8 = +a * $e8
Mult24:Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Damage formula
Unless an attack is set to always crit, it is critical when a random byte is under 8, a 1-in-32 chance, and a critical adds 2 to the damage multiplier, which the code comments as damage ×2. ff6/critical
About: Final Fantasy VI Critical hit
Value
{
"chance": 8,
"of": 256
}src/battle/attack.asm#L332-L348@33f2: lda #$02
bit zb3
beq @340c ; auto-crit
bit zb2
bne @3414
bit zba
beq @3414
jsr Rand
cmp #$08
bcs @3414 ; 31/32 chance to branch
lda near w7e3eb0 + 25
beq @3414 ; branch if there are no targets
…Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Critical hit, Final Fantasy VI
A damage element that the target absorbs turns the damage into healing; one it nullifies makes the damage 0; one it halves halves it; one it is weak to doubles it, unless the damage is already 32,768 or more. The checks run in that order and the first match applies. ff6/elements
About: Final Fantasy VI Elemental weakness
Value
{
"absorb": -1,
"nullify": 0,
"halve": 0.5,
"weak": 2
}src/battle/calc_dmg.asm#L40-L72@0bd3: lda $11a1
…
lda near wTargetProp2::ElemAbsorb,y
bit $11a1
beq @0bf2
lda $f2
eor #$01
sta $f2
bra @0c1e
@0bf2: lda near wTargetProp2::ElemNull,y
bit $11a1
beq @0c00
…Final Fantasy VI Disassembly · src/battle/calc_dmg.asm#L125-L130 — Bit 0 of $f2, flipped by an absorbed element above, turns the damage taken into damage healed.@0c76: phy
php
rol
eor $f2
lsr
bcc @0c82 ; branch if damage takenChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Elemental weakness
While the characters are trying to run away, each character's run counter gains a random 1 to their run factor each time their status counter overflows, and the character escapes when the counter reaches the run difficulty. The difficulty is 2 for each monster present, or 6 for one marked harder to run from; a monster marked can't-escape, or a pincer attack, forbids running. ff6/run
About: Final Fantasy VI Fleeing
Value
{
"perMonster": 2,
"perHarderMonster": 6
}src/battle/timer.asm#L293-L316CheckRunAway:
@5c1b: cpx #$08
bcs @5c53 ; return if a monster
…
lda near w7e3a3b
bne @5c3a
jsr @5c4d
jmp CreateRunAwayAction
@5c3a: lda near wTargetProp2::w7e3d71,x ; run probability
jsr RandA
inc
clc
…Final Fantasy VI Disassembly · src/battle/timer.asm#L239-L242; 15: run away
GlobalCounter_05:
@5bd0: lda near w7e2f45
beq _5c1a ; return if characters are not trying to run awayFinal Fantasy VI Disassembly · src/battle/timer.asm#L13-L41; frame 0-9 (status counters for each character/monster)
…
lda near wTargetProp2::w7e3adc,x ; slow/normal/haste counter
adc near wTargetProp2::w7e3add,x ; add constant (+32/+64/+84)
…
bcc _5ae9 ; return if it didn't overflow
…
@5ac9: jsr CheckRunAwayFinal Fantasy VI Disassembly · src/battle/gfx_buf.asm#L22-L73; [ update monster graphics buffer and run difficulty ]
…
cmp #BATTLE_TYPE::PINCER
bne @5ca4 ; branch if not a pincer attack
…
lda #$02 ; can't run away
tsb zb1
@5ca4: stz near w7e3a3b ; clear run difficulty
…
lda near wTargetProp2::_4::MonsterStatus,y ; MONSTER_STATUS::HARDER_TO_RUN
lsr ; set carry if harder to run
bit #MONSTER_STATUS::CANT_ESCAPE >> 1
…Final Fantasy VI Disassembly · src/battle/init_attacker.asm#L182-L183lda <$11dc
sta near wTargetProp2::w7e3d71,x ; run factorChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Fleeing
Each step on a town or dungeon map adds the map's rate to a random-battle counter ($70 per step at the normal rate; $40, $160, or $200 at the low, high, and very high ones; the Charm Bangle halves them and the Moogle Charm zeroes them), and a battle starts when a byte from the random table, plus an offset that grows by 17 each time its pointer wraps, is under the counter's high byte. A battle clears the counter, so each step without one makes the next likelier. ff6/encounter-rate
About: Final Fantasy VI Random encounter
Value
{
"normal": 112,
"low": 64,
"high": 352,
"veryHigh": 512,
"charmBangleFactor": 0.5
}src/field/battle.asm#L264-L270; normal map random battle rates
; 8 bytes each (normal, low, high, very high)
SubBattleRateTbl:
.word $0070,$0040,$0160,$0200 ; normal
.word $0038,$0020,$00b0,$0100 ; charm bangle
.word $0000,$0000,$0000,$0000 ; moogle charmFinal Fantasy VI Disassembly · src/field/battle.asm#L374-L396lda $11df ; moogle charm and charm bangle effect
…
lda $1f6e ; random battle counter
adc f:SubBattleRateTbl,x ; add random battle rate (max #$ff00)
bcc :+
lda #$ff00
: sta $1f6e
shorta0
jsr UpdateBattleRng
cmp $1f6f
bcs Done ; return if counter didn't overflow
stz $1f6e ; clear random battle counter
…Final Fantasy VI Disassembly · src/field/battle.asm#L470-L485; [ update random number for random battle ]
.proc UpdateBattleRng
phx
inc $1fa1 ; increment random number pointer
bne :+
lda $1fa4
clc
adc #17 ; add 17 to random number counter
sta $1fa4
: lda $1fa1
tax
lda f:RNGTbl,x ; add random number to counter
…Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Random encounter
On the world map, the sector that picks the battle rate and group is read from $1F60 and $1F61. While the player walks, the world map's movement code copies the current position there only in the branch taken after a random battle starts, so the rate and group stay as they were until a battle or another writer (world map start, events, entrances) updates them; the disassembly marks this as a bug. ff6/world-map-sector-bug
About: Final Fantasy VI Random encounter
CodeFinal Fantasy VI Disassembly ·src/field/battle.asm#L125-L129; *** bug ***
; The x and y positions used below do not get updated when the player moves on
; the world map. They only update when the world map loads (when entering the
; world map, after closing the menu, or after a battle). Thus, these are the
; only times that the random battle group and probability rate will change.Final Fantasy VI Disassembly · src/field/battle.asm#L130-L134lda $1f61 ; y sector (0 to 7)
…
lda $1f60 ; x position (0 to 7)Final Fantasy VI Disassembly · src/world/move.asm#L884-L894 — The only writes to $1F60/$1F61 in world/move.asm; the others are in world/world_start.asm, world/init.asm, field/event.asm, and field/entrance.asm.jsl CheckBattleWorld_ext
cmp #$00
beq @1e1c ; branch if no random battle
…
lda f:$000ae0
sta $1f60
lda f:$000ae2
sta $1f61Checked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Random encounter
Final Fantasy V counts each combatant's ATB timer down by one per tick from 120 + weight ÷ 8 − agility; Final Fantasy VI instead adds a constant built from speed to a gauge every 2 frames and gives the turn when the gauge overflows. ff6/atb-changes-ff5
About: Final Fantasy VI Active Time Battle
CodeFinal Fantasy V Disassembly ·src/battle/battle-main.asm#L5405-L5416adc #$78 ;+120
sec
sbc Agility ;-agiFinal Fantasy V Disassembly · src/battle/battle-main.asm#L4740-L4745dec CurrentTimer,X
lda CurrentTimer,X
bne TimerActive
FlagTimer: ;flag EnableTimer when CurrentTimer hits 0Final Fantasy VI Disassembly · src/battle/atb.asm#L91-L104; [ increment atb gauge counter ]
…
adc near wTargetProp2::w7e3ac8,x ; add atb constant
sta near wTargetProp1::w7e3218,x
shorta
bcc _11ba ; return if it didn't overflowChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Active Time Battle, Final Fantasy V, Final Fantasy VI
Final Fantasy VI keeps Final Fantasy V's random-battle counter, which each step raises by the map's rate and which a byte from the random table, offset each time its pointer wraps, is tested against; it halves the normal rate from $E0 to $70 per step and changes the high one from $180 to $160. ff6/encounter-keeps-ff5
About: Final Fantasy VI Random encounter
CodeFinal Fantasy V Disassembly ·src/field/field-main.asm#L21700-L21701_c0cb09:
.word $00e0, $0040, $0180, $0200Final Fantasy V Disassembly · src/field/field-main.asm#L21658-L21670lda $16a8 ; random battle counter
clc
adc f:_c0cb09,x ; add probability value
…
jsr _c0cc52 ; update random number for random battles
cmp $16a9Final Fantasy VI Disassembly · src/field/battle.asm#L264-L267; normal map random battle rates
; 8 bytes each (normal, low, high, very high)
SubBattleRateTbl:
.word $0070,$0040,$0160,$0200 ; normalFinal Fantasy VI Disassembly · src/field/battle.asm#L386-L393lda $1f6e ; random battle counter
adc f:SubBattleRateTbl,x ; add random battle rate (max #$ff00)
…
jsr UpdateBattleRng
cmp $1f6fChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Final Fantasy V, Final Fantasy VI, Random encounter
In Final Fantasy V only three weapon attack types roll for a critical (fists, katanas, and type 36), at the crit % the attack type carries; in Final Fantasy VI an attack that can crit does so on a random byte under 8, 1 in 32, whatever the weapon. ff6/critical-changes-ff5
About: Final Fantasy VI Critical hit
CodeFinal Fantasy V Disassembly ·src/battle/battle-main.asm#L20794-L20803;Check for Critical Hit
;Param1: Crit%
…
jsr Random_0_99
cmp Param1Final Fantasy V Disassembly · src/battle/battle-main.asm#L16363-L16382;Attack Type 30 (Fists)
…
jsr CheckCritFinal Fantasy V Disassembly · src/battle/battle-main.asm#L16574-L16592;Attack Type 37 (Katanas)
…
jsr CheckCritFinal Fantasy V Disassembly · src/battle/battle-main.asm#L16542-L16564;Attack Type 36 (Bows with Element)
…
jsr CheckCrit ;because crit routine expects it thereFinal Fantasy VI Disassembly · src/battle/attack.asm#L339-L342jsr Rand
cmp #$08
bcs @3414 ; 31/32 chance to branchChecked by claude-agent, 2026-10-21 — read each pinned range against every part of the statementCited by: Critical hit, Final Fantasy V