程序集的C伪代码

程序集的C伪代码,c,assembly,C,Assembly,我的老板让我把它转换成汇编,而我对汇编知之甚少。有人能帮我吗 这是给我的C伪代码 //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 us

我的老板让我把它转换成汇编,而我对汇编知之甚少。有人能帮我吗

这是给我的C伪代码

 //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
}

请帮助我

您能试试GCC的-S选项吗

这是文件吗

-S选项:

“在编译阶段结束后停止;不要汇编。对于指定的每个非汇编程序输入文件,输出是汇编程序代码文件的形式。 默认情况下,源文件的汇编程序文件名是通过将后缀'.c'、'.i'等替换为'.s'来生成的。 不需要编译的输入文件将被忽略。“

我相信,如果您将该代码放在文件“source.c”中,并且安装了gcc,则可以完成以下工作:

gcc -S source.c

输出将是一个名为:source.s->汇编代码的文件。

用于什么体系结构和处理器?听起来不太刺耳,但您的上司似乎在有效地将任务分配给资源方面存在问题。如果公司需要进行汇编开发,他们可能会雇佣一名汇编开发人员。你的“老板”可能是大学教授吗?你不能用编译器来完成吗?他们基本上就是这么做的,而且他们通常比我们做得更好。为什么你的老板要你这么做?这看起来更像是家庭作业而不是工作。该死。我刚在MOS-6502汇编中写下,问题就结束了-(更好的办法是,告诉你的老板检查
-S
选项。