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

  1. Path: mordred.cc.jyu.fi!news
  2. From: daeron@horus.co.jyu.fi (Aki Laukkanen)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Integer Sine tables?
  5. Date: 26 Feb 1996 13:53:50 GMT
  6. Organization: University of Jyvaskyla, Finland
  7. Message-ID: <1410.6630T670T1066@horus.co.jyu.fi>
  8. References: <4glqbd$4ab@nnrp1.news.primenet.com>
  9. NNTP-Posting-Host: dynamic03.co.jyu.fi
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  11.  
  12.  
  13. > Since I am using assembly, how can I make sine tables without using an FPU?
  14. >(i.e. to use in 3d routines)
  15.  
  16. I use this sort source (courtesy of Touchstone/Essence):
  17.  
  18. --clip--
  19. calcsincos
  20. Size    equ     4096            ;number of entries
  21. Amp     equ     1024            ;the amplitude
  22. Pi      equ     205887          ;Pi^1 = (3.14159)^1*65536
  23. Pi2     equ     646814          ;Pi^2 = (3.14159)^2*65536
  24.  
  25.         lea     sin,a0
  26.         moveq   #0,d0                           ; s = 0
  27.         move.l  #2*Pi*Amp/Size,d1               ; t = 2 * pi / Size
  28.         move.l  #4*Pi2/Size*65536/Size,d2       ; r = t * t
  29.         move    #Size-1,d7                      ; number of values
  30.  
  31. si2.Loop
  32.         move.l  d0,(a0)                         ; Store the value (but
  33.         addq.l  #2,a0                           ; only the HIGH word!)
  34.  
  35.         move.l  d2,d3                           ; d3      = r
  36.         muls.l  d0,d4:d3                        ; d3 + d4 = r * s
  37.         sub.l   d4,d1                           ; t = t - r * s
  38.         add.l   d1,d0                           ; s = s + t
  39.         dbf     d7,si2.Loop                     ; all data done?
  40.         move.w  #1024/2-1,d7
  41.         lea     sin,a0
  42.         lea     sin+4096*2,a1
  43. .copy   move.l  (a0)+,(a1)+
  44.         dbf     d7,.copy
  45.         rts                                     ; good bye!
  46.  
  47. --clap--
  48.  
  49.  
  50. ---
  51. Daeron
  52.  
  53. VirusScan: MS Windows found.  Delete? (Y/y)
  54.  
  55.