This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

你好,这个程序是用来计算绝对误差和的,就是计算x和y数组对应四个数的绝对值的和,出错如下,谢谢



#include <stdio.h>
#define count 4
int x[count]={1,2,3,4};
int y[count]={6,6,7,8};
int result=0;

int main()
{
result=abs_4(x,y,count);
printf("result=%d decimal \n",result);
}

.def abs_4
abs_4: .cproc ap, bp, count
.reg a, b, c, diff, sum
zero sum

loop: ldh *ap++, a ;
ldh *bp++, b
sub a, b, diff
abs diff, c
add c, sum, sum
[count] b loop

.return sum
.endproc

这是是c调用汇编,c那部分应该不会错,可能是线性汇编那部分错了,谢谢