A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / fpu code in interrupts

 

Author Message
dalton
Member
#1 - Posted: 27 Sep 2011 18:39
Reply Quote
Hi,

does anybody know if there are any special constraints when using fpu code in interrupts?

Most fpu commands seem to run fine, but some appears to crash my system; like fscale, fsincos, and fmovecr when I use them in my interrupt code. I have my own interrupt routine written into the vblank vector, and I use fmovem.x along with fsave/frestore to keep the fpu state intact.

My system is A1200 with Blizzard 1260, running oxypatcher.

/Dalton
Angry Retired Bastard
Member
#2 - Posted: 27 Sep 2011 22:51
Reply Quote
I'd assume this is because the instructions in question are not natively supported by the 68060 FPU (as opposed to in the 68881/2) and therefore are implemented as SW fallbacks depending on exceptions. As a result you're getting issues because your FPU code is triggering new exceptions while servicing the vblank interrupt.
No idea how to get around it though...

If this is indeed the case then I'd expect all the following instructions (copied from Erik H. Bakke's old FPU guide) to give you this issue (on 040/060):
FACOS,FASIN,FATAN,FATANH,FCOS,FCOSH,FETOX,FETOXM1,
FGETEXP,FGETMAN,FINT,FINTRZ,FLOG10,FLOG2,FLOGN,
FLOGNP1,FSIN,FSINCOS,FSINH,FTAN,FTANH,FTENTOX,
FTWOTOX
FMOD,FREM,FSCAL,FSGLDIV,FSGLMUL
FMOVECR
dalton
Member
#3 - Posted: 28 Sep 2011 08:13
Reply Quote
That's quite a bunch of instructions! I can't believe this is the first time I try to use any of them in an interrupt.
Blueberry
Member
#4 - Posted: 28 Sep 2011 12:21
Reply Quote
According to the 68060 manual, FINT, FINTRZ, FSGLDIV and FSGLMUL are supported. But apart from those, the list looks right.

If it is acceptable for your demo to be dependent on an FPU instruction patcher (OxyPatcher, MuRedox), you can try putting your code using these instructions in a subroutine and make sure it is called (and all problematic instructions executed) at least once from non-interrupt code before it is called from interrupt code. This way, all the exception-causing instructions will likely have been replaced by direct calls to emulation code.
dalton
Member
#5 - Posted: 28 Sep 2011 16:10
Reply Quote
Ah, sounds like a workaround that will do the trick!

I guess the best thing would be to have software macros implementing those fpu instructions so that the program does not have to rely on some patcher.

 

  Please register a new account or log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0