MASM/NASM 差异

发布于 2024-08-17 12:05:40 字数 33 浏览 2 评论 0原文

NASM 和 MASM 汇编器之间的语法差异是什么?

What are the syntax differences between the NASM and MASM assemblers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉生梦死 2024-08-24 12:05:40

NASM 文档第 2.2 节的标题为 MASM 用户快速入门,其中列出了 NASM 和 MASM 之间的重要区别。

NASM 2.15 版添加了一些 MASM 兼容性,包括 %use masm 宏包。请参阅第 6.5 节 masm:MASM 兼容性。即使没有宏包,?DUP 也可以在 dbdisplacement[base+index] 等数据指令中工作允许使用 > 来代替 NASM 过去要求的常用 [rdi+4] 语法。

也相关,如何知道汇编代码是否具有特定语法(emu8086、NASM、TASM...)?讨论了一些语法差异。

Section 2.2 of the NASM documentation is titled Quick Start for MASM Users which lists the important differences between NASM and MASM.

NASM version 2.15 added some MASM compatibility, including a %use masm macro package. See section 6.5 masm: MASM compatibility. Even without the macro package, ? and DUP work in data directives like db, and displacement[base+index] is allowed instead of the usual [rdi+4] syntax which NASM used to require.

Also related, How to know if an assembly code has particular syntax (emu8086, NASM, TASM, ...)? discusses some of the syntax differences.

对岸观火 2024-08-24 12:05:40

多么有趣的问题啊。它们之间的区别是,它们不兼容!但话又说回来,nasm 汇编器之间似乎并不兼容。在编译 libvpx 时,我费了很大的劲才学会了它。我认为这个例子说明了一切:

ml64.exe (MSVC 2019) -> 对于 Windows抛出

nasm ->编译一些 *.asm 文件,抛出一些

invalid combination of opcode and operands

Huh?

Windows 版 yasm ->工作

llvm 汇编器 (debian) ->抛出:

    /usr/lib/llvm-13/bin/llvm-as

https://packages.debian.org/experimental/llvm-13

yasm (debian)->作品

nasm (debian) -> GNU 汇编器工作

-> ???

https://manpages.debian.org/experimental/binutils-通用/as.1.en.html

What an interesting question. The difference between them is, they are not compatible! But then again, nasm assemblers are not compatible amongst themselves, it seems. Learned it the hard way, while compiling libvpx. I think this single example says it all:

ml64.exe (MSVC 2019) -> throws

nasm for windows -> compiles some *.asm files, throws on some

invalid combination of opcode and operands

Huh?

yasm for windows -> works

llvm assembler (debian) -> throws:

    /usr/lib/llvm-13/bin/llvm-as

https://packages.debian.org/experimental/llvm-13

yasm (debian) -> works

nasm (debian) -> works

GNU assembler -> ???

https://manpages.debian.org/experimental/binutils-common/as.1.en.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文