⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 q15_atan.lst

📁 Texas-Instrument C2000 Series DSP example programs
💻 LST
字号:
C:\DSP\2XX\DSPTOOLS\CGT\6.63B\dspa.exe -v2xx -s -s -l ..\source\q15_atan.asm q15_atan.obj 

TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63  Mon Feb  9 04:52:49 1998
Copyright (c) 1987-1996  Texas Instruments Incorporated 
..\source\q15_atan.asm                                               PAGE    1

       1            ;=====================================================================
       2            ; Name:          Q15_ATAN.ASM
       3            ; Project:       Q15.LIB 
       4            ; Originator:    Martin Staebler
       5            ;=====================================================================
       6            ;        Function:      int q15_atan(int) 
       7            ;                       unsigned q15p_atan(unsigned) 
       8            ;        Status:  
       9            ;
      10            ;        Target:         TMS320C240
      11            ;
      12            ;        History:        (Date, Revision, Who, What)
      13            ;        ------------------------------------------------------------
      14            ;        02/11/97        1.0     STAE    Preliminary
      15            ;======================================================================
      16            
      17            
      18            ;----------------------------------------------------------------------------
      19            ; Include files
      20            ;----------------------------------------------------------------------------
      21                           .include        "q15_atan.inc"   ;lookup table
      22            
      23            
      24            ;--------------------------------------------------------------------
      25            ; int q15_atan(int);
      26            ;--------------------------------------------------------------------
      27            ; Function:      arcus tanges, for fractional q15 format
      28            ;                                                                       
      29            ; Arguments:     fractional q15
      30            ;                min: -1.0   <--> 8000h
      31            ;                max: 0.9999 <--> 7FFFh
      32            ;                                                                       
      33            ; Return value:  scaled angle (-PI/4 .. PI/4)
      34            ;                scaling: PI  (e.g. atan(1.0) = 0.25 or 2000h)
      35            ;
      36            ; Error:         < 2 LSB  (128 point lookup table)
      37            ;--------------------------------------------------------------------
      38                            .def    _q15_atan       ;define global
      39 0081                       .text
      40 0081       _q15_atan:                
      41                    ;context save        
      42                    ;------------
      43 0081 8aa0                  popd    *+              ;push return address
      44 0082 80a0                  sar     AR0, *+         ;push old frame pointer
      45 0083 8180                  sar     AR1, *          
      46 0084 0080                  lar     AR0,*           ;init new frame pointer  
      47 0085 7803                  adrk    #3              ;alocate space for two local variables
      48                            
      49 0086 8b8a                  mar     *,AR2
      50 0087 bf0a                  lar     AR2,#-3      
         0088 fffd  
      51 0089 8be0                  mar     *0+             ;AR2 = &parameter      
      52                            
      53                     ;check if negative or -1        
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63  Mon Feb  9 04:52:49 1998
Copyright (c) 1987-1996  Texas Instruments Incorporated 
..\source\q15_atan.asm                                               PAGE    2

      54                     ;-----------------------
      55 008a 1080                  lacc    *
      56 008b 7803                  adrk    #3
      57 008c 9080                  sacl    *               ;local #1 = abs(parameter)
      58 008d e38c                  bcnd    OK,GEQ    
         008e 0096' 
      59 008f bfa0                  sub     #8000h
         0090 8000  
      60 0091 e388                  bcnd    MINUS_1,EQ
         0092 00b7' 
      61 0093 1080                  lacc    *
      62 0094 be02                  neg
      63 0095 9080                  sacl    *               ;local #1 = abs(parameter)
      64                            
      65                    ;calculte atan for POSITIV fractional numbers        
      66                    ;--------------------------------------------
      67 0096 18a0  OK:             lacc    *+,tablen_lg2+1 ;lookup table length = 2^tablen_lg2
      68 0097 9880                  sach    *               ;local #2 = first table address
      69 0098 bf80                  lacc    #table
         0099 0000' 
      70 009a 2080                  add     *
      71 009b a6a0                  tblr    *+              ;local #2 = first value           
      72 009c b801                  add     #1                
      73 009d a680                  tblr    *               ;local #3 = second value           
      74 009e 1090                  lacc    *- 
      75 009f 30a0                  sub     *+              ;ACC = difference = local #3 - #2
      76 00a0 9080                  sacl    *               ;local #3 = difference 
      77 00a1 7380                  lt      *               ;T = difference
      78 00a2 7c02                  sbrk    #2              ;AR2 points to local #1
      79 00a3 1780                  lacc    *,tablen_lg2    ;ACC = local #1 << tablen_lg2
      80 00a4 bfb0                  and     #7FFFh          ;make distance positiv value
         00a5 7fff  
      81 00a6 9080                  sacl    *               ;local #1 = distance 
      82 00a7 54a0                  mpy     *+              ;differnce * distance
      83 00a8 bf01                  spm     1
      84 00a9 6a90                  lacc    *-,16           ;ACCH = local #2 = first value
      85 00aa be04                  apac                    ;ACC += distance * difference
      86 00ab 9880                  sach    *               ;local #1 = 'positiv' result         
      87                            
      88                    ;correct sign, if necessary         
      89                    ;--------------------------
      90 00ac bf0a                  lar     AR2,#-3      
         00ad fffd  
      91 00ae 8be0                  mar     *0+             ;AR2 = &parameter      
      92 00af 1080                  lacc    *               
      93 00b0 7803                  adrk    #3
      94 00b1 e38c                  bcnd    POSITIV,GEQ    
         00b2 00bb' 
      95 00b3 1080                  lacc    *
      96 00b4 be02                  neg                     ;2's complement
      97 00b5 7980                  b       EPIO
         00b6 00bc' 
      98            
      99 00b7 bf80  MINUS_1:        lacc    #-4000h
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63  Mon Feb  9 04:52:49 1998
Copyright (c) 1987-1996  Texas Instruments Incorporated 
..\source\q15_atan.asm                                               PAGE    3

         00b8 c000  
     100 00b9 7980                  b       EPIO                   
         00ba 00bc' 
     101            
     102 00bb 1080  POSITIV:        lacc    *               ;ACCL = fractional result       
     103                            ;b       EPIO           ;does already
     104            
     105            
     106                    ;context restore                
     107                    ;---------------
     108 00bc bf00  EPIO:           spm     0               ;default 'C' setting                
     109 00bd 8b89                  mar     *,AR1
     110 00be 7c04                  sbrk    #(3+1)          ;pop local var's+1 from stack
     111 00bf 0090                  lar     ar0, *-         ;restore old frame pointer
     112 00c0 7680                  pshd    *               ;restore return address
     113 00c1 ef00                  ret
     114                    
     115                    
     116                   
     117            
     118            
     119            ;--------------------------------------------------------------------
     120            ; unsigned q15p_atan(unsigned);
     121            ;--------------------------------------------------------------------
     122            ; Function:      arcus tanges, for positiv fractional q15 format
     123            ;                                                                       
     124            ; Arguments:     fractional q15
     125            ;                min: 9.0    <--> 0000h
     126            ;                max: 0.9999 <--> 7FFFh
     127            ;                                                                       
     128            ; Return value:  scaled angle (0 .. PI/4)
     129            ;                scaling: PI  (e.g. atan(1.0) = 0.25 or 2000h)
     130            ;
     131            ; Error:         < 2 LSB  (128 point lookup table)
     132            ;--------------------------------------------------------------------
     133                            .def    _q15p_atan       ;define global
     134 00c2                       .text
     135 00c2       _q15p_atan:                
     136                    ;context save        
     137                    ;------------
     138 00c2 8aa0                  popd    *+              ;push return address
     139 00c3 80a0                  sar     AR0, *+         ;push old frame pointer
     140 00c4 8180                  sar     AR1, *          
     141 00c5 0080                  lar     AR0,*           ;init new frame pointer  
     142 00c6 7803                  adrk    #3              ;alocate space for three local variables
     143                            
     144 00c7 8b8a                  mar     *,AR2
     145 00c8 bf0a                  lar     AR2,#-3      
         00c9 fffd  
     146 00ca 8be0                  mar     *0+             ;AR2 = &parameter      
     147                            
     148                     ;local #1 = parameter
     149                     ;--------------------
     150 00cb 1080                  lacc    *
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63  Mon Feb  9 04:52:49 1998
Copyright (c) 1987-1996  Texas Instruments Incorporated 
..\source\q15_atan.asm                                               PAGE    4

     151 00cc 7803                  adrk    #3
     152 00cd 9080                  sacl    *               ;local #1 = parameter
     153                            
     154                    ;calculte atan for POSITIV fractional numbers        
     155                    ;--------------------------------------------
     156 00ce 18a0                  lacc    *+,tablen_lg2+1 ;lookup table length = 2^tablen_lg2
     157 00cf 9880                  sach    *               ;local #2 = first table address
     158 00d0 bf80                  lacc    #table
         00d1 0000' 
     159 00d2 2080                  add     *
     160 00d3 a6a0                  tblr    *+              ;local #2 = first value           
     161 00d4 b801                  add     #1                
     162 00d5 a680                  tblr    *               ;local #3 = second value           
     163 00d6 1090                  lacc    *- 
     164 00d7 30a0                  sub     *+              ;ACC = difference = local #3 - #2
     165 00d8 9080                  sacl    *               ;local #3 = difference 
     166 00d9 7380                  lt      *               ;T = difference
     167 00da 7c02                  sbrk    #2              ;AR2 points to local #1
     168 00db 1780                  lacc    *,tablen_lg2    ;ACC = local #1 << tablen_lg2
     169 00dc bfb0                  and     #7FFFh          ;make distance positiv value
         00dd 7fff  
     170 00de 9080                  sacl    *               ;local #1 = distance 
     171 00df 54a0                  mpy     *+              ;differnce * distance
     172 00e0 bf01                  spm     1
     173 00e1 6a90                  lacc    *-,16           ;ACCH = local #2 = first value
     174 00e2 be04                  apac                    ;ACC += distance * difference
     175 00e3 9880                  sach    *               ;local #1 = 'positiv' result         
     176 00e4 1080                  lacc    *               ;put into lowwer ACC
     177            
     178                    ;context restore                
     179                    ;---------------
     180 00e5 bf00                  spm     0               ;default 'C' setting                
     181 00e6 8b89                  mar     *,AR1
     182 00e7 7c04                  sbrk    #(3+1)          ;pop local var's+1 from stack
     183 00e8 0090                  lar     ar0, *-         ;restore old frame pointer
     184 00e9 7680                  pshd    *               ;restore return address
     185 00ea ef00                  ret
     186                    
     187                    
     188                   
     189            

 No Errors,  No Warnings

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -