The
built-in assembler supports all of the Intel-documented opcodes for general
application use. Note that operating system privileged instructions may not be
supported. Specifically, the following families of instructions are supported:
· Pentium family
· Pentium Pro and Pentium II
· Pentium III
· Pentium IV
In
addition, the built-in assembler supports the following instruction sets
· AMD 3DNow! (from the AMD K6 onwards)
· AMD Enhanced 3DNow (from the AMD Athlon onwards)
For a complete description of each instruction, refer to your microprocessor documentation.
The RET instruction opcode always generates a near return.
Unless otherwise directed, the built-in assembler optimizes jump instructions by automatically selecting the shortest, and therefore most efficient, form of a jump instruction. This automatic jump sizing applies to the unconditional jump instruction (JMP), and to all conditional jump instructions when the target is a label (not a procedure or function).
For an unconditional jump
instruction (JMP), the built-in assembler generates a short jump (one-byte
opcode followed by a one-byte displacement) if the distance to the target label
is -128 to 127 bytes. Otherwise it generates a near jump (one-byte opcode
followed by a two-byte displacement).
For a
conditional jump instruction, a short jump (one-byte opcode followed by a
one-byte displacement) is generated if the distance to the target label is -128
to 127 bytes. Otherwise, the built-in assembler generates a short jump with the
inverse condition, which jumps over a near jump to the target label (five bytes
in total). For example, the assembler statement
JC Stop
where Stop isn’t within reach of a
short jump, is converted to a machine code sequence that corresponds to this:
JNC Skip
JMP Stop
Skip:
Jumps to the entry points of procedures and functions are always near.
内建汇编程序支持所有由Intel对一般应用程序使用发布的操作码。注意:可能不支持某些操作系统特有的指令。特别支持下列CPU系列:
· Pentium系列
· Pentium Pro和Pentium II
· Pentium III
· Pentium IV
此外,内建汇编程序支持下列指令集:
· AMD 3DNow!(来自早先的AMD K6)
· AMD Enhanced 3DNow(来自早先的AMD Athlon)
要了解每个指令的完整描述,可以参考有关的微处理器文档。
RET指令操作码总是产生一个近的返回。
在跳转指令中,内建汇编程序通过自动选择最短的因此也是最有效的指令优化跳转指令,除非有其它特别指示。这种自动调整适用于无条件的跳转指令(JMP),以及所有目标是标号(不是一个过程或函数)的条件跳转指令。
对于无条件跳转(JMP),如果到目标标号的距离在 -128到127个字节之间,那么内建汇编程序产生一个短的跳转(一个字节的操作码后面跟随一个字节的偏移量)。否则产生一个近的跳转(一个字节的操作码后面跟随一个双字节的偏移量)。
对于条件转换,如果到目标标号的记录在 -128到127个字节之间,那么将产生一个短的跳转(一个字节的操作码后面跟随一个字节的偏移量)。否则,将产生一个相反条件的短的跳转,该跳转越过对目标标号的一个近的跳转(总共五个字节)。例如,汇编语句
JC Stop
这里的Stop不在短的跳转范围之内,那么该语句将被转换成如下相应的机器代码:
JNC Skip
JMP Stop
Skip:
到过程和函数入口点的跳转总是近的跳转。