I'm not really sure how to do this so ill ask here.
This is what i want to do
My first line is a button activator, if true
i want to add 10 to address xxxxxxxx
How do would i do this?
All ive seen with asm is registers but i just want to add a number to an address.
I think it would be something like the following
Copy the value at XXXXXXXX to a gecko register
(CST1 : Load into Gecko Register)
Increment by 10
(CST3 : Gecko Register / Direct Value operations)
Copy it back to the original address
(CST2 : Save Gecko Register to)
For example:
207A2B60 00000400 <-- 32bit check on the address 807A2B60 for the value of 00000400 (B button pressed)
82200000 80000010 <-- Take the value at 80000010 and put it in gecko register 0
86000000 0000000F <-- increment gecko register 0 by F
84200000 80000010 <-- write gecko register 0 back to 80000010
E0000000 80008000
Holding down the B button increases the address until you let go
Awesome! Thanks for the help, i did not know i could use the gecko register for direct values.
ummm 1 more question, how would I subtract? I dont see an operator for minus, only add.
you have to subtract your value from 00000000, so subtracting 1 will be adding FFFFFFFF
Quote from: Romaap on November 08, 2008, 08:46:19 PM
you have to subtract your value from 00000000, so subtracting 1 will be adding FFFFFFFF
On that thought: How can you divide something?
you would multiply by a fraction(which i have no idea how to do)
Divide by 2 = Multiply by .5
Can someone tell me why this isnt working
This is for brawl(rsbe01 ntsc-usa), the button activators MAY be wrong
040188A8 60000000 << nop
04018644 60000000<< nop
040194F0 60000000<< nop
040A06A8 60000000<< nop
0494E704 60000000<< nop
0494E65C 60000000<< nop
80000000 430E0000 << set gRN to 430E0000
285BA488 00000048 << if 805BA488 has a value of 48
86000000 0000FFFF << add FFFF to gRN
84200000 805B6D94 << save gRN to 805B6D94
E2000001 00000000 << endif
285BA488 00000044 << if 805BA488 has a value of 44
86000000 FFFFFFF1 << add FFFFFFF1 to gRN
84200000 805B6D94 << save gRN to 805B6D94
E0000000 80008000<< full terminator
040188A8 60000000 << nop
04018644 60000000<< nop
040194F0 60000000<< nop
040A06A8 60000000<< nop
0494E704 60000000<< nop
0494E65C 60000000<< nop
80000000 430E0000 << set gRN to 430E0000
285BA488 00000048 << if 805BA488 has a value of 48
86000000 0000FFFF << add FFFF to gRN
84200000 805B6D94 << save gRN to 805B6D94
E2000001 00000000 << endif
285BA488 00000044 << if 805BA488 has a value of 44
86000000 FFFFFFF1 << add FFFFFFF1 to gRN
84200000 805B6D94 << save gRN to 805B6D94
E0000000 80008000<< full terminator
80000000 isn't the correct code?
CST0 : Set Gecko Register to
80SY000N XXXXXXXX :
8000 : grN = XXXXXXXX
8001 : grN = XXXXXXXX+ba
9001 : grN = XXXXXXXX+po
8010 : grN += XXXXXXXX
8011 : grN += XXXXXXXX+ba
9011 : grN += XXXXXXXX+po
I used that, does it set it to an address or a value?
if i were you i'd just inject the asm, it would be a lot easier to do imo. Just use links asm tool. First find a place to inject your code (like setting a read breakpoint on your button address), and look at some safe registers while your at it (they'll be 00000000 in the breakpoint results) lets say r18 and r19 are safe registers, do this:
285BA488 00000048
:IN ASM TOOL
lis r18, 0x805B
lwz r19, 0xA488(r18)
addi r19, r19, 0x2000
stw r19, 0xA488(r18)
285BA488 00000044
:IN ASM TOOL
lis r18, 0x805B
lwz r19, 0xA488(r18)
subi r19, r19, 0x2000
stw r19, 0xA488(r18)
This routine basically says IF HOLDING 48, ADD 0x2000 to value at 0x805ba488
IF HOLDING 44, SUBTRACT 0x2000 from value at 0x805ba488
When you use the if check you use code 28 which is 16 bit
What's the value of 805BA488? is it 00000048?
code 20 is a 32 bit check
yea i figured that out
but now i can only add FFFF once or subtract FFFFFFF1 once
i think the gecko register reset every time i run it
heres my code
80000000 430E0000
040188A8 60000000
04018644 60000000
040194F0 60000000
040A06A8 60000000
0494E704 60000000
0494E65C 60000000
205BA488 00000048
86000000 0000FFFF
84200000 805B6D94
E2000001 00000000
205BA488 00000044
86000000 FFFFFFF1
84200000 805B6D94
E0000000 80008000
See anything wrong?
Oh and black wolf i keep getting an error when i put that in the asm converter
and i want to add to 805B6D94 not 805BA488
Try the following code:
It should load the value from 805B6D94 into gR1, add 0000FFFF to or
substract FFFFFFF1 from it, and writes the new value to 805B6D94 again.
040188A8 60000000
04018644 60000000
040194F0 60000000
040A06A8 60000000
0494E704 60000000
0494E65C 60000000
205BA488 00000048
82200000 805B6D94
86000000 0000FFFF
84200000 805B6D94
E0000000 80008000
205BA488 00000044
82200000 805B6D94
86000000 FFFFFFF1
84200000 805B6D94
E0000000 80008000
Why do you want to set the register to 430E0000 (your first line)?
i figured it out
thx for your help guys