Hey, I found the Y-Coord of Mario and Sonic.
Now I want to increase it with ASM, since the address moves in memory.
Doing an ASM RAM Write:
[spoiler]lis r11,-32637 # Button Activator
lhz r11,17428(r11)
andi. r11,r11,4096 # do we press minus?
beq- 0x0C # if not...
lis r12,17664 # value to write
stw r12,144(r4) # store
lfs f0,144(r4) # default, branch will take us here[/spoiler]
but I also tried doing an increase in ASM:
[spoiler]
lis r11,-32768 # random first 16bit of an address on the RAM
lis r12,16256 # value to add
stw r12,5376(r11) # store value to add at 80001500
lfs f22,5376(r11) # load value into f22
lis r11,-32637 # load Button Activator
lhz r11,17428(r11)
andi. r11,r11,4096 # do we press minus?
beq- 0x0C # if not...
fadd f0,f0,f22 # add f0 and f22, store the result in f0
stfs f0,144(r4) # store f0 back to Y-Coord in RAM
lfs f0,144(r4) # default, branch will take us here
[/spoiler]
The RAM Write worked, but the Increase Code somehow wrote a high value *instead* of constantly adding the floating value.
However, is there a recommendation for a float I should use for adding?
I´m also wondering why the increase code failed :o
Hey Bully, try writing it out with Labels to the branches. It's the ASM way of writing it out. You're writing it out converted. dcx2 will be appreciative if you do.
I'll give it a go for you
lis r11,0x???? # Button Activator
lhz r11,17428(r11)#load the address' value (I'm assuming that r11 already has the right value??)
andi. r11,r11, ????# do we press minus?
b NOLOAD:
lis r12,17664 # value to write
stw r12,144(r4) # store
NOLOAD:
lfs f0,144(r4) # default, branch will take us here
c´mon dude, you could also find it out by yourself.
Anyway, the addresses won´t matter I thought.
I post the unconverted stuff now.
[spoiler]
lis r11, 0x8000 # load 8000 into r11
lis r12, 0x3F80 # load 3F80 (value to add) into r12
stw r12, 0x1500 (r11) # store r12 to 80001500
lfs f22, 0x1500 (r11) # load value from 800015000 into f22
lis r11, 0x8083 # load 8083 as first 16 bit of our Button Activator
lhz r11, 0x4414 (r11) # load value from 80834414 (Button Activator) into r11
andi. r11,r11, 0x1000 # do we press minus?
beq- _NOTPRESSED # if not, branch to the end
lfs f0,144(r4) # load our Y-Coord into f0
fadd f0,f0,f22 # add float f0 and f22 (our Y-Coord plus the value to increase it)
stfs f0,144(r4) # store back the modified value to our Y-Coord in RAM
_NOTPRESSED: # branch takes us here
lfs f0,144(r4) # original instruction
[/spoiler]
Is it fine now, or not? ???
could the problem be fadd, where fadds could work. double precision to single instead.