Difference between revisions of "P00 GetTpage"
Jump to navigation
Jump to search
(Created page with " # ROUTINE: ? Calculation (0x2398c) # Parameters: # r4 = ? # r5 = ? # r6 = ? # r7 = ? # Returns: # r2 = ...") |
|||
Line 1: | Line 1: | ||
− | # ROUTINE: | + | # ROUTINE: P00 GetTpage |
# Parameters: | # Parameters: | ||
− | # r4 = | + | # r4 = VRAM Texture mode |
− | # r5 = | + | # 0x00: 4 bit compressed |
− | # r6 = | + | # 0x01: 8 bit compressed |
− | # r7 = | + | # 0x02: 16 bit (uncompressed) |
+ | # r5 = Semi Transparency rate | ||
+ | # 0x00: 0.5 back + 0x5 forward | ||
+ | # 0x01: 1 back + 1 forward | ||
+ | # 0x02: 1 back - 1 forward | ||
+ | # 0x03: 1 back + 0.25 forward | ||
+ | # r6 = texture page address (x) (must be multiple of 0x040) | ||
+ | # r7 = texture page address (y) (must be multiple of 0x100) | ||
# Returns: | # Returns: | ||
− | # r2 = ? | + | # r2 = Tpage ID |
− | + | # if (([? Accessor Result] = 1) or ([? Accessor Result] = 2)) | |
+ | # 0x000f: x pos of tpage | ||
+ | # 0x0060: y pos of tpage | ||
+ | # 0x0180: semi transparency mode | ||
+ | # 0x0600: texture mode | ||
+ | # else | ||
+ | # 0x000f: x pos of tpage | ||
+ | # 0x0010: y pos of tpage (mod 2) | ||
+ | # 0x0060: semi transparency mode | ||
+ | # 0x0180: texture mode | ||
+ | # 0x0800: y pos of tpage (div 2) | ||
+ | |||
0002398c: 27bdffd8 addiu r29,r29,-0x0028 | 0002398c: 27bdffd8 addiu r29,r29,-0x0028 | ||
00023990: afb00010 sw r16,0x0010(r29) | 00023990: afb00010 sw r16,0x0010(r29) | ||
Line 21: | Line 39: | ||
000239b8: 34030001 ori r3,r0,0x0001 | 000239b8: 34030001 ori r3,r0,0x0001 | ||
000239bc: 10430006 beq r2,r3,0x000239d8 | 000239bc: 10430006 beq r2,r3,0x000239d8 | ||
− | 000239c0: 32030003 andi r3,r16,0x0003 # | + | 000239c0: 32030003 andi r3,r16,0x0003 # Texture mode mod 4 |
# if (([? Accessor Result] != 1) | # if (([? Accessor Result] != 1) | ||
000239c4: 0c00916f jal 0x000245bc # ROUTINE: [[? Accessor (0x245bc)]] (Call #2) | 000239c4: 0c00916f jal 0x000245bc # ROUTINE: [[? Accessor (0x245bc)]] (Call #2) | ||
Line 27: | Line 45: | ||
000239cc: 34030002 ori r3,r0,0x0002 | 000239cc: 34030002 ori r3,r0,0x0002 | ||
000239d0: 1443000b bne r2,r3,0x00023a00 # AND ([? Accessor Result (#2)] == 2)) | 000239d0: 1443000b bne r2,r3,0x00023a00 # AND ([? Accessor Result (#2)] == 2)) | ||
− | 000239d4: 32030003 andi r3,r16,0x0003 # ( | + | 000239d4: 32030003 andi r3,r16,0x0003 # (texture mode) |
# { | # { | ||
− | 000239d8: 00031a40 sll r3,r3,0x09 # | + | 000239d8: 00031a40 sll r3,r3,0x09 # texture mode << 9 |
− | 000239dc: 32420003 andi r2,r18,0x0003 # | + | 000239dc: 32420003 andi r2,r18,0x0003 # semi transparency |
− | 000239e0: 000211c0 sll r2,r2,0x07 # | + | 000239e0: 000211c0 sll r2,r2,0x07 # semi transparency << 7 |
− | 000239e4: 00621825 or r3,r3,r2 # ( | + | 000239e4: 00621825 or r3,r3,r2 # (texture mode << 9) | (semi transparency << 7) |
− | 000239e8: 32220300 andi r2,r17,0x0300 # | + | 000239e8: 32220300 andi r2,r17,0x0300 # tpage y & 0x0300 // for a multiple of 0x100, this limits it to 3 values |
− | 000239ec: 000210c3 sra r2,r2,0x03 # | + | 000239ec: 000210c3 sra r2,r2,0x03 # tpage y >> 3 // absolute y value << 5 |
− | 000239f0: 00621825 or r3,r3,r2 # leftValue = ( | + | 000239f0: 00621825 or r3,r3,r2 # leftValue = (tmode << 9) | (ABEMode << 7)) | (AbsY << 5) |
− | 000239f4: 326203ff andi r2,r19,0x03ff # | + | 000239f4: 326203ff andi r2,r19,0x03ff # tpage x |
000239f8: 08008e8c j 0x00023a30 | 000239f8: 08008e8c j 0x00023a30 | ||
− | 000239fc: 00021183 sra r2,r2,0x06 # rightValue = ( | + | 000239fc: 00021183 sra r2,r2,0x06 # rightValue = (tpage x) >> 6 // absolute x value << 0 |
# } else { | # } else { | ||
− | 00023a00: 000319c0 sll r3,r3,0x07 # | + | 00023a00: 000319c0 sll r3,r3,0x07 # texture mode << 7 |
− | 00023a04: 32420003 andi r2,r18,0x0003 # | + | 00023a04: 32420003 andi r2,r18,0x0003 # semi transparency |
− | 00023a08: 00021140 sll r2,r2,0x05 # | + | 00023a08: 00021140 sll r2,r2,0x05 # ABE mode << 5 |
− | 00023a0c: 00621825 or r3,r3,r2 # ( | + | 00023a0c: 00621825 or r3,r3,r2 # (Tmode << 7) | (ABEMode << 5) |
− | 00023a10: 32220100 andi r2,r17,0x0100 # | + | 00023a10: 32220100 andi r2,r17,0x0100 # tpage y & 0x100 // limited to a very small VRAM size here. |
− | 00023a14: 00021103 sra r2,r2,0x04 # | + | 00023a14: 00021103 sra r2,r2,0x04 # tpage y >> 4 // absy << 4 |
− | 00023a18: 00621825 or r3,r3,r2 # ( | + | 00023a18: 00621825 or r3,r3,r2 # (tmode << 7) | (ABEmode << 5) | (absy << 4) |
− | 00023a1c: 326203ff andi r2,r19,0x03ff # | + | 00023a1c: 326203ff andi r2,r19,0x03ff # tpage x |
− | 00023a20: 00021183 sra r2,r2,0x06 # | + | 00023a20: 00021183 sra r2,r2,0x06 # tpage x >> 6 // absx << 0 |
− | 00023a24: 00621825 or r3,r3,r2 # leftValue = ( | + | 00023a24: 00621825 or r3,r3,r2 # leftValue = (tmode << 7) | (ABEmode << 5) | (absy << 4) | (absx) |
− | 00023a28: 32220200 andi r2,r17,0x0200 # | + | 00023a28: 32220200 andi r2,r17,0x0200 # tpage y & 0x200 |
− | 00023a2c: 00021080 sll r2,r2,0x02 # rightValue = | + | 00023a2c: 00021080 sll r2,r2,0x02 # rightValue = tpage y << 2 |
# } | # } | ||
− | 00023a30: 00621025 or r2,r3,r2 # RETURN | + | 00023a30: 00621025 or r2,r3,r2 # RETURN halfword (Tpage ID) |
00023a34: 8fbf0020 lw r31,0x0020(r29) | 00023a34: 8fbf0020 lw r31,0x0020(r29) | ||
00023a38: 8fb3001c lw r19,0x001c(r29) | 00023a38: 8fb3001c lw r19,0x001c(r29) |
Revision as of 09:39, 14 June 2023
# ROUTINE: P00 GetTpage # Parameters: # r4 = VRAM Texture mode # 0x00: 4 bit compressed # 0x01: 8 bit compressed # 0x02: 16 bit (uncompressed) # r5 = Semi Transparency rate # 0x00: 0.5 back + 0x5 forward # 0x01: 1 back + 1 forward # 0x02: 1 back - 1 forward # 0x03: 1 back + 0.25 forward # r6 = texture page address (x) (must be multiple of 0x040) # r7 = texture page address (y) (must be multiple of 0x100) # Returns: # r2 = Tpage ID # if (([? Accessor Result] = 1) or ([? Accessor Result] = 2)) # 0x000f: x pos of tpage # 0x0060: y pos of tpage # 0x0180: semi transparency mode # 0x0600: texture mode # else # 0x000f: x pos of tpage # 0x0010: y pos of tpage (mod 2) # 0x0060: semi transparency mode # 0x0180: texture mode # 0x0800: y pos of tpage (div 2)
0002398c: 27bdffd8 addiu r29,r29,-0x0028 00023990: afb00010 sw r16,0x0010(r29) 00023994: 00808021 addu r16,r4,r0 00023998: afb20018 sw r18,0x0018(r29) 0002399c: 00a09021 addu r18,r5,r0 000239a0: afb3001c sw r19,0x001c(r29) 000239a4: 00c09821 addu r19,r6,r0 000239a8: afb10014 sw r17,0x0014(r29) 000239ac: afbf0020 sw r31,0x0020(r29) 000239b0: 0c00916f jal 0x000245bc # ROUTINE: ? Accessor (0x245bc) 000239b4: 00e08821 addu r17,r7,r0 000239b8: 34030001 ori r3,r0,0x0001 000239bc: 10430006 beq r2,r3,0x000239d8 000239c0: 32030003 andi r3,r16,0x0003 # Texture mode mod 4 # if (([? Accessor Result] != 1) 000239c4: 0c00916f jal 0x000245bc # ROUTINE: ? Accessor (0x245bc) (Call #2) 000239c8: 00000000 nop 000239cc: 34030002 ori r3,r0,0x0002 000239d0: 1443000b bne r2,r3,0x00023a00 # AND ([? Accessor Result (#2)] == 2)) 000239d4: 32030003 andi r3,r16,0x0003 # (texture mode) # { 000239d8: 00031a40 sll r3,r3,0x09 # texture mode << 9 000239dc: 32420003 andi r2,r18,0x0003 # semi transparency 000239e0: 000211c0 sll r2,r2,0x07 # semi transparency << 7 000239e4: 00621825 or r3,r3,r2 # (texture mode << 9) | (semi transparency << 7) 000239e8: 32220300 andi r2,r17,0x0300 # tpage y & 0x0300 // for a multiple of 0x100, this limits it to 3 values 000239ec: 000210c3 sra r2,r2,0x03 # tpage y >> 3 // absolute y value << 5 000239f0: 00621825 or r3,r3,r2 # leftValue = (tmode << 9) | (ABEMode << 7)) | (AbsY << 5) 000239f4: 326203ff andi r2,r19,0x03ff # tpage x 000239f8: 08008e8c j 0x00023a30 000239fc: 00021183 sra r2,r2,0x06 # rightValue = (tpage x) >> 6 // absolute x value << 0 # } else { 00023a00: 000319c0 sll r3,r3,0x07 # texture mode << 7 00023a04: 32420003 andi r2,r18,0x0003 # semi transparency 00023a08: 00021140 sll r2,r2,0x05 # ABE mode << 5 00023a0c: 00621825 or r3,r3,r2 # (Tmode << 7) | (ABEMode << 5) 00023a10: 32220100 andi r2,r17,0x0100 # tpage y & 0x100 // limited to a very small VRAM size here. 00023a14: 00021103 sra r2,r2,0x04 # tpage y >> 4 // absy << 4 00023a18: 00621825 or r3,r3,r2 # (tmode << 7) | (ABEmode << 5) | (absy << 4) 00023a1c: 326203ff andi r2,r19,0x03ff # tpage x 00023a20: 00021183 sra r2,r2,0x06 # tpage x >> 6 // absx << 0 00023a24: 00621825 or r3,r3,r2 # leftValue = (tmode << 7) | (ABEmode << 5) | (absy << 4) | (absx) 00023a28: 32220200 andi r2,r17,0x0200 # tpage y & 0x200 00023a2c: 00021080 sll r2,r2,0x02 # rightValue = tpage y << 2 # } 00023a30: 00621025 or r2,r3,r2 # RETURN halfword (Tpage ID) 00023a34: 8fbf0020 lw r31,0x0020(r29) 00023a38: 8fb3001c lw r19,0x001c(r29) 00023a3c: 8fb20018 lw r18,0x0018(r29) 00023a40: 8fb10014 lw r17,0x0014(r29) 00023a44: 8fb00010 lw r16,0x0010(r29) 00023a48: 27bd0028 addiu r29,r29,0x0028 00023a4c: 03e00008 jr r31 00023a50: 00000000 nop