我的老板让我把它转换成装配,我对装配知之甚少.有人可以帮帮我吗?
这是给我的C-pseudo代码
//Global Variables
#define HRM_PERIOD 15
int hrArr [HRM_PERIOD]
int *hrPt = hrArr;
/*
Function addtoarray
Parameter: int np - a value to add to the array
Description: Stores 16-bit value np in array using global pointer hraPt.
hraPt is incremented so that the next call will add the value
to the next element in the array. The pointer wraps to start
when it reaches the end of the array
*/
void addToArray(int np)
{
*hraPt = np;// save value
hraPt++; // increment pointer
// wrap around
if (hraPt == hrArr + HRM_PERIOD)
hraPt = hrArr
}
Run Code Online (Sandbox Code Playgroud)
请帮我
你能试试海湾合作委员会的-S选项吗?
这是文档
-S选项:
"在编译阶段之后停止;不进行汇编.对于指定的每个非汇编器输入文件,输出采用汇编程序代码文件的形式.默认情况下,源文件的汇编程序文件名是通过替换后缀来完成的. '.c','.i'等,带'.s'.忽略不需要编译的输入文件."
我相信如果你把那些代码放在一个文件"source.c"中,并且你已经安装了gcc,那么这将完成工作:
gcc -S source.c
Run Code Online (Sandbox Code Playgroud)
输出将是一个名为:source.s - >汇编代码的文件.