Palette Modification
Jump to navigation
Jump to search
0008f710: 27bdfff0 addiu r29,r29,0xfff0 0008f714: afb10004 sw r17,0x0004(r29) 0008f718: 00808821 addu r17,r4,r0 r17 = Preset Value (9 in Team checking section) 0008f71c: afb20008 sw r18,0x0008(r29) 0008f720: 00a09021 addu r18,r5,r0 r18 = PV 2 0008f724: afb00000 sw r16,0x0000(r29) 0008f728: 00e08021 addu r16,r7,r0 r16 = Unit/Color ID 0008f72c: 8fa20020 lw r2,0x0020(r29) Load ? 0008f730: 97ad0024 lhu r13,0x0024(r29) Load Red Mod 0008f734: 97ae0028 lhu r14,0x0028(r29) Load Green Mod 0008f738: 97af002c lhu r15,0x002c(r29) Load Blue Mod 0008f73c: 34030001 ori r3,r0,0x0001 r3 = 1 0008f740: 1443012c bne r2,r3,0x0008fbf4 Branch if ? != 1 0008f744: afb3000c sw r19,0x000c(r29) 0008f748: 00061080 sll r2,r6,0x02 Section ID * 4 0008f74c: 00461021 addu r2,r2,r6 ID * 5 0008f750: 00021080 sll r2,r2,0x02 ID * 20 0008f754: 00461023 subu r2,r2,r6 ID * 19 0008f758: 00021180 sll r2,r2,0x06 ID * 1216 0008f75c: 00461021 addu r2,r2,r6 ID * 1217 0008f760: 00021040 sll r2,r2,0x01 ID * 2434 0008f764: 3c03800a lui r3,0x800a 0008f768: 24639676 addiu r3,r3,0x9676 0008f76c: 00433821 addu r7,r2,r3 r7 = Palette Color Data Pointer 0008f770: 00006021 addu r12,r0,r0 Counter = 0 0008f774: 3c182aaa lui r24,0x2aaa 0008f778: 3718aaab ori r24,r24,0xaaab 0008f77c: 00408021 addu r16,r2,r0 r16 = Palette Color Data Mod 0008f780: 24630700 addiu r3,r3,0x0700 0008f784: 02035021 addu r10,r16,r3 r10 = Raw Palette Mod 0008f788: 000c10c0 sll r2,r12,0x03 Counter * 8 0008f78c: 004c1023 subu r2,r2,r12 Counter * 7 0008f790: 00472821 addu r5,r2,r7 0008f794: 90a20000 lbu r2,0x0000(r5) Load Red 0008f798: 90a30001 lbu r3,0x0001(r5) Load Green 0008f79c: 90a40002 lbu r4,0x0002(r5) Load Blue 0008f7a0: 00431021 addu r2,r2,r3 Red + Green 0008f7a4: 00441021 addu r2,r2,r4 Red + Green + Blue 0008f7a8: 104000dc beq r2,r0,0x0008fb1c Branch if no color is present 0008f7ac: 2e22000b sltiu r2,r17,0x000b 0008f7b0: 10400097 beq r2,r0,0x0008fa10 Branch if PV >= 0xb 0008f7b4: 00111080 sll r2,r17,0x02 PV * 4 0008f7b8: 3c018007 lui r1,0x8007 0008f7bc: 00220821 addu r1,r1,r2 0008f7c0: 8c2282cc lw r2,-0x7d34(r1) Load Code Pointer 0008f7c4: 00000000 nop 0008f7c8: 00400008 jr r2 0008f7cc: 00000000 nop
- PV = 0*
0008f7d0: 000c10c0 sll r2,r12,0x03 Counter * 8 0008f7d4: 004c1023 subu r2,r2,r12 Counter * 7 0008f7d8: 00471021 addu r2,r2,r7 0008f7dc: 90430000 lbu r3,0x0000(r2) Load Red 0008f7e0: 00000000 nop 0008f7e4: 01a35821 addu r11,r13,r3 r11 = Red Mod + Red 0008f7e8: 90430001 lbu r3,0x0001(r2) Load Green 0008f7ec: 90420002 lbu r2,0x0002(r2) Load Blue 0008f7f0: 01c34821 addu r9,r14,r3 r9 = Green Mod + Green 0008f7f4: 08023e84 j 0x0008fa10 0008f7f8: 01e24021 addu r8,r15,r2 r8 = Blue Mod + Blue
- PV = 1*
0008f7fc: 000c10c0 sll r2,r12,0x03 Counter * 8 0008f800: 004c1023 subu r2,r2,r12 Counter * 7 0008f804: 00471021 addu r2,r2,r7 0008f808: 90430000 lbu r3,0x0000(r2) Load Red 0008f80c: 90440001 lbu r4,0x0001(r2) Load Green 0008f810: 90420002 lbu r2,0x0002(r2) Load Blue 0008f814: 00031842 srl r3,r3,0x01 Red / 2 0008f818: 006d5821 addu r11,r3,r13 r11 = Red / 2 + Red Mod 0008f81c: 00042042 srl r4,r4,0x01 Green / 2 0008f820: 008e4821 addu r9,r4,r14 r9 = Green / 2 + Green Mod 0008f824: 00021042 srl r2,r2,0x01 Blue / 2 0008f828: 08023e84 j 0x0008fa10 0008f82c: 004f4021 addu r8,r2,r15 r8 = Blue / 2 + Blue Mod
- PV = 2*
0008f830: 000c10c0 sll r2,r12,0x03 Counter * 8 0008f834: 004c1023 subu r2,r2,r12 Counter * 7 0008f838: 00471021 addu r2,r2,r7 0008f83c: 90430000 lbu r3,0x0000(r2) Load Red 0008f840: 90450001 lbu r5,0x0001(r2) Load Green 0008f844: 90420002 lbu r2,0x0002(r2) Load Blue 0008f848: 00031840 sll r3,r3,0x01 Red * 2 0008f84c: 00052040 sll r4,r5,0x01 Green * 2 0008f850: 00852021 addu r4,r4,r5 Green * 3 0008f854: 00641821 addu r3,r3,r4 Red * 2 + Green * 3 0008f858: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 + Blue 0008f85c: 00780018 mult r3,r24 (R * 2 + G * 3 + B) * 0.16666667 0008f860: 00001010 mfhi r2 r2 = Color Mod 0008f864: 08023e6b j 0x0008f9ac (R/G/B Mod + Color Mod) 0008f868: 00031fc3 sra r3,r3,0x1f
- PV = 3*
0008f86c: 000c10c0 sll r2,r12,0x03 Counter * 8 0008f870: 004c1023 subu r2,r2,r12 Counter * 7 0008f874: 00471021 addu r2,r2,r7 0008f878: 90440000 lbu r4,0x0000(r2) Load Red 0008f87c: 90450001 lbu r5,0x0001(r2) Load Green 0008f880: 90420002 lbu r2,0x0002(r2) Load Blue 0008f884: 00042040 sll r4,r4,0x01 Red * 2 0008f888: 00051840 sll r3,r5,0x01 Green * 2 0008f88c: 00651821 addu r3,r3,r5 Green * 3 0008f890: 00832021 addu r4,r4,r3 Red * 2 + Green * 3 0008f894: 00822021 addu r4,r4,r2 Red * 2 + Green * 3 + Blue 0008f898: 00980018 mult r4,r24 (R * 2 + G * 3 + B) * 0.16666667 0008f89c: 000427c3 sra r4,r4,0x1f 0008f8a0: 00001010 mfhi r2 r2 = Color Mod 0008f8a4: 00021043 sra r2,r2,0x01 Color Mod / 2 0008f8a8: 08023e6c j 0x0008f9b0 (R/G/B Mod + Color Mod) 0008f8ac: 00441023 subu r2,r2,r4
- PV = 4, 9*
0008f8b0: 000c1040 sll r2,r12,0x01 Counter * 2 0008f8b4: 004a1021 addu r2,r2,r10 0008f8b8: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008f8bc: 00000000 nop 0008f8c0: 3062001f andi r2,r3,0x001f r2 = Red 0008f8c4: 01a25821 addu r11,r13,r2 r11 = Red Mod + Red 0008f8c8: 306203e0 andi r2,r3,0x03e0 0008f8cc: 00021142 srl r2,r2,0x05 r2 = Green 0008f8d0: 01c24821 addu r9,r14,r2 r9 = Green Mod + Green 0008f8d4: 30637c00 andi r3,r3,0x7c00 0008f8d8: 00031a82 srl r3,r3,0x0a r3 = Blue 0008f8dc: 08023e84 j 0x0008fa10 0008f8e0: 01e34021 addu r8,r15,r3 r8 = Blue Mod + Blue
- PV = 5*
0008f8e4: 000c1040 sll r2,r12,0x01 Counter * 2 0008f8e8: 004a1021 addu r2,r2,r10 0008f8ec: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008f8f0: 00000000 nop 0008f8f4: 3062001f andi r2,r3,0x001f r2 = Red 0008f8f8: 00021043 sra r2,r2,0x01 Red / 2 0008f8fc: 01a25821 addu r11,r13,r2 r11 = Red Mod + Red / 2 0008f900: 306203e0 andi r2,r3,0x03e0 0008f904: 00021182 srl r2,r2,0x06 r2 = Green / 2 0008f908: 01c24821 addu r9,r14,r2 r9 = Green Mod + Green / 2 0008f90c: 30637c00 andi r3,r3,0x7c00 0008f910: 00031ac2 srl r3,r3,0x0b r3 = Blue / 2 0008f914: 08023e84 j 0x0008fa10 0008f918: 01e34021 addu r8,r15,r3 r8 = Blue Mod + Blue / 2
- PV = 6*
0008f91c: 000c1040 sll r2,r12,0x01 Counter * 2 0008f920: 004a1021 addu r2,r2,r10 0008f924: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008f928: 00000000 nop 0008f92c: 306403e0 andi r4,r3,0x03e0 0008f930: 30657c00 andi r5,r3,0x7c00 0008f934: 3063001f andi r3,r3,0x001f r3 = Red 0008f938: 00031840 sll r3,r3,0x01 Red * 2 0008f93c: 00042142 srl r4,r4,0x05 r4 = Green 0008f940: 00041040 sll r2,r4,0x01 Green * 2 0008f944: 00441021 addu r2,r2,r4 Green * 3 0008f948: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 0008f94c: 00052a82 srl r5,r5,0x0a r5 = Blue 0008f950: 00651821 addu r3,r3,r5 Red * 2 + Green * 3 + Blue 0008f954: 00780018 mult r3,r24 (R * 2 + G * 3 + B) * 0.16666667 0008f958: 00001010 mfhi r2 r2 = Color Mod 0008f95c: 08023e6b j 0x0008f9ac (R/G/B Mod + Color Mod) 0008f960: 00031fc3 sra r3,r3,0x1f
- PV = 7*
0008f964: 000c1040 sll r2,r12,0x01 Counter * 2 0008f968: 004a1021 addu r2,r2,r10 0008f96c: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008f970: 00000000 nop 0008f974: 306403e0 andi r4,r3,0x03e0 0008f978: 30657c00 andi r5,r3,0x7c00 0008f97c: 3063001f andi r3,r3,0x001f r3 = Red 0008f980: 00031840 sll r3,r3,0x01 Red * 2 0008f984: 00042142 srl r4,r4,0x05 r4 = Green 0008f988: 00041040 sll r2,r4,0x01 Green * 2 0008f98c: 00441021 addu r2,r2,r4 Green * 3 0008f990: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 0008f994: 00052a82 srl r5,r5,0x0a r5 = Blue 0008f998: 00651821 addu r3,r3,r5 Red * 2 + Green * 3 + Blue 0008f99c: 00780018 mult r3,r24 (R * 2 + G * 3 + B) * 0.16666667 0008f9a0: 00031fc3 sra r3,r3,0x1f 0008f9a4: 00001010 mfhi r2 r2 = Color Mod 0008f9a8: 00021043 sra r2,r2,0x01 Color Mod / 2 0008f9ac: 00431023 subu r2,r2,r3 0008f9b0: 01a25821 addu r11,r13,r2 r11 = Red Mod + Color Mod / 2 0008f9b4: 01c24821 addu r9,r14,r2 r9 = Green Mod + Color Mod / 2 0008f9b8: 08023e84 j 0x0008fa10 0008f9bc: 01e24021 addu r8,r15,r2 r8 = Blue Mod + Color Mod / 2
- PV = 8*
0008f9c0: 000c1040 sll r2,r12,0x01 Counter * 2 0008f9c4: 004a1021 addu r2,r2,r10 0008f9c8: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008f9cc: 00000000 nop 0008f9d0: 306b001f andi r11,r3,0x001f r11 = Red 0008f9d4: 306203e0 andi r2,r3,0x03e0 0008f9d8: 00024942 srl r9,r2,0x05 r9 = Green 0008f9dc: 30637c00 andi r3,r3,0x7c00 0008f9e0: 08023e84 j 0x0008fa10 0008f9e4: 00034282 srl r8,r3,0x0a r8 = Blue
- PV = 10*
0008f9e8: 340c000f ori r12,r0,0x000f Counter = 0xf 0008f9ec: 26020078 addiu r2,r16,0x0078 Palette Color Data Mod + 0x78 0008f9f0: 3c01800a lui r1,0x800a 0008f9f4: 00220821 addu r1,r1,r2 0008f9f8: a02095fa sb r0,-0x6a06(r1) Store ? = 0 0008f9fc: 258cffff addiu r12,r12,0xffff Counter -- 0008fa00: 0581fffb bgez r12,0x0008f9f0 Branch if Counter >= 0 0008fa04: 2442fff8 addiu r2,r2,0xfff8 Color Data Mod -= 8 0008fa08: 0802400b j 0x0009002c 0008fa0c: 00000000 nop 0008fa10: 000b1400 sll r2,r11,0x10 0008fa14: 00021403 sra r2,r2,0x10 0008fa18: 28420020 slti r2,r2,0x0020 0008fa1c: 14400002 bne r2,r0,0x0008fa28 Branch if Red Mod < 0x20 0008fa20: 00091400 sll r2,r9,0x10 0008fa24: 340b001f ori r11,r0,0x001f Red Mod = 0x1f 0008fa28: 00021403 sra r2,r2,0x10 0008fa2c: 28420020 slti r2,r2,0x0020 0008fa30: 14400002 bne r2,r0,0x0008fa3c Branch if Green Mod < 0x20 0008fa34: 00081400 sll r2,r8,0x10 0008fa38: 3409001f ori r9,r0,0x001f Green Mod = 0x1f 0008fa3c: 00021403 sra r2,r2,0x10 0008fa40: 28420020 slti r2,r2,0x0020 0008fa44: 14400002 bne r2,r0,0x0008fa50 Branch if Blue Mod < 0x20 0008fa48: 000b1400 sll r2,r11,0x10 0008fa4c: 3408001f ori r8,r0,0x001f Blue Mod = 0x1f 0008fa50: 1c400002 bgtz r2,0x0008fa5c Branch if Red Mod > 0 0008fa54: 00091400 sll r2,r9,0x10 0008fa58: 00005821 addu r11,r0,r0 Red Mod = 0 0008fa5c: 1c400002 bgtz r2,0x0008fa68 Branch if Green Mod > 0 0008fa60: 00081400 sll r2,r8,0x10 0008fa64: 00004821 addu r9,r0,r0 Green Mod = 0 0008fa68: 1c400002 bgtz r2,0x0008fa74 Branch if Blue Mod > 0 0008fa6c: 01691025 or r2,r11,r9 0008fa70: 00004021 addu r8,r0,r0 Blue Mod = 0 0008fa74: 01021025 or r2,r8,r2 0008fa78: 00021400 sll r2,r2,0x10 0008fa7c: 14400002 bne r2,r0,0x0008fa88 Branch if a color is present 0008fa80: 00000000 nop 0008fa84: 34080001 ori r8,r0,0x0001 Blue Mod = 1 0008fa88: 12400010 beq r18,r0,0x0008facc Branch if PV2 = 0 0008fa8c: 000c18c0 sll r3,r12,0x03 Counter * 8 0008fa90: 006c1823 subu r3,r3,r12 Counter * 7 0008fa94: 00671821 addu r3,r3,r7 0008fa98: 90620000 lbu r2,0x0000(r3) Load Red 0008fa9c: 90640001 lbu r4,0x0001(r3) Load Green 0008faa0: 01621023 subu r2,r11,r2 Red Mod - Red 0008faa4: 2442001f addiu r2,r2,0x001f Red Mod - Red + 0x1f 0008faa8: 01242023 subu r4,r9,r4 Green Mod - Green 0008faac: a0620004 sb r2,0x0004(r3) Store Modified Red 0008fab0: 90620002 lbu r2,0x0002(r3) Load Blue 0008fab4: 2484001f addiu r4,r4,0x001f Green Mod - Green + 0x1f 0008fab8: a0640005 sb r4,0x0005(r3) Store Modified Green 0008fabc: 01021023 subu r2,r8,r2 Blue Mod - Blue 0008fac0: 2442001f addiu r2,r2,0x001f Blue Mod - Blue + 0x1f 0008fac4: 08023ecb j 0x0008fb2c 0008fac8: a0620006 sb r2,0x0006(r3) Store Modified Blue
- PV2 = 0*
0008facc: 006c1823 subu r3,r3,r12 Counter * 7 0008fad0: 00671821 addu r3,r3,r7 0008fad4: 3c04800e lui r4,0x800e 0008fad8: 24844ea4 addiu r4,r4,0x4ea4 r4 = Modified Palette Pointer 0008fadc: 00061240 sll r2,r6,0x09 Section ID * 512 0008fae0: 00441021 addu r2,r2,r4 0008fae4: 000c2840 sll r5,r12,0x01 Counter * 2 0008fae8: 00a22821 addu r5,r5,r2 0008faec: 00091140 sll r2,r9,0x05 Green * 32 0008faf0: 01621021 addu r2,r11,r2 Red + Green * 32 0008faf4: 00082280 sll r4,r8,0x0a Blue * 1024 0008faf8: a06b0000 sb r11,0x0000(r3) Store Modified Red 0008fafc: a0690001 sb r9,0x0001(r3) Store Modified Green 0008fb00: a0680002 sb r8,0x0002(r3) Store Modified Blue 0008fb04: 90630003 lbu r3,0x0003(r3) Load Alpha Flag 0008fb08: 00441021 addu r2,r2,r4 R + G * 32 + B * 1024 0008fb0c: 00031bc0 sll r3,r3,0x0f Alpha * 0x8000 0008fb10: 00431021 addu r2,r2,r3 r2 = Complete Color 0008fb14: 08023ecb j 0x0008fb2c 0008fb18: a4a20000 sh r2,0x0000(r5) Store Modified Palette Color 0008fb1c: 3402001f ori r2,r0,0x001f r2 = 0x1f 0008fb20: a0a20006 sb r2,0x0006(r5) Store Blue Mod = 0x1f 0008fb24: a0a20005 sb r2,0x0005(r5) Store Green Mod = 0x1f 0008fb28: a0a20004 sb r2,0x0004(r5) Store Red Mod = 0x1f 0008fb2c: 258c0001 addiu r12,r12,0x0001 Counter ++ 0008fb30: 29820100 slti r2,r12,0x0100 0008fb34: 1440ff14 bne r2,r0,0x0008f788 Branch if Counter < 0x100 0008fb38: 00000000 nop 0008fb3c: 1240001c beq r18,r0,0x0008fbb0 Branch if PV2 = 0 0008fb40: 00006021 addu r12,r0,r0 Counter = 0 0008fb44: 34040001 ori r4,r0,0x0001 r4 = 1 0008fb48: 00061080 sll r2,r6,0x02 Section ID * 4 0008fb4c: 00461021 addu r2,r2,r6 ID * 5 0008fb50: 00021080 sll r2,r2,0x02 ID * 20 0008fb54: 00461023 subu r2,r2,r6 ID * 19 0008fb58: 00021180 sll r2,r2,0x06 ID * 1216 0008fb5c: 00461021 addu r2,r2,r6 ID * 1217 0008fb60: 00021040 sll r2,r2,0x01 ID * 2434 0008fb64: 3c03800a lui r3,0x800a 0008fb68: 246395f6 addiu r3,r3,0x95f6 0008fb6c: 00431821 addu r3,r2,r3 0008fb70: 34020009 ori r2,r0,0x0009 r2 = 9 0008fb74: a0640000 sb r4,0x0000(r3) Store ? = 1 0008fb78: a0600001 sb r0,0x0001(r3) Store ? = 0 0008fb7c: a0600002 sb r0,0x0002(r3) Store ? = 0 0008fb80: 16220005 bne r17,r2,0x0008fb98 Branch if PV != 9 0008fb84: a0720003 sb r18,0x0003(r3) Store ? = PV2 0008fb88: a0640004 sb r4,0x0004(r3) Store ? = 1 0008fb8c: a06d0005 sb r13,0x0005(r3) Store Red Mod 0008fb90: a06e0006 sb r14,0x0006(r3) Store Green Mod 0008fb94: a06f0007 sb r15,0x0007(r3) Store Blue Mod 0008fb98: 258c0001 addiu r12,r12,0x0001 Counter ++ 0008fb9c: 29820010 slti r2,r12,0x0010 0008fba0: 1440fff3 bne r2,r0,0x0008fb70 Branch if Counter < 0x10 0008fba4: 24630008 addiu r3,r3,0x0008 Pointer += 8 0008fba8: 0802400b j 0x0009002c 0008fbac: 00000000 nop
- PV2 = 0*
0008fbb0: 340c000f ori r12,r0,0x000f Counter = 0xf 0008fbb4: 00061080 sll r2,r6,0x02 Section ID * 4 0008fbb8: 00461021 addu r2,r2,r6 ID * 5 0008fbbc: 00021080 sll r2,r2,0x02 ID * 20 0008fbc0: 00461023 subu r2,r2,r6 ID * 19 0008fbc4: 00021180 sll r2,r2,0x06 ID * 1216 0008fbc8: 00461021 addu r2,r2,r6 ID * 1217 0008fbcc: 00021040 sll r2,r2,0x01 ID * 2434 0008fbd0: 24420078 addiu r2,r2,0x0078 ID * 2434 + 120 0008fbd4: 3c01800a lui r1,0x800a 0008fbd8: 00220821 addu r1,r1,r2 0008fbdc: a02095f6 sb r0,-0x6a0a(r1) Store ? = 0 0008fbe0: 258cffff addiu r12,r12,0xffff Counter -- 0008fbe4: 0581fffb bgez r12,0x0008fbd4 Branch if Counter >= 0 0008fbe8: 2442fff8 addiu r2,r2,0xfff8 Pointer -= 8 0008fbec: 08024009 j 0x00090024 0008fbf0: 34020001 ori r2,r0,0x0001 r2 = 1
- ? != 1*
0008fbf4: 00006021 addu r12,r0,r0 r12 = 0 0008fbf8: 3c072aaa lui r7,0x2aaa 0008fbfc: 34e7aaab ori r7,r7,0xaaab 0008fc00: 00061080 sll r2,r6,0x02 Section ID * 4 0008fc04: 00461021 addu r2,r2,r6 ID * 5 0008fc08: 00021080 sll r2,r2,0x02 ID * 20 0008fc0c: 00461023 subu r2,r2,r6 ID * 19 0008fc10: 00021180 sll r2,r2,0x06 ID * 1216 0008fc14: 00461021 addu r2,r2,r6 ID * 1217 0008fc18: 00021040 sll r2,r2,0x01 Palette Mod = ID * 2434 0008fc1c: 3c03800a lui r3,0x800a 0008fc20: 24639676 addiu r3,r3,0x9676 r3 = Palette Color Data Pointer 0008fc24: 00409821 addu r19,r2,r0 r19 = Palette Mod 0008fc28: 24620700 addiu r2,r3,0x0700 0008fc2c: 0262c821 addu r25,r19,r2 r25 = Raw Palette Data Pointer 0008fc30: 0010c100 sll r24,r16,0x04 r24 = ID * 16 0008fc34: 02631821 addu r3,r19,r3 0008fc38: 001010c0 sll r2,r16,0x03 ID * 8 0008fc3c: 00501023 subu r2,r2,r16 ID * 7 0008fc40: 00021100 sll r2,r2,0x04 ID * 112 0008fc44: 00625021 addu r10,r3,r2 r10 = Palette Color Data Pointer 0008fc48: 91420000 lbu r2,0x0000(r10) Load Red 0008fc4c: 91430001 lbu r3,0x0001(r10) Load Green 0008fc50: 91440002 lbu r4,0x0002(r10) Load Blue 0008fc54: 00431021 addu r2,r2,r3 Red + Green 0008fc58: 00441021 addu r2,r2,r4 Red + Green + Blue 0008fc5c: 104000c2 beq r2,r0,0x0008ff68 Branch if no color is present 0008fc60: 2e22000b sltiu r2,r17,0x000b 0008fc64: 10400082 beq r2,r0,0x0008fe70 Branch if PV >= 0xb 0008fc68: 00111080 sll r2,r17,0x02 PV * 4 0008fc6c: 3c018007 lui r1,0x8007 0008fc70: 00220821 addu r1,r1,r2 0008fc74: 8c2282fc lw r2,-0x7d04(r1) Load Code Pointer 0008fc78: 00000000 nop 0008fc7c: 00400008 jr r2 0008fc80: 00000000 nop
- PV = 0*
0008fc84: 91420000 lbu r2,0x0000(r10) Load Red 0008fc88: 91430002 lbu r3,0x0002(r10) Load Blue 0008fc8c: 01a25821 addu r11,r13,r2 r11 = Red Mod + Red 0008fc90: 91420001 lbu r2,0x0001(r10) Load Green 0008fc94: 01e34021 addu r8,r15,r3 r8 = Blue Mod + Blue 0008fc98: 08023f9c j 0x0008fe70 0008fc9c: 01c24821 addu r9,r14,r2 r9 = Green Mod + Green
- PV = 1*
0008fca0: 91420000 lbu r2,0x0000(r10) Load Red 0008fca4: 91430001 lbu r3,0x0001(r10) Load Green 0008fca8: 00021042 srl r2,r2,0x01 Red / 2 0008fcac: 004d5821 addu r11,r2,r13 r11 = Red / 2 + Red Mod 0008fcb0: 00031842 srl r3,r3,0x01 Green / 2 0008fcb4: 91420002 lbu r2,0x0002(r10) Load Blue 0008fcb8: 006e4821 addu r9,r3,r14 r9 = Green / 2 + Green Mod 0008fcbc: 00021042 srl r2,r2,0x01 Blue / 2 0008fcc0: 08023f9c j 0x0008fe70 0008fcc4: 004f4021 addu r8,r2,r15 r8 = Blue / 2 + Blue Mod
- PV = 2*
0008fcc8: 91430000 lbu r3,0x0000(r10) Load Red 0008fccc: 91440001 lbu r4,0x0001(r10) Load Green 0008fcd0: 00031840 sll r3,r3,0x01 Red * 2 0008fcd4: 00041040 sll r2,r4,0x01 Green * 2 0008fcd8: 00441021 addu r2,r2,r4 Green * 3 0008fcdc: 91440002 lbu r4,0x0002(r10) Load Blue 0008fce0: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 0008fce4: 00641821 addu r3,r3,r4 R * 2 + G * 3 + B 0008fce8: 00670018 mult r3,r7 (R * 2 + G * 3 + B) * 0.16666667 0008fcec: 00001010 mfhi r2 r2 = Color Mod 0008fcf0: 08023f86 j 0x0008fe18 (R/G/B Mod + Color Mod) 0008fcf4: 00031fc3 sra r3,r3,0x1f
- PV = 3*
0008fcf8: 91430000 lbu r3,0x0000(r10) Load Red 0008fcfc: 91440001 lbu r4,0x0001(r10) Load Green 0008fd00: 00031840 sll r3,r3,0x01 Red * 2 0008fd04: 00041040 sll r2,r4,0x01 Green * 2 0008fd08: 00441021 addu r2,r2,r4 Green * 3 0008fd0c: 91440002 lbu r4,0x0002(r10) Load Blue 0008fd10: 00621821 addu r3,r3,r2 Red * 2 + Blue * 3 0008fd14: 08023f82 j 0x0008fe08 (same as PV = 2, but gets / 2) 0008fd18: 00641821 addu r3,r3,r4 R * 2 + G * 3 + B
- PV = 4, 9*
0008fd1c: 00181040 sll r2,r24,0x01 ID * 32 0008fd20: 00591021 addu r2,r2,r25 0008fd24: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008fd28: 00000000 nop 0008fd2c: 3062001f andi r2,r3,0x001f r2 = Red 0008fd30: 01a25821 addu r11,r13,r2 r11 = Red Mod + Red 0008fd34: 306203e0 andi r2,r3,0x03e0 0008fd38: 00021142 srl r2,r2,0x05 r2 = Green 0008fd3c: 01c24821 addu r9,r14,r2 r9 = Green Mod + Green 0008fd40: 30637c00 andi r3,r3,0x7c00 0008fd44: 00031a82 srl r3,r3,0x0a r3 = Blue 0008fd48: 08023f9c j 0x0008fe70 0008fd4c: 01e34021 addu r8,r15,r3 r8 = Blue Mod + Blue
- PV = 5*
0008fd50: 00181040 sll r2,r24,0x01 ID * 32 0008fd54: 00591021 addu r2,r2,r25 0008fd58: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008fd5c: 00000000 nop 0008fd60: 3062001f andi r2,r3,0x001f r2 = Red 0008fd64: 00021043 sra r2,r2,0x01 Red / 2 0008fd68: 01a25821 addu r11,r13,r2 r11 = Red Mod + Red / 2 0008fd6c: 306203e0 andi r2,r3,0x03e0 0008fd70: 00021182 srl r2,r2,0x06 r2 = Green / 2 0008fd74: 01c24821 addu r9,r14,r2 r9 = Green Mod + Green / 2 0008fd78: 30637c00 andi r3,r3,0x7c00 0008fd7c: 00031ac2 srl r3,r3,0x0b r3 = Blue / 2 0008fd80: 08023f9c j 0x0008fe70 0008fd84: 01e34021 addu r8,r15,r3 r8 = Blue Mod + Blue / 2
- PV = 6*
0008fd88: 00181040 sll r2,r24,0x01 ID * 32 0008fd8c: 00591021 addu r2,r2,r25 0008fd90: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008fd94: 00000000 nop 0008fd98: 306403e0 andi r4,r3,0x03e0 0008fd9c: 30657c00 andi r5,r3,0x7c00 0008fda0: 3063001f andi r3,r3,0x001f r3 = Red 0008fda4: 00031840 sll r3,r3,0x01 Red * 2 0008fda8: 00042142 srl r4,r4,0x05 r4 = Green 0008fdac: 00041040 sll r2,r4,0x01 Green * 2 0008fdb0: 00441021 addu r2,r2,r4 Green * 3 0008fdb4: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 0008fdb8: 00052a82 srl r5,r5,0x0a r5 = Blue 0008fdbc: 00651821 addu r3,r3,r5 R * 2 + G * 3 + B 0008fdc0: 00670018 mult r3,r7 (R * 2 + G * 3 + B) * 0.16666667 0008fdc4: 00001010 mfhi r2 r2 = Color Mod 0008fdc8: 08023f86 j 0x0008fe18 (R/G/B Mod + Color Mod) 0008fdcc: 00031fc3 sra r3,r3,0x1f
- PV = 7*
0008fdd0: 00181040 sll r2,r24,0x01 ID * 32 0008fdd4: 00591021 addu r2,r2,r25 0008fdd8: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008fddc: 00000000 nop 0008fde0: 306403e0 andi r4,r3,0x03e0 0008fde4: 30657c00 andi r5,r3,0x7c00 0008fde8: 3063001f andi r3,r3,0x001f r3 = Red 0008fdec: 00031840 sll r3,r3,0x01 Red * 2 0008fdf0: 00042142 srl r4,r4,0x05 r4 = Green 0008fdf4: 00041040 sll r2,r4,0x01 Green * 2 0008fdf8: 00441021 addu r2,r2,r4 Green * 3 0008fdfc: 00621821 addu r3,r3,r2 Red * 2 + Green * 3 0008fe00: 00052a82 srl r5,r5,0x0a r5 = Blue 0008fe04: 00651821 addu r3,r3,r5 R * 2 + G * 3 + B 0008fe08: 00670018 mult r3,r7 (R * 2 + G * 3 + B) * 0.16666667 0008fe0c: 00031fc3 sra r3,r3,0x1f 0008fe10: 00001010 mfhi r2 r2 = Color Mod 0008fe14: 00021043 sra r2,r2,0x01 Color Mod / 2 0008fe18: 00431023 subu r2,r2,r3 0008fe1c: 01a25821 addu r11,r13,r2 r11 = Red Mod + Color Mod / 2 0008fe20: 01c24821 addu r9,r14,r2 r9 = Green Mod + Color Mod / 2 0008fe24: 08023f9c j 0x0008fe70 0008fe28: 01e24021 addu r8,r15,r2 r8 = Blue Mod + Color Mod / 2
- PV = 8*
0008fe2c: 00181040 sll r2,r24,0x01 ID * 2 0008fe30: 00591021 addu r2,r2,r25 0008fe34: 94430000 lhu r3,0x0000(r2) Load Raw Color 0008fe38: 00000000 nop 0008fe3c: 306b001f andi r11,r3,0x001f r11 = Red 0008fe40: 306203e0 andi r2,r3,0x03e0 0008fe44: 00024942 srl r9,r2,0x05 r9 = Green 0008fe48: 30637c00 andi r3,r3,0x7c00 0008fe4c: 08023f9c j 0x0008fe70 0008fe50: 00034282 srl r8,r3,0x0a r8 = Blue
- PV = 10*
0008fe54: 001010c0 sll r2,r16,0x03 ID * 8 0008fe58: 00531021 addu r2,r2,r19 Palette Mod + ID * 8 0008fe5c: 3c01800a lui r1,0x800a 0008fe60: 00220821 addu r1,r1,r2 0008fe64: a02095fa sb r0,-0x6a06(r1) Store ? = 0 0008fe68: 0802400b j 0x0009002c 0008fe6c: 00000000 nop 0008fe70: 000b1400 sll r2,r11,0x10 0008fe74: 00021403 sra r2,r2,0x10 0008fe78: 28420020 slti r2,r2,0x0020 0008fe7c: 14400002 bne r2,r0,0x0008fe88 Branch if Red Mod < 0x20 0008fe80: 00091400 sll r2,r9,0x10 0008fe84: 340b001f ori r11,r0,0x001f Red Mod = 0x1f 0008fe88: 00021403 sra r2,r2,0x10 0008fe8c: 28420020 slti r2,r2,0x0020 0008fe90: 14400002 bne r2,r0,0x0008fe9c Branch if Green Mod < 0x20 0008fe94: 00081400 sll r2,r8,0x10 0008fe98: 3409001f ori r9,r0,0x001f Green Mod = 0x1f 0008fe9c: 00021403 sra r2,r2,0x10 0008fea0: 28420020 slti r2,r2,0x0020 0008fea4: 14400002 bne r2,r0,0x0008feb0 Branch if Blue Mod < 0x20 0008fea8: 000b1400 sll r2,r11,0x10 0008feac: 3408001f ori r8,r0,0x001f Blue Mod = 0x1f 0008feb0: 1c400002 bgtz r2,0x0008febc Branch if Red Mod > 0 0008feb4: 00091400 sll r2,r9,0x10 0008feb8: 00005821 addu r11,r0,r0 Red Mod = 0 0008febc: 1c400002 bgtz r2,0x0008fec8 Branch if Green Mod > 0 0008fec0: 00081400 sll r2,r8,0x10 0008fec4: 00004821 addu r9,r0,r0 Green Mod = 0 0008fec8: 1c400002 bgtz r2,0x0008fed4 Branch if Blue Mod > 0 0008fecc: 01691025 or r2,r11,r9 0008fed0: 00004021 addu r8,r0,r0 Blue Mod = 0 0008fed4: 01021025 or r2,r8,r2 0008fed8: 00021400 sll r2,r2,0x10 0008fedc: 14400002 bne r2,r0,0x0008fee8 Branch if Colors are present 0008fee0: 00000000 nop 0008fee4: 34080001 ori r8,r0,0x0001 Blue Mod = 1 0008fee8: 1240000e beq r18,r0,0x0008ff24 Branch if PV2 = 0 0008feec: 00061240 sll r2,r6,0x09 Section ID * 512 0008fef0: 91420000 lbu r2,0x0000(r10) Load Red 0008fef4: 91430001 lbu r3,0x0001(r10) Load Green 0008fef8: 01621023 subu r2,r11,r2 Red Mod - Red 0008fefc: 2442001f addiu r2,r2,0x001f Red Mod - Red + 0x1f 0008ff00: 01231823 subu r3,r9,r3 Green Mod - Green 0008ff04: a1420004 sb r2,0x0004(r10) Store Modified Red? 0008ff08: 91420002 lbu r2,0x0002(r10) Load Blue 0008ff0c: 2463001f addiu r3,r3,0x001f Green Mod - Green + 0x1f 0008ff10: a1430005 sb r3,0x0005(r10) Store Modified Green? 0008ff14: 01021023 subu r2,r8,r2 Blue Mod - Blue 0008ff18: 2442001f addiu r2,r2,0x001f Blue Mod - Blue + 0x1f 0008ff1c: 08023fde j 0x0008ff78 0008ff20: a1420006 sb r2,0x0006(r10) Store Modified Blue?
- PV2 = 0*
0008ff24: 3c03800e lui r3,0x800e 0008ff28: 24634ea4 addiu r3,r3,0x4ea4 0008ff2c: 00431021 addu r2,r2,r3 0008ff30: 00182840 sll r5,r24,0x01 r5 = Unit/Color ID * 2 0008ff34: 00a22821 addu r5,r5,r2 r5 = Modified Palette Data Pointer 0008ff38: 00091140 sll r2,r9,0x05 Green * 32 0008ff3c: 01621021 addu r2,r11,r2 Green * 32 + Red 0008ff40: 00082280 sll r4,r8,0x0a Blue * 1024 0008ff44: 91430003 lbu r3,0x0003(r10) Load Alpha Flag 0008ff48: 00441021 addu r2,r2,r4 Red + Green * 0x20 + Blue * 0x400 0008ff4c: a14b0000 sb r11,0x0000(r10) Store Red 0008ff50: a1490001 sb r9,0x0001(r10) Store Green 0008ff54: a1480002 sb r8,0x0002(r10) Store Blue 0008ff58: 00031bc0 sll r3,r3,0x0f Alpha * 0x8000 0008ff5c: 00431021 addu r2,r2,r3 r2 = Color 0008ff60: 08023fde j 0x0008ff78 0008ff64: a4a20000 sh r2,0x0000(r5) Store Color
- No color present*
0008ff68: 3402001f ori r2,r0,0x001f r2 = 0x1f 0008ff6c: a1420006 sb r2,0x0006(r10) Store Modified Blue? = 0x1f 0008ff70: a1420005 sb r2,0x0005(r10) Store Modified Green? = 0x1f 0008ff74: a1420004 sb r2,0x0004(r10) Store Modified Red? = 0x1f 0008ff78: 27180001 addiu r24,r24,0x0001 Unit/Color ID ++ 0008ff7c: 258c0001 addiu r12,r12,0x0001 Counter ++ 0008ff80: 29820010 slti r2,r12,0x0010 0008ff84: 1440ff30 bne r2,r0,0x0008fc48 Branch if Counter < 0x10 0008ff88: 254a0007 addiu r10,r10,0x0007 Color Mod Pointer += 7 0008ff8c: 12400018 beq r18,r0,0x0008fff0 Branch if PV2 = 0 0008ff90: 00061080 sll r2,r6,0x02 Section ID * 4 0008ff94: 00461021 addu r2,r2,r6 ID * 5 0008ff98: 00021080 sll r2,r2,0x02 ID * 20 0008ff9c: 00461023 subu r2,r2,r6 ID * 19 0008ffa0: 00021180 sll r2,r2,0x06 ID * 1216 0008ffa4: 00461021 addu r2,r2,r6 ID * 1217 0008ffa8: 00021040 sll r2,r2,0x01 ID * 2434 0008ffac: 3c03800a lui r3,0x800a 0008ffb0: 246395f6 addiu r3,r3,0x95f6 0008ffb4: 00431021 addu r2,r2,r3 0008ffb8: 001018c0 sll r3,r16,0x03 Unit/Color ID * 8 0008ffbc: 00431821 addu r3,r2,r3 r3 = ? Color Data 0008ffc0: 34040001 ori r4,r0,0x0001 r4 = 1 0008ffc4: 34020009 ori r2,r0,0x0009 r2 = 9 0008ffc8: a0640000 sb r4,0x0000(r3) Store ? = 1 0008ffcc: a0600001 sb r0,0x0001(r3) Store ? = 0 0008ffd0: a0600002 sb r0,0x0002(r3) Store ? = 0 0008ffd4: 16220015 bne r17,r2,0x0009002c 0008ffd8: a0720003 sb r18,0x0003(r3) Store ? = PV2 0008ffdc: a0640004 sb r4,0x0004(r3) Store ? = 1 0008ffe0: a06d0005 sb r13,0x0005(r3) Store Red Mod 0008ffe4: a06e0006 sb r14,0x0006(r3) Store Green Mod 0008ffe8: 0802400b j 0x0009002c 0008ffec: a06f0007 sb r15,0x0007(r3) Store Blue Mod
- PV2 = 0 with no color present*
0008fff0: 001010c0 sll r2,r16,0x03 Unit/Color ID * 8 0008fff4: 00061880 sll r3,r6,0x02 Section ID * 4 0008fff8: 00661821 addu r3,r3,r6 ID * 5 0008fffc: 00031880 sll r3,r3,0x02 ID * 20 00090000: 00661823 subu r3,r3,r6 ID * 19 00090004: 00031980 sll r3,r3,0x06 ID * 1216 00090008: 00661821 addu r3,r3,r6 ID * 1217 0009000c: 00031840 sll r3,r3,0x01 ID * 2434 00090010: 00431021 addu r2,r2,r3 00090014: 3c01800a lui r1,0x800a 00090018: 00220821 addu r1,r1,r2 0009001c: a02095f6 sb r0,-0x6a0a(r1) Store ? = 0 00090020: 34020001 ori r2,r0,0x0001 r2 = 1 00090024: 3c01800a lui r1,0x800a 00090028: ac2295ec sw r2,-0x6a14(r1) Store ? = 1 0009002c: 8fb3000c lw r19,0x000c(r29) 00090030: 8fb20008 lw r18,0x0008(r29) 00090034: 8fb10004 lw r17,0x0004(r29) 00090038: 8fb00000 lw r16,0x0000(r29) 0009003c: 27bd0010 addiu r29,r29,0x0010 00090040: 03e00008 jr r31 00090044: 00000000 nop