home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.dsp
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!phaedrus
- From: phaedrus@leland.Stanford.EDU (Avery Wang)
- Subject: DSP 56001 arccos -- ERRATUM
- Message-ID: <1992Sep5.160307.14396@leland.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: DSG, Stanford University, CA 94305 USA
- Date: Sat, 5 Sep 92 16:03:07 GMT
- Lines: 45
-
- Hi DSP hackers-
-
- Thanks to mlelstv@specklec.mpifr-bonn.mpg.de for pointing out that my posting
- was rather nonsense. What happened was that I grabbed the wrong file and
- posted that instead of the correct (working and compilable) version of the
- arccos macro. Here is the correct version for those who are interested.
-
- =======================================================================
- ; arccos.asm
- ; Calculates the arc-cosine of the input to 8 bits.
- ; The output is between 0 and +127 and is in a
- ;
- ; Copyright! February 20,1992
- ; Free for non-profit usage
- ;
- ; Avery Wang
- ; Ruhr-Uni-Bochum
- ; Institut fuer Neuroinformatik
- ; ND03, Postfach 102148
- ; W-4630 Bochum
- ; Germany
- ; avery@neuroinformatik.ruhr-uni-bochum.de or
- ; awang@isl.stanford.edu
-
- ; uses the Sine-ROM and simply does a table lookup.
- ; input and output are in a
- ; uses a,b,x0,y0,r6,r7,n7
- arccos macro
- move #$140,r7 ;offset
- move #$40,n7 ;guess
- move n7,b
- do #7,_arccos_loop
- lua (r7)+n7,r6 ;save guess
- nop
- asr b a,x0 y:(r6),y0 ;make increment smaller, lookup cosine
- cmp y0,a b,n7
- tlt x0,a r6,r7 ;dummy move, if arg>table value, keep old guess
- nop
- _arccos_loop
- move r7,a
- move #$140,y0
- sub y0,a ;result is here
-
- endm
-
-