Loading into floats?

Started by Mathew_Wi, July 28, 2010, 01:58:38 AM

Previous topic - Next topic

Mathew_Wi

Hi, I'm trying to load the value from r12 into f12.

Doesn't seem to work.

r12 : C6FA0000
f12 : 60000000

lfs f12,0(r12)

Am I doing something wrong?

dcx2

Yeah.  Floats are loaded and stored from memory, not other registers.

0(r12) means load the value that r12 is pointing at.


matt123337

#2
Quote from: Mathew_Wi on July 28, 2010, 01:58:38 AM
Hi, I'm trying to load the value from r12 into f12.

Doesn't seem to work.

r12 : C6FA0000
f12 : 60000000

lfs f12,0(r12)

Am I doing something wrong?

find some empty place in memory.  I'n my example i'll use 0x8000098


lis r9, 0x8000 # base address
lis r12, 0xC6FA # value u want to load into float register
stw r12, 0x98(r9) # stores value into memory at 0x8000098
lfs f12, 0x98(r9) # reads value from 0x8000098 into f12

dcx2

That makes me nervous...r9 needs to be safe, and I'm not sure that 0x80000098 is free.

I believe ZiT used a "negative stack frame" for loading floats in an SMG2 code.

lis r12, 0xC6FA
stw r12,-4(r1)
lfs f12,-4(r1)

matt123337

it is safe, he's hacking Legend of Zelda: Ocarina of Time.  I just check :p