Display Related (0x7af44)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Alternate documentation here: Construct Polygon Data for Units
#   ROUTINE: DISPLAY RELATED? 0x7af44
#       Parameters:
#           r4 = (display) Display Pointer (Example: Misc Unit Data + 0x3fa; Numerical Display Data 3 Pointer)
#           r5 = (p2) End value for loop ?
#           r6 = (p3) Start value for loop ?
#           r7 = (p4) ?
#           STACK + 0x10 = (p5) ?
#           STACK + 0x14 = (p6) Flags ?
#           STACK + 0x18 = (p7) Array of 2 halfwords (2-byte values) ?
#           STACK + 0x1c = (p8) ? 

8007af44: 27bdffa8 addiu r29,r29,-0x0058
8007af48: afb20038 sw r18,0x0038(r29)
8007af4c: 87b20068 lh r18,0x0068(r29)                   #   p5
8007af50: afb60048 sw r22,0x0048(r29)
8007af54: 0080b021 addu r22,r4,r0                       #   display
8007af58: afb40040 sw r20,0x0040(r29)
8007af5c: 00c0a021 addu r20,r6,r0                       #   count = p3
8007af60: afb3003c sw r19,0x003c(r29)
8007af64: 00e09821 addu r19,r7,r0                       #   p4
8007af68: afbf0054 sw r31,0x0054(r29)
8007af6c: afbe0050 sw r30,0x0050(r29)
8007af70: afb7004c sw r23,0x004c(r29)
8007af74: afb50044 sw r21,0x0044(r29)
8007af78: afb10034 sw r17,0x0034(r29)
8007af7c: afb00030 sw r16,0x0030(r29)
8007af80: afa50020 sw r5,0x0020(r29)                    #   p2
8007af84: 96c4000c lhu r4,0x000c(r22)                   #   display.0xC
8007af88: 8fb00070 lw r16,0x0070(r29)                   #   p7
8007af8c: 8fb50074 lw r21,0x0074(r29)                   #   p8
8007af90: 97b7006c lhu r23,0x006c(r29)                  #   p6
8007af94: 0c006f0a jal 0x8001bc28                       #   ROUTINE: result = ? 0x1bc28 (p5 + display.0xC)
8007af98: 02442021 addu r4,r18,r4
8007af9c: 00021400 sll r2,r2,0x10                       #   result << 16
8007afa0: 86030000 lh r3,0x0000(r16)                    #   *p7
8007afa4: 00021403 sra r2,r2,0x10                       #   result
8007afa8: 00430018 mult r2,r3               
8007afac: 00001812 mflo r3                              #   result * *p7
8007afb0: 96c40008 lhu r4,0x0008(r22)                   #   display.0x8
8007afb4: 00031b03 sra r3,r3,0x0c                       #   (result * *p7) >> 12
8007afb8: 00640018 mult r3,r4                           
8007afbc: 3c11800a lui r17,0x800a
8007afc0: 26318dcc addiu r17,r17,-0x7234                #   0x80098dcc
8007afc4: 00001812 mflo r3                              #   ((result * *p7) >> 12) * display.0x8
8007afc8: 00031b03 sra r3,r3,0x0c                       #   (((result * *p7) >> 12) * display.0x8) >> 12
8007afcc: a6230000 sh r3,0x0000(r17)                    #   0x80098dcc = (((result * *p7) >> 12) * display.0x8) >> 12
8007afd0: 86030002 lh r3,0x0002(r16)                    #   *(p7 + 2)
8007afd4: 00000000 nop
8007afd8: 00430018 mult r2,r3                           
8007afdc: 00001012 mflo r2                              #   result * *(p7 + 2)
8007afe0: 96c3000a lhu r3,0x000a(r22)                   #   display.0xA
8007afe4: 00021303 sra r2,r2,0x0c                       #   result * *(p7 + 2) >> 12
8007afe8: 00430018 mult r2,r3
8007afec: 00001012 mflo r2                              #   (result * *(p7 + 2) >> 12) * display.0xA
8007aff0: 00021303 sra r2,r2,0x0c                       #   ((result * *(p7 + 2) >> 12) * display.0xA) >> 12
8007aff4: 3c01800a lui r1,0x800a
8007aff8: a4228dd4 sh r2,-0x722c(r1)                    #   *0x80098dd4 = ((result * *(p7 + 2) >> 12) * display.0xA) >> 12
8007affc: 96c4000c lhu r4,0x000c(r22)                   #   display.0xC
8007b000: 0c006ed7 jal 0x8001bb5c                       
8007b004: 02442021 addu r4,r18,r4                       #   ROUTINE: result = ? 0x1bb5c (p5 + display.0xC)
8007b008: 00021400 sll r2,r2,0x10
8007b00c: 00021403 sra r2,r2,0x10
8007b010: 86040002 lh r4,0x0002(r16)                    #   *(p7 + 2)   
8007b014: 00021823 subu r3,r0,r2                        #   -result
8007b018: 00640018 mult r3,r4
8007b01c: 00001812 mflo r3                              #   -result * *(p7 + 2)
8007b020: 96c4000a lhu r4,0x000a(r22)                   #   display.0xA
8007b024: 00031b03 sra r3,r3,0x0c                       #   (-result * *(p7 + 2)) >> 12
8007b028: 00640018 mult r3,r4
8007b02c: 00001812 mflo r3                              #   ((-result * *(p7 + 2)) >> 12) * display.0xA
8007b030: 00031b03 sra r3,r3,0x0c                       #   (((-result * *(p7 + 2)) >> 12) * display.0xA) >> 12
8007b034: 3c01800a lui r1,0x800a
8007b038: a4238dce sh r3,-0x7232(r1)                    #   *0x80098dce = (((-result * *(p7 + 2)) >> 12) * display.0xA) >> 12
8007b03c: 86030000 lh r3,0x0000(r16)                    #   *p7
8007b040: 00000000 nop
8007b044: 00430018 mult r2,r3                           
8007b048: 00001012 mflo r2                              #   result * *p7
8007b04c: 96c30008 lhu r3,0x0008(r22)                   #   display.0x8
8007b050: 00021303 sra r2,r2,0x0c                       #   (result * *p7) >> 12
8007b054: 00430018 mult r2,r3
8007b058: 00001012 mflo r2                              #   ((result * *p7) >> 12) * display.0x8
8007b05c: 00021303 sra r2,r2,0x0c                       #   (((result * *p7) >> 12) * display.0x8) >> 12
8007b060: 3c01800a lui r1,0x800a
8007b064: a4228dd2 sh r2,-0x722e(r1)                    #   *0x80098dd2 = (((result * *p7) >> 12) * display.0x8) >> 12
8007b068: 86620000 lh r2,0x0000(r19)                    #   *p4
8007b06c: 3c01800a lui r1,0x800a                        
8007b070: ac228de0 sw r2,-0x7220(r1)                    #   *0x80098de0 = *p4
8007b074: 86620002 lh r2,0x0002(r19)                    #   *(p4 + 2)
8007b078: 3c01800a lui r1,0x800a
8007b07c: ac228de4 sw r2,-0x721c(r1)                    #   *0x80098de4 = *(p4 + 2)
8007b080: 0c00742a jal 0x8001d0a8                       #   ROUTINE: ? 0x1d0a8 (0x80098dcc)
8007b084: 02202021 addu r4,r17,r0                       
8007b088: 0c00744e jal 0x8001d138                       #   ROUTINE: ? 0x1d138 (0x80098dcc)
8007b08c: 02202021 addu r4,r17,r0
8007b090: 8fa80020 lw r8,0x0020(r29)                    #   p2
8007b094: 00000000 nop
8007b098: 0288102a slt r2,r20,r8                        
8007b09c: 10400106 beq r2,r0,0x8007b4b8
8007b0a0: 3c1eb60b lui r30,0xb60b                       #   0xb60b0000
                                                        #   if (count >= p2), return 0
