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

📄 fir.asm

📁 TMS320C3X 汇编语言程序编译环境
💻 ASM
字号:

         .globl FIR ; Entry point for execution

         .global start,INIT,BEGIN,OUTPUT,AK

         .data
MASK     .word 0FFFFFFFFH
BLK0     .word 0809800H ; 片内1K×32bit RAM块0起始地址
BLK1     .word 0809C00H ; 片内1K×32bit RAM块1起始地址
STCK     .word 0809F00H ; 堆栈起始地址
CTRL     .word 0808000H ; Pointer for peripheral±bus memory map
DMACTL   .word 0000000H ; Init for DMA control (0)
TIM0CTL  .word 0000000H ; Init of timer 0 control (32)
TIM1CTL  .word 0000000H ; Init of timer 1 control (48)
SERGLOB0 .word 0000000H ; Init of serial 0 glbl control (64)
SERPRTX0 .word 0000000H ; Init of serial 0 xmt port control (66)
SERPRTR0 .word 0000000H ; Init of serial 0 rcv port control (67)
SERTIM0  .word 0000000H ; Init of serial 0 timer control (68)
SERGLOB1 .word 0000000H ; Init of serial 1 glbl control (80)
SERPRTX1 .word 0000000H ; Init of serial 1 xmt port control (82)
SERPRTR1 .word 0000000H ; Init of serial 1 rcv port control (83)
SERTIM1  .word 0000000H ; Init of serial 1 timer control (84)
PARINT   .word 0000000H ; Init of parallel interface control (100)
IOINT    .word 0000000H ; Init of I/O interface control (96)
INPUT    .WORD INP
OUTPUT   .WORD OUP

         .sect ".text:vectors"; Named section 
start    .word INIT ; load address INIT to PC
         .space 63 ; Reserved space

         .text 
INIT:    LDP 0,DP ; Point the DP register to page 0
         LDI 1800H,ST ; Clear and enable cache, and disable OVM
         LDI @MASK,IE ; Unmask all interrupts
         LDI @BLK0,AR0 ; AR0 points to block 0
         LDI @BLK1,AR1 ; AR1 points to block 1
         LDF 0.0,R0    ; 0 register R0
         RPTS 1023 ; Repeat 1024 times ...
         STF R0,*AR0++(1) ; Zero out location in RAM block 0 and ...
      || STF R0,*AR1++(1) ; Zero out location in RAM block 1
         LDI @CTRL,AR0 ; Load in AR0 the pointer to control registers
	  LDI @DMACTL,R0
	  STI R0,*+AR0(0) ; Init DMA control
	  LDI @TIM0CTL,R0
	  STI R0,*+AR0(32) ; Init timer 0 control
	  LDI @TIM1CTL,R0
	  STI R0,*+AR0(48) ; Init timer 1 control
	  LDI @SERGLOB0,R0
	  STI R0,*+AR0(64) ; Init serial 0 global control
	  LDI @SERPRTX0,R0
	  STI R0,*+AR0(66) ; Init serial 0 xmt control
	  LDI @SERPRTR0,R0
	  STI R0,*+AR0(67) ; Init serial 0 rcv control
	  LDI @SERTIM0,R0
	  STI R0,*+AR0(68) ; Init serial 0 timer control
	  LDI @SERGLOB1,R0
	  STI R0,*+AR0(80) ; Init serial 1 global control
	  LDI @SERPRTX1,R0
	  STI R0,*+AR0(82) ; Init serial 1 xmt control
	  LDI @SERPRTR1,R0
	  STI R0,*+AR0(83) ; Init serial 1 rcv control
	  LDI @SERTIM1,R0
	  STI R0,*+AR0(84) ; Init serial 1 timer control
	  LDI @PARINT,R0
	  STI R0,*+AR0(100) ; Init parallel interface control (C30 only)
	  LDI @IOINT,R0
	  STI R0,*+AR0(96) ; Init I/O interface control
	  LDI @STCK,SP ; Init the stack pointer
         OR  2000H,ST ; Global interrupt enable
 
          LDI 1,R0    ;
          LDI 3,R1    ;
          LDI @INPUT,AR0  ;
	   LDI @INPUT,AR1  ;   
          ADDI 1,AR1      ;
          LDI 5,RC        ;
          LDI 2,IR0       ;
          RPTS RC 
D_IN:     STF R0,*AR0++(IR0) ;init x[e]  ;
      ||  STF R1,*AR1++(IR0) ;init x[o]  ;

          LDI @AK,AR0     ;POINTS TO X
          LDI @INP,AR1
          LDI @OUP,AR2
	   LDI 20,RC
	   LDI 12,BK
INLOO:    MPYF3 *AR0++,*AR1++(1)%,R0;R0=h(N-1)*x(n-(N-1))
          LDF 0.0,R2;
          RPTB LOO
          MPYF3 *AR0++(1),*AR1++(1)%,R0;R0=h(N-1-I)*x(n-(N-1-I))
	|| ADDF3 R0,R2,R2; MULTIPLY AND ADD OPERATION   
          ADDF R0,R2,R0
LOO       STF  R0,*AR2++
          BR  $; Branch to itself at the end

        .data
AK
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.3
       .float  0.0
       .float  0.0
       .float  0.0
INP 	.usect "IN",12 ; Memory with input data
OUP    .usect "OUT",26
	.end






⌨️ 快捷键说明

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