Difference between revisions of "Effect code script loop"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(added link to duplicate routine)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
Duplicate routine: [[Run_Effect_Block]]
 
 
  001a4cf0: 27bdffe0 addiu r29,r29,0xffe0
 
  001a4cf0: 27bdffe0 addiu r29,r29,0xffe0
 
  001a4cf4: 00042400 sll r4,r4,0x10
 
  001a4cf4: 00042400 sll r4,r4,0x10
 
  001a4cf8: 00042403 sra r4,r4,0x10
 
  001a4cf8: 00042403 sra r4,r4,0x10
 
  001a4cfc: 00041140 sll r2,r4,0x05
 
  001a4cfc: 00041140 sll r2,r4,0x05
  001a4d00: 00441023 subu r2,r2,r4 r2 = effect * 0x1f
+
  001a4d00: 00441023 subu r2,r2,r4 r2 = effect running state? * 0x1f
  001a4d04: 000210c0 sll r2,r2,0x03 r2 = effect * 0xf8
+
  001a4d04: 000210c0 sll r2,r2,0x03 r2 = effect state? * 0xf8
 
  001a4d08: 3c03801c lui r3,0x801c
 
  001a4d08: 3c03801c lui r3,0x801c
  001a4d0c: 2463f02c addiu r3,r3,0xf02c table of pointers per effect (0xf8 long per effect)
+
  001a4d0c: 2463f02c addiu r3,r3,0xf02c temp effect data
 
  001a4d10: afb00010 sw r16,0x0010(r29)
 
  001a4d10: afb00010 sw r16,0x0010(r29)
  001a4d14: 00438021 addu r16,r2,r3 r16 = 0c801cf02c + effect * 0xf8
+
  001a4d14: 00438021 addu r16,r2,r3 r16 = running state's temp effect data
 
  001a4d18: afb10014 sw r17,0x0014(r29)
 
  001a4d18: afb10014 sw r17,0x0014(r29)
 
  001a4d1c: 3c11801b lui r17,0x801b
 
  001a4d1c: 3c11801b lui r17,0x801b
 
  001a4d20: 263167c8 addiu r17,r17,0x67c8
 
  001a4d20: 263167c8 addiu r17,r17,0x67c8
 
  001a4d24: afbf0018 sw r31,0x0018(r29)
 
  001a4d24: afbf0018 sw r31,0x0018(r29)
  001a4d28: 86030006 lh r3,0x0006(r16) load counter for finding desired data
+
  001a4d28: 86030006 lh r3,0x0006(r16) load instruction counter
  001a4d2c: 8e020008 lw r2,0x0008(r16) load header address
+
  001a4d2c: 8e020008 lw r2,0x0008(r16) load code script pointer
 
  001a4d30: 00000000 nop
 
  001a4d30: 00000000 nop
 
  001a4d34: 00431021 addu r2,r2,r3 address + counter
 
  001a4d34: 00431021 addu r2,r2,r3 address + counter
Line 26: Line 25:
 
  001a4d4c: 8c420000 lw r2,0x0000(r2) load return address based on header byte
 
  001a4d4c: 8c420000 lw r2,0x0000(r2) load return address based on header byte
 
  001a4d50: 00000000 nop
 
  001a4d50: 00000000 nop
  001a4d54: 0040f809 jalr r2,r31 go to where the byte tells it to go?
+
  001a4d54: 0040f809 jalr r2,r31 go to instruction code
  001a4d58: 02002021 addu r4,r16,r0
+
  001a4d58: 02002021 addu r4,r16,r0 Parse temp. effect data
 +
Return addresses:
 +
801a2238 - instruction 0
 +
801a225c - instruction 1
 +
801a2280 - instruction 2
 +
801a22f8 - instruction 3
 +
801a236c - instruction 4
 +
801a2374 - instruction 5 (seems to just be a debug instruction?)
 +
801a23a8 - instruction 6 (2 arguments, Table ID to store file pointer, and file ID to find pointer for.)
 +
801a2414 - instruction 7
 +
801a2488 - instruction 8
 +
801a2524 - instruction 9
 +
801a2560 - instruction a
 +
801a259c - instruction b
 +
801a262c - instruction c
 +
801a2668 - instruction d
 +
801a26a4 - instruction e
 +
801a2734 - instruction f
 +
801a2770 - instruction 10
 +
801a27b0 - instruction 11
 +
801a2810 - instruction 12
 +
801a2870 - instruction 13
 +
801a28d4 - instruction 14
 +
801a2938 - instruction 15
 +
801a2998 - instruction 16
 +
801a29e0 - instruction 17
 +
801a2a2c - instruction 18
 +
801a2a7c - instruction 19
 +
801a2b18 - instruction 1a
 +
801a2b70 - instruction 1b
 +
801a2bc8 - instruction 1c
 +
801a2c28 - instruction 1d
 +
801a2c7c - instruction 1e
 +
801a2cfc - instruction 1f
 +
801a2d48 - instruction 20
 +
801a2d94 - instruction 21
 +
801a2de0 - instruction 22
 +
801a2e2c - instruction 23
 +
801a2e78 - instruction 24
 +
801a2eb4 - instruction 25
 +
801a30ec - instruction 26
 +
801a3148 - instruction 27
 +
801a3408 - instruction 28
 +
801a4838 - instruction 29
 +
801a4c44 - instruction 2a
 +
801a4c84 - instruction 2b
 +
801a4cc0 - instruction 2c
 +
801a4cd8 - instruction 2d
 +
801a2214 - instruction 2e
 +
