Set Tile Background Color (Partial Tiles)
Jump to navigation
Jump to search
# ROUTINE: SET TILE BACKGROUND COLOR? (PARTIAL TILES?) 0x12cc54 # Observations of register values: # Parameters: # r4 = ? 0x80056b18, 0x80057118 (alternating) # r5 = ? 0x800fc55c, 0x8010b384 (alternating) # r6 = ? 0x200 (512) (Number of possible tiles?) 0012cc54: 27bdffc0 addiu r29,r29,0xffc0 0012cc58: afb0003c sw r16,0x003c(r29) 0012cc5c: afb10038 sw r17,0x0038(r29) 0012cc60: afb30030 sw r19,0x0030(r29) 0012cc64: 3c118010 lui r17,0x8010 0012cc68: 8e31bdf8 lw r17,-0x4208(r17) # *0x800fbdf8 0012cc6c: 3c088013 lui r8,0x8013 0012cc70: 2508d878 addiu r8,r8,-0x2788 # 0x8012d878 0012cc74: 8d090000 lw r9,0x0000(r8) # *0x8012d878 0012cc78: 20d3ffff addi r19,r6,-0x0001 # [Parameter 3] - 1 (= 0x1ff) 0012cc7c: 32730e00 andi r19,r19,0x0e00 # ([Parameter 3] - 1) & 0xe00 (= 0) 0012cc80: 00139a42 srl r19,r19,0x09 # (([Parameter 3] - 1) & 0xe00) >> 9 (= 0) 0012cc84: 20d00200 addi r16,r6,0x0200 # [Parameter 3] + 0x200 (= 0x400) 0012cc88: 321003ff andi r16,r16,0x03ff # ([Parameter 3] + 0x200) & 0x3ff (= 0) 0012cc8c: 30c60c00 andi r6,r6,0x0c00 # r6 = [Parameter 3] & 0xc00 (= 0) 0012cc90: 00063282 srl r6,r6,0x0a # r6 = ([Parameter 3] & 0xc00) >> 10 (= 0) 0012cc94: 12000002 beq r16,r0,0x0012cca0 # if ((([Parameter 3] + 0x200) & 0x3ff) != 0) { 0012cc98: 00000000 nop 0012cc9c: 34060004 ori r6,r0,0x0004 # r6 = 4 # } 0012cca0: 21290001 addi r9,r9,0x0001 # *0x8012d878 + 1 0012cca4: ad090000 sw r9,0x0000(r8) # *0x8012d878 = *0x8012d878 + 1 0012cca8: 00008021 addu r16,r0,r0 # r16 = 0 0012ccac: 3c0e800f lui r14,0x800f 0012ccb0: 8dce5b84 lw r14,0x5b84(r14) # *0x800f5b84 0012ccb4: 3c108010 lui r16,0x8010 0012ccb8: 8e10a6b8 lw r16,-0x5948(r16) # *0x800fa6b8 0012ccbc: 2231ffe8 addi r17,r17,-0x0018 # *0x800fbdf8 - 0x18 (24) 0012ccc0: 20a5ffd8 addi r5,r5,-0x0028 # pointer = pointer - 0x28 (40) 0012ccc4: 21ceffff addi r14,r14,-0x0001 # *0x800f5b84 - 1 0012ccc8: 05c10007 bgez r14,0x0012cce8 # if ((*0x800f5b84 - 1) < 0) { 0012cccc: 00000000 nop 0012ccd0: 8fb30030 lw r19,0x0030(r29) 0012ccd4: 8fb10038 lw r17,0x0038(r29) 0012ccd8: 8fb0003c lw r16,0x003c(r29) 0012ccdc: 27bd0040 addiu r29,r29,0x0040 0012cce0: 03e00008 jr r31 # return; 0012cce4: 00000000 nop # } 0012cce8: ca000000 lwc2 gtedr00_vxy0,0x0000(r16) # Load r16 pointer data into GTE 0012ccec: ca010004 lwc2 gtedr01_vz0,0x0004(r16) 0012ccf0: 22100008 addi r16,r16,0x0008 # r16 = r16 + 8 0012ccf4: 20a50028 addi r5,r5,0x0028 # pointer = pointer + 0x28 (40) 0012ccf8: 4a480012 mvmva # GTE operation 0012ccfc: 86070006 lh r7,0x0006(r16) # *(r16 + 6) 0012cd00: 22310018 addi r17,r17,0x0018 0012cd04: 4808c800 mfc2 r8,gtedr25_mac1 0012cd08: 4809d000 mfc2 r9,gtedr26_mac2 0012cd0c: 4819d800 mfc2 r25,gtedr27_mac3 0012cd10: ca000000 lwc2 gtedr00_vxy0,0x0000(r16) 0012cd14: ca010004 lwc2 gtedr01_vz0,0x0004(r16) 0012cd18: 22100008 addi r16,r16,0x0008 0012cd1c: 0009c400 sll r24,r9,0x10 0012cd20: 4a480012 mvmva 0012cd24: 0118c025 or r24,r8,r24 0012cd28: 48986000 mtc2 r24,gtedr12_sxy0 0012cd2c: 48998800 mtc2 r25,gtedr17_sz1 0012cd30: a4a80008 sh r8,0x0008(r5) 0012cd34: a4a9000a sh r9,0x000a(r5) 0012cd38: 480ac800 mfc2 r10,gtedr25_mac1 0012cd3c: 480bd000 mfc2 r11,gtedr26_mac2 0012cd40: 4819d800 mfc2 r25,gtedr27_mac3 0012cd44: ca000000 lwc2 gtedr00_vxy0,0x0000(r16) 0012cd48: ca010004 lwc2 gtedr01_vz0,0x0004(r16) 0012cd4c: 000bc400 sll r24,r11,0x10 0012cd50: 22100008 addi r16,r16,0x0008 0012cd54: 4a480012 mvmva 0012cd58: a4aa0014 sh r10,0x0014(r5) 0012cd5c: a4ab0016 sh r11,0x0016(r5) 0012cd60: 0158c025 or r24,r10,r24 0012cd64: 48986800 mtc2 r24,gtedr13_sxy1 0012cd68: 48999000 mtc2 r25,gtedr18_sz2 0012cd6c: 480cc800 mfc2 r12,gtedr25_mac1 0012cd70: 480dd000 mfc2 r13,gtedr26_mac2 0012cd74: 4819d800 mfc2 r25,gtedr27_mac3 0012cd78: 000dc400 sll r24,r13,0x10 0012cd7c: 0198c025 or r24,r12,r24 0012cd80: 48987000 mtc2 r24,gtedr14_sxy2 0012cd84: 48999800 mtc2 r25,gtedr19_sz3 0012cd88: 30ef3ffc andi r15,r7,0x3ffc 0012cd8c: 026fc006 srlv r24,r15,r19 0012cd90: 33180004 andi r24,r24,0x0004 0012cd94: 1700ffcb bne r24,r0,0x0012ccc4 0012cd98: 00cf7806 srlv r15,r15,r6 0012cd9c: 31ef0400 andi r15,r15,0x0400 0012cda0: 15e0ffc8 bne r15,r0,0x0012ccc4 0012cda4: 00000000 nop 0012cda8: a4ac0020 sh r12,0x0020(r5) 0012cdac: a4ad0022 sh r13,0x0022(r5) 0012cdb0: 4b400006 nclip 0012cdb4: 05010007 bgez r8,0x0012cdd4 0012cdb8: 00000000 nop 0012cdbc: 05410005 bgez r10,0x0012cdd4 0012cdc0: 00000000 nop 0012cdc4: 05810003 bgez r12,0x0012cdd4 0012cdc8: 00000000 nop 0012cdcc: 0804b331 j 0x0012ccc4 0012cdd0: 00000000 nop 0012cdd4: 05210007 bgez r9,0x0012cdf4 0012cdd8: 00000000 nop 0012cddc: 05610005 bgez r11,0x0012cdf4 0012cde0: 00000000 nop 0012cde4: 05a10003 bgez r13,0x0012cdf4 0012cde8: 00000000 nop 0012cdec: 0804b331 j 0x0012ccc4 0012cdf0: 00000000 nop 0012cdf4: 2108fd80 addi r8,r8,-0x0280 0012cdf8: 05000007 bltz r8,0x0012ce18 0012cdfc: 214afd80 addi r10,r10,-0x0280 0012ce00: 05400005 bltz r10,0x0012ce18 0012ce04: 218cfd80 addi r12,r12,-0x0280 0012ce08: 05800003 bltz r12,0x0012ce18 0012ce0c: 00000000 nop 0012ce10: 0804b331 j 0x0012ccc4 0012ce14: 00000000 nop 0012ce18: 4818c000 mfc2 r24,gtedr24_mac0 0012ce1c: 2129fe20 addi r9,r9,-0x01e0 0012ce20: 0700ffa8 bltz r24,0x0012ccc4 0012ce24: 216bfe20 addi r11,r11,-0x01e0 0012ce28: 05200007 bltz r9,0x0012ce48 0012ce2c: 21adfe20 addi r13,r13,-0x01e0 0012ce30: 05600005 bltz r11,0x0012ce48 0012ce34: 00000000 nop 0012ce38: 05a00003 bltz r13,0x0012ce48 0012ce3c: 00000000 nop 0012ce40: 0804b331 j 0x0012ccc4 0012ce44: 00000000 nop 0012ce48: 00000000 nop 0012ce4c: 00000000 nop 0012ce50: 4b58002d avsz3 0012ce54: 48193800 mfc2 r25,gtedr07_otz 0012ce58: 00000000 nop 0012ce5c: 0720ff99 bltz r25,0x0012ccc4 0012ce60: 00000000 nop 0012ce64: 0320c021 addu r24,r25,r0 0012ce68: 2339fe80 addi r25,r25,-0x0180 0012ce6c: 0721ff95 bgez r25,0x0012ccc4 0012ce70: 00000000 nop 0012ce74: 00e07821 addu r15,r7,r0 0012ce78: 31e30001 andi r3,r15,0x0001 0012ce7c: 10600007 beq r3,r0,0x0012ce9c 0012ce80: 00000000 nop 0012ce84: ca220008 lwc2 gtedr02_vxy1,0x0008(r17) 0012ce88: ca23000c lwc2 gtedr03_vz1,0x000c(r17) 0012ce8c: ca240010 lwc2 gtedr04_vxy2,0x0010(r17) 0012ce90: ca250014 lwc2 gtedr05_vz2,0x0014(r17) 0012ce94: ca200000 lwc2 gtedr00_vxy0,0x0000(r17) 0012ce98: ca210004 lwc2 gtedr01_vz0,0x0004(r17) 0012ce9c: 00804021 addu r8,r4,r0 0012cea0: 0018c080 sll r24,r24,0x02 0012cea4: 4ad80420 nct 0012cea8: 00982020 add r4,r4,r24 0012ceac: 0804b3af j 0x0012cebc 0012ceb0: 00000000 nop 0012ceb4: 0804b3af j 0x0012cebc 0012ceb8: 00000000 nop 0012cebc: 3c1800ff lui r24,0x00ff 0012cec0: 3718ffff ori r24,r24,0xffff 0012cec4: 3c19ff00 lui r25,0xff00 0012cec8: 8ca30000 lw r3,0x0000(r5) 0012cecc: 8c820000 lw r2,0x0000(r4) 0012ced0: 00791824 and r3,r3,r25 0012ced4: 00581024 and r2,r2,r24 0012ced8: 00621825 or r3,r3,r2 0012cedc: aca30000 sw r3,0x0000(r5) 0012cee0: 8c820000 lw r2,0x0000(r4) 0012cee4: 00b84824 and r9,r5,r24 0012cee8: 00591024 and r2,r2,r25 0012ceec: 00491025 or r2,r2,r9 0012cef0: ac820000 sw r2,0x0000(r4) 0012cef4: 01002021 addu r4,r8,r0 0012cef8: 31e30001 andi r3,r15,0x0001 0012cefc: 1060000f beq r3,r0,0x0012cf3c 0012cf00: 00000000 nop 0012cf04: 4808a000 mfc2 r8,gtedr20_rgb0 0012cf08: 4809a800 mfc2 r9,gtedr21_rgb1 0012cf0c: 480ab000 mfc2 r10,gtedr22_rgb2 0012cf10: a4a80004 sh r8,0x0004(r5) 0012cf14: a4a90010 sh r9,0x0010(r5) 0012cf18: a4aa001c sh r10,0x001c(r5) 0012cf1c: 00084402 srl r8,r8,0x10 0012cf20: 00094c02 srl r9,r9,0x10 0012cf24: 000a5402 srl r10,r10,0x10 0012cf28: a0a80006 sb r8,0x0006(r5) 0012cf2c: a0a90012 sb r9,0x0012(r5) 0012cf30: a0aa001e sb r10,0x001e(r5) 0012cf34: 0804b3cf j 0x0012cf3c # Delightful! 0012cf38: 00000000 nop 0012cf3c: 0804b331 j 0x0012ccc4 # Jump back to position that might return (0x12ccc4), otherwise re-iterates. 0012cf40: 00000000 nop