C2 ASM Branch and Write without "load into address"

Started by Deathwolf, December 18, 2010, 07:57:18 PM

Previous topic - Next topic

Deathwolf

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




lolz

wiiztec

#1
Use a C6 then a C2

C6389400 80389404

I think that's how you use C6 though it might be C6389400 00000004
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

Deathwolf

oh C6  :eek:

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

btw thanks for your answer
lolz

wiiztec

#3
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
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

Deathwolf

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.
lolz

wiiztec

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

Deathwolf

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?
lolz

wiiztec

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

Deathwolf

ok but then there is another problem.
what about the value at 80389404? this instruction should be a cmpwi.

lolz

wiiztec

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

Deathwolf

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"....



lolz

wiiztec

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

Deathwolf

I just want to learn to combinate C2 with branches.
lolz