Gecko Register Addresses in ASM

Started by live2play, May 14, 2010, 07:01:01 PM

Previous topic - Next topic

live2play

Given that Gecko Register 0 is at 0x80001804, am I correct in assuming that I can use that memory location for storing/retrieving temporary values in my ASM code?

dcx2

At some rev, Gecko OS moved the Gecko Registers up 4 bytes.  Register 0 might actually be 80001808.

Make a code that writes into GR0 and turn it on.  Then set a Write breakpoint on 80001804.  If that doesn't hit, try 80001808.  That will help you find GR0.

If you're using pure ASM, this is no big deal.  There are 16 GR's, so pick something in the middle-ish and you don't have to worry too much (unless you're coordinating an ASM code with non-ASM codes, in which case it would be tied to the version).  I usually use GR5-8 in my own codes; it's away from the edge cases, and most people probably use GR0 or GR1 in their codes.

To actually answer your question, yes, you can store/retrieve temporary values.  I wrote an unreleased rough hack for Resident Evil that made the crosshair change colors continuously.  I was modifying a value stored in a GR, and then I hooked the crosshair color routine and read my GR's value.

I also wrote another code for an RPG (Tales of Symphonia...amazing game, absolutely recommend it) that involved allowing the user to specify some setting, but the setting was not immediately reflected and I didn't want the user flying blind.  When the game was paused, I stored the main character's MP to a GR and over-wrote the MP with a value that the user could use to specify some setting, and then when the user was done I restored the MP value.  Almost like pushing/popping on the stack.

live2play

Great advice and code example.  Thanks!  I was able to use a Gecko Register to accomplish what I needed.