P00 GetTpage

From Final Fantasy Hacktics Wiki
(Redirected from ? Calculation (0x2398c))
Jump to navigation Jump to search
#   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

Return Atlas

Requests Frame.bin (Tpage 0x1f, x = 0x3c0, y = 0x100)
0x001170f8: 001170b4 - 00117128 (0, 2, 0x3c0, 0x100)
0x00117114: 001170b4 - 00117128 (0, 1, 0x3c0, 0x100)
0x001c79b8: 001c7944 - 001c7a04 (0, 2, 0x3c0, 0x100)
0x001c767c: 001c755c - 001c771c (0, 2, 0x3c0, 0x100)
0x001c769c: 001c755c - 001c771c (0, 1, 0x3c0, 0x100)
0x0012e43c: 0012e348 - 0012e598 (0, 2, 0x3c0, 0x100)
0x0012e518: 0012e348 - 0012e598 (0, 0, 0x3c0, 0x100)
0x000e263c: 000e2548 - 000e2798 (0, 2, 0x3c0, 0x100)
0x000e2718: 000e2548 - 000e2798 (0, 0, 0x3c0, 0x100)
0x001181ec: 0011814c - 00118228 (0, 2, 0x3c0, 0x100)
0x000ef6fc: 000ef680 - 000ef784 (0, 1, 0x3c0, 0x100)
0x0013bae4: 0013ba68 - 0013bb6c (0, 1, 0x3c0, 0x100)
0x0012f2b4: 0012f10c - 0012f35c (0, 0, 0x3c0, 0x100)
0x0012f2e8: 0012f10c - 0012f35c (0, 2, 0x3c0, 0x100)
0x000e3500: 000e3358 - 000e35a8 (0, 0, 0x3c0, 0x100)
0x000e3534: 000e3358 - 000e35a8 (0, 2, 0x3c0, 0x100)
0x000e902c: 000e8fb8 - 000e90e0 (0, 2, 0x3c0, 0x100)
0x001349b4: 00134940 - 00134a68 (0, 2, 0x3c0, 0x100)
0x00118108: 00117ffc - 00118148 (0, 2, 0x3c0, 0x100)
0x001c3340: 001c32cc - 001c3458 (0, 0, 0x3c0, 0x100)
0x001c35a8: DEBUGCHR.OUT/001c3534 - 001c36c0 (0, 0, 0x3c0, 0x100)
0x001c29c0: 001c2940 - 001c2ad8 (0, 0, 0x3c0, 0x100)
0x000ef344: 000ef2fc - 000ef4ac (0, 2, 0x3c0, 0x100)
0x00138380: 00138174 - 001383c4 (0, 2, 0x3c0, 0x100)
0x000ef0b8: 000eeecc - 000ef69c (0, 3, 0x3c0, 0x100)
0x001c69b8: 001c67cc - 001c7284 (0, 1, 0x3c0, 0x100)
0x000ec3a4: 000ec108 - 000ec3e8 (0, 2, 0x3c0, 0x100)
0x0010b908: 0010b7e8 - 0010bdf4 (0, 0, 0x3c0, 0x100)
0x0010b968: 0010b7e8 - 0010bdf4 (0, 2, 0x3c0, 0x100)
0x0006b7d0: 0006b78c - 0006bad0 (0, 0, 0x3c0, 0x100)
0x0010bf04: 0010bdf8 - 0010c484 (0, 0, 0x3c0, 0x100)
0x0010bf64: 0010bdf8 - 0010c484 (0, 2, 0x3c0, 0x100)
 
Requests current event portrait (8) (Tpage = 0x1e, x = 0x380, y = 0x100)
0x00136c4c: 00136bd0 - 00136d30 (0, 0, 0x380, 0x100)

Requests Item.bin (Tpage = 0x1e, x = 0x380, y = 0x120)
0x00136c94: 00136bd0 - 00136d30 (0, 0, 0x380, 0x120)
0x001128c8: 00112878 - 001128dc (0, 0, 0x380, 0x120)
0x001c3be8: 001c3b98 - 001c3bfc (0, 0, 0x380, 0x120)
0x001c2294: 001c2244 - 001c22a8 (0, 0, 0x380, 0x120)
0x001c1f08: 001c1eb8 - 001c1f1c (0, 0, 0x380, 0x120)
0x001c23f4: DEBUGCHR.OUT/001c23a4 - 001cd408 (0, 0, 0x380, 0x120)
0x0014a774: 0014a6e4 - 0014a7a4 (0, 0, 0x380, 0x120)
0x000fdc30: 000fdba0 - 000fdc60 (0, 0, 0x380, 0x120)
0x001344c4: 00134430 - 001346f0 (0, 0, 0x380, 0x120)
0x000e8b3c: 000e8aa8 - 000e8d68 (0, 0, 0x380, 0x120)