8007b0a4: 3c07800a lui r7,0x800a
8007b0a8: 24e77784 addiu r7,r7,0x7784                   #   0x800a7784
8007b0ac: 3c06800c lui r6,0x800c
8007b0b0: 24c67ca8 addiu r6,r6,0x7ca8                   #   0x800c7ca8
8007b0b4: 37de60b7 ori r30,r30,0x60b7                   #   0xb60b60b7      // Will be used to represent decimal value 0.7111111
8007b0b8: 3c1100ff lui r17,0x00ff
8007b0bc: 3631ffff ori r17,r17,0xffff                   #   0x00ffffff
8007b0c0: 3c13ff00 lui r19,0xff00                       #   0xff000000
8007b0c4: 001410c0 sll r2,r20,0x03                      #   count * 8
                                                        #   do {
8007b0c8: 00541023 subu r2,r2,r20                       #       count * 7
8007b0cc: 2442000e addiu r2,r2,0x000e                   #       count * 7 + 14
8007b0d0: 02c28021 addu r16,r22,r2                      #       ptr = display + (count * 7 + 14)                 
8007b0d4: 92120006 lbu r18,0x0006(r16)                  #       *(ptr + 6)
8007b0d8: afa60028 sw r6,0x0028(r29)                    #       0x800c7ca8
8007b0dc: 0c01ebc2 jal 0x8007af08                       #       ROUTINE: result = ? 0x7af08
8007b0e0: afa7002c sw r7,0x002c(r29)                    #       0x800a7784
8007b0e4: 00021400 sll r2,r2,0x10
8007b0e8: 00021403 sra r2,r2,0x10                       #       result
8007b0ec: 02571826 xor r3,r18,r23                       #       *(ptr + 6) XOR p6
8007b0f0: 00609021 addu r18,r3,r0                       #       r18 = *(ptr + 6) XOR p6
8007b0f4: 00021880 sll r3,r2,0x02                       #       result * 4
8007b0f8: 00621821 addu r3,r3,r2                        #       result * 5
8007b0fc: 3c02800e lui r2,0x800e
8007b100: 8c424e70 lw r2,0x4e70(r2)                     #       *0x800e4e70
8007b104: 000318c0 sll r3,r3,0x03                       #       result * 40
8007b108: 00622021 addu r4,r3,r2                        #       ptr4 = (result * 40) + *0x800e4e70 // sprite display data?
8007b10c: 34020009 ori r2,r0,0x0009                     #       9
8007b110: a0820003 sb r2,0x0003(r4)                     #       *(ptr4 + 3) = 9
8007b114: 3402002c ori r2,r0,0x002c                     #       44
8007b118: a0820007 sb r2,0x0007(r4)                     #       *(ptr4 + 7) = 44
8007b11c: 32e20002 andi r2,r23,0x0002                   #       p6 & 2
8007b120: 8fa60028 lw r6,0x0028(r29)                    #       0x800c7ca8
8007b124: 8fa7002c lw r7,0x002c(r29)                    #       0x800a7784
8007b128: 10400008 beq r2,r0,0x8007b14c                 #       if ((p6 & 2) != 0) {
8007b12c: 00000000 nop
8007b130: 92020000 lbu r2,0x0000(r16)                   #           *ptr
8007b134: 92030002 lbu r3,0x0002(r16)                   #           *(ptr + 2)
8007b138: 00021600 sll r2,r2,0x18
8007b13c: 00021603 sra r2,r2,0x18
8007b140: 00021023 subu r2,r0,r2                        #           -*ptr
8007b144: 0801ec57 j 0x8007b15c
8007b148: 00432823 subu r5,r2,r3                        #           value = -*ptr - *(ptr + 2)
                                                        #       } else {
