Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 4,395 of 4,675    |
|    Robert to R.Wieser    |
|    Re: FPU (x87) code debugging.    |
|    07 Aug 21 14:19:22    |
      From: redelm@nospicedham.ev1.net.invalid              R.Wieser wrote in part:       > Moderator, Frank : I'm not sure if questions about the x87       > FPU are permitted here. If not than please just discard.       > If they are than please remove this line. :-)       >       > Hello all,       >       > I've just been writing some basic code to parse a simple       > float, and realized that I had no idea how to check if the       > x87 FPU was empty after I was done - as a simple measure       > to check if my code cleaned up correctly.              You will need FSAVE/FRSTOR (and varients) if you use       the x87. Your first FLD will clobber the stack top,       which might be OK only if it is empty.              >       > I've been looking at using the ST bits in the FPU status word, but had to       > find that they (unexpectedly) didn't end at zero after I done my thing :       >       > minimal example:       >       > fld1 ;Load       > fld1       >       > fstp st(2) ;Swap ST(0) and ST(1) <-- this is the culprit       >       > fstp st(0) ;Discard       > fstp st(0)       >       > At this point all the ST bits are set, indicating a minus one, not zero.              As another poster has said, I don't think the x87 automagically       sets value flags (as x86 does( and needs FXAM. FSTSW=FF sounds       like an empty x87.              >       > My questions at this point are:       >       > 1) Have I done anything wrong in the above ? I don't think       > so, but "you never know" ....       >       > 2) How do I, for debugging purposes, check the FPU stack ?              Dump and examine in main memory. Like the Hewlett-Packard       Reverse Polish Notation calculators it was modelled on,       the x87 is meant for crunching together, not picking apart.              -- Robert              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca