以下是c语言
#include<stdio.h>
void main()
{
short n=7;
short result;
result=factfunc(n);
printf("factorial=%d",result);
}
以下是线性汇编
.def _factfunc
_factfunc: MV A4,A1
SUB A1,1,A1
LOOP: MPY A4,A1,A4
NOP
SUB A1,1,A1
[A1] B LOOP
NOP 5
B B3
NOP 5
.end
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.
以下是c语言
#include<stdio.h>
void main()
{
short n=7;
short result;
result=factfunc(n);
printf("factorial=%d",result);
}
以下是线性汇编
.def _factfunc
_factfunc: MV A4,A1
SUB A1,1,A1
LOOP: MPY A4,A1,A4
NOP
SUB A1,1,A1
[A1] B LOOP
NOP 5
B B3
NOP 5
.end
谢谢,编译运行都可以通过了,但是有如下warning,虽然对结果没影响,可是还是想解决,谢了
"../factorial.c", line 13: warning #225-D: function declared implicitly
warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
warning #10210-D: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size
henry liu 说:谢谢,编译运行都可以通过了,但是有如下warning,虽然对结果没影响,可是还是想解决,谢了
"../factorial.c", line 13: warning #225-D: function declared implicitly
warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
warning #10210-D: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size
在cmd文件中加入
-heap 0x400
-stack 0x400
即可,提示你堆栈没有初始化长度