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

init template

上级
/Debug
/Release
<?xml version="1.0" encoding="gb2312"?>
<ASMProject Version="1.00" Name="Lab005" TemplatePath="console(c)\Project" ProjectID="8bf3bbfe-e43a-4d2c-bb94-c54ae28146e3" 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:
#根据以下要求,完成汇编代码的编写
#使用eax和ebx完成以下定点运算指令的使用
#将两个全局变量的值32和16分别传入寄存器eax和ebx
mov _Optr1, %eax;
mov _Optr2, %ebx;
#******************************************************************************
#在此处将汇编代码补充完整
#根据计算要求,使用不同的定点运算指令完成程序
#ADD加法运算指令,计算32+16,注意计算结果会保存到寄存器eax中
#SUB减法运算指令,计算48-16
#MUL乘法运算指令,计算32*16
#DIV除法运算指令,计算512/16
#INC自增指令,计算32+1
#DEC自减指令,计算33-1
#NEG取负指令,对32取负
#******************************************************************************
ret #程序返回
\ No newline at end of file
#include "console.h"
int Optr1; // 定义两个全局变量供汇编程序中使用
int Optr2;
unsigned long asmfun(); // 声明函数asmfun()
int main(int argc, char* argv[])
{
Optr1 = 32; // 初值
Optr2 = 16;
asmfun(); // 调用函数asmfun()
return 0;
}
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <stdio.h>
/* TODO: 在此处引用程序需要的其他头文件 */
#endif /* _CONSOLE_H_ */
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论