1 / 13

TMS320C24X 寻址方式和指令系统 汇编语言例程讲解

TMS320C24X 寻址方式和指令系统 汇编语言例程讲解. 例一 : 1 完成 Z=X+Y; 2 将位于数据区地址 201H 开始的 4 个单元的数值复制到 300H 开始的 4 个单元;. .global start ; 定义全局标号 .sect “ .reset ” B start ;汇编语言程序的执行直接从用户指定的入口开始,此处, start 是入口标号,这个标号可自定 ;在 CC 中,可以在 optional 中注明汇编程序的入口地址,那么该段可以不用编写. .text

base
Download Presentation

TMS320C24X 寻址方式和指令系统 汇编语言例程讲解

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TMS320C24X 寻址方式和指令系统汇编语言例程讲解 DSP芯片技术及应用

  2. 例一 : 1 完成Z=X+Y; 2 将位于数据区地址201H开始的4个单元的数值复制到300H开始的4个单元; DSP芯片技术及应用

  3. .global start ; 定义全局标号 .sect “.reset” B start ;汇编语言程序的执行直接从用户指定的入口开始,此处,start是入口标号,这个标号可自定 ;在CC中,可以在optional 中注明汇编程序的入口地址,那么该段可以不用编写 DSP芯片技术及应用

  4. .text .bss x,1 ;三个变量各为一个字 ;(16位,非初始化段) .bss y,1 .bss z,1 .text start: DSP芯片技术及应用

  5. ldp #x ; 因下面诸变量使用直接 ;寻址,装载DP值 splk #1,x ; 变量赋初值,x=1 splk #2,y ; y=2 lacc x ; 将x的值装载至累加器 add y ; 累加器加上y的值 sacl z ; 将累加器结果(32位)的低 ;16位存放到变量z DSP芯片技术及应用

  6. ldp #4 ; 直接寻址,装载DP值,页指 ;针指向片内数据区DARAM B0 splk #1,1 ; 绝对地址201H开始的四个单元 ; 存1,2,3,4 splk #2,2 splk #3,3 splk #4,4 DSP芯片技术及应用

  7. ; 以下使用间接寻址将201H开始的4个单元的数 ; 转存到300H开始的4个单元 lar ar0,#201h ; 源起始地址存在辅助寄存器0 lar ar1,#300h ; 目的起始地址存在辅助寄存器1 lar ar2,#3 ; 循环计数值为移动数-1 mar*,ar0 ; 设置当前辅助寄存器为ar0 DSP芯片技术及应用

  8. loop1: ; 开始循环搬移数据 lacc *+,ar1 ; 将当前辅助寄存器(ar0);所 ;指向的数据内存单元的值装载到acc, ; ar0加1,设置当前辅助寄存器为ar1 sacl *+,ar2 ; acc低16位存放到当前辅助寄存;器(ar1)指定的单元, ; ar1加1,设置当前辅助寄存器为ar2 banz loop1,ar0 ; 当前辅助寄存器(ar2)如果不等于0则当前辅助寄存器(ar2)减1,转loop1 xh: b xh ; 空循环 .end DSP芯片技术及应用

  9. 移动部分另一种方法: mar*,ar1 rpt #3 bldd #201h,*+ DSP芯片技术及应用

  10. 例二 : 完成 汇编编程中中断矢量的段的编写 DSP芯片技术及应用

  11. DSP芯片技术及应用

  12. DSP芯片技术及应用

  13. 混编中要注意的冠以符号的汇编伪指令 .ref 识别在当前模块中使用但在其他模块中定义的符号 .def 识别在当前模块中定义且可以被其他模块使用的符号 .global 声明外部符号以便在连接时它可以用至其他模块 本指令对于已定义的符号起.def的作用,对未定义的符号起.ref作用 DSP芯片技术及应用

More Related