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
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
; 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
fld
fstp dword ptr
or since we're talking floats here (dword in size) you could use
mov edx,
mov ,edx
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.
myfloat = info.someotherfloat;
}
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