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

init template

上级
/Debug
/Release
\ No newline at end of file
<?xml version="1.0" encoding="gb2312"?>
<ASMProject Version="1.00" Name="Demo017" TemplatePath="Lab004\Project" ProjectID="b229c591-a26a-42e5-88f1-6f87a8f7ad4b" IsSubmitWork="0">
<Configurations>
<Configuration Name="Debug" DebuggerFlavor="0">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool" PreprocessorDefinitions="_DEBUG" GenerateDebugInformation="-1" LanguageStandard="c99" AssemblerOutput="-1"/>
<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:
pushl %ebp #R[esp]<--R[esp]-4,M[R[esp]]<--R[ebp],双字
movl %esp, %ebp #R[ebp]<--R[esp],双字
sub $0x10,%esp #R[esp]<--R[esp]-16,双字
movl 8(%ebp), %edx #R[edx]<--M[R[ebp]+8],双字
movb $255, %bl #R[bl]<--255,字节
movw 8(%ebp, %eax, 4), %ax #R[ax]<--M[R[ebp] + R[eax]*4+8],字
movw %dx, 20(%ebp) #M[R[ebp]+20]<--R[dx],字
leal 8(%ecx, %eax, 4), %eax #R[eax]<--R[ecx]+R[eax]*4+8,双字
leave #恢复堆栈栈顶指针。相当于mov %ebp, %esp;pop %ebp
ret #程序返回
\ No newline at end of file
#include "console.h"
unsigned long asmfun(); // asmfun()
int main(int argc, char* argv[])
{
asmfun(); // úasmfun()
return 0;
}
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <stdio.h>
/* TODO: 在此处引用程序需要的其他头文件 */
#endif /* _CONSOLE_H_ */
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论