Copy and Paste into ASM C2

Started by Deathwolf, December 24, 2010, 03:15:52 PM

Previous topic - Next topic

Deathwolf

normally you use lis and ori to write a value and a stw instruction to store it but is there another way to copie a value from another address via a instruction and paste it into the RAM?

I know you can change the lwz/stw registers but what about loading from other addresses?

thanks for any help and answer...
lolz

James0x57

lwz reads from RAM and stw will write to RAM:


lwz r18,0x04(r5) # Take the value at the address r5 + 0x04 and put it in r18  [copy]

stw r18,0x2C(r5) # The value in r18, write it to the address r5 + 0x2C  [paste]


Deathwolf

#2
ok thanks alot.
I've done this now by smg2

lwz r4,1712(r30) + 0056 = lwz r4,1768(r30) and it works ^^ thanks alot!

but how should I write this now in C2?
lolz

Bully@Wiiplaza

Quote from: Deathwolf on December 24, 2010, 04:43:35 PM
ok thanks alot.
I've done this now by smg2

lwz r4,1712(r30) + 0056 = lwz r4,1768(r30) and it works ^^ thanks alot!

but how should I write this now in C2?

like this:

04XXXXXX 809E06E8 (your code)

lwz r4,1768(r30)

instead of:

04XXXXXX 809E06B0 (original instruction)

lwz r4,1712(r30)
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully

Deathwolf

no without 04 code.

I wanna do this in C2
lolz

IRS

#5
for something like a teleportation code? heres my basic structure (i use this in black ops. but i did strip the key parts out :P) its my code and im not leaking it ;)

this is actually something ive had to do to determine who is host and who all else has joined.. etc. etc.... kinda a cache of sorts.

-beginning snip to keep the code a bit harder to find.-
stwu r1,-48(r1)
stmw r24,4(r1)
lis r24,0x8000
ori r24,r24,0x09D4    -my custom pointer, indicates the storage location (huge volumes of data can be placed in these locations)
lwz r25,0(r24)         -loads the value from my pointer and then makes sure there is actually an address there, if not, make one.
cmpwi r25,0           -has the pointer already been indicated?
bne 0x0C              -if yes branch over the fresh write.
addi r25,r24,4        -"makes" the storage location, +4 from my pointer for compactness.
stw r25,0(r24)       -stores value to pointer.
lwz r26,0(r25)        -checks to see if there is an address i wanted to store in my storage.
mr r30,r24             -used later (later for a max/min check of the storage)
cmpw r26,r29         -does the current address i want to store already match an existing one?
beq 0x4C              -if yes then skip to end.
cmpw r31,r29        -used to determine if my code has reached its max store (first time the code executes this will never trip.)
beq 0x44              -if bounds are reached skip to end.
lwzu r31,4(r30)      -loads value from store to see if its 0/if the value i want to store already has been stored, and updates the storage "check"
addi r28,r24,44      -sets maximum storage value (used for comparing if the address has already been reached or not.
cmpw r30,r28        -is the current storage address the maximum value? if yes, skip to the end.
beq 0x08              -skip
b -0x18                -causes a loop to occur to check all addresses to make sure everything is only copied 1x
cmpwi r26,0          -is the address actually blank and not going to write over something else?
bne 0x28              -if yes then end.
stw r29,0(r25)      -if not then store said address into my storage.
addi r25,r25,4       -increase the pointer by 4 to ready it for the next store.
addi r30,r24,44     -has the max already been reached?
cmpw r25,r30       -checks to make sure the pointer has not already reached its max.
beq 0x0C             -if yes... branch to "reset"
stw r25,0(r24)      -store the current pointer into the pointers storage location.
b 0x0C                -branch to end.
addi r25,r24,4      -restarts my pointer (only used for redundancy purposes aka, no crashes or infinite loops and guarantees the code will work)
stw r25,0(r24)     -stores the pointer into its address.
lmw r24,4(r1)      -blah blah blah (loads back the previous data from the stack pointer)
addi r1,r1,48       -reverts stack pointer back to the original


well thats my code, well. half of it :/ all of my black ops codes work :P but they are rather long... but hey, its the price for 100% assurance they will function.

if you can manage to read through the whole mess, the main point of the code is determining who/what is going on, and when someone new joins. my wii constantly reads who all is in the matches when im host, so i load my previous "stores" to check what all i have kept, compare it to the current area, and if it is not equal it will finally store it, then increase my "pointer" by 4 so its set for the next storage. the other critical half of the code ill keep secret though :P (mainly because it was a pain to find the original ASM piece. all it does it write everything to 0 every time the match starts.)