|
|
|
|
![]() ![]() |
Aug 24 2006, 02:37 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 397 Joined: 9-June 06 From: Wisconsin Member No.: 24,924 |
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 |
|
|
|
Sep 26 2006, 01:50 AM
Post
#2
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 399 Joined: 14-November 04 From: Elysium Member No.: 2,280 |
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. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 6th October 2008 - 07:10 PM |