Final Fantasy I & II: Dawn of Souls:ROM map

From Data Crystal
Jump to navigation Jump to search

The following offsets have been determined for Final Fantasy I only. All offsets are given in hexadecimal format. All currently described ASM routines are in Thumb mode.

Formatting: No Formatting -- Code or data's purpose and functionality are unknown

Italics -- Area's general purpose is known but its workings are not well understood.

Bold -- Area's purpose and functionality are more or less fully understood

Bold & Italics --- Refers to "root" routines that handle medium-to-high level tasks and usually call many smaller routines

(Under Construction)

General Purpose Routines

Core Routines:

  • 000EFC-000F81 (000086) = Core division-related routines
  • 000F18 = General division routine. Given r0 = divident and r1 = divisor, checks for zero and calls software division
  • 000F2C = As above, but only returns remainder in r0
  • 000F68 = Divides r1 by r2; stores the product in [r0],[r0+8] and the remainder in [r0+4]
  • 011D70-011E07 (000098) = General Key Input Handling Routine


Game-Specific Routines:

  • 014E4C-014E6B (000020) = Uncompressed tile graphic size finder routine
  • 014E6C-0158E7 (000A7C) = Unknown (Short ASM routines)
  • 0158E8-0158FB (000014) = Chest State Determination Routine
  • 0158FC-01591B (000020) = If A+B+Select+Start Held, Soft Reset

FF1 Stat Routines

  • 01591C-0159B3 (000098) = Total Attack Determination
  • 0159B4-015ACB (000118) = Total Defence Determination
  • 015ACC-015B8F (0000C4) = Total Evade Determination
  • 015B90-015C23 (000094) = Effective Max HP Determination
  • 015C24-015CB7 (000094) = Effective Max MP Determination
  • 015CB8-015D4B (000094) = Total Intellect Determination
  • 015D4C-015DDF (000094) = Total Agility Determination
  • 015DE0-015E73 (000094) = Total Stamina Determination
  • 015E74-015F07 (000094) = Total Strength Determination
  • 015F08-015F43 (00003C) = Current HP/MP Determination (And Possible Truncation)
  • 015F44-015F83 (000040) = Total Accuracy Determination

FF1 Animation Routines

  • 01E2FC-01E8C3 (0005C8) = Root Spell/Weapon Animation Handling
  • 01E8C4-01F12F (00086C) = Unknown Routines
  • 01F130-01F1A3 (000074) = Conditional Animation Effect Handling
  • 01F1A4-01F743 (0005A0) = Animation Chunk Storage Routine
  • 01F744-02B4B3 (00BD70) = Unknown/Animation-related routines; exact function undetermined
  • 02B4B4-02BE3F (00098C) = Unknown Routines

FF1 Text, Menu and Field Spell Routines

  • 02BE40-02BF7F (000140) = Base Menu Window Drawing Routine
  • 02BF80-02C0C3 (000144) = Base Text Printing Routine
  • 02C0C4-02C43F (00037C) = Two Unknown Routines
  • 02C440-02C7A7 (000368) = Base Number Printing Routine
  • 02C7A8-0302BB (003B14) = Unknown
  • 0302BC-0304DB (000220) = Out-of-Battle Spell Usability Pointer Table+Routines
  • 0304DC-0308BB (0003E0) = Out-of-Battle Spell Effect Pointer Table+Routines
  • 0308BC-038917 (00805C) = Unknown
  • 038918-039347 (000A30) = Root Status Screen Drawing Routine
  • 039348-03A1A7 (000E60) = Unknown Routines
  • 03A1A8-03A26B (0000C4) = Out-of-Battle Healing Spell Base Healing Determination
  • 03A26C-03A2FF (000094) = Armor Equipping: Writing to Memory
  • 03A300-03A37F (000080) = Armor Removing: Adding to Inventory

FF1 Shopping Routines

  • 043910-04465F (000D50) = Root Buying Window Logic
  • 044660-044B83 (000524) = Unknown Routines
  • 044B84-044BCB (000048) = Item/Armor/Weapon Sorting Order Loading Routine
  • 044BCC-044C3B (000070) = Buying: Does item already exist among team's gear?
  • 044C3C-044C6F (000034) = Buying: Does item already exist in inventory?
  • 044C70-0454E3 (000874) = Root Spell Buying Routine?
  • 0454E4-0456A3 (0001C0) = Spell Buying: Can purchaser learn this spell?
  • 0456A4-0456E3 (000040) = Class Usability for Given Spell Determination
  • 0456E4-045F9B (0008B8) = Unknown Routines
  • 045F9C-04714B (0011B0) = Root Buying/Selling Screen Drawing Routine
  • 04714C-0471DB (000090) = Unknown Shopping-Related Routine
  • 0471DC-047813 (000638) = Root Shop Data Loading Routine?

