HOME       >>       Programming

Fpu Help


ghostrider

I'm new to using the FPU in assembly, the 'Stack Fault' bit in the Status Word is always set, and I'm not quite sure what this means. Has anyone else encountered this problem? My code is posted below. It will eventually take a 64-bit variable and turn it into a number that a human can understand.

CQWOne:fld [CQWBuffer]fld [CQW01] fcom;Compare ST(0) with ST(1)fstsw axsahf;Store ah in flags.jc CQWTwofsub [CQW01]fst [CQWBuffer]jmp CQWOneCQWTwo:hlt;Just here for testing purposes.CQWBuffer dq 0FFFFFFFFFFFFFFFFhCQW01 dq 10000000000000000000dCQW02 dq 1000000000000000000dCQW03 dq 100000000000000000dCQW04 dq 10000000000000000dCQW05 dq 1000000000000000dCQW06 dq 100000000000000dCQW07 dq 10000000000000dCQW08 dq 1000000000000dCQW09 dq 100000000000dCQW10 dq 10000000000dCQW11 dq 1000000000dCQW12 dq 100000000dCQW13 dq 10000000dCQW14 dq 1000000dCQW15 dq 100000dCQW16 dq 10000dCQW17 dq 1000dCQW18 db 100dCQW19 db 10dCQW20 db 1d


osknockout

Hmm... don't you hate it when you get replies only months away from your problem?
I don't know if you're still looking for an answer, but here's one: (finally)

The SF field (bit6) or Stack Fault exception is set whenever an attempt is made to either load a value into a register which is not free (the C1 bit would also get set to 1) or pop a value from a register which is free (and the C1 bit would get reset to 0). (Such stack fault is also treated as an invalid operation and the I field flag bit0 would thus also be set by this exception; see below.)

So basically either a) you tried to write over a register you loaded b)you forgot to clear the FPU registers.

a)doesn't really seem like it. I might have to go over it a few times, but it seems like clean code.
b)hmm... have you tried FFREEing your registers first? Because they're usually loaded before
you run your code. FFREE x - clears fpu register x.


VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.