Extract Palette Data

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: EXTRACT PALETTE DATA
#       Parameters:
#           r4 = (palette) Palette data pointer (Two-byte packed values)
#           r5 = (sectionID) Section ID
#           r6 = (p3) ? (For effects, 0?)
#           r7 = (p4) ? (For effects, 1?)

800926d8: 27bdffe0 addiu r29,r29,-0x0020
800926dc: afb20018 sw r18,0x0018(r29)
800926e0: 00a09021 addu r18,r5,r0                   #   sectionID
800926e4: 00121080 sll r2,r18,0x02                  #   sectionID * 4
800926e8: 00521021 addu r2,r2,r18                   #   sectionID * 5
800926ec: 00021080 sll r2,r2,0x02                   #   sectionID * 20
800926f0: 00521023 subu r2,r2,r18                   #   sectionID * 19
800926f4: 00021180 sll r2,r2,0x06                   #   sectionID * 1216
800926f8: 00521021 addu r2,r2,r18                   #   sectionID * 1217
800926fc: 00022840 sll r5,r2,0x01                   #   sectionID * 2434
80092700: afbf001c sw r31,0x001c(r29)
80092704: afb10014 sw r17,0x0014(r29)
80092708: afb00010 sw r16,0x0010(r29)
8009270c: 3c01800a lui r1,0x800a
80092710: 00250821 addu r1,r1,r5
80092714: 902295f5 lbu r2,-0x6a0b(r1)               #   testValue = *(0x800995f5 + (sectionID * 2434))
80092718: 00000000 nop
8009271c: 14400020 bne r2,r0,0x800927a0             #   if (testValue != 0) return;
80092720: 34020001 ori r2,r0,0x0001                 #   1
80092724: 14e20014 bne r7,r2,0x80092778
80092728: 3403000f ori r3,r0,0x000f                 #   clearID = 15
                                                    #   if (p4 == 1) {
8009272c: 24a20078 addiu r2,r5,0x0078               #       clearOffset = sectionID + 120
                                                    #       do {
80092730: 3c01800a lui r1,0x800a
80092734: 00220821 addu r1,r1,r2
80092738: a02095f6 sb r0,-0x6a0a(r1)                #           *0x800995f6 + clearOffset = 0
8009273c: 2463ffff addiu r3,r3,-0x0001              #           clearID = clearID - 1
80092740: 0461fffb bgez r3,0x80092730
80092744: 2442fff8 addiu r2,r2,-0x0008              #           clearOffset = clearOffset - 8
                                                    #       } while (clearID >= 0);
80092748: 00008021 addu r16,r0,r0                   #       count = 0
8009274c: 00808821 addu r17,r4,r0                   #       paletteColorsPtr = palette
                                                    #       do {
80092750: 02202021 addu r4,r17,r0                   #           paletteColorsPtr
80092754: 02402821 addu r5,r18,r0                   #           sectionID
80092758: 0c024988 jal 0x80092620                   #           Extract Colors Data (paletteColorsPtr, sectionID, count);
8009275c: 02003021 addu r6,r16,r0                   #           count
80092760: 26100001 addiu r16,r16,0x0001             #           count = count + 1
80092764: 2a020010 slti r2,r16,0x0010
80092768: 1440fff9 bne r2,r0,0x80092750
8009276c: 26310020 addiu r17,r17,0x0020             #           paletteColorsPtr = paletteColorsPtr + 32
                                                    #       } while (count < 16);
80092770: 080249e6 j 0x80092798
80092774: 34020001 ori r2,r0,0x0001                 #       1
                                                    #   } else {
80092778: 000610c0 sll r2,r6,0x03                   #       p3 * 8
8009277c: 00451021 addu r2,r2,r5                    #       (p3 * 8) + sectionID
80092780: 3c01800a lui r1,0x800a
80092784: 00220821 addu r1,r1,r2
80092788: a02095f6 sb r0,-0x6a0a(r1)                #       *(0x800995f6 + ((p3 * 8) + sectionID)) = 0
8009278c: 0c024988 jal 0x80092620                   #       Extract Colors Data (palette, sectionID, p3);
80092790: 02402821 addu r5,r18,r0                        
80092794: 34020001 ori r2,r0,0x0001                 #       1
                                                    #   }
80092798: 3c01800a lui r1,0x800a
8009279c: ac2295ec sw r2,-0x6a14(r1)                #   *0x800995ec = 1
800927a0: 8fbf001c lw r31,0x001c(r29)
800927a4: 8fb20018 lw r18,0x0018(r29)
800927a8: 8fb10014 lw r17,0x0014(r29)
800927ac: 8fb00010 lw r16,0x0010(r29)
800927b0: 27bd0020 addiu r29,r29,0x0020
800927b4: 03e00008 jr r31
800927b8: 00000000 nop