Name Battle Formation Event Command 1.0
Author madsiur
Link Download
ROM Name Final Fantasy III (USA) 1.0
ROM SHA-1 4F37E4274AC3B2EA1BEDB08AA149D8FC5BB676E7
Header No
ROM Name Final Fantasy III (USA) 1.1
ROM SHA-1 057ADA1C641E3E0B3CA34E6E4F4EB1B05A87143A
Header No

This hack is inspired by the work of Shall on FF6-G (which ASM code is public) but his code has been adapted to FF3us and modified in order to behave exactly like command $4D and not like the original $C0A5A7 battle calling code, which resulted in weird behavior with the party position after a battle called with an event trigger.

This event command fill a gap in FF3us by letting you call a battle directly with a formation. Normally as an example command $4D will call a pack with ID between $100 and $1FF, which can be somehow limited for extensive hacks with a lot of battle called this way. This command $69 behave in a identical way of command $4D, except of a pack number a formation ID is provided. The format is the following:

Battle with formation BBAA with battle background CC
CC AND $3F = Background ID, map default if CC equals $3F
CC AND $80 = Disable battle blur
CC AND $40 = No battle sound 

As an example, 69 22 01 12 will trigger a battle with formation $0122 with battle background $12 with battle blur and battle sound. 69 22 01 3F would use the map default background and 69 22 01 FF the default background with no battle blur and no battle sound. As always, you need to provide the good event context after battle in order to see this fully working (same for command $4D). An example would be:

69 22 01 12         ; Call battle
B2 A9 5E 00         ; Check for game over (subroutine $CA5EA9)
96                  ; Restore screen from fade
FE                  ; Return

If you want to move the code, you can assemble the ASM file you need with xkas 0.06.

$C0992C - $C0992D Event Command Pointer Table (both implementations)
$C0D613 - $C0D65E Bank $C0 Implementation: Command Code
$C0D613 - $C0D616 Bank $F2 Implementation: JML to Command Code
$F20000 - $F2004B Bank $F2 Implementation: Command Code
Bank $C0 Implementation

org $C0992C                     ; Jump table edit
dw cmd69

org $C0D613                     ; Change to relocate command in bank $C0
cmd69:                          ; Requires $4B bytes of free space
    REP #$20                    ; 16-Bit Accumulator
    LDA $EB                     ; Battle formation
    STA $0011E0                 ; Store as battle formation
    TDC                         ; Clear Accumulator
    SEP #$20                    ; 8-Bit Accumulator
    LDA $ED                     ; Battle intro effects and background
    AND #$C0                    ; Isolate battle blur and battle sound effect disabling
    STA $078A                   ; Save value in RAM
    LDA $ED                     ; Battle intro effects and background
    AND #$3F                    ; Isolate bits 0-5 (battle background ID, max #$3F)
    CMP #$3F                    ; Check if equal to #$3F
    BNE lblA                    ; If not, set as background
    LDA $0522                   ; Load $0522 (#$7F = battle background ID)
    AND #$7F                    ; Isolate bits 0-6 (battle background ID, max #$7F)
    STA $0011E2                 ; Store as battle background ID
    TDC                         ; Clear Accumulator
    STA $0011E3                 ; ???
    LDA $1ED7                   ;
    AND #$10                    ; Continue music during battle?
    LSR                         ;
    STA $0011E4                 ; Set to continue current music
    LDA #$01                    ;
    STA $56                     ; Enable battle
    LDX $0541                   ; BG1 X,Y Center Coordinate
    STX $1F66                   ; Store as Field XY Scroll Position
    LDX $00AF                   ; Party's X,Y Position
    STX $1FC0                   ; Set as Party XY Position
    LDA #$E0                    ;
    STA $11FA                   ; enable startup event, disable fade-in, no update on map load
    LDA #$04                    ; Number of bytes: 4
    JMP $9B70                   ; Advance the event queue of 4 bytes

  • ff3/ff3us/patches/madsiur/battle_form.txt
  • Last modified: 5 years ago
  • (external edit)