home bbs files messages ]

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,396 of 4,675   
   Robert to R.Wieser   
   Re: FPU (x87) code debugging.   
   08 Aug 21 03:22:58   
   
   From: redelm@nospicedham.ev1.net.invalid   
      
   R.Wieser  wrote in part:   
   > Robert,   
   >> You will need FSAVE/FRSTOR (and varients)   
   > Wolfgang gave that suggestion too.  Alas, the F(N)SAVE resets   
   > the FPU stack, and for some reason I can't get the FXSAVE to work   
   > (my assembler shows its age by not knowing the opcode, and trying   
   > to use a "db 0Fh,0AEH, ....."  sequence crashes the program).   
      
   It might have some safeguards against executing data :)   
      
   >> Your first FLD will clobber the stack top,   
   >   
   > I don't get that - why only the first one, and why would   
   > it clobber (the value at) the stack top ?   
      
   The stack is eight FP registers, any load pushes the one on   
   the top into the bit bucket.  Actually, I believe the registers   
   are a circular file,  and the load overwrites and decrements TOS.   
      
   >> As another poster has said, I don't think the x87 automagically   
   >> sets value flags   
   >   
   > I don't quite get this either.   Value flags ?   I'm reading the   
   > "Status Word" and in it look at the ST bits (at 11-13).   
      
   Aren't those three bits (0-7) the Top-of-Stack pointer?   
   People sometimes compare the FPSW with the x86 flags register.   
   It is not.   
      
   > Remark : I later found out/realized that the "Stack Top"   
   > is just the starting offset for the ST(x) arguments.  IOW :   
   > whats in it isn't really relevant.   
      
   Exactly.   
      
   >> Dump and examine in main memory.   
   >   
   > :-)  The problem was that I had no idea that I could or how to do that .   
      
   Well, debugging always requires more space. x86 assumes   
   sufficient stack space (or switches to priviliged memory).   
      
   34 years ago I wrote an extention to MS-DOS DEBUG.COM to   
   examine the x87.  Converting binaryFP to decimal FP was hard.   
      
   > Ofcourse it didn't help that I got confused by (and by it focussed on)   
   > the "Stack Top" value. :-\   
      
   Well, quite forgivable.  The x87 is focussed on the stack.   
      
   -- 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