WiiRd forum

Wii & Gamecube Hacking => WiiRD Remote Debugger => Topic started by: Almas on January 03, 2009, 02:27:59 AM

Title: Writing a Gecko Register to an Address
Post by: Almas on January 03, 2009, 02:27:59 AM
I'm going to look like a fool for asking this, I fear.

I have a code that stores one of two values into a gecko register pending an If codetype. However, I am having issues writing this value to another place. The CT4/CST2 (Gecko Register Functions / Save Register To) codes write to [XXXXXXXX], but I can find no codes which do the equivalent to XXXXXXXX, which would make life a lot easier. I suppose it is possible for me to use a second register to permanently store the place where I'd like to write to, but I was wondering if there was a more efficient means to write to this point.

Thanks for your help.


EDIT: There was a mistake elsewhere in my code, it seems, and I managed to patch it up. It turns out the codetypes DO write to XXXXXXXX. Does this mean that the codetype document is incorrect, or did I make an error reading it? Sorry for the fuss.
Title: Re: Writing a Gecko Register to an Address
Post by: hetoan2 on January 03, 2009, 05:18:40 PM
you could always set the value to 0 and have your gecko Register be added to the value, which is basically moving it :|
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 03, 2009, 05:51:29 PM
what are you trying to do?

because there is an option to store XXXXXXXX to gR
Title: Re: Writing a Gecko Register to an Address
Post by: hetoan2 on January 03, 2009, 06:13:21 PM
no he want's gR to XXXXXXXX
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 03, 2009, 06:22:02 PM
gR to [XXXXXXXX] or to XXXXXXXX? because you can't store anything to a value xwink

use this:
84UYZZZN XXXXXXXX:
8400 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX]
8401 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9401 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX+po]
8410 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX]
8411 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9411 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX+po]
8420 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]
8421 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9421 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX+po]

I think you should use 8420

Doesnt anybody read the codetypes? >_>
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 03, 2009, 07:54:22 PM
eehh... yeah, sorry. but why put an 04 in front?
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 03, 2009, 08:49:58 PM
but still, people shoud look at the codetypes before asking.
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 04, 2009, 06:40:52 PM
My initial concern was that there was no simple way to write grN to XXXXXXXX - thanks paprika for resolving this for me. However, I later discovered that the gecko register codetypes which SAY they write to [XXXXXXXX] ACTUALLY write to XXXXXXXX. Which is different, I thought.
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 04, 2009, 06:58:22 PM
[XXXXXXXX] is a address and XXXXXXXX is a value
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 04, 2009, 08:36:24 PM
QuoteSo [XXXXXXXX] means "the data stored at XXXXXXXX".

Does this not imply that:
Quote8420 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]
means:

Write grN ZZZ times+1 at the address stored at XXXXXXXX

?
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 04, 2009, 08:51:35 PM
Quote from: Almas on January 04, 2009, 08:36:24 PM
QuoteSo [XXXXXXXX] means "the data stored at XXXXXXXX".

Does this not imply that:
Quote8420 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]
means:

Write grN ZZZ times+1 at the address stored at XXXXXXXX

?
no
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 04, 2009, 09:06:50 PM
Well then, my point is that the codetype doesn't do that. It writes the Gecko Register to the address XXXXXXXX, rather than the value stored at the address XXXXXXXX, as the codetype document would suggest (and you have just agreed with me upon).
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 04, 2009, 09:40:52 PM
yeah, I'm sorry. it does write to the address, I didn't read it properly. my bad
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 04, 2009, 10:37:46 PM
84200000 80123456

that code will write the value at gR0 to 80123456
so if gR0 is 11111111, 80123456 will become 11111111
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 05, 2009, 10:34:23 PM
No, it doesn't. Which is what my editted point was - the description of it in the codetype document is incorrect, I believe.
Title: Re: Writing a Gecko Register to an Address
Post by: Link on January 06, 2009, 09:06:59 AM
Quote from: Almas on January 04, 2009, 08:36:24 PM
QuoteSo [XXXXXXXX] means "the data stored at XXXXXXXX".

Does this not imply that:
Quote8420 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]
means:

Write grN ZZZ times+1 at the address stored at XXXXXXXX

?

8420ZZZN XXXXXXXX : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]

--> so if you want to write the value of gr0 to 80102030
--> 84200000 80102030

the ZZZ would write it multiple times:
84200020 80102030 --> writes 80102030, 80102034, 80102038 - ZZZ+1 = 002+1 = 3 times!
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 06, 2009, 04:47:58 PM
I know what this code does, however, I am arguing that in the codetypes document it should be described as:

Quote8420 : writes the 32bits in grN ZZZ times+1 at XXXXXXXX

Because we are talking about storing it at the location XXXXXXX, not storing it at the address specified by the location XXXXXXXX.
Title: Re: Writing a Gecko Register to an Address
Post by: Romaap on January 06, 2009, 04:56:43 PM
you can't store a value at a value (http://i108.photobucket.com/albums/n31/Romaap/e49b77fb.jpg)
Title: Re: Writing a Gecko Register to an Address
Post by: Almas on January 06, 2009, 06:14:30 PM
Eh, I guess I just interpret it in a different way to you, I can kinda understand where you're coming from. Either way my problem has been resolved. Thanks for the help.

That said I've started working on a couple of codes which require ASM, which I see giving me even more grief. Twice the freeze glitches, half the comprehension =).