C(0x03) SysDeqIntRP

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
r4 = priority chain
r5 = exception handler struc*
00001444: 3c0ea000 lui r14,0xa000
00001448: 8dce0100 lw r14,0x0100(r14)         # list of priority chain pointers
0000144c: 000478c0 sll r15,r4,0x03            # priority chain * 8
00001450: 01cf1021 addu r2,r14,r15            # 
00001454: 8c460000 lw r6,0x0000(r2)           # first element in chain
00001458: 27bdfff8 addiu r29,r29,-0x0008      # 
0000145c: 14c00003 bne r6,r0,0x0000146c       # branch if element exists
00001460: 00401821 addu r3,r2,r0
00001464: 10000026 beq r0,r0,0x00001500       # else END return 0
00001468: 00001021 addu r2,r0,r0

First element in chain is one to remove:

0000146c: 14c50005 bne r6,r5,0x00001484       # branch if element is not same as exception handler struc* to remove
00001470: 00000000 nop
00001474: 8cd80000 lw r24,0x0000(r6)          # load next element from element to remove
00001478: 00c01021 addu r2,r6,r0             
0000147c: 10000020 beq r0,r0,0x00001500       # END return r0
00001480: ac780000 sw r24,0x0000(r3)          # store next element, replacing first

First element in chain is not removed

00001484: 8cc20000 lw r2,0x0000(r6)           # load next element from first element
00001488: 00000000 nop
0000148c: 14400003 bne r2,r0,0x0000149c       # branch if it exists
00001490: 00000000 nop
00001494: 1000001a beq r0,r0,0x00001500       # else END
00001498: 00001021 addu r2,r0,r0
0000149c: 14c50004 bne r6,r5,0x000014b0       # branch if element is not same as exception handler struc* to remove (ALWAYS)
000014a0: 00000000 nop
000014a4: 8fa30000 lw r3,0x0000(r29)          # UNREACHABLE
000014a8: 1000000e beq r0,r0,0x000014e4       # UNREACHABLE
000014ac: 00000000 nop
000014b0: 14400005 bne r2,r0,0x000014c8       # branch if next element from first element exists (ALWAYS)
000014b4: 00c01821 addu r3,r6,r0              # preserve first element in r3
000014b8: 8fa30000 lw r3,0x0000(r29)          # UNREACHABLE
000014bc: 10000009 beq r0,r0,0x000014e4       # UNREACHABLE
000014c0: 00000000 nop
000014c4: 00c01821 addu r3,r6,r0              # preserve last element in r3
000014c8: 00403021 addu r6,r2,r0              # set r6 to next element struc*
000014cc: 10c50005 beq r6,r5,0x000014e4       # branch if next element from first element equals element to remove
000014d0: 00000000 nop
000014d4: 8cc20000 lw r2,0x0000(r6)           # else, grab next element
000014d8: 00000000 nop
000014dc: 1440fff9 bne r2,r0,0x000014c4       # loop if next element exists
000014e0: 00000000 nop
000014e4: 14c50006 bne r6,r5,0x00001500       # end if element to remove does not equal last known element to exist, return 0
000014e8: 00001021 addu r2,r0,r0
000014ec: 8cd90000 lw r25,0x0000(r6)          # load next element
000014f0: 00c01021 addu r2,r6,r0              # push element to remove to r2
000014f4: 10000002 beq r0,r0,0x00001500
000014f8: ac790000 sw r25,0x0000(r3)          # store next element in last element not to be removed
000014fc: 00001021 addu r2,r0,r0
00001500: 03e00008 jr r31
00001504: 27bd0008 addiu r29,r29,0x0008