00026e7c - 00026f54

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Determines GPU environment?

00026e7c: 3c031000 lui r3,0x1000
00026e80: 3c028003 lui r2,0x8003
00026e84: 8c422968 lw r2,0x2968(r2)                  // GP1
00026e88: 34630007 ori r3,r3,0x0007
00026e8c: ac430000 sw r3,0x0000(r2)                  // sends getinfo to gp1, 0x7 "read gpu type" 
00026e90: 3c058003 lui r5,0x8003
00026e94: 8ca52964 lw r5,0x2964(r5)                  // GP0
00026e98: 3c0300ff lui r3,0x00ff
00026e9c: 8ca20000 lw r2,0x0000(r5)                  // Read result of get GPU type
00026ea0: 3463ffff ori r3,r3,0xffff
00026ea4: 00431024 and r2,r2,r3
00026ea8: 34030002 ori r3,r0,0x0002
00026eac: 1043001d beq r2,r3,0x00026f24              // branch if gpu type is 2... only valid for 208 pin gpus, returns N/A for 160 pin. also returns 2 if using emulator.
00026eb0: 3c03e100 lui r3,0xe100                     // 
00026eb4: 3c028003 lui r2,0x8003
00026eb8: 8c422968 lw r2,0x2968(r2)                  // GPUSTAT
00026ebc: 00000000 nop
00026ec0: 8c420000 lw r2,0x0000(r2)                  // read GPUSTAT
00026ec4: 34631000 ori r3,r3,0x1000                  // 0xe1001000
00026ec8: 30423fff andi r2,r2,0x3fff                 // get lower values of current gpu status (bits 0 -> D)
00026ecc: 00431025 or r2,r2,r3                       // 
00026ed0: aca20000 sw r2,0x0000(r5)                  // store back as if instruction? (immediately sets drawmode to current GPU drawing status?)
00026ed4: 3c028003 lui r2,0x8003
00026ed8: 8c422964 lw r2,0x2964(r2)
00026edc: 3c038003 lui r3,0x8003
00026ee0: 8c632968 lw r3,0x2968(r3)             // read returns GPU status
00026ee4: 8c420000 lw r2,0x0000(r2)             // ? does this just serve to mark the register as read?
00026ee8: 8c620000 lw r2,0x0000(r3)
00026eec: 00000000 nop
00026ef0: 30421000 andi r2,r2,0x1000            // check gpu ready to receive DMA block
00026ef4: 14400003 bne r2,r0,0x00026f04         // branch if so
00026ef8: 30820008 andi r2,r4,0x0008            // 
00026efc: 08009bd4 j 0x00026f50                 // return gpu env = 0
00026f00: 00001021 addu r2,r0,r0
00026f04: 14400003 bne r2,r0,0x00026f14         //
00026f08: 3c022000 lui r2,0x2000
00026f0c: 08009bd4 j 0x00026f50                 // return gpu env = 1
00026f10: 34020001 ori r2,r0,0x0001
00026f14: 34420504 ori r2,r2,0x0504
00026f18: ac620000 sw r2,0x0000(r3)             // prototype disable texture instruction, argument 0x504 means... disable textures.
00026f1c: 08009bd4 j 0x00026f50                 // return gpu env = 2
00026f20: 34020002 ori r2,r0,0x0002
00026f24: 30820008 andi r2,r4,0x0008
00026f28: 10400008 beq r2,r0,0x00026f4c         // all calls to this routine mean below code isn't executed. return GPU environment = 3
00026f2c: 3c040900 lui r4,0x0900
00026f30: 34840001 ori r4,r4,0x0001             // otherwise, calls the second texture disable function with argument "disable textures" fun.
00026f34: 3c038003 lui r3,0x8003
00026f38: 8c632968 lw r3,0x2968(r3)
00026f3c: 34020004 ori r2,r0,0x0004
00026f40: ac640000 sw r4,0x0000(r3)
00026f44: 08009bd4 j 0x00026f50                 // return gpu env = 4
00026f48: 00000000 nop
00026f4c: 34020003 ori r2,r0,0x0003             // this seems to be the value fft uses?
00026f50: 03e00008 jr r31
00026f54: 00000000 nop