FF1 Encounter Selection and Chest Routines

  • 05AF34-05B1EF (0002BC) = Root Map Feature Data Loading and Processing Routine
  • 05B1F0-05B277 (000088) = Map Feature Chunk Processing: Special Tiles and Objects
  • 05B278-05B533 (0002BC) = Root Map Setup Routine?
  • 05B534-05B9E3 (0004B0) = Root Encounter Checker and Selector
   05B5BE = Overworld Encounter RN Check
   05B5D8 = OW Type Encounter Handling:
       05B626 = Normal world map area
       05B630 = Rivers
       05B638 = Ocean/shipside
       05B640 = Deserts
       05B64E = Swamps
   05B83E = Normal Dungeon Handling
   05B85C = Soul of Chaos Dungeon Handling
  • 05B9E4-05C4BF (000ADC) = Unknown Routines
  • 05C4C0-05C6A7 (0001E8) = Root Chest Opening Handling
  • 05C6A8-05C833 (00018C) = Unknown Routines
  • 05C834-05CA33 (000200) = Chest Logic Part 2?

FF1 Misc Routines 1

  • 0669B8-066A07 (000050) = Check for Fixed Encounter Square
  • 066A08-0696AB (002CA4) = Unknown
  • 0696AC-0696C3 (000018) = RNG Increment Subroutine
  • 0696C4-06981F (00015C) = Unknown
  • 069820-06A007 (0007E8) = Root Encounter Data Loading Routine
  • 06A008-06A190 (000188) = Unknown
  • 06A190-06A323 (000194) = Levelup: Determination of Gain/Strong Increase in one Stat
   06A1E0 = If gain not guranteed, roll 1/8 chance
   06A234 = HP Gain code
   06A264 = Warrior, Thief, Monk, Master cannot gain MP
   06A270 = MP Gain code

FF1 Battle Routines

  • 06A9A0-06ACAB (00030C) = In-Battle Structural Routine Selector (Ambush message, turn order determination...)

Battle Menus

  • 06C26C-06C4A3 (000238) = In-Battle Item Menu: Resolve Cursor Position After Input, Selected Item's Spell
  • 06C4A4-06CBD3 (000730) = Unknown Routines
  • 06CBD4-06D013 (000440) = In-Battle: Populating Equip Menu
  • 06D014-06D1DF (0001CC) = Unknown Routines
  • 06D1E0-06D4B3 (0002D4) = Root Spell Menu Waiting Loop
  • 06D4B4-06DC5F (0007AC) = Root Physical Attack Animation Handling?
  • 06DC60-06DEFF (0002A0) = Unknown Animation-Related Routine (run when PC turn comes up, when opening battle menus...)
  • 06DF00-06EC5B (000D5C) = Unknown Routines
  • 06EC5C-06ED4F (0000F4) = In-Battle: Party Member HP Printing (and Tinting) Routine
  • 06ED50-06EFCF (000280) = In-Battle: Party Member Name or Status Printing Routine
  • 06EFD0-06F08B (0000BC) = In-Battle: Print Names of All Living Monster Types
  • 06F08C-06F1D7 (00014C) = In-Battle: Item Menu Population & Usability Determination
  • 06F1D8-06F2EF (000118) = In-Battle: Spell Menu Population & Usability Determination
  • 06F2F0-06F35F (000070) = In-Battle Spell Usability Routine
  • 06F360-06F46F (000110) = In-Battle Spell Menu: MP Info Box Writing Routine
  • 06F470-06F68B (00021C) = In-Battle Equip Menu: Equipment/Stats Names/Values Writing Routine
  • 06F68C-06F7E3 (000158) = In-Battle Equip Change Submenu: Gear Names Printing
  • 06F7E4-06FB7B (000398) = Equip Change Submenu: Compare Current and Replacement Gear+Print
  • 06FB7C-06FC8B (000110) = Root Monster Listing / Player Name&HP / Player MP Text Update Routine
  • 06FC8C-06FDFB (000170) = In-Battle Equipment Swapping Handler
  • 06FDFC-06FEC7 (0000CC) = Printing Text for In-Battle Description Boxes?

