ASM Mark and Recall [Black_Wolf]

Hey again guys, just writing some quick templates for you all.

This is a little more complex, so only attempt this if you have a bit of a decent understanding.

!!!Remember, I am still new to the Wii Scene (and PowerPC for that matter) so bear with me if I make some mistakes!



As you know I love working with co-ordinates, so here is another quick guide for you if you have found them yet. This code essentially "saves" you're co-ordinates when you press a button, and then when you press ANOTHER button, it stores them all back to their address. Meaning you can essentially save a spot (easy to make multiple button saves). So for example, store the co-ords of you're flag, then the oppositions flag in a ctf match. Then just press the 2 STORE buttons repeatedly to capture the flag over and over lol. Here's how its done


WHAT YOU NEED

-The address of the co-ords (x,y and z)

-An address for a blank bit of code (zerro's) where you can copy you're co-ords to. Just do a string search in a hex editor for 00000000000000000000000000000000 etc to get a big area lol.

-Link's asm helper.


WHAT IT DOES

BUTTON1

-Loads the x, y, and z co-ords into a reegister

-Stores all of these at a blank area of code (different addresses)

BUTTON2

-Loads the x, y, z co-ords SAVED IN THE BLANK PART

-Stores these back at the real co-ord adddress.


For this example, we will say:


BUTTON1 (mark) is Z

BUTTON2 (recall) is C

The 3 blanks are at 80114560,80114564 and 80114568 respectively

The co-ords are at 80981C70, 80981C74 and 80981C78 respectively

The button activator is at 80C650A4



The ASM

li r0, 0x2000

li r1, 0x4000

lis r2, 0x80C6

lwz r2, 0x50A4(r2)

cmpw r2, r0

beq +0x10

cmpw r2, r1

beq +0x2C

b +0x48

lis r3, 0x8098

lwz r4, 0x1c70(r3)

lwz r5, 0x1c74(r3)

lwz r6, 0x1c78(r3)

lis r7, 0x8011

stw r4, 0x4560(r7)

stw r5, 0x4564(r7)

stw r6, 0x4568(r7)

b +0x24

lis r3, 0x8011

lwz r4, 0x4560(r3)

lwz r5, 0x4564(r3)

lwz r6, 0x4568(r3)

lis r7, 0x8098

stw r4, 0x1c70(r7)

stw r5, 0x1c74(r7)

stw r6, 0x1c78(r7)

nop


Ok now with some comments:

BUTTON CHECK:

li r0, 0x2000 //Loads the Z value into r0

li r1, 0x4000 //Loads the C value into r1

lis r2, 0x80C6

lwz r2, 0x50A4(r2) //Loads the button control value into r2

cmpw r2, r0 //Checks if Z is pressed

beq +0x10 //If it is, branches to MARK FUNCTION

cmpw r2, r1 //Checks if C is pressed

beq +0x2C //If is is, branches to RECALL FUNCTION

b +0x48 //If neither, branch to the end


MARK FUNCTION:

lis r3, 0x8098

lwz r4, 0x1c70(r3) //Loads X co-ords into r4

lwz r5, 0x1c74(r3) //Loads Y co-ords into r5

lwz r6, 0x1c78(r3) //Loads Z co-ords into r6

lis r7, 0x8011

stw r4, 0x4560(r7) //Stores X Co-ords at SAVE1

stw r5, 0x4564(r7) //Stores Y Co-ords at SAVE2

stw r6, 0x4568(r7) //Stores Z Co-ords at SAVE3

b +0x24 //Branch to the end


RECALL FUNCTION

lis r3, 0x8011

lwz r4, 0x4560(r3) //Loads SAVE1 into r4

lwz r5, 0x4564(r3) //Loads SAVE2 into r5

lwz r6, 0x4568(r3) //Loads SAVE3 into r6

lis r7, 0x8098

stw r4, 0x1c70(r7) //Stores SAVE1 at X co-ords

stw r5, 0x1c74(r7) //Stores SAVE2 at Y co-ords

stw r6, 0x1c78(r7) //Stores SAVE3 at Z co-ords

nop