8007b14c: 92020000 lbu r2,0x0000(r16)                   #           *ptr
8007b150: 00000000 nop
8007b154: 00021600 sll r2,r2,0x18
8007b158: 00022e03 sra r5,r2,0x18                       #           value = *ptr
                                                        #       }
8007b15c: 32e20004 andi r2,r23,0x0004                   #       p6 & 4
8007b160: 10400008 beq r2,r0,0x8007b184                 #       if ((p6 & 4) != 0) {
8007b164: 00000000 nop
8007b168: 92020001 lbu r2,0x0001(r16)                   #           *(ptr + 1)
8007b16c: 92030003 lbu r3,0x0003(r16)                   #           *(ptr + 3)
8007b170: 00021600 sll r2,r2,0x18
8007b174: 00021603 sra r2,r2,0x18
8007b178: 00021023 subu r2,r0,r2                        #           -*(ptr + 1)
8007b17c: 0801ec65 j 0x8007b194
8007b180: 00431823 subu r3,r2,r3                        #           r3 = -*(ptr + 1) - *(ptr + 3)
                                                        #       } else {
8007b184: 92020001 lbu r2,0x0001(r16)                   #           *(ptr + 1)
8007b188: 00000000 nop
8007b18c: 00021600 sll r2,r2,0x18
8007b190: 00021e03 sra r3,r2,0x18                       #           r3 = *(ptr + 1)
                                                        #       }
