home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5924 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: phoenix.owl.de!not-for-mail
  2. Newsgroups: comp.sys.amiga.programmer
  3. References: <4ikpqk$ds@serpens.rhein.de>
  4. From: "Frank Wille" <frank@phoenix.owl.de>
  5. Date: Thu, 21 Mar 1996 14:38:23 +0200
  6. X-NewsReader: IntuiNews 1.3b Beta 3 (5.11.95)
  7. Subject: Re: FPU: What am I doing wrong???
  8. Message-ID: <42116663@phoenix.owl.de>
  9.  
  10. Michael van Elst wrote on 18 Mar 1996 23:58:28 +0100
  11. about "FPU: What am I doing wrong???" :
  12.  
  13.  
  14. MvE> I'm posting this for Chuck Davis
  15. MvE> (roshicorp@roshi.corp.earthlink.net),
  16. MvE> please reply to him directly.
  17. MvE> ____________________________________________________________________
  18. MvE> 
  19. MvE> 
  20. MvE>    I wonder if you might know what's happening that I don't seem to
  21. MvE> understand? This is my first experience in trying to use the FPU.
  22. MvE> The DFT routines are three versions of the same thing.
  23. MvE> I'm using PhxAss for all three assemblies.
  24. MvE> 
  25. MvE> CPU 68030
  26. MvE> FPU
  27. MvE> 
  28. MvE>   The first version works but, of course, is too slow as it is
  29. MvE> used in an _interrupt_ routine and each interrupt is 8ms.
  30. MvE> 128 sample/sec. This used the ascii version of the sin/cos
  31. MvE> routines converted for FFP.
  32. MvE> 
  33. MvE>   In the second routine, I'm trying to get at the FPU via the IEEE
  34. MvE> libraries. Immediate crash! Guru# 8000 000D ???
  35. MvE> 
  36. MvE>   In the third routine, I'm trying to use pure FPU code. Of course,
  37. MvE> this would be the most ideal routine to use. Again GURU# 8000 000D
  38. MvE> 
  39. MvE> [...]
  40.  
  41. I already replied to Chuck directly, but this is an interesting
  42. problem:
  43.  
  44.   Does Amiga OS support accessing the FPU in interrupts?
  45.  
  46. Any experts on this topic?
  47.  
  48. When switching tasks, the OS saves the whole internal FPU state of
  49. the active task on its stack and restores the FPU state of the new
  50. task. But what about interrupts? I can't remember that the FPU
  51. state is saved by the OS before entering an interrupt handler.
  52.  
  53. So maybe the interrupt routine using the FPU should look like this?
  54.  
  55. ---8<---
  56.         fsave    -(sp)
  57.         fmovem.x fp0-fp7,-(sp)
  58.         fmovem.l fpsr/fpcr/fpiar,-(sp)
  59. ;       ...
  60. ;       FPU instructions
  61. ;       ...
  62.         fmovem.l (sp)+,fpsr/fpcr/fpiar
  63.         fmovem.x (sp)+,fp0-fp7
  64.         frestore (sp)+
  65. ---8<---
  66.  
  67.  
  68. -- _
  69. _ // Frank      EMail: frank@phoenix.owl.de
  70. \X/             IRC:   Phx @ #amiga(ger)
  71.  
  72.