home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / dsp / 2092 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.7 KB  |  56 lines

  1. Newsgroups: comp.dsp
  2. Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!phaedrus
  3. From: phaedrus@leland.Stanford.EDU (Avery Wang)
  4. Subject: DSP 56001 arccos -- ERRATUM
  5. Message-ID: <1992Sep5.160307.14396@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: DSG, Stanford University, CA 94305 USA
  8. Date: Sat, 5 Sep 92 16:03:07 GMT
  9. Lines: 45
  10.  
  11. Hi DSP hackers-
  12.  
  13. Thanks to mlelstv@specklec.mpifr-bonn.mpg.de for pointing out that my posting
  14. was rather nonsense.  What happened was that I grabbed the wrong file and
  15. posted that instead of the correct (working and compilable) version of the
  16. arccos macro.  Here is the correct version for those who are interested.
  17.  
  18. =======================================================================
  19. ;   arccos.asm
  20. ;   Calculates the arc-cosine of the input to 8 bits.
  21. ;   The output is between 0 and +127 and is in a
  22. ;
  23. ;   Copyright! February 20,1992
  24. ;   Free for non-profit usage
  25. ;
  26. ;   Avery Wang                         
  27. ;   Ruhr-Uni-Bochum
  28. ;   Institut fuer Neuroinformatik
  29. ;   ND03, Postfach 102148
  30. ;   W-4630 Bochum
  31. ;   Germany
  32. ;   avery@neuroinformatik.ruhr-uni-bochum.de  or
  33. ;   awang@isl.stanford.edu
  34.  
  35. ; uses the Sine-ROM and simply does a table lookup.
  36. ; input and output are in a
  37. ; uses a,b,x0,y0,r6,r7,n7
  38. arccos macro
  39.     move #$140,r7           ;offset
  40.     move #$40,n7            ;guess
  41.     move n7,b
  42.     do #7,_arccos_loop
  43.         lua (r7)+n7,r6                  ;save guess
  44.         nop
  45.         asr b       a,x0    y:(r6),y0   ;make increment smaller, lookup cosine
  46.         cmp y0,a    b,n7
  47.         tlt x0,a    r6,r7  ;dummy move, if arg>table value, keep old guess
  48.         nop
  49. _arccos_loop
  50.     move r7,a
  51.     move #$140,y0
  52.     sub  y0,a                           ;result is here
  53.  
  54.     endm
  55.  
  56.