Ok take pseudocode:

void somefunc( float *myfloat ) {
myfloat = info.someotherfloat;
}
How would I do something equivalent in asm?
Do I need to use the floatingpoint registers to move the value in someotherfloat into myfloat ? And how about the pointer? How do I use that the same way.



Regards SFP
Posted on 2003-07-29 18:30:09 by SFP
; Assume eax points to myfloat

fld
fstp dword ptr

or since we're talking floats here (dword in size) you could use

mov edx,
mov ,edx
Posted on 2003-07-29 18:39:34 by Eóin
void somefunc( float *myfloat ) {
myfloat = info.someotherfloat;
}
The better way to transpose such a function in asm is to pass the ADDRESS of the variable to the function.

Assuming that "float" would be a declared floating point variable to be multiplied by someotherfloat, the function would then be:
fld   float           ;unless it's already in st(0) of the FPU

mov eax,myfloat ;passed address of "someotherfloat"
fmul [COLOR=red]x[/COLOR]word ptr[eax] ;[COLOR=red]x[/COLOR] being replaced by "d" or "q"
;depending on the size of "someotherfloat"
;result is in st(0)
Raymond
Posted on 2003-07-29 21:24:13 by Raymond