Turn Structure and Graphics

  • 06FEC8-06FF1F (000058) = Inbattle Item Use: Storing Item ID/Type/Position to Memory
  • 06FF20-06FFBB (00009C) = Monster Listing Updater
  • 06FFBC-070027 (00006C) = Unit Check: Can Unit Act?
  • 070028-070127 (000100) = PC Pose Determination (store ROM data to memory)
  • 070128-070213 (0000EC) = PC Pose Determination 2 (store to unit data)
  • 070214-07028B (000078) = Unit can be Targeted Check Routine
  • 07028C-07040B (000180) = Post-Attack Action Cancel Check: Death/Stone, Sleep/Stun, Silence
  • 07040C-0704F3 (0000E8) = Root Monster Targeting Routine
  • 0704F4-07054B (000058) = PC Sprite Animation Change Handling Routine?
  • 07054C-0706FF (0001B4) = PC Sprite Movement/Animation Handling?
  • 070700-070897 (000198) = Unit X-Coord (with modifiers) Finder
  • 070898-070A5B (0001C4) = Unit Y-Coord (with modifiers) Finder
  • 070A5C-070B1F (0000C4) = Monster Palette Switching Routine
  • 070B20-070D67 (000248) = Acting Monster Palette Cycling Routine
  • 070D68-070E5F (0000F8) = Monster GFX Horizontal Flip Routine
  • 070E60-070EFB (00009C) = Multitargeting Arrows/Pointers Handler Routine
  • 070EFC-0710FB (000200) = Multitargeting Routine - Determine Pointers' Positions?
  • 0710FC-07114F (000054) = When Exiting Multitarget Selection, Clear Pointers?
  • 071150-071457 (000308) = Root "Miss"/Damage/Healing Numbers Printing Handling
  • 071458-0716EB (000294) = Physical Attack Animation Setup Routine
  • 0716EC-071827 (00013C) = Status Ailment Bubble Placement Routine
  • 071828-0718F3 (0000CC) = Post-Recovery Displayed Ailment Recalculation
  • 0718F4-0719AB (0000B8) = Status Ailment Bubble Redrawing
  • 0719AC-071A3B (000090) = PC Blink/Invis Effect Checking+Redrawing Routine
  • 071A3C-071B93 (000158) = Sleep/Paralyze Recovery Step (and optional redrawing)
  • 071B94-071BE3 (000050) = Animation Params Copying (called when a unit is affected by anything)
  • 071BE4-071C37 (000054) = Clear Damage/Miss/Healing Numbers From Screen

Visual Effects, Text, Utility

  • 071C38-071C8B (000054) = Copy PC Unit Coordinates from Battle Data to Animation Data
  • 071C8C-071D3F (0000B4) = String Construction: Append Number to String (used in victory messages)
  • 071D40-071E1F (0000E0) = Player Character Sprite Tint Cycle Control
  • 071E20-071EC7 (0000A8) = Unknown (Periodic routine; calls the above)
  • 071EC8-0720EF (000228) = Player Character Inbattle Stats Updater Routine
  • 0720F0-072173 (000084) = Monster Inbattle Stats Updater Routine
  • 072174-07221F (0000AC) = Unknown Routine
  • 072220-072357 (000138) = Graphics-Related Routine (called twice at battle start)
  • 072358-072563 (00020C) = Root Levelup Handling Routine
  • 072564-07259F (00003C) = Enough XP for Next Level Determination Routine (Possibly unused)
  • 0725A0-0725D3 (000034) = Add Final EXP From Battle
  • 0725D4-0725DF (00000C) = Load BattleMem+$535C Pointer
  • 0725E0-0725F7 (000018) = Load Single PC's Permanent Data
  • 0725F8-07266F (000078) = Critical Hit Screen Effects Parameter Setting
  • 072670-07269B (00002C) = Monster Death Effect: Check if Monster is a Flyer
  • 07269C-0726CF (000034) = Unknown Routine (boss death-related?)
  • 0726D0-0726FB (00002C) = Unknown Routine
  • 0726FC-072773 (000078) = Special Encounter IDs Checker
  • 072774-0727AF (00003C) = End of Combat Round: Clear Window 0
  • 0727B0-0727EB (00003C) = Start of Unit Action: Set WIN 0/1 Properties, WIN0 Position
  • 0727EC-07284B (000060) = Initialize All Units' "Current Action Animation Effect" Struct
  • 07284C-072867 (00001C) = Unknown Routine (Runs continually during battle)
  • 072868-07288B (000024) = Re-enable PC Palette Tinting? (run after physical/spell animations complete)
  • 07288C-0728CB (000040) = Clear All PC Palette Tints, Disable Tinting
  • 0728CC-072903 (000038) = PC Death/Stone: Remove All Palette Tint Effects
  • 072904-07298F (00008C) = Spell Aura/Tint Setting Routine
  • 072990-0729D7 (000048) = Number Printing Wrapper Routine
  • 0729D8-072A03 (00002C) = String Construction: Append Text to String
  • 072A04-072A4F (00004C) = When PC is selected for action, check if they need to move forward?
  • 072A50-072A87 (000038) = Check if Any Monsters Still Undergoing Death Animations
  • 072A88-072AC7 (000040) = Does something with every PC sprite when a spell is about to be cast
  • 072AC8-072AFF (000038) = Does something with every unit's sprite data when spell is going to be cast
  • 072B00-072B17 (000018) = Check if Given PC Still Animating
  • 072B18-072B77 (000060) = Unknown Routine (perform PC sprite animation, if alive?)
  • 072B78-072B8F (000018) = PC Sprite ID Setting Routine
  • 072B90-072BDF (000050) = Check if Given Unit has Given Status Ailment(s)
  • 072BE0-072C23 (000044) = Check if Given Monster Exists and is Alive
  • 072C24-072C5F (00003C) = Check if Given PC is Alive
  • 072C60-072CAF (000050) = Set Death Flags for Given Dying Monster

