May 16, 2008

Fpu Help

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Assembler and Delphi

free web hosting

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.

CODE

CQWOne:
fld [CQWBuffer]
fld [CQW01]
fcom;Compare ST(0) with ST(1)
fstsw ax
sahf;Store ah in flags.
jc CQWTwo
fsub [CQW01]
fst [CQWBuffer]
jmp CQWOne

CQWTwo:
hlt;Just here for testing purposes.



CQWBuffer dq 0FFFFFFFFFFFFFFFFh

CQW01 dq 10000000000000000000d
CQW02 dq 1000000000000000000d
CQW03 dq 100000000000000000d
CQW04 dq 10000000000000000d
CQW05 dq 1000000000000000d
CQW06 dq 100000000000000d
CQW07 dq 10000000000000d
CQW08 dq 1000000000000d
CQW09 dq 100000000000d
CQW10 dq 10000000000d
CQW11 dq 1000000000d
CQW12 dq 100000000d
CQW13 dq 10000000d
CQW14 dq 1000000d
CQW15 dq 100000d
CQW16 dq 10000d
CQW17 dq 1000d
CQW18 db 100d
CQW19 db 10d
CQW20 db 1d


 

 

 


Reply

osknockout
dry.gif 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)

QUOTE
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.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics
Looking for fpu

Searching Video's for fpu
advertisement



Fpu Help



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE