mdale9
February 15th, 2005, 07:04 AM
I am a bit of a newbie to assembly and only need to do one thing at present, which is access the FSINCOS operation on the x87 math co-processer. I have trawled the web and found a few references and have come up with the following code:
void SinCos(double Angle, double *SinAns, double *CosAns) {
__asm {
fld QWORD PTR [Angle]
fsincos
fstp QWORD PTR [CosAns]
fstp QWORD PTR [SinAns]
fwait
}
}
main()
{
double s=0.0;
double c=0.0;
double ang = 3.0;
SinCos(ang,&s,&c); //call one version of the code
//call the other one version of the code
__asm {
fld QWORD PTR [ang]
fsincos
fstp QWORD PTR [c]
fstp QWORD PTR [s]
fwait
};
}
When I single step through it and look at the registers the operation is occuring as expected but only the second version pops the values into "c" and "s".
I am using VC++ 6.0 Professional with the default compiler options:
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/small_test.pch" /YX /Fo"Debug/"
Please help.
void SinCos(double Angle, double *SinAns, double *CosAns) {
__asm {
fld QWORD PTR [Angle]
fsincos
fstp QWORD PTR [CosAns]
fstp QWORD PTR [SinAns]
fwait
}
}
main()
{
double s=0.0;
double c=0.0;
double ang = 3.0;
SinCos(ang,&s,&c); //call one version of the code
//call the other one version of the code
__asm {
fld QWORD PTR [ang]
fsincos
fstp QWORD PTR [c]
fstp QWORD PTR [s]
fwait
};
}
When I single step through it and look at the registers the operation is occuring as expected but only the second version pops the values into "c" and "s".
I am using VC++ 6.0 Professional with the default compiler options:
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/small_test.pch" /YX /Fo"Debug/"
Please help.