Hi everyone
I'm decompiling a PS2 game by reading MIPS assembly and converting it to C, and would like some help with understanding some peculiar patterns I'm coming across. Most of it seems to be related to global variables.
For example:
This puts the address of the global variable actwk in register v1, but I can't understand how! Why is it taking the upper part of offset 256, base actwk? Then it adds the lower part of offset 13696, base actwk. What's puzzling is that 13696 is the memory address of said global variable. It doesn't make any sense!
Something similar seems to be happening here to make a function call:
Can anyone help me? The PS2 homebrew seems to be mostly dead.
I'm decompiling a PS2 game by reading MIPS assembly and converting it to C, and would like some help with understanding some peculiar patterns I'm coming across. Most of it seems to be related to global variables.
For example:
Code:
lui v1,hi(actwk+256)
addiu v1,v1,lo(actwk+13696)
Something similar seems to be happening here to make a function call:
Code:
lui v0,hi(sMemSet+256) ; v0 = hi(sMemSet+256)
lw v0,lo(sMemSet)(v0) ; v0 = lo(sMemSet+v0)
jalr ra,v0