8007b194: 32420002 andi r2,r18,0x0002                   #       r18 & 2
8007b198: 1040000e beq r2,r0,0x8007b1d4                 #       if ((*(ptr + 6) & 2) != 0) {
8007b19c: 00000000 nop
8007b1a0: 3c01800a lui r1,0x800a
8007b1a4: a42577a8 sh r5,0x77a8(r1)                     #           *0x800a77a8 = value
8007b1a8: 3c01800a lui r1,0x800a
8007b1ac: a4257798 sh r5,0x7798(r1)                     #           *0x800a7798 = value
8007b1b0: 92020002 lbu r2,0x0002(r16)                   #           *(ptr + 2)
8007b1b4: 00000000 nop
8007b1b8: 00451021 addu r2,r2,r5                        #           *(ptr + 2) + value
8007b1bc: 3c01800a lui r1,0x800a
8007b1c0: a42277a0 sh r2,0x77a0(r1)                     #           *0x800a77a0 = *(ptr + 2) + value
8007b1c4: 3c01800a lui r1,0x800a
8007b1c8: a4227790 sh r2,0x7790(r1)                     #           *0x800a7790 = *(ptr + 2) + value
8007b1cc: 0801ec81 j 0x8007b204
8007b1d0: 32420004 andi r2,r18,0x0004                   #           r18 & 4
                                                        #       } else {
8007b1d4: 3c01800a lui r1,0x800a
8007b1d8: a42577a0 sh r5,0x77a0(r1)                     #           *0x800a77a0 = value
8007b1dc: 3c01800a lui r1,0x800a
8007b1e0: a4257790 sh r5,0x7790(r1)                     #           *0x800a7790 = value
8007b1e4: 92020002 lbu r2,0x0002(r16)                   #           *(ptr + 2)
8007b1e8: 00000000 nop
8007b1ec: 00451021 addu r2,r2,r5                        #           *(ptr + 2) + value
8007b1f0: 3c01800a lui r1,0x800a
8007b1f4: a42277a8 sh r2,0x77a8(r1)                     #           *0x800a77a8 = *(ptr + 2) + value
8007b1f8: 3c01800a lui r1,0x800a
8007b1fc: a4227798 sh r2,0x7798(r1)                     #           *0x800a7798 = *(ptr + 2) + value
8007b200: 32420004 andi r2,r18,0x0004                   #           r18 & 4
                                                        #       }
8007b204: 1040000e beq r2,r0,0x8007b240                 #       if ((*(ptr + 6) & 4) != 0) {
8007b208: 00000000 nop
8007b20c: 3c01800a lui r1,0x800a
8007b210: a42377aa sh r3,0x77aa(r1)                     #           *0x800a77aa = r3
8007b214: 3c01800a lui r1,0x800a
8007b218: a42377a2 sh r3,0x77a2(r1)                     #           *0x800a77a2 = r3
8007b21c: 92020003 lbu r2,0x0003(r16)                   #           *(ptr + 3)
8007b220: 00000000 nop
8007b224: 00431021 addu r2,r2,r3                        #           *(ptr + 3) + r3
8007b228: 3c01800a lui r1,0x800a
8007b22c: a422779a sh r2,0x779a(r1)                     #           *0x800a779a = *(ptr + 3) + r3
8007b230: 3c01800a lui r1,0x800a
8007b234: a4227792 sh r2,0x7792(r1)                     #           *0x800a7792 = *(ptr + 3) + r3
8007b238: 0801ec9b j 0x8007b26c
8007b23c: 00000000 nop
                                                        #       } else {