Requests current event portraits (0-7) (Tpage = 0x1d, x = 0x340, y = 0x100)
0x00136cb8: 00136bd0 - 00136d30 (0, 0, 0x340, 0x100)

Requests wldfce.bin (3) (Tpage 0x1d, x = 0x340, y = 0x100)
0x0012e530: 0012e348 - 0012e598 (0, 0, 0x340, 0x100) (could request current event portaits... unsure condition for trigger)
0x000e2730: 000e2548 - 000e2798 (0, 0, 0x340, 0x100) (seems to be related to the shopkeep.)

Requests Unit.bin (2) (Tpage 0x5, x = 0x140, y=0x000)
0x001c7998: 001c7944 - 001c7a04 (0, 0, 0x140, 0x000)

Requests Unit.bin (1) (Tpage 0x4, x = 0x100, y = 0x000)
0x00127b60: 00127b3c - 00127ba0 (0, var, 0x100, 0x000)
0x0012d540: 0012d4c0 - 0012d5b8 (0, 2, 0x100, 0x000)
0x001c8ca0: 001c8c08 - 001c8cec (0, 0, 0x100, 0x000)
0x0012d650: 0012d5bc - 0012d6c8 (0, 2, 0x100, 0x000)
0x001c535c: 001c52c4 - 001c53a8 (0, 0, 0x100, 0x000)
0x001c63e4: 001c62e0 - 001c6518 (0, 1, 0x100, 0x000)
0x001c68f8: 001c67cc - 001c7284 (0, 1, 0x100, 0x000)
0x001c6934: 001c67cc - 001c7284 (0, 1, 0x100, 0x000)
0x001c6960: 001c67cc - 001c7284 (0, 1, 0x100, 0x000)
0x001c698c: 001c67cc - 001c7284 (0, 1, 0x100, 0x000)

Requests Constructed Text/Menu box (2) (Tpage 0x7, x = 0x1c0, y = 0x000)
0x000e2424: 000e2390 - 000e2440 (0, 0, 0x1c0, 0x000)
0x0012e224: 0012e190 - 0012e240 (0, 0, 0x1c0, 0x000)
0x0012ebe8: 0012e9fc - 0012ec8c (0, 0, 0x1c0, 0x000)
0x000e2e34: 000e2c48 - 000e2ed8 (0, 0, 0x1c0, 0x000)
0x0008d5f4: 0008d514 - 0008d7fc (0, 0, 0x1c0, 0x000)
0x0012e928: 0012e65c - 0012e9bc (0, 0, 0x1c0, 0x000)

Requests screen (top) (Tpage 0x0, x = 0x000, y = 0x000)
0x0012e7e8: 0012e7a0 - 0012ea40 (0, 1, 0x000, 0x000)

Requests screencap of worldmap (Tpage 0x4, x = 0x100, y = 0x000)
0x0008057c: 0008047c - 00080754 (2, 0, 0x100, 0x000)

Requests Orbonne Monastery Text (Tpage 0x1e, x = 0x380, y = 0x100)
0x000432e8: 0004315c - 000434d8 (0, 0, 0x380, 0x100)

Request ambiguous (tpage unknown)
0x00127afc: 00127ad0 - 00127b20 (var, var, var, var)
0x000fdca4: 000fdc64 - 000fdcd4 (0, 0, var, var)
0x0014a7e8: 0014a7a8 - 0014a818 (0, 0, var, var)
0x00022cec: E00 LoadTpage (var, var, var, var)
0x0014a910: Image loading setup? (0x14a834) (0, 0, var, var)
0x0008fa4c: 0008f9bc - 0008fad4 (0, 0, var, var)
0x000eab34: 000eaa50 - 000eabc8 (0, 0, var, 0x100)            // likely requests wldface portraits
0x000fddcc: 000fdce8 - 000fdf34 (0, 0, var, var)
0x0014a910: 0014a82c - 0014aa78 (0, 0, var, var)
0x001c2eac: 001c2dcc - 001c300c (0, 0, var, var)
0x001c24f8: 001c2418 - 001c2658 (0, 0, var, var)
0x001c3114: DEBUGCHR.OUT/001c3034 - 001c3274 (0, 0, var, var)
0x001c35c8: 001c345c - 001c3728 (1, 0, var, var)              // from require.out (game over?)
0x001c3830: DEBUGCHR.OUT/001c36c4 - 001c3990 (1, 0, var, var) // also only 8 bit compressed.
0x00044d0c: 00044ba0 - 00044e7c (1, 0, var, var)              // from scus_942.21 (zodiac.bin?)
0x001c2c48: 001c2adc - 001c2db8 (1, 0, var, var)              // from attack.out (yeah I got nothing.)
0x0006a6b8: 0006a58c - 0006a884 (1, 0, var, var)              // from world.bin (world map?)
0x0006b168: 0006aed0 - 0006b268 (0, var, var, var)