Jump to content
xisto Community

Fpu Help

Recommended Posts

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

Share this post

Link to post
Share on other sites
:) 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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.