8007b240: 3c01800a lui r1,0x800a
8007b244: a423779a sh r3,0x779a(r1)                     #           *0x800a779a = r3
8007b248: 3c01800a lui r1,0x800a
8007b24c: a4237792 sh r3,0x7792(r1)                     #           *0x800a7792 = r3
8007b250: 92020003 lbu r2,0x0003(r16)                   #           *(ptr + 3)
8007b254: 00000000 nop
8007b258: 00431021 addu r2,r2,r3                        #           *(ptr + 3) + r3
8007b25c: 3c01800a lui r1,0x800a
8007b260: a42277aa sh r2,0x77aa(r1)                     #           *0x800a77aa = *(ptr + 3) + r3
8007b264: 3c01800a lui r1,0x800a
8007b268: a42277a2 sh r2,0x77a2(r1)                     #           *0x800a77a2 = *(ptr + 3) + r3
                                                        #       }
8007b26c: 3c08800a lui r8,0x800a
8007b270: 25087790 addiu r8,r8,0x7790                   #       0x800a7790
8007b274: 01006021 addu r12,r8,r0                       #       0x800a7790
8007b278: 3c08800a lui r8,0x800a
8007b27c: 25087798 addiu r8,r8,0x7798                   #       0x800a7798
8007b280: 01006821 addu r13,r8,r0                       #       0x800a7798
8007b284: 3c08800a lui r8,0x800a
8007b288: 250877a0 addiu r8,r8,0x77a0                   #       0x800a7780
8007b28c: 01007021 addu r14,r8,r0                       #       0x800a7780
8007b290: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)        #       GTE vxy0 = *0x800a7790
8007b294: c9810004 lwc2 gtedr01_vz0,0x0004(r12)         #       GTE vz0 = *0x800a7794
8007b298: c9a20000 lwc2 gtedr02_vxy1,0x0000(r13)        #       GTE vxy1 = *0x800a7798
8007b29c: c9a30004 lwc2 gtedr03_vz1,0x0004(r13)         #       GTE vz1 = *0x800a779c
8007b2a0: c9c40000 lwc2 gtedr04_vxy2,0x0000(r14)        #       GTE vxy2 = *0x800a7780
8007b2a4: c9c50004 lwc2 gtedr05_vz2,0x0004(r14)         #       GTE vz2 = *0x800a7784
8007b2a8: 00000000 nop
8007b2ac: 00000000 nop
8007b2b0: 4a280030 rtpt                                 #       GTE command: rtpt
8007b2b4: 02571025 or r2,r18,r23                        #       r18 | p6
8007b2b8: 30420001 andi r2,r2,0x0001                    #       (*(ptr + 6) | p6) & 0x01
8007b2bc: 10400004 beq r2,r0,0x8007b2d0                 #       if (((*(ptr + 6) | p6) & 0x01) != 0) {
8007b2c0: 00000000 nop
8007b2c4: 90820007 lbu r2,0x0007(r4)                    #           *(ptr4 + 7)
8007b2c8: 0801ecb7 j 0x8007b2dc
8007b2cc: 34420002 ori r2,r2,0x0002                     #           *(ptr4 + 7) | 0x02   // Include 0x02 flag
                                                        #       } else {
8007b2d0: 90820007 lbu r2,0x0007(r4)                    #           *(ptr4 + 7)
8007b2d4: 00000000 nop
8007b2d8: 304200fd andi r2,r2,0x00fd                    #           *(ptr4 + 7) & 0xfd   // Remove 0x02 flag
8007b2dc: a0820007 sb r2,0x0007(r4)
                                                        #       }
