Home  >  Article  >  Database  >  TMSC64XX DSP混合汇编2

TMSC64XX DSP混合汇编2

WBOY
WBOYOriginal
2016-06-07 15:43:031568browse

自己研究了一个星期还是没什么进展!自己写的代码和大家分享,希望对大家有帮助! extern int a = 0; //定义外部变量,但要先赋值。 extern int asmfunc(int); //汇编函数 int main() { int ret = 1; ret = asmfunc(ret); printf("ret is %d/n",ret); } .glo

自己研究了一个星期还是没什么进展!自己写的代码和大家分享,希望对大家有帮助!

extern int a = 0;        //定义外部变量,但要先赋值。
extern int asmfunc(int);  //汇编函数

int main()
{
int ret = 1;
ret = asmfunc(ret);
printf("ret is %d/n",ret);

}

 

  .global _asmfunc     //调用C函数

  .global _a                //调用C的变量
   

_asmfunc:
        mvk .S 12,a2
        STW .D a2,*b14(_a)        //给变量a赋值
        LDW .D *+b14(_a),a3      //把变量的值赋给a3寄存器
        NOP 4
        add .L   a3,a4,a3
        STW .D  a3,*b14(_a)
        mv  .S a3,a4
        STW .D a3,*b14(_a)
        mv  .S a3,a4
        mvk .S _a,a2
        B   .S B3
        NOP 5
       .end

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn