[英]How to run Assembly Code in FASM
Hello I downloaded FASM to run Assembly code. 您好,我下载了FASM以运行汇编代码。
I need to write a small program like this 我需要写一个像这样的小程序
Sum:
push %ebp
movl %esp, %ebp
movl 8(%ebp), %ecx
movl 12(%ebp), %edx
xorl %eax, %eax
testl %edx, %edx
je .L34
.L35:
addl (%ecx), %eax
addl $4, %ecx
decl %edx
jnz .L35
.L34:
movl %ebp, %esp
popl %ebp
ret
The problem is that i am not sure how to run it in FASM, do i need to do a include something somewhere or something? 问题是我不确定如何在FASM中运行它,我是否需要在某个地方或某个地方进行包含? my pc is a 64bit and also when i compile something it gives me an error, but if i import one of the examples it works fine.,.. 我的电脑是一个64位,当我编译的东西它给我一个错误,但如果我导入其中一个例子它工作正常..,..
Thank you for your help 谢谢您的帮助
Regards 问候
fasm does not support AT&T syntax. fasm不支持AT&T语法。 Perhaps with some complicated macros it would be possible to add such support, but none of the package-provided includes will provide this feature. 也许对于一些复杂的宏,可以添加这样的支持,但是所提供的包中没有一个会提供此功能。
You'll need to add extra code and specify a format, please refer to the manual, below I'll only translate your code: 您需要添加额外的代码并指定格式,请参阅下面的手册,我只会翻译您的代码:
Sum:
push ebp
mov ebp, esp
mov ecx, [ebp + 8]
mov edx, [ebp + 12]
xor eax, eax
test edx, edx
je .L34
.L35:
add eax, [ecx]
add ecx, 4
dec edx
jnz .L35
.L34:
mov esp, ebp
pop ebp
ret
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.