Using 06 Codetype in ASM

Started by live2play, June 08, 2010, 02:05:22 AM

Previous topic - Next topic

live2play

I have an address saved to Gecko Register 0 and I need to use that address as the one used in a 06 code (e.g. 06<GR0_Address>).  How do I do this?

I guess that an alternative would be to write the 480 bytes (0x1E0) of data that I want the 06 code type to write starting at the address stored in Gecko Register 0 to an area of memory controlled by Gecko and then write the assembly to lwz/stw the data from the Gecko controlled memory to addresses starting with the one in Gecko Register 0.  I hope I don't have to do it this way.  :-\

paprika_killer

since an 06 writes at ba+adress, use this:

42001 : ba = grN+XXXXXXXX

so you get
42001000 00000000 (ba = gr0)
06000000 0000NNNN (write at ba)
....

[SIGPIC][/SIGPIC]

wiiztec

since the base address isn't flexible enough for that purpose you'll probably want to do this

48001 : po = [grN+XXXXXXXX]

48001000 00000000
16000000 0000NNNN
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

paprika_killer

Why is the ba not flexible enough for that?
[SIGPIC][/SIGPIC]

wiiztec

Because it can only be 80000000, 90000000, or 92000000
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

paprika_killer

where did you get that from?
as far as I know the ba can be everything, with increments of 0x4

EDIT:
why would we otherwise have all this:

CST0 : Load into Base Address

40TYZ00N XXXXXXXX :
40000 : ba = [XXXXXXXX
]40010 : ba = [ba+XXXXXXXX]
50010 : ba = [po+XXXXXXXX]
40001 : ba = [grN+XXXXXXXX]
40011 : ba = [ba+grN+XXXXXXXX]
50011 : ba = [po+grN+XXXXXXXX]
40100 : ba += [XXXXXXXX]
40110 : ba += [ba+XXXXXXXX]
50110 : ba += [po+XXXXXXXX]
40101 : ba += [grN+XXXXXXXX]
40111 : ba += [ba+grN+XXXXXXXX]
50111 : ba += [po+grN+XXXXXXXX]

CST1 : Set Base Address to

42TYZ00N XXXXXXXX
42000 : ba = XXXXXXXX
42010 : ba = ba+XXXXXXXX
52010 : ba = po+XXXXXXXX
42001 : ba = grN+XXXXXXXX
42011 : ba = ba+grN+XXXXXXXX
52011 : ba = po+grN+XXXXXXXX
42100 : ba += XXXXXXXX
42110 : ba += ba+XXXXXXXX
52110 : ba += po+XXXXXXXX
42101 : ba += grN+XXXXXXXX
42111 : ba += ba+grN+XXXXXXXX
52111 : ba += po+grN+XXXXXXXX

CST2 : Save Base Address to

440YZ00N XXXXXXXX
44000 : [XXXXXXXX]=ba
44010 : [XXXXXXXX+ba]=ba
54010 : [XXXXXXXX+po]=ba
44001 : [XXXXXXXX+grN]=ba
44011 : [XXXXXXXX+ba+grN]=ba
54011 : [XXXXXXXX+po+grN]=ba
[SIGPIC][/SIGPIC]

wiiztec

No idea all of those except 42 are basically useless, but I know you can't set the base address to 81000000 even though it's an increment of 0x4
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

live2play

So, if the address in GR0 is 91xxxxxx, what would the code look like to use it in a 06/07 code type?

paprika_killer

The same.

and wiiztec, where did you get that from, that's what I was asking.
[SIGPIC][/SIGPIC]

dcx2

Quote from: paprika_killer on June 08, 2010, 05:52:33 PM
and wiiztec, where did you get that from, that's what I was asking.

From the Code Types doc:

Quoteba : Base Address. Set at 0x80000000 each time the code handler is executed. Each time the ba is added to a code address, the code handler do : address = address + (ba & 0xFE000000). You can modify it, however if you do, don't forget to reset it to its original value after.

What this means is that any time the ba is used, the code handler only looks at the most significant 7 bits.  The other 25 bits are masked off, or ignored.

dcx2

Quote from: live2play on June 08, 2010, 02:05:22 AM
I have an address saved to Gecko Register 0 and I need to use that address as the one used in a 06 code (e.g. 06<GR0_Address>).  How do I do this?

I think you actually want the 4A code type.

4A00100N 00000000    # get value in grN and put it directly into the po
16000000 0000MMMM  # string write MMMM bytes using po
ZZZZZZZZ ZZZZZZZZ  # values to write...
ZZZZZZZZ ZZZZZZZZ
...

Be careful if you're using ASM with Gecko Registers.  In one of the versions of Gecko OS, the registers moved by 4 bytes.  When in doubt, you can use a C0 ASM code; I believe the Gecko Register pointer is stored in...r6?

paprika_killer

Quote from: dcx2 on June 08, 2010, 06:03:59 PM
Quote from: paprika_killer on June 08, 2010, 05:52:33 PM
and wiiztec, where did you get that from, that's what I was asking.

From the Code Types doc:

Quoteba : Base Address. Set at 0x80000000 each time the code handler is executed. Each time the ba is added to a code address, the code handler do : address = address + (ba & 0xFE000000). You can modify it, however if you do, don't forget to reset it to its original value after.

What this means is that any time the ba is used, the code handler only looks at the most significant 7 bits.  The other 25 bits are masked off, or ignored.

ah, like that.
what's the point in doing that though?
[SIGPIC][/SIGPIC]

Deathwolf

#12
Quote from: dcx2 on June 08, 2010, 06:11:48 PM
Quote from: live2play on June 08, 2010, 02:05:22 AM
I have an address saved to Gecko Register 0 and I need to use that address as the one used in a 06 code (e.g. 06<GR0_Address>).  How do I do this?

I think you actually want the 4A code type.

4A00100N 00000000    # get value in grN and put it directly into the po
16000000 0000MMMM  # string write MMMM bytes using po
ZZZZZZZZ ZZZZZZZZ  # values to write...
ZZZZZZZZ ZZZZZZZZ
...

Be careful if you're using ASM with Gecko Registers.  In one of the versions of Gecko OS, the registers moved by 4 bytes.  When in doubt, you can use a C0 ASM code; I believe the Gecko Register pointer is stored in...r6?

What do you mean with this? How should this work??
Example I want to write 3F800000 3F800000 3F800000 as string to an address with C2/C0.
Please give me an example.

thanks


EDIT: something like this?

C0000000 00000002
3D808012 618C8234
4A001000 00000000
16000000 00000010
12345678 12345678
12345678 12345678
4E800020 00000000

but no, I don't think so. 4A001000 <-- b 0x1000... what's wrong?
lolz