Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!polyslo!rcfische From: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Newsgroups: comp.sys.mac.programmer Subject: Re: 68881 Questions/Troubles (HELP!) Message-ID: <25da1339.48a@polyslo.CalPoly.EDU> Date: 15 Feb 90 02:26:01 GMT References: <3943@hub.UUCP> Reply-To: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Organization: Cal Poly State University -- San Luis Obispo Lines: 38 In article <3943@hub.UUCP> 6500stom@hub.UUCP (Josh Pritikin) writes: >I don't have the Motorola Manual so I've resorting to posting here- > >1. I get a NaN(255) after my program runs for 1-60 seconds. Its very >irregular and I'm pretty sure I'm not dividing by zero or overflowing. >Does the '881 give a NaN when you underflow? No. The likeliest couse of this problem is the use of uninitialized floating- point variables, probably register variables. The registers in the 68882 are all initialized to NaN(255) when you turn on your Mac. With register saves/restores, they tend to stay that way for a long while. >2. I need to use the '881 during interupt time. I know it needs it's >environment saved and restored somehow.. how do you do this? FSAVE -(SP) FMOVE.X ,-(SP) your routine FMOVE (SP)+, FRESTORE (SP)+ Tech note 235 describes this in more detail. Two things to be aware of about FSAVE/FRESTORE however. 1) they are priviledged instructions and won't work in user mode (not presently relevent) 2) they are expensive instructions. FSAVE uses 4 to 216 (28 typically) bytes on the stack and 15-330 (100 typical) clock cycles. FRESTORE is similar Ray Fischer rcfische@polyslo.calpoly.edu