8007b2e0: 96c20004 lhu r2,0x0004(r22)                   #       display.0x04
8007b2e4: 32e30060 andi r3,r23,0x0060                   #       p6 & 0x60
8007b2e8: 00431025 or r2,r2,r3                          #       display.0x04 | (p6 & 0x60)
8007b2ec: a4820016 sh r2,0x0016(r4)                     #       *(ptr4 + 0x16) = display.0x04 | (p6 & 0x60)
8007b2f0: 96c20006 lhu r2,0x0006(r22)                   #       VRAM Palette
8007b2f4: 00000000 nop
8007b2f8: a482000e sh r2,0x000e(r4)                     #       *(ptr4 + 0x0e) = VRAM Palette
8007b2fc: 24820008 addiu r2,r4,0x0008                   #       ptr4 + 8 
8007b300: 00406021 addu r12,r2,r0                       #       ptr4 + 8
8007b304: 24820010 addiu r2,r4,0x0010                   #       ptr4 + 0x10
8007b308: 00406821 addu r13,r2,r0                       #       ptr4 + 0x10
8007b30c: 24820018 addiu r2,r4,0x0018                   #       ptr4 + 0x18
8007b310: 00407021 addu r14,r2,r0                       #       ptr4 + 0x18
8007b314: e98c0000 swc2 gtedr12_sxy0,0x0000(r12)        #       *(ptr4 + 8) = GTE sxy0 
8007b318: e9ad0000 swc2 gtedr13_sxy1,0x0000(r13)        #       *(ptr4 + 0x10) = GTE sxy1    
8007b31c: e9ce0000 swc2 gtedr14_sxy2,0x0000(r14)        #       *(ptr4 + 0x18) = GTE sxy2 
8007b320: 3c08800a lui r8,0x800a
8007b324: 250877a8 addiu r8,r8,0x77a8                   #       0x800a77a8
8007b328: 01006021 addu r12,r8,r0                       #       0x800a77a8
8007b32c: c9800000 lwc2 gtedr00_vxy0,0x0000(r12)        #       GTE $vxy0 = *(ptr4 + 8)
8007b330: c9810004 lwc2 gtedr01_vz0,0x0004(r12)         #       GTE $vxy1 = *(ptr4 + 12)
8007b334: 00000000 nop
8007b338: 00000000 nop
8007b33c: 4a180001 rtps                                 #       GTE command: rtps
8007b340: 96c20000 lhu r2,0x0000(r22)                   #       display.0x0
8007b344: 00000000 nop
8007b348: a4820004 sh r2,0x0004(r4)                     #       *(ptr4 + 4) = display.0x0
8007b34c: 92c20002 lbu r2,0x0002(r22)                   #       display.0x2
8007b350: 00000000 nop
8007b354: a0820006 sb r2,0x0006(r4)                     #       *(ptr4 + 6) = display.0x2
8007b358: 24820020 addiu r2,r4,0x0020                   #       ptr4 + 0x20
8007b35c: 00406021 addu r12,r2,r0                       #       ptr4 + 0x20
8007b360: e98e0000 swc2 gtedr14_sxy2,0x0000(r12)        #       *(ptr4 + 0x20) = GTE sxy2
8007b364: 92020004 lbu r2,0x0004(r16)                   #       *(ptr + 4)
8007b368: 00000000 nop
8007b36c: a082001c sb r2,0x001c(r4)                     #       *(ptr4 + 0x1c) = *(ptr + 4)
8007b370: a082000c sb r2,0x000c(r4)                     #       *(ptr4 + 0x0c) = *(ptr + 4)
8007b374: 92030002 lbu r3,0x0002(r16)                   #       *(ptr + 2)
8007b378: 00000000 nop
8007b37c: 00431021 addu r2,r2,r3                        #       *(ptr + 4) + *(ptr + 2)
8007b380: a0820024 sb r2,0x0024(r4)                     #       *(ptr4 + 0x24) = *(ptr + 4) + *(ptr + 2)
8007b384: a0820014 sb r2,0x0014(r4)                     #       *(ptr4 + 0x14) = *(ptr + 4) + *(ptr + 2)
8007b388: 92020005 lbu r2,0x0005(r16)                   #       *(ptr + 5)
8007b38c: 00000000 nop
8007b390: a0820015 sb r2,0x0015(r4)                     #       *(ptr4 + 0x15) = *(ptr + 5)
8007b394: a082000d sb r2,0x000d(r4)                     #       *(ptr4 + 0x0d) = *(ptr + 5)
8007b398: 92030003 lbu r3,0x0003(r16)                   #       *(ptr + 3)
8007b39c: 00000000 nop
8007b3a0: 00431021 addu r2,r2,r3                        #       *(ptr + 5) + *(ptr + 3)
8007b3a4: a0820025 sb r2,0x0025(r4)                     #       *(ptr4 + 0x25) = *(ptr + 5) + *(ptr + 3)
8007b3a8: a082001d sb r2,0x001d(r4)                     #       *(ptr4 + 0x1d) = *(ptr + 5) + *(ptr + 3)
8007b3ac: 32420080 andi r2,r18,0x0080                   #       r18 & 0x80 
8007b3b0: 10400031 beq r2,r0,0x8007b478                 #       if (((r18 & 0x80) != 0)
8007b3b4: 00000000 nop
8007b3b8: 94e20000 lhu r2,0x0000(r7)                    #           *0x800a7784
8007b3bc: 00000000 nop
8007b3c0: 30450fff andi r5,r2,0x0fff                    #           *0x800a7784 & 0x0fff
8007b3c4: 28a20400 slti r2,r5,0x0400
8007b3c8: 1040002b beq r2,r0,0x8007b478
8007b3cc: 24a2fed2 addiu r2,r5,-0x012e                  #           (*0x800a7784 & 0x0fff) - 0x012e
                                                        #           and ((*0x800a7784 & 0x0fff) < 0x400)) {
