home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.ibm.pc.hardware:23151 comp.sys.ibm.pc.programmer:361
- Newsgroups: comp.sys.ibm.pc.hardware,comp.sys.ibm.pc.programmer
- Path: sparky!uunet!caen!hellgate.utah.edu!fcom.cc.utah.edu!news
- From: alex@fff.chem.utah.edu (Alex Dommasch)
- Subject: Re: Saving the state of the 80x87 math co-pro - SUMMARY
- Message-ID: <1992Sep1.164837.27951@fcom.cc.utah.edu>
- Sender: news@fcom.cc.utah.edu
- Organization: University of Utah Computer Center
- References: <1992Aug24.220638.25002@fcom.cc.utah.edu>
- Date: Tue, 1 Sep 92 16:48:37 GMT
- Lines: 56
-
- In article <1992Aug24.220638.25002@fcom.cc.utah.edu> alex@fff.chem.utah.edu
- (Alex Dommasch) writes:
- > I am using an interrupt routine to do data aquisition while other processing
- is
- > going on. However, both the main routine and the interrupt routine need to
- use
- > floating point operations - hence, the interrupt routine often steps on any
- > calculations in progress in the main routine. I figured out that I have to
- > save the state of the 8087 on entry, and restore it on exit. However, I have
- > absolutely no idea how to do this.
- >
- > I am using Turbo C 2.0. This program has to run on XT's, AT's and 386's,
- both
- > with and without coprocessors (so I have to figure out how to save the state
- of
- > the emulation library as well). I am at a total loss at how to do this. Any
- > help would be greatly appreciated.
- >
-
- Kevin Kraul was kind enough to send me a solution to this problem *if* you are
- using a math coprocessor (Thanks Kevin; hope you don't mind me posting this):
- ----------------------------
- static void interrupt InterruptHandler(void)
- {
- char coprocessor_state[94];
- .
- . // Insert other declarations here.
- .
-
- // Note: interrupts are disabled by the processor (80X86) automatically.
- asm fsave coprocessor_state; // Save floating point state and regs.
- enable(); // Enable interrupts so other interrupts can be processed.
-
- .
- . // Insert your code here!
- .
-
- asm frstor coprocessor_state; // Restore the coprocessor state.
- }
- ----------------------------
-
- However, this does not work when you are using emulation on machines without a
- co-pro. Apparently this is a much more difficult problem. If any one has a
- simple solution to it, I'd be glad to hear about it.
-
- It seems to me, however, that Borland should have put instructions to do this
- in their library. I mean, they went to all the trouble to make a special
- interrupt function type, why couldn't they have taken the last step and saved
- the floating-point state?
- --
- Alex Dommasch, Programmer |--
- Field-Flow Fractionation Research Center |-
- Department of Chemistry, University of Utah V
- Salt Lake City, Utah 84112 |->|..
- (801)581-7168 FAX: (801)581-4353 |- |.
- alex@fff.chem.utah.edu (NeXT Mail) | |
-