all instructions 2e and beyond return to instruction 2e.
 +
 
 
  001a4d5c: 00021400 sll r2,r2,0x10
 
  001a4d5c: 00021400 sll r2,r2,0x10
 
  001a4d60: 00021c03 sra r3,r2,0x10
 
  001a4d60: 00021c03 sra r3,r2,0x10
 
  001a4d64: 34020002 ori r2,r0,0x0002
 
  001a4d64: 34020002 ori r2,r0,0x0002
  001a4d68: 10620005 beq r3,r2,0x001a4d80 branch if return = 2 (cancels animation.)
+
  001a4d68: 10620005 beq r3,r2,0x001a4d80 branch if return = 2 (cancels effect.)
 
  001a4d6c: 00000000 nop
 
  001a4d6c: 00000000 nop
 
  001a4d70: 1460ffed bne r3,r0,0x001a4d28 branch if return isn't 0
 
  001a4d70: 1460ffed bne r3,r0,0x001a4d28 branch if return isn't 0
Line 44: Line 93:
 
  001a4d94: 03e00008 jr r31
 
  001a4d94: 03e00008 jr r31
 
  001a4d98: 00000000 nop
 
  001a4d98: 00000000 nop
</font>
 

Latest revision as of 20:12, 27 April 2025

Duplicate routine: Run_Effect_Block

001a4cf0: 27bdffe0 addiu r29,r29,0xffe0
001a4cf4: 00042400 sll r4,r4,0x10
001a4cf8: 00042403 sra r4,r4,0x10
001a4cfc: 00041140 sll r2,r4,0x05
001a4d00: 00441023 subu r2,r2,r4		r2 = effect running state? * 0x1f
001a4d04: 000210c0 sll r2,r2,0x03		r2 = effect state? * 0xf8
001a4d08: 3c03801c lui r3,0x801c
001a4d0c: 2463f02c addiu r3,r3,0xf02c		temp effect data
001a4d10: afb00010 sw r16,0x0010(r29)
001a4d14: 00438021 addu r16,r2,r3		r16 = running state's temp effect data
001a4d18: afb10014 sw r17,0x0014(r29)
001a4d1c: 3c11801b lui r17,0x801b
001a4d20: 263167c8 addiu r17,r17,0x67c8
001a4d24: afbf0018 sw r31,0x0018(r29)
001a4d28: 86030006 lh r3,0x0006(r16)		load instruction counter
001a4d2c: 8e020008 lw r2,0x0008(r16)		load code script pointer
001a4d30: 00000000 nop
001a4d34: 00431021 addu r2,r2,r3		address + counter
001a4d38: 94420000 lhu r2,0x0000(r2)		loads halfword command
001a4d3c: 00000000 nop
001a4d40: 304201ff andi r2,r2,0x01ff		seperate lower byte
001a4d44: 00021080 sll r2,r2,0x02		byte * 4
001a4d48: 00511021 addu r2,r2,r17		
001a4d4c: 8c420000 lw r2,0x0000(r2)		load return address based on header byte
001a4d50: 00000000 nop
001a4d54: 0040f809 jalr r2,r31			go to instruction code
001a4d58: 02002021 addu r4,r16,r0		Parse temp. effect data

Return addresses:

801a2238 - instruction 0
801a225c - instruction 1
801a2280 - instruction 2
801a22f8 - instruction 3
801a236c - instruction 4
801a2374 - instruction 5 (seems to just be a debug instruction?)
801a23a8 - instruction 6 (2 arguments, Table ID to store file pointer, and file ID to find pointer for.)
801a2414 - instruction 7
801a2488 - instruction 8
801a2524 - instruction 9
801a2560 - instruction a
801a259c - instruction b
801a262c - instruction c
801a2668 - instruction d
801a26a4 - instruction e
801a2734 - instruction f
801a2770 - instruction 10
801a27b0 - instruction 11
801a2810 - instruction 12
801a2870 - instruction 13
801a28d4 - instruction 14
801a2938 - instruction 15
801a2998 - instruction 16
801a29e0 - instruction 17
801a2a2c - instruction 18
801a2a7c - instruction 19
801a2b18 - instruction 1a
801a2b70 - instruction 1b
801a2bc8 - instruction 1c
801a2c28 - instruction 1d
801a2c7c - instruction 1e
801a2cfc - instruction 1f
801a2d48 - instruction 20
801a2d94 - instruction 21
801a2de0 - instruction 22
801a2e2c - instruction 23
801a2e78 - instruction 24
801a2eb4 - instruction 25
801a30ec - instruction 26
801a3148 - instruction 27
801a3408 - instruction 28
801a4838 - instruction 29
801a4c44 - instruction 2a
801a4c84 - instruction 2b
801a4cc0 - instruction 2c
801a4cd8 - instruction 2d
801a2214 - instruction 2e
all instructions 2e and beyond return to instruction 2e.
001a4d5c: 00021400 sll r2,r2,0x10
001a4d60: 00021c03 sra r3,r2,0x10
001a4d64: 34020002 ori r2,r0,0x0002
001a4d68: 10620005 beq r3,r2,0x001a4d80		branch if return = 2 (cancels effect.)
001a4d6c: 00000000 nop
001a4d70: 1460ffed bne r3,r0,0x001a4d28		branch if return isn't 0
001a4d74: 34020001 ori r2,r0,0x0001
001a4d78: 08069361 j 0x001a4d84
001a4d7c: 00000000 nop
001a4d80: 00001021 addu r2,r0,r0
001a4d84: 8fbf0018 lw r31,0x0018(r29)
001a4d88: 8fb10014 lw r17,0x0014(r29)
001a4d8c: 8fb00010 lw r16,0x0010(r29)
001a4d90: 27bd0020 addiu r29,r29,0x0020
001a4d94: 03e00008 jr r31
001a4d98: 00000000 nop