System function setup routine
Jump to navigation
Jump to search
Parameters: r4 = 0x05 (Run spell quote routine, skip routine at 141b0c) = 0x06 (Run routine at 141b0c with original parameter values) = 0x07 (Clear r5, r7, and saved stack value, re-set r4 = 7?, then run routine at 141b0c) = 0x08 (Run routine at 141b0c with original parameter values) = else; Run routine at 141b0c with original parameter values r5 = ? (see notes) r6 = some unit's ID? (see notes) r7 = ? (see notes) 001419b8: 27bdffd0 addiu r29,r29,0xffd0 001419bc: afb00018 sw r16,0x0018(r29) 001419c0: 00808021 addu r16,r4,r0 #r16 = PV1 001419c4: afb20020 sw r18,0x0020(r29) 001419c8: 00a09021 addu r18,r5,r0 #r18 = PV2 001419cc: afb1001c sw r17,0x001c(r29) 001419d0: 00c08821 addu r17,r6,r0 #r17 = PV3 001419d4: afb30024 sw r19,0x0024(r29) 001419d8: 00e09821 addu r19,r7,r0 #r19 = PV4 001419dc: afb40028 sw r20,0x0028(r29) 001419e0: 8fb40040 lw r20,0x0040(r29) #Load previously saved stack value? 001419e4: 34020008 ori r2,r0,0x0008 #r2 = 0x08 001419e8: 12020018 beq r16,r2,0x00141a4c #Branch if PV1 = 8 001419ec: afbf002c sw r31,0x002c(r29) 001419f0: 34020006 ori r2,r0,0x0006 #r2 = 0x06 001419f4: 12020016 beq r16,r2,0x00141a50 #Branch if PV1 = 6 001419f8: 02002021 addu r4,r16,r0 #Restore original parameter value 001419fc: 0c0233b4 jal 0x0008ced0 #0008cdf0 - 0008cf10 - Find Unit's Misc Data Pointer (+0x15c) 00141a00: 02202021 addu r4,r17,r0 #r4 = Unit's ID 00141a04: 00401821 addu r3,r2,r0 #r3 = Unit's Misc Data Pointer (+0x15c) 00141a08: 34020005 ori r2,r0,0x0005 #r2 = 0x05 00141a0c: 16020007 bne r16,r2,0x00141a2c #Branch if PV1 ≠ 5 00141a10: 34020007 ori r2,r0,0x0007 #r2 = 0x07 00141a14: 00602021 addu r4,r3,r0 #r4 = Unit's Misc Data Pointer (+0x15c) 00141a18: 02202821 addu r5,r17,r0 #r5 = PV3 (unit ID) 00141a1c: 0c0505d7 jal 0x0014175c #Spell Quote determination routine 00141a20: 02803021 addu r6,r20,r0 #r6 = previously saved stack value? 00141a24: 0805069a j 0x00141a68 #Jump to End 00141a28: 00000000 nop 00141a2c: 16020008 bne r16,r2,0x00141a50 #Branch if PV1 ≠ 7 00141a30: 02002021 addu r4,r16,r0 #Restore original parameter value 00141a34: 34040007 ori r4,r0,0x0007 #r4 = 0x07 00141a38: 00002821 addu r5,r0,r0 #r5 = 0x00 00141a3c: 02203021 addu r6,r17,r0 #Restore original parameter value 00141a40: 00003821 addu r7,r0,r0 #r7 = 0x00 00141a44: 08050698 j 0x00141a60 00141a48: afa00010 sw r0,0x0010(r29) #Clear previously saved stack value? 00141a4c: 02002021 addu r4,r16,r0 #Restore original parameter value 00141a50: 02402821 addu r5,r18,r0 #Restore original parameter value 00141a54: 02203021 addu r6,r17,r0 #Restore original parameter value 00141a58: 02603821 addu r7,r19,r0 #Restore original parameter value 00141a5c: afb40010 sw r20,0x0010(r29) #Save previously saved stack value? 00141a60: 0c0506c3 jal 0x00141b0c #Routine at 141b0c 00141a64: afa30014 sw r3,0x0014(r29) #Save r3 to stack End: 00141a68: 8fbf002c lw r31,0x002c(r29) 00141a6c: 8fb40028 lw r20,0x0028(r29) 00141a70: 8fb30024 lw r19,0x0024(r29) 00141a74: 8fb20020 lw r18,0x0020(r29) 00141a78: 8fb1001c lw r17,0x001c(r29) 00141a7c: 8fb00018 lw r16,0x0018(r29) 00141a80: 27bd0030 addiu r29,r29,0x0030 00141a84: 03e00008 jr r31 00141a88: 00000000 nop
Notes
r4 = 0x01 - Auto Battle message *r5 = 2 (triangle turn menu), 1 (Protect allies) | r6 = ENTD ID | r7 = 0 - (r6 & r7 go unused for this function)
r4 = 0x02 - Confirm move destination *r5 = 0 (close menu), 1 (ride chocobo confirmation), 2 (select tile within moveable range), 3 (are you sure?), 4 (inherit crystal confirmation)
r4 = 0x03 - Show Wait instructions *takes no arguments
r4 = 0x04 - Target selection *r5 = 0x01 (can follow, tile has target), 0x02 (empty tile), 0x04 (can't follow, tile has target), 0x05 (out of firing range),
r4 = 0x05 - Spell quotes *r6 = unit ID
r4 = 0x06 - no menu
r4 = 0x07 - Display action name *takes no arguments
r4 = 0x08 - focus on unit and open menu? (triggered when X is hit on empty panel) *r5 = 0 | r6 = unit ID | r7 = 0 | 0x01 stored on stack - set active turn *r5 = 1 | r6 = unit ID | r7 = 0 | 0x01 stored on stack - ability cast (2) *r5 = 2 | r6 = unit ID | r7 = 0 | 0x01 stored on stack - ability cast (1) [validation?]
r4 = 0x09 - AI targetting error messages *r5 = 0x01 (can't be aggressive to ally), 0x02 (can't protect an enemy), 0x03 (can't target panel)
r4 = 0x0a - small pop-up text box *r6 = attacker unit ID | r7 = defender unit ID | store 01 in 0x10(r29) *r6 = attacker unit ID | r7 = 0 | store 01 in 0x10(r29) *store 00 in 0x10(r29) - display fail? *r5 = 0x183f - level up text *r5 = 0x183e - job level up text *r5 = 0x1838 - poach was successful text *r5 = 0x1828 - Tamed! text
r4 = 0x0b - learn on hit *r5 = learned ability ID? | r6 = ENTD ID | r7 = 00 | control check stored at 0x10(r29)
r4 = 0x0c - Post movement display - treasure/crystal *r5 = 0 | r6 = ENTD ID | 0 stored at 0x10(r29) | r7 = 0 - prep? and status changes *r5=r6= ENTD ID | 1 stored at 0x10(r29) | r7 = 0 - player unit or controlled unit display *r5=r6= ENTD ID | 0 stored at 0x10(r29) | r7 = 0 - Enemy units display ^ opens OPTIONS.BIN
r4 = 0x0d - move confirmation?
r4 = 0x0e - Trap *r5 = type of trap | r6 = unit ENTD ID | r7 = 0 | 1 stored at 0x10(r29)
r4 = 0x0f - move find item *r5 = item to display | r6 = unit ENTD ID | r7 = 0 | 1 stored at 0x10(r29) - player unit *r5 = item to display | r6 = unit ENTD ID | r7 = 0 | 0 stored at 0x10(r29) - enemy unit
r4 = 0x11 - set attack type stuff *r5 = attack type flags | r6 = unit ID | r7 = broken/stolen item | 1 stored on stack
Return Locations
00070a20: Set casting unit ID = FF 1 <- focus on unit and open menu? (triggered when X is hit on empty panel) 00070aa0: Some system routines for ramza crystal, ability CT resolution } 00070b04: Some system routines for ramza crystal, ability CT resolution } <- focus on unit and open menu? (triggered when X is hit on empty panel) 00070b2c: Some system routines for ramza crystal, ability CT resolution } 0007120c: 000711a4 - 000712d4 <- small pop-up text box (text = mimic failed) 000712a4: 000711a4 - 000712d4 <- small pop-up text box (text = unit crystalised/treasured) 0007180c: 000717cc - 00071820 <- Auto Battle message (r5 = 0?) 00071864: Show free-cursor autobattle feedback setup <- Auto Battle message (triangle turn menu) 0007196c: 0007192c - 00071980 <- Confirm move destination (text = select tile within moveable range) 00071a60: 00071984 - 00071a78 <- Confirm move destination (text = inherit crystal confirmation) 00071be0: 00071b4c - 00071c88 <- Move confirmation? / small pop-up text box (text = teleport failed) 00071c40: 00071b4c - 00071c88 <- Move confirmation? 00071cd4: 00071c8c - 00071ce8 <- no menu 00071e28: Level up animation and report <- small pop-up text box (text = level up) 00071ea8: Job Level up animation and report <- small pop-up text box (text = job level up) 00071f20: Main Post Movement <- Post movement display - treasure/crystal (r5 = 0) 00071fe0: Main Post Movement <- Post movement display - treasure/crystal (r5 = r6, stack.0x10 = player controlled unit) 00071ffc: Main Post Movement <- Post movement display - treasure/crystal (r5 = r6, stack.0x10 = enemy controlled unit) 0007207c: Main Post Movement <- Post movement display - treasure/crystal (r5 = r6, stack.0x10 = enemy controlled unit) 000721d4: Main Post Movement <- move find item (stack 0x10 = player controlled unit) 00072284: Main Post Movement <- Trap 000722d0: Main Post Movement <- move find item (stack.0x10 = enemy controlled unit) 000722f8: Main Post Movement <- Post movement display - treasure/crystal (r5 = 0) 00072334: Main Post Movement <- Post movement display - treasure/crystal (r5 = 0) 00072578: 00072544 - 00072670 <- focus on unit and open menu? (triggered when X is hit on empty panel) 000725bc: 00072544 - 00072670 <- focus on unit and open menu? (triggered when X is hit on empty panel) 00072628: 00072544 - 00072670 <- Show Wait instructions 00072ba8: Range 1 Ability Used <- Auto Battle message (??) 00072d64: 00072ce8 - 00072d88 <- set attack type stuff 00073234: 000731d8 - 0007324c <- small pop-up text box (text = 0?) 000734a4: Battle Message Display <- small pop-up text box (text varies) 00073514: Some post action (including learn on hit setup) <- small pop-up text box (text = 0?) 000735e0: Some post action (including learn on hit setup) <- learn on hit 000744b0: 00074470 - 000744c4 <- Target selection (text = out of firing range) 00074690: 000745ac - 000746a8 <- Target selection (text varies) 000747f4: 000747b8 - 00074810 <- Auto Battle message (r5 = 0?) 00074914: 0007485c - 0007492c <- AI targetting error messages (text varies) 000749b0: 00074930 - 000749c4 <- AI targetting error messages (r5 = 0?) 00074a14: 000749c8 - 00074a38 <- Auto Battle message (r5 = 0?) 000781e4: Copy 0x16e in unit data to misc data, display processing <- focus on unit and open menu? (triggered when X is hit on empty panel) 00078228: Copy 0x16e in unit data to misc data, display processing <- focus on unit and open menu? (triggered when X is hit on empty panel)