8007b3d0: 8cc30000 lw r3,0x0000(r6)                     #               *0x800c7ca8
8007b3d4: 00000000 nop
8007b3d8: 00430018 mult r2,r3
8007b3dc: 00001812 mflo r3                              #               value = ((*0x800a7784 & 0x0fff) - 0x012e) * *0x800c7ca8
8007b3e0: 00000000 nop
8007b3e4: 00000000 nop
8007b3e8: 007e0018 mult r3,r30
8007b3ec: 00001010 mfhi r2                              #               value * 0.7111111       // (* 0xb60b60b7 >> 32)
8007b3f0: 00431021 addu r2,r2,r3                        #               value * 1.7111111
8007b3f4: 00021483 sra r2,r2,0x12                       #               value * 1.7111111) >> 12
8007b3f8: 00031fc3 sra r3,r3,0x1f                       #               value >> 31
8007b3fc: 00431023 subu r2,r2,r3                        #               (value * 1.7111111) >> 12) - (value >> 31)
8007b400: 00021080 sll r2,r2,0x02                       #               ((value * 1.7111111) >> 12) - (value >> 31)) << 2
8007b404: 02a21023 subu r2,r21,r2                       #               tempPtr = p8 - (((value * 1.7111111) >> 12) - (value >> 31)) << 2)
8007b408: 8c830000 lw r3,0x0000(r4)                     #               *ptr4
8007b40c: 8c42fffc lw r2,-0x0004(r2)                    #               *(tempPtr - 4)
8007b410: 00731824 and r3,r3,r19                        #               *ptr4 & 0xff000000
8007b414: 00511024 and r2,r2,r17                        #               *(tempPtr - 4) & 0x00ffffff
8007b418: 00621825 or r3,r3,r2                          #               (*ptr4 & 0xff000000) | (*(tempPtr - 4) & 0x00ffffff)
8007b41c: ac830000 sw r3,0x0000(r4)                     #               *ptr4 = (*ptr4 & 0xff000000) | (*(tempPtr - 4) & 0x00ffffff)
8007b420: 94e20000 lhu r2,0x0000(r7)                    #               *0x800a7784
8007b424: 8cc30000 lw r3,0x0000(r6)                     #               *0x800c7ca8
8007b428: 30420fff andi r2,r2,0x0fff                    #               *0x800a7784 & 0x0fff
8007b42c: 2442fed2 addiu r2,r2,-0x012e                  #               (*0x800a7784 & 0x0fff) - 0x12e
8007b430: 00430018 mult r2,r3
8007b434: 00001812 mflo r3                              #               value = ((*0x800a7784 & 0x0fff) - 0x12e) * *0x800c7ca8
8007b438: 00000000 nop
8007b43c: 00000000 nop
8007b440: 007e0018 mult r3,r30
8007b444: 00001010 mfhi r2                              #               value * 0.7111111
8007b448: 00431021 addu r2,r2,r3                        #               value * 1.7111111
8007b44c: 00021483 sra r2,r2,0x12                       #               (value * 1.7111111) >> 0x12
8007b450: 00031fc3 sra r3,r3,0x1f                       #               value >> 31
8007b454: 00431023 subu r2,r2,r3                        #               ((value * 1.7111111) >> 0x12) - (value >> 31)
8007b458: 00021080 sll r2,r2,0x02                       #               (((value * 1.7111111) >> 0x12) - (value >> 31)) << 2
8007b45c: 02a21023 subu r2,r21,r2                       #               tempPtr = p8 - (((value * 1.7111111) >> 12) - (value >> 31)) << 2)
8007b460: 8c43fffc lw r3,-0x0004(r2)                    #               *(tempPtr - 4)
8007b464: 00912024 and r4,r4,r17                        #               ptr4 & 0x00ffffff
8007b468: 00731824 and r3,r3,r19                        #               *(tempPtr - 4) & 0xff000000
8007b46c: 00641825 or r3,r3,r4                          #               (ptr4 & 0x00ffffff) | (*(tempPtr - 4) & 0xff000000)
8007b470: 0801ed29 j 0x8007b4a4
8007b474: ac43fffc sw r3,-0x0004(r2)                    #               *(tempPtr - 4) = (ptr4 & 0x00ffffff) | (*(tempPtr - 4) & 0xff000000)
                                                        #       } else {
