提交 abc7edf9 创建 作者: 赵鹏翀's avatar 赵鹏翀

init template

上级
/Debug
/Release
<?xml version="1.0" encoding="gb2312"?>
<ASMProject Version="1.00" Name="Lab006" TemplatePath="console(c)\Project" ProjectID="e4589682-a85d-439b-96a4-4c616015d937" IsSubmitWork="0">
<Configurations>
<Configuration Name="Debug" DebuggerFlavor="0">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool" PreprocessorDefinitions="_DEBUG" GenerateDebugInformation="-1" LanguageStandard="c99"/>
<Tool Name="PreLinkEventTool"/>
<Tool Name="GCCLinkerTool"/>
<Tool Name="PostBuildEventTool"/>
</Configuration>
<Configuration Name="Release" DebuggerFlavor="0">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool" PreprocessorDefinitions="NDEBUG" LanguageStandard="c99"/>
<Tool Name="PreLinkEventTool"/>
<Tool Name="GCCLinkerTool" StripDebugInfo="-1"/>
<Tool Name="PostBuildEventTool"/>
</Configuration>
</Configurations>
<Files>
<Filter Name="ͷļ" Filter="h;hpp;hxx">
<File RelativePath=".\console.h">
</File>
</Filter>
<Filter Name="Դļ" Filter="cpp;c;cc;cxx">
<File RelativePath=".\asmfun.s">
</File>
<File RelativePath=".\console.c">
</File>
</Filter>
</Files>
</ASMProject>
添加文件
.globl _asmfun
_asmfun:
#根据以下要求,完成汇编代码的编写
#使用cmp指令比较存在全局变量中的两个数据,根据比较结果跳转到不同分支中设置Result的值
#两个数相等,Result=0;第一个数较小时,Result=-1;第一个数较大时,Result=1。
L4:
ret #程序返回
\ No newline at end of file
#include "console.h"
int Optr1; // 定义全局变量
int Optr2;
int Result; // 比较结果
unsigned long asmfun(); // 声明函数asmfun()
int main(int argc, char* argv[])
{
printf("请输入两个数字用来比较\n");
// 将输入数据保存在全局变量中供使用
scanf("%d %d", &Optr1, &Optr2);
// 调用函数asmfun()
asmfun();
// 输出比较结果
if(Result == 0)
{
printf("输入的两个数字相等\n");
}
if(Result == -1)
{
printf("输入的数字不等,第一个数字较小\n");
}
if(Result == 1)
{
printf("输入的数字不等,第一个数字较大\n");
}
return 0;
}
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <stdio.h>
/* TODO: 在此处引用程序需要的其他头文件 */
#endif /* _CONSOLE_H_ */
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论