Battle Menus 2

  • 072CB0-072CDB (00002C) = Unknown (Related to inbattle Item menus - return ((r1+1)/r3) - r2)
  • 072CDC-072D17 (00003C) = After Item is Used, Deplete by One
  • 072D18-072D6B (000054) = Start of Round: All PCs' Item Use Struct Reset Routine
  • 072D6C-072D8F (000024) = Active PC Item Use Struct Reset Routine
  • 072D90-072DC7 (000038) = Given Item Position in Inventory, Load Description Text Pointer (Unused?)
  • 072DC8-072DE7 (000020) = Given Item Type and ID, Load Description Text Pointer
  • 072DE8-072E1F (000038) = Given Item Position in Inventory, Load Item Name 1 Text Pointer
  • 072E20-072E3F (000020) = Given Item Type and ID, Load Name 1 Text Pointer
  • 072E40-072E8F (000050) = Given Item Position in Inventory, Determine Available Uses Left
  • 072E90-072EAF (000020) = (Unused) Given Item Position, Determine Item's Type
  • 072EB0-072ECF (000020) = (Unused) Given Item Position, Determine Item's Sub-ID
  • 072ED0-072EF3 (000024) = Given Selected Item Struct, Copy Type, Sub-ID to Struct
  • 072EF4-072F1F (00002C) = (Unused) Given Item Position, Copy Type, Sub-ID to Selected Item Struct
  • 072F20-072FA3 (000084) = (Unused) Return Given Item's Associated Spell's Targeting Byte
  • 072FA4-072FF7 (000054) = Return Given Item's Associated Spell Byte
  • 072FF8-07305F (000068) = (Unused) For Given Inventory Position, Return Item's Associated Spell Byte
  • 073060-073097 (000038) = Spell Menu: Locate and Print Selected Spell's Description
  • 073098-07310B (000074) = In-Battle Equip Change Submenu: Print Selected Piece's Description
  • 07310C-073157 (00004C) = In-Battle Equip Change Submenu: Return Inventory Position of Selected Gear
  • 073158-0731E3 (00008C) = In-Battle Equip Change Submenu: Calculate Defence and Evade With Prospective Armor
  • 0731E4-07323F (00005C) = In-Battle Equip Change Submenu: Calculate Attack and Accuracy With Prospective Weapon
  • 073240-07329B (00005C) = Display Party Members' MP
  • 07329C-073327 (00008C) = (Unused) Return Equip Bit for Given Class
  • 073328-073357 (000030) = Unknown Routine