8007b478: 8c830000 lw r3,0x0000(r4)                     #           *ptr4
8007b47c: 8ea20000 lw r2,0x0000(r21)                    #           *p8
8007b480: 00731824 and r3,r3,r19                        #           *ptr4 & 0xff000000
8007b484: 00511024 and r2,r2,r17                        #           *p8 & 0x00ffffff
8007b488: 00621825 or r3,r3,r2                          #           (*ptr4 & 0xff000000) | (*p8 & 0x00ffffff)
8007b48c: ac830000 sw r3,0x0000(r4)                     #           *ptr4 = (*ptr4 & 0xff000000) | (*p8 & 0x00ffffff)
8007b490: 8ea20000 lw r2,0x0000(r21)                    #           *p8
8007b494: 00911824 and r3,r4,r17                        #           ptr4 & 0x00ffffff
8007b498: 00531024 and r2,r2,r19                        #           *p8 & 0xff000000
8007b49c: 00431025 or r2,r2,r3                          #           (*p8 & 0xff000000) | (ptr4 & 0x00ffffff)
8007b4a0: aea20000 sw r2,0x0000(r21)                    #           *p8 = (*p8 & 0xff000000) | (ptr4 & 0x00ffffff)
                                                        #       }
8007b4a4: 8fa80020 lw r8,0x0020(r29)                    #       p2
8007b4a8: 26940001 addiu r20,r20,0x0001                 #       count = count + 1
8007b4ac: 0288102a slt r2,r20,r8
8007b4b0: 1440ff05 bne r2,r0,0x8007b0c8
8007b4b4: 001410c0 sll r2,r20,0x03                      #       count * 8
                                                        #   while (count < p2)
8007b4b8: 8fbf0054 lw r31,0x0054(r29)
8007b4bc: 8fbe0050 lw r30,0x0050(r29)
8007b4c0: 8fb7004c lw r23,0x004c(r29)
8007b4c4: 8fb60048 lw r22,0x0048(r29)
8007b4c8: 8fb50044 lw r21,0x0044(r29)
8007b4cc: 8fb40040 lw r20,0x0040(r29)
8007b4d0: 8fb3003c lw r19,0x003c(r29)
8007b4d4: 8fb20038 lw r18,0x0038(r29)
8007b4d8: 8fb10034 lw r17,0x0034(r29)
8007b4dc: 8fb00030 lw r16,0x0030(r29)
8007b4e0: 27bd0058 addiu r29,r29,0x0058
8007b4e4: 03e00008 jr r31
8007b4e8: 00000000 nop