WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: Deathwolf on December 18, 2010, 07:57:18 PM

Title: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 07:57:18 PM
is there a way to branch to another addess without loading into a new address?

example:

hook address:
80389400

should branch to 80389404
so I want to overwrite the instruction at 80389400 and then overwrite the instruction at 80389404.

80389400 to stw
branch
80389404 to cmpwi

but how should I branch this? no 2xC2 codes. all in one would be great.
and there even shouldn't a lis and ori to fill out.


thanks a lot




Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 08:33:15 PM
Use a C6 then a C2

C6389400 80389404

I think that's how you use C6 though it might be C6389400 00000004
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 08:36:08 PM
oh C6  :eek:

can you give me please a example?
this would be great.

btw thanks for your answer
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 08:36:45 PM
Create a branch
C6______ YYYYYYYY

Writes, at ______+ba, a "b YYYYYYYY" instruction.


To use po instead of ba, change the codetype from C6 to D6.
For values of ______ >= 0x01000000, add one to the codetype.

or you could just nop the instruction at 80389400 and make a C2 code for 80389404
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 08:38:26 PM
ok thanks.

so

first the C2 code and then the  C6389400 80389404 ?
but the C6 code doesn't know how many lines I want to write.
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 08:39:43 PM
C6 only writes 1 line
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 08:43:25 PM
yeah that's right. write a nop instruction at 80389400 is also another way, but I was asking about a full C2 code (only one C2, all in one)


so is C6 only for branching? can I write ONE value with it?
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 08:45:55 PM
Yes it's only for branching
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 08:49:04 PM
ok but then there is another problem.
what about the value at 80389404? this instruction should be a cmpwi.

Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 08:51:26 PM
Use a 04 or C2 code for that
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 08:59:45 PM
if I can use 04, then why I need the C6 code?

04389400 XXXXXXXX
04389404 XXXXXXXX

and it's done... but the question was:

combinate C2389400 and C2389404 to ONE C2 code.

stw <--- first C2
lis r12,0x8038 <-- second C2
ori r12,r12,0x9404
lis r14,0xXXXX
ori r14,r14,0xXXXX
stw r14,0(r12)

again done. 2xC2 to 1xC2

but it's again with "loading into address"....



Title: Re: C2 ASM Branch and Write without "load into address"
Post by: wiiztec on December 18, 2010, 09:08:00 PM
Why does it have to be 1 C2 code?
Title: Re: C2 ASM Branch and Write without "load into address"
Post by: Deathwolf on December 18, 2010, 09:12:28 PM
I just want to learn to combinate C2 with branches.