#include<stdio.h>
int add(int *n,int *sum)
{
int temp1,temp2;
__asm
{
LDR temp1,[n]
LDR temp2,[sum]
add:
ADD temp2,temp2,temp1
SUBS temp1,temp1,#1
BNE add
}
return temp2;
}
int main()
{
int n=100;
int sum=0;
sum=add(&n,&sum);
printf("The number of number is:%d\n",n);
printf("The sum of number is:%d\n",sum);
}
程序中用指针变量传递变量n,sum的值
C语言调用嵌套汇编
最新推荐文章于 2024-02-02 21:26:39 发布