Death Effects, Battle Start

  • 073358-0733E7 (000090) = PC Stone Curing: Remove Stone Palette Effect?
  • 0733E8-073447 (000060) = PC Sprite Animation: Load and Draw Specified Sprite
  • 073448-073553 (00010C) = Start of Battle: Initialize Displays?
  • 073554-07382F (0002DC) = Start of Battle: Initialize PC Sprites?
  • 073830-074333 (000B04) = Start of Battle: Initialize ??
  • 074334-07471B (0003E8) = Start of Battle: Initialize ??
  • 07471C-07494B (000230) = Start of Battle: Initialize BG (and other stuff?)
  • 07494C-075073 (000728) = Start of Battle: Initialize Encounter/Monster Data
  • 075074-075533 (0004C0) = Monster GFX Loading/Drawing-Related Routine?
  • 075534-0755C7 (000094) = Periodic Monster Death Anim/PC Animation Update Routine
  • 0755C8-075657 (000090) = Monster Death Effect: If Monster is Flyer, Erase Additional Pixels
  • 075658-075793 (00013C) = Monster Death Effect: Erase One Line of Monster Sprite
  • 075794-075E0B (000678) = Root Monster Death Animation Handling Routine
  • 075E0C-075F2F (000124) = Boss Death Effect: Screen Flashing Handler
  • 075F30-0760E3 (0001B4) = Boss Death Effect: Sprite Shaking Handler
  • 0760E4-0761C7 (0000E4) = Chaos Death Animation-Related
  • 0761C8-07640B (000244) = Chaos Death Animation-Related
  • 07640C-07648F (000084) = Chaos Death Animation-Related
  • 076490-076603 (000174) = Root PC Animation/Position Update Routine
  • 076604-07672B (000128) = Battle Start: Monster Data Generation Routine
  • 07672C-076A03 (0002D8) = Battle Start: PC Data Transfer/Generation Routine
  • 076A04-076A4F (00004C) = (Unused?) Modify Portions of First Monster's VRAM Data
  • 076A50-076A63 (000014) = Caller for $7494C
  • 076A64-076B07 (0000A4) = Ambush/Preemptive Message Handling Routine

Menus, Battle End, Action Processing

  • 076B08-076CAB (0001A4) = Turn Start: Various Redrawing, Check if PCs May Act
  • 076CAC-076E9B (0001F0) = New Active PC: Handle Animation/Movement, Some Redrawing
  • 076E9C-076F7F (0000E4) = Unknown PC Animation-Related Routine
  • 076F80-07703F (0000C0) = Unknown PC Animation-Related Routine
  • 077040-07717F (000140) = Root Spell Menu Operation Routine
  • 077180-07754F (0003D0) = Root Item Menu Operation Routine
  • 077550-07784F (000300) = Root Equip Menu Operation Routine
  • 077850-0779B3 (000164) = Root Command Targeting Handling
  • 0779B4-077BD7 (000224) = For Targeted Enemies, Display Arrows and Highlight Names
  • 077BD8-077F6B (000394) = Active PC Root Interface Handling Routine
  • 077F6C-0782EF (000384) = Root Battle Victory Handling Routine
  • 0782F0-078513 (000224) = Battle Victory: Levelup Messages Printing
  • 078514-07864B (000138) = Battle Victory: Monster Drops Handling
  • 07864C-078713 (0000C8) = Root Battle Loss Handling Routine
  • 078714-07880B (0000F8) = Action Menu Input Polling/Handling Routine
  • 07880C-078847 (00004C) = (Unused) Equip Menu-Related Routine
  • 078848-07888B (000044) = Battle Start: Store Cursor Settings (Memory or Default)
  • 07888C-07896F (0000E4) = Unknown Battle Start Routine
  • 078970-078B4F (0001E0) = Battle Start: Determine Normal/Ambush/Preemptive, Music to Use
  • 078B50-078C1F (0000D0) = Process Next Unit's Turn
  • 078C20-078E47 (000228) = Physical Attack Processing
  • 078E48-07952B (0006E4) = Physical Attack Animation Processing
  • 07952C-0796C3 (000198) = Damage Number "Bouncing" Effect and Timing Handler
  • 079764-0797F7 (000094) = For All Units, Print Damage/Healing/Miss After Action
  • 0797F8-079927 (000130) = Retarget Coming Action if Target no Longer Valid
  • 079928-079A2F (000108) = Monster Spell Selection and Targeting Handling
  • 079A30-079B3B (00010C) = Monster Ability Selection and Targeting Handling
  • 079B3C-079D33 (0001F8) = Monster Action Determination
  • 079D34-079E27 (0000F4) = Turn Order Determination/Randomization