Author Topic: qword to ascii conversion  (Read 51714 times)


  • Member
  • ***
  • Posts: 318
    • Raymond's page
Re: qword to ascii conversion
« Reply #90 on: July 12, 2017, 02:36:54 AM »
Most Microsoft programmers working on the Windows OS probably don't know anything about FPU instructions. However, they do use (maybe unknowingly) the FPU general registers without preserving their content. I doubt that they would change any of the control registers. If you want to see Windows in action with fpu general registers, write a test program loading some values on the FPU and then use the MessageBox API to display whatever you like. Then run that program with Ollydbg and watch the content of the fpu registers when the API is called.

THEREFORE, I consider all general and control FPU registers as free to use and would personally not preserve any of them because of other external programs which may use them. I may preserve them strictly for the internal needs of my own program. (Because the Fpulib would be used within one's program, and some of the data within registers might be required to be preserved for the user, each of the functions within that library does an initial fpu save and a fpu restore on exit.)

As for using the FINIT at the very beginning of a program, its only function would be to change the precision control from double-precision (64-bit) to extended double-precision (80-bit); all other general and control registers are provided initialized to an exe upon loading it. Obviously, if you need to change any of the controls for specific purposes, you adjust them as needed but there is no need to preserve them unless other parts of your own program expects them to have them preserved.

The ffree st(7) instruction by itself would not necessarily make the fpu behave. It would only guarantee that the next immediately following fld or fild instruction would be carried out without an exception being raised.

To all those other members following this thread without much knowledge about the FPU, you may want to have an initial quick glance at
Whenever you assume something, you risk being wrong half the time.


  • Member
  • *****
  • Posts: 13651
  • Assembly is fun ;-)
    • MasmBasic
Re: qword to ascii conversion
« Reply #91 on: July 12, 2017, 04:19:42 AM »
Ray's tutorial is an absolute "must read" indeed. Yes, I had forgotten MessageBox, it erases ST(6) and ST(7). Which is normally not a problem, nobody uses the fpu so deeply and then launches a MsgBox while intermediate results are still in the fpu.

In short: don't worry. Do what you have to do with the fpu.