assembly - MOV r/m8,r8 和 MOV r8,r/m8 的区别

标签 assembly x86 nasm machine-code opcode

通过查看英特尔指令卷,我发现了这一点:

1) 88/r ​​MOV r/m8,r8
2) 8A/r MOV r8,r/m8

当我在 NASM 中写下这样的一行,并使用列表选项将其组装时:

mov al, bl

我在列表中得到了这个:

88D8 mov al, bl

很明显 NASM 选择了上面两条指令中的第一条指令,但第二条指令不是选项二吗?如果是,NASM 基于什么理由选择第一个?

最佳答案

不同编码的有趣副作用:来自 A86 手册。

  1. A86 takes advantage of situations in which more than one set of opcodes can be generated for the same instruction. (For example, MOV AX,BX can be generated using either an 89 or 8B opcode, by reversing fields in the following effective address byte. Both forms are absolutely identical in functionality and execution speed.) A86 adopts an unusual mix of choices in such situations. This creates a code-generation "footprint" that occupies no space in your program file, but will enable me to tell, and to demonstrate in a court of law, if a non-trivial object file has been produced by A86. The specification for this "footprint" is sufficiently obscure and complicated that it would be impossible to duplicate by accident. I claim exclusive rights to the particular "footprint" I have chosen, and prohibit anyone from duplicating it. This has at least two specific implications:

    a. Any assembler that duplicates the "footprint" is mine. If it is not identified as mine and issued under these terms, then those who sell or distribute the assembler will be subject to prosecution.

    b. Any program marked with the "footprint" has been produced by my assembler. It is subject to condition 5 above.

关于assembly - MOV r/m8,r8 和 MOV r8,r/m8 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44335265/

相关文章:

arrays - 如何在ARM汇编中正确创建数组?

c++ - 在 Visual Studio Debug模式下编译的可执行文件 : jmp to function body instead of direct address in call

c++ - 双向地址转换还是什么?

assembly - 是否可以用 x86 汇编语言编写 if 语句?

assembly - 为什么用 int 13h 读取扇区后 int 10h 不起作用?

assembly - FASM 是低级汇编器而 NASM 是高级汇编器吗?

assembly - 如何在 x86 程序集中读写网卡?

c - 确定函数参数起始地址

linux - 我如何在 nasm 中获取系统调用 getcwd 返回字符串的真实长度?

c++ - Nasm,C++,传递类对象