Hi ,all .  I use FLDZ instructions to clear the st0 register, bug i failed often , in ollydbg , it just shows the st0 filled with "bad". 

and when using FILD to set st0 register , i also see that . sometimes it is right , but often it is "bad".

can anyone tell me the reason ?  thanks!
Posted on 2005-10-04 10:43:11 by nbw
Maybe there's a problem in the code, like a bad pointer? Try to come up with some code to show the problem, and post it here so we can test it ourselves. :)
Posted on 2005-10-04 11:01:39 by QvasiModo

Function is here :

void cal_para_xyz(dword x, dword y, dword z)
mov ebx, esp
sub esp, 0x20
mov dword ptr ss:, 0x30000000
fldz ; often excute bad
fild x ; can't load data
fsub dword ptr ss:

the code is here , but maybe the the mistake is others.....

thank you very much!
Posted on 2005-10-04 19:29:47 by nbw

There are numerous pitfalls when using the FPU. It is very different from the regular CPU.
Before you start using FPU instructions, you should have an adequate understanding of how the FPU functions. Although there are many places where you can get such information, you may want to have a look at:


You can have a look at that tutorial on-line and/or download it for future reference off-line. It's in html format. Be sure to read and understand the first two chapters. You may find an explanation for your current problem.

Posted on 2005-10-04 19:49:53 by Raymond
Why are you fooling around with the stack pointer?  leave the stack alone and just load the variable normal:
mov x,30000000
fild x
fsub x
Posted on 2005-10-05 05:14:55 by GorillaCoder

Thank all of you very much , i have dealed with it .  :lol: :lol:
Posted on 2005-10-05 07:47:29 by nbw