diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/html/nasmdo10.html | 165 | ||||
-rw-r--r-- | doc/html/nasmdo11.html | 164 | ||||
-rw-r--r-- | doc/html/nasmdo12.html | 178 | ||||
-rw-r--r-- | doc/html/nasmdoc0.html | 378 | ||||
-rw-r--r-- | doc/html/nasmdoc1.html | 159 | ||||
-rw-r--r-- | doc/html/nasmdoc2.html | 650 | ||||
-rw-r--r-- | doc/html/nasmdoc3.html | 753 | ||||
-rw-r--r-- | doc/html/nasmdoc4.html | 1970 | ||||
-rw-r--r-- | doc/html/nasmdoc5.html | 83 | ||||
-rw-r--r-- | doc/html/nasmdoc6.html | 371 | ||||
-rw-r--r-- | doc/html/nasmdoc7.html | 1267 | ||||
-rw-r--r-- | doc/html/nasmdoc8.html | 808 | ||||
-rw-r--r-- | doc/html/nasmdoc9.html | 482 | ||||
-rw-r--r-- | doc/html/nasmdoca.html | 165 | ||||
-rw-r--r-- | doc/html/nasmdocb.html | 3148 | ||||
-rw-r--r-- | doc/html/nasmdocc.html | 1468 | ||||
-rw-r--r-- | doc/html/nasmdoci.html | 2345 | ||||
-rw-r--r-- | doc/info/nasm.info | 398 | ||||
-rw-r--r-- | doc/info/nasm.info-1 | 7484 | ||||
-rw-r--r-- | doc/info/nasm.info-2 | 6521 | ||||
-rw-r--r-- | doc/info/nasm.info-3 | 1284 | ||||
-rw-r--r-- | doc/inslist.src | 3130 | ||||
-rw-r--r-- | doc/nasmdoc.pdf | bin | 0 -> 689552 bytes | |||
-rw-r--r-- | doc/nasmdoc.ps | 12251 | ||||
-rw-r--r-- | doc/nasmdoc.txt | 12394 |
25 files changed, 58016 insertions, 0 deletions
diff --git a/doc/html/nasmdo10.html b/doc/html/nasmdo10.html new file mode 100644 index 0000000..151dee1 --- /dev/null +++ b/doc/html/nasmdo10.html @@ -0,0 +1,165 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdo11.html">Next Chapter</a> | +<a href="nasmdoc9.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-10">Chapter 10: Mixing 16 and 32 Bit Code</a></h2> +<p>This chapter tries to cover some of the issues, largely related to +unusual forms of addressing and jump instructions, encountered when writing +operating system code such as protected-mode initialisation routines, which +require code that operates in mixed segment sizes, such as code in a 16-bit +segment trying to modify data in a 32-bit one, or jumps between +different-size segments. +<h3><a name="section-10.1">10.1 Mixed-Size Jumps</a></h3> +<p>The most common form of mixed-size instruction is the one used when +writing a 32-bit OS: having done your setup in 16-bit mode, such as loading +the kernel, you then have to boot it by switching into protected mode and +jumping to the 32-bit kernel start address. In a fully 32-bit OS, this +tends to be the <em>only</em> mixed-size instruction you need, since +everything before it can be done in pure 16-bit code, and everything after +it can be pure 32-bit. +<p>This jump must specify a 48-bit far address, since the target segment is +a 32-bit one. However, it must be assembled in a 16-bit segment, so just +coding, for example, +<p><pre> + jmp 0x1234:0x56789ABC ; wrong! +</pre> +<p>will not work, since the offset part of the address will be truncated to +<code><nobr>0x9ABC</nobr></code> and the jump will be an ordinary 16-bit +far one. +<p>The Linux kernel setup code gets round the inability of +<code><nobr>as86</nobr></code> to generate the required instruction by +coding it manually, using <code><nobr>DB</nobr></code> instructions. NASM +can go one better than that, by actually generating the right instruction +itself. Here's how to do it right: +<p><pre> + jmp dword 0x1234:0x56789ABC ; right +</pre> +<p>The <code><nobr>DWORD</nobr></code> prefix (strictly speaking, it should +come <em>after</em> the colon, since it is declaring the <em>offset</em> +field to be a doubleword; but NASM will accept either form, since both are +unambiguous) forces the offset part to be treated as far, in the assumption +that you are deliberately writing a jump from a 16-bit segment to a 32-bit +one. +<p>You can do the reverse operation, jumping from a 32-bit segment to a +16-bit one, by means of the <code><nobr>WORD</nobr></code> prefix: +<p><pre> + jmp word 0x8765:0x4321 ; 32 to 16 bit +</pre> +<p>If the <code><nobr>WORD</nobr></code> prefix is specified in 16-bit +mode, or the <code><nobr>DWORD</nobr></code> prefix in 32-bit mode, they +will be ignored, since each is explicitly forcing NASM into a mode it was +in anyway. +<h3><a name="section-10.2">10.2 Addressing Between Different-Size Segments</a></h3> +<p>If your OS is mixed 16 and 32-bit, or if you are writing a DOS extender, +you are likely to have to deal with some 16-bit segments and some 32-bit +ones. At some point, you will probably end up writing code in a 16-bit +segment which has to access data in a 32-bit segment, or vice versa. +<p>If the data you are trying to access in a 32-bit segment lies within the +first 64K of the segment, you may be able to get away with using an +ordinary 16-bit addressing operation for the purpose; but sooner or later, +you will want to do 32-bit addressing from 16-bit mode. +<p>The easiest way to do this is to make sure you use a register for the +address, since any effective address containing a 32-bit register is forced +to be a 32-bit address. So you can do +<p><pre> + mov eax,offset_into_32_bit_segment_specified_by_fs + mov dword [fs:eax],0x11223344 +</pre> +<p>This is fine, but slightly cumbersome (since it wastes an instruction +and a register) if you already know the precise offset you are aiming at. +The x86 architecture does allow 32-bit effective addresses to specify +nothing but a 4-byte offset, so why shouldn't NASM be able to generate the +best instruction for the purpose? +<p>It can. As in <a href="#section-10.1">section 10.1</a>, you need only +prefix the address with the <code><nobr>DWORD</nobr></code> keyword, and it +will be forced to be a 32-bit address: +<p><pre> + mov dword [fs:dword my_offset],0x11223344 +</pre> +<p>Also as in <a href="#section-10.1">section 10.1</a>, NASM is not fussy +about whether the <code><nobr>DWORD</nobr></code> prefix comes before or +after the segment override, so arguably a nicer-looking way to code the +above instruction is +<p><pre> + mov dword [dword fs:my_offset],0x11223344 +</pre> +<p>Don't confuse the <code><nobr>DWORD</nobr></code> prefix +<em>outside</em> the square brackets, which controls the size of the data +stored at the address, with the one <code><nobr>inside</nobr></code> the +square brackets which controls the length of the address itself. The two +can quite easily be different: +<p><pre> + mov word [dword 0x12345678],0x9ABC +</pre> +<p>This moves 16 bits of data to an address specified by a 32-bit offset. +<p>You can also specify <code><nobr>WORD</nobr></code> or +<code><nobr>DWORD</nobr></code> prefixes along with the +<code><nobr>FAR</nobr></code> prefix to indirect far jumps or calls. For +example: +<p><pre> + call dword far [fs:word 0x4321] +</pre> +<p>This instruction contains an address specified by a 16-bit offset; it +loads a 48-bit far pointer from that (16-bit segment and 32-bit offset), +and calls that address. +<h3><a name="section-10.3">10.3 Other Mixed-Size Instructions</a></h3> +<p>The other way you might want to access data might be using the string +instructions (<code><nobr>LODSx</nobr></code>, +<code><nobr>STOSx</nobr></code> and so on) or the +<code><nobr>XLATB</nobr></code> instruction. These instructions, since they +take no parameters, might seem to have no easy way to make them perform +32-bit addressing when assembled in a 16-bit segment. +<p>This is the purpose of NASM's <code><nobr>a16</nobr></code>, +<code><nobr>a32</nobr></code> and <code><nobr>a64</nobr></code> prefixes. +If you are coding <code><nobr>LODSB</nobr></code> in a 16-bit segment but +it is supposed to be accessing a string in a 32-bit segment, you should +load the desired address into <code><nobr>ESI</nobr></code> and then code +<p><pre> + a32 lodsb +</pre> +<p>The prefix forces the addressing size to 32 bits, meaning that +<code><nobr>LODSB</nobr></code> loads from +<code><nobr>[DS:ESI]</nobr></code> instead of +<code><nobr>[DS:SI]</nobr></code>. To access a string in a 16-bit segment +when coding in a 32-bit one, the corresponding +<code><nobr>a16</nobr></code> prefix can be used. +<p>The <code><nobr>a16</nobr></code>, <code><nobr>a32</nobr></code> and +<code><nobr>a64</nobr></code> prefixes can be applied to any instruction in +NASM's instruction table, but most of them can generate all the useful +forms without them. The prefixes are necessary only for instructions with +implicit addressing: <code><nobr>CMPSx</nobr></code>, +<code><nobr>SCASx</nobr></code>, <code><nobr>LODSx</nobr></code>, +<code><nobr>STOSx</nobr></code>, <code><nobr>MOVSx</nobr></code>, +<code><nobr>INSx</nobr></code>, <code><nobr>OUTSx</nobr></code>, and +<code><nobr>XLATB</nobr></code>. Also, the various push and pop +instructions (<code><nobr>PUSHA</nobr></code> and +<code><nobr>POPF</nobr></code> as well as the more usual +<code><nobr>PUSH</nobr></code> and <code><nobr>POP</nobr></code>) can +accept <code><nobr>a16</nobr></code>, <code><nobr>a32</nobr></code> or +<code><nobr>a64</nobr></code> prefixes to force a particular one of +<code><nobr>SP</nobr></code>, <code><nobr>ESP</nobr></code> or +<code><nobr>RSP</nobr></code> to be used as a stack pointer, in case the +stack segment in use is a different size from the code segment. +<p><code><nobr>PUSH</nobr></code> and <code><nobr>POP</nobr></code>, when +applied to segment registers in 32-bit mode, also have the slightly odd +behaviour that they push and pop 4 bytes at a time, of which the top two +are ignored and the bottom two give the value of the segment register being +manipulated. To force the 16-bit behaviour of segment-register push and pop +instructions, you can use the operand-size prefix +<code><nobr>o16</nobr></code>: +<p><pre> + o16 push ss + o16 push ds +</pre> +<p>This code saves a doubleword of stack space by fitting two segment +registers into the space which would normally be consumed by pushing one. +<p>(You can also use the <code><nobr>o32</nobr></code> prefix to force the +32-bit behaviour when in 16-bit mode, but this seems less useful.) +<p align=center><a href="nasmdo11.html">Next Chapter</a> | +<a href="nasmdoc9.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdo11.html b/doc/html/nasmdo11.html new file mode 100644 index 0000000..c40eede --- /dev/null +++ b/doc/html/nasmdo11.html @@ -0,0 +1,164 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdo12.html">Next Chapter</a> | +<a href="nasmdo10.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-11">Chapter 11: Writing 64-bit Code (Unix, Win64)</a></h2> +<p>This chapter attempts to cover some of the common issues involved when +writing 64-bit code, to run under Win64 or Unix. It covers how to write +assembly code to interface with 64-bit C routines, and how to write +position-independent code for shared libraries. +<p>All 64-bit code uses a flat memory model, since segmentation is not +available in 64-bit mode. The one exception is the +<code><nobr>FS</nobr></code> and <code><nobr>GS</nobr></code> registers, +which still add their bases. +<p>Position independence in 64-bit mode is significantly simpler, since the +processor supports <code><nobr>RIP</nobr></code>-relative addressing +directly; see the <code><nobr>REL</nobr></code> keyword +(<a href="nasmdoc3.html#section-3.3">section 3.3</a>). On most 64-bit +platforms, it is probably desirable to make that the default, using the +directive <code><nobr>DEFAULT REL</nobr></code> +(<a href="nasmdoc6.html#section-6.2">section 6.2</a>). +<p>64-bit programming is relatively similar to 32-bit programming, but of +course pointers are 64 bits long; additionally, all existing platforms pass +arguments in registers rather than on the stack. Furthermore, 64-bit +platforms use SSE2 by default for floating point. Please see the ABI +documentation for your platform. +<p>64-bit platforms differ in the sizes of the fundamental datatypes, not +just from 32-bit platforms but from each other. If a specific size data +type is desired, it is probably best to use the types defined in the +Standard C header <code><nobr><inttypes.h></nobr></code>. +<p>In 64-bit mode, the default instruction size is still 32 bits. When +loading a value into a 32-bit register (but not an 8- or 16-bit register), +the upper 32 bits of the corresponding 64-bit register are set to zero. +<h3><a name="section-11.1">11.1 Register Names in 64-bit Mode</a></h3> +<p>NASM uses the following names for general-purpose registers in 64-bit +mode, for 8-, 16-, 32- and 64-bit references, respecitively: +<p><pre> + AL/AH, CL/CH, DL/DH, BL/BH, SPL, BPL, SIL, DIL, R8B-R15B + AX, CX, DX, BX, SP, BP, SI, DI, R8W-R15W + EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D-R15D + RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8-R15 +</pre> +<p>This is consistent with the AMD documentation and most other assemblers. +The Intel documentation, however, uses the names +<code><nobr>R8L-R15L</nobr></code> for 8-bit references to the higher +registers. It is possible to use those names by definiting them as macros; +similarly, if one wants to use numeric names for the low 8 registers, +define them as macros. The standard macro package +<code><nobr>altreg</nobr></code> (see +<a href="nasmdoc5.html#section-5.1">section 5.1</a>) can be used for this +purpose. +<h3><a name="section-11.2">11.2 Immediates and Displacements in 64-bit Mode</a></h3> +<p>In 64-bit mode, immediates and displacements are generally only 32 bits +wide. NASM will therefore truncate most displacements and immediates to 32 +bits. +<p>The only instruction which takes a full 64-bit immediate is: +<p><pre> + MOV reg64,imm64 +</pre> +<p>NASM will produce this instruction whenever the programmer uses +<code><nobr>MOV</nobr></code> with an immediate into a 64-bit register. If +this is not desirable, simply specify the equivalent 32-bit register, which +will be automatically zero-extended by the processor, or specify the +immediate as <code><nobr>DWORD</nobr></code>: +<p><pre> + mov rax,foo ; 64-bit immediate + mov rax,qword foo ; (identical) + mov eax,foo ; 32-bit immediate, zero-extended + mov rax,dword foo ; 32-bit immediate, sign-extended +</pre> +<p>The length of these instructions are 10, 5 and 7 bytes, respectively. +<p>The only instructions which take a full 64-bit <em>displacement</em> is +loading or storing, using <code><nobr>MOV</nobr></code>, +<code><nobr>AL</nobr></code>, <code><nobr>AX</nobr></code>, +<code><nobr>EAX</nobr></code> or <code><nobr>RAX</nobr></code> (but no +other registers) to an absolute 64-bit address. Since this is a relatively +rarely used instruction (64-bit code generally uses relative addressing), +the programmer has to explicitly declare the displacement size as +<code><nobr>QWORD</nobr></code>: +<p><pre> + default abs + + mov eax,[foo] ; 32-bit absolute disp, sign-extended + mov eax,[a32 foo] ; 32-bit absolute disp, zero-extended + mov eax,[qword foo] ; 64-bit absolute disp + + default rel + + mov eax,[foo] ; 32-bit relative disp + mov eax,[a32 foo] ; d:o, address truncated to 32 bits(!) + mov eax,[qword foo] ; error + mov eax,[abs qword foo] ; 64-bit absolute disp +</pre> +<p>A sign-extended absolute displacement can access from -2 GB to +2 GB; a +zero-extended absolute displacement can access from 0 to 4 GB. +<h3><a name="section-11.3">11.3 Interfacing to 64-bit C Programs (Unix)</a></h3> +<p>On Unix, the 64-bit ABI is defined by the document: +<p> +<a href="http://www.x86-64.org/documentation/abi.pdf"><code><nobr>http://www.x86-64.org/documentation/abi.pdf</nobr></code></a> +<p>Although written for AT&T-syntax assembly, the concepts apply +equally well for NASM-style assembly. What follows is a simplified summary. +<p>The first six integer arguments (from the left) are passed in +<code><nobr>RDI</nobr></code>, <code><nobr>RSI</nobr></code>, +<code><nobr>RDX</nobr></code>, <code><nobr>RCX</nobr></code>, +<code><nobr>R8</nobr></code>, and <code><nobr>R9</nobr></code>, in that +order. Additional integer arguments are passed on the stack. These +registers, plus <code><nobr>RAX</nobr></code>, +<code><nobr>R10</nobr></code> and <code><nobr>R11</nobr></code> are +destroyed by function calls, and thus are available for use by the function +without saving. +<p>Integer return values are passed in <code><nobr>RAX</nobr></code> and +<code><nobr>RDX</nobr></code>, in that order. +<p>Floating point is done using SSE registers, except for +<code><nobr>long double</nobr></code>. Floating-point arguments are passed +in <code><nobr>XMM0</nobr></code> to <code><nobr>XMM7</nobr></code>; return +is <code><nobr>XMM0</nobr></code> and <code><nobr>XMM1</nobr></code>. +<code><nobr>long double</nobr></code> are passed on the stack, and returned +in <code><nobr>ST0</nobr></code> and <code><nobr>ST1</nobr></code>. +<p>All SSE and x87 registers are destroyed by function calls. +<p>On 64-bit Unix, <code><nobr>long</nobr></code> is 64 bits. +<p>Integer and SSE register arguments are counted separately, so for the +case of +<p><pre> + void foo(long a, double b, int c) +</pre> +<p><code><nobr>a</nobr></code> is passed in <code><nobr>RDI</nobr></code>, +<code><nobr>b</nobr></code> in <code><nobr>XMM0</nobr></code>, and +<code><nobr>c</nobr></code> in <code><nobr>ESI</nobr></code>. +<h3><a name="section-11.4">11.4 Interfacing to 64-bit C Programs (Win64)</a></h3> +<p>The Win64 ABI is described at: +<p> +<a href="http://msdn2.microsoft.com/en-gb/library/ms794533.aspx"><code><nobr>http://msdn2.microsoft.com/en-gb/library/ms794533.aspx</nobr></code></a> +<p>What follows is a simplified summary. +<p>The first four integer arguments are passed in +<code><nobr>RCX</nobr></code>, <code><nobr>RDX</nobr></code>, +<code><nobr>R8</nobr></code> and <code><nobr>R9</nobr></code>, in that +order. Additional integer arguments are passed on the stack. These +registers, plus <code><nobr>RAX</nobr></code>, +<code><nobr>R10</nobr></code> and <code><nobr>R11</nobr></code> are +destroyed by function calls, and thus are available for use by the function +without saving. +<p>Integer return values are passed in <code><nobr>RAX</nobr></code> only. +<p>Floating point is done using SSE registers, except for +<code><nobr>long double</nobr></code>. Floating-point arguments are passed +in <code><nobr>XMM0</nobr></code> to <code><nobr>XMM3</nobr></code>; return +is <code><nobr>XMM0</nobr></code> only. +<p>On Win64, <code><nobr>long</nobr></code> is 32 bits; +<code><nobr>long long</nobr></code> or <code><nobr>_int64</nobr></code> is +64 bits. +<p>Integer and SSE register arguments are counted together, so for the case +of +<p><pre> + void foo(long long a, double b, int c) +</pre> +<p><code><nobr>a</nobr></code> is passed in <code><nobr>RCX</nobr></code>, +<code><nobr>b</nobr></code> in <code><nobr>XMM1</nobr></code>, and +<code><nobr>c</nobr></code> in <code><nobr>R8D</nobr></code>. +<p align=center><a href="nasmdo12.html">Next Chapter</a> | +<a href="nasmdo10.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdo12.html b/doc/html/nasmdo12.html new file mode 100644 index 0000000..9c937f8 --- /dev/null +++ b/doc/html/nasmdo12.html @@ -0,0 +1,178 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoca.html">Next Chapter</a> | +<a href="nasmdo11.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-12">Chapter 12: Troubleshooting</a></h2> +<p>This chapter describes some of the common problems that users have been +known to encounter with NASM, and answers them. It also gives instructions +for reporting bugs in NASM if you find a difficulty that isn't listed here. +<h3><a name="section-12.1">12.1 Common Problems</a></h3> +<h4><a name="section-12.1.1">12.1.1 NASM Generates Inefficient Code</a></h4> +<p>We sometimes get `bug' reports about NASM generating inefficient, or +even `wrong', code on instructions such as +<code><nobr>ADD ESP,8</nobr></code>. This is a deliberate design feature, +connected to predictability of output: NASM, on seeing +<code><nobr>ADD ESP,8</nobr></code>, will generate the form of the +instruction which leaves room for a 32-bit offset. You need to code +<code><nobr>ADD ESP,BYTE 8</nobr></code> if you want the space-efficient +form of the instruction. This isn't a bug, it's user error: if you prefer +to have NASM produce the more efficient code automatically enable +optimization with the <code><nobr>-O</nobr></code> option (see +<a href="nasmdoc2.html#section-2.1.22">section 2.1.22</a>). +<h4><a name="section-12.1.2">12.1.2 My Jumps are Out of Range</a></h4> +<p>Similarly, people complain that when they issue conditional jumps (which +are <code><nobr>SHORT</nobr></code> by default) that try to jump too far, +NASM reports `short jump out of range' instead of making the jumps longer. +<p>This, again, is partly a predictability issue, but in fact has a more +practical reason as well. NASM has no means of being told what type of +processor the code it is generating will be run on; so it cannot decide for +itself that it should generate <code><nobr>Jcc NEAR</nobr></code> type +instructions, because it doesn't know that it's working for a 386 or above. +Alternatively, it could replace the out-of-range short +<code><nobr>JNE</nobr></code> instruction with a very short +<code><nobr>JE</nobr></code> instruction that jumps over a +<code><nobr>JMP NEAR</nobr></code>; this is a sensible solution for +processors below a 386, but hardly efficient on processors which have good +branch prediction <em>and</em> could have used +<code><nobr>JNE NEAR</nobr></code> instead. So, once again, it's up to the +user, not the assembler, to decide what instructions should be generated. +See <a href="nasmdoc2.html#section-2.1.22">section 2.1.22</a>. +<h4><a name="section-12.1.3">12.1.3 <code><nobr>ORG</nobr></code> Doesn't Work</a></h4> +<p>People writing boot sector programs in the <code><nobr>bin</nobr></code> +format often complain that <code><nobr>ORG</nobr></code> doesn't work the +way they'd like: in order to place the <code><nobr>0xAA55</nobr></code> +signature word at the end of a 512-byte boot sector, people who are used to +MASM tend to code +<p><pre> + ORG 0 + + ; some boot sector code + + ORG 510 + DW 0xAA55 +</pre> +<p>This is not the intended use of the <code><nobr>ORG</nobr></code> +directive in NASM, and will not work. The correct way to solve this problem +in NASM is to use the <code><nobr>TIMES</nobr></code> directive, like this: +<p><pre> + ORG 0 + + ; some boot sector code + + TIMES 510-($-$$) DB 0 + DW 0xAA55 +</pre> +<p>The <code><nobr>TIMES</nobr></code> directive will insert exactly enough +zero bytes into the output to move the assembly point up to 510. This +method also has the advantage that if you accidentally fill your boot +sector too full, NASM will catch the problem at assembly time and report +it, so you won't end up with a boot sector that you have to disassemble to +find out what's wrong with it. +<h4><a name="section-12.1.4">12.1.4 <code><nobr>TIMES</nobr></code> Doesn't Work</a></h4> +<p>The other common problem with the above code is people who write the +<code><nobr>TIMES</nobr></code> line as +<p><pre> + TIMES 510-$ DB 0 +</pre> +<p>by reasoning that <code><nobr>$</nobr></code> should be a pure number, +just like 510, so the difference between them is also a pure number and can +happily be fed to <code><nobr>TIMES</nobr></code>. +<p>NASM is a <em>modular</em> assembler: the various component parts are +designed to be easily separable for re-use, so they don't exchange +information unnecessarily. In consequence, the +<code><nobr>bin</nobr></code> output format, even though it has been told +by the <code><nobr>ORG</nobr></code> directive that the +<code><nobr>.text</nobr></code> section should start at 0, does not pass +that information back to the expression evaluator. So from the evaluator's +point of view, <code><nobr>$</nobr></code> isn't a pure number: it's an +offset from a section base. Therefore the difference between +<code><nobr>$</nobr></code> and 510 is also not a pure number, but involves +a section base. Values involving section bases cannot be passed as +arguments to <code><nobr>TIMES</nobr></code>. +<p>The solution, as in the previous section, is to code the +<code><nobr>TIMES</nobr></code> line in the form +<p><pre> + TIMES 510-($-$$) DB 0 +</pre> +<p>in which <code><nobr>$</nobr></code> and <code><nobr>$$</nobr></code> +are offsets from the same section base, and so their difference is a pure +number. This will solve the problem and generate sensible code. +<h3><a name="section-12.2">12.2 Bugs</a></h3> +<p>We have never yet released a version of NASM with any <em>known</em> +bugs. That doesn't usually stop there being plenty we didn't know about, +though. Any that you find should be reported firstly via the +<code><nobr>bugtracker</nobr></code> at +<a href="https://sourceforge.net/projects/nasm/"><code><nobr>https://sourceforge.net/projects/nasm/</nobr></code></a> +(click on "Bugs"), or if that fails then through one of the contacts in +<a href="nasmdoc1.html#section-1.2">section 1.2</a>. +<p>Please read <a href="nasmdoc2.html#section-2.2">section 2.2</a> first, +and don't report the bug if it's listed in there as a deliberate feature. +(If you think the feature is badly thought out, feel free to send us +reasons why you think it should be changed, but don't just send us mail +saying `This is a bug' if the documentation says we did it on purpose.) +Then read <a href="#section-12.1">section 12.1</a>, and don't bother +reporting the bug if it's listed there. +<p>If you do report a bug, <em>please</em> give us all of the following +information: +<ul> +<li>What operating system you're running NASM under. DOS, Linux, NetBSD, +Win16, Win32, VMS (I'd be impressed), whatever. +<li>If you're running NASM under DOS or Win32, tell us whether you've +compiled your own executable from the DOS source archive, or whether you +were using the standard distribution binaries out of the archive. If you +were using a locally built executable, try to reproduce the problem using +one of the standard binaries, as this will make it easier for us to +reproduce your problem prior to fixing it. +<li>Which version of NASM you're using, and exactly how you invoked it. +Give us the precise command line, and the contents of the +<code><nobr>NASMENV</nobr></code> environment variable if any. +<li>Which versions of any supplementary programs you're using, and how you +invoked them. If the problem only becomes visible at link time, tell us +what linker you're using, what version of it you've got, and the exact +linker command line. If the problem involves linking against object files +generated by a compiler, tell us what compiler, what version, and what +command line or options you used. (If you're compiling in an IDE, please +try to reproduce the problem with the command-line version of the +compiler.) +<li>If at all possible, send us a NASM source file which exhibits the +problem. If this causes copyright problems (e.g. you can only reproduce the +bug in restricted-distribution code) then bear in mind the following two +points: firstly, we guarantee that any source code sent to us for the +purposes of debugging NASM will be used <em>only</em> for the purposes of +debugging NASM, and that we will delete all our copies of it as soon as we +have found and fixed the bug or bugs in question; and secondly, we would +prefer <em>not</em> to be mailed large chunks of code anyway. The smaller +the file, the better. A three-line sample file that does nothing useful +<em>except</em> demonstrate the problem is much easier to work with than a +fully fledged ten-thousand-line program. (Of course, some errors +<em>do</em> only crop up in large files, so this may not be possible.) +<li>A description of what the problem actually <em>is</em>. `It doesn't +work' is <em>not</em> a helpful description! Please describe exactly what +is happening that shouldn't be, or what isn't happening that should. +Examples might be: `NASM generates an error message saying Line 3 for an +error that's actually on Line 5'; `NASM generates an error message that I +believe it shouldn't be generating at all'; `NASM fails to generate an +error message that I believe it <em>should</em> be generating'; `the object +file produced from this source code crashes my linker'; `the ninth byte of +the output file is 66 and I think it should be 77 instead'. +<li>If you believe the output file from NASM to be faulty, send it to us. +That allows us to determine whether our own copy of NASM generates the same +file, or whether the problem is related to portability issues between our +development platforms and yours. We can handle binary files mailed to us as +MIME attachments, uuencoded, and even BinHex. Alternatively, we may be able +to provide an FTP site you can upload the suspect files to; but mailing +them is easier for us. +<li>Any other information or data files that might be helpful. If, for +example, the problem involves NASM failing to generate an object file while +TASM can generate an equivalent file without trouble, then send us +<em>both</em> object files, so we can see what TASM is doing differently +from us. +</ul> +<p align=center><a href="nasmdoca.html">Next Chapter</a> | +<a href="nasmdo11.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc0.html b/doc/html/nasmdoc0.html new file mode 100644 index 0000000..2b51d51 --- /dev/null +++ b/doc/html/nasmdoc0.html @@ -0,0 +1,378 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p>This manual documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. +<p><p><a href="nasmdoc1.html">Chapter 1: Introduction</a><br> +<a href="nasmdoc1.html#section-1.1">Section 1.1: What Is NASM?</a><br> +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1: Why Yet Another Assembler?</a><br> +<a href="nasmdoc1.html#section-1.1.2">Section 1.1.2: License Conditions</a><br> +<a href="nasmdoc1.html#section-1.2">Section 1.2: Contact Information</a><br> +<a href="nasmdoc1.html#section-1.3">Section 1.3: Installation</a><br> +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1: Installing NASM under MS-DOS or Windows</a><br> +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2: Installing NASM under Unix</a><br> +<p><a href="nasmdoc2.html">Chapter 2: Running NASM</a><br> +<a href="nasmdoc2.html#section-2.1">Section 2.1: NASM Command-Line Syntax</a><br> +<a href="nasmdoc2.html#section-2.1.1">Section 2.1.1: The <code><nobr>-o</nobr></code> Option: Specifying the Output File Name</a><br> +<a href="nasmdoc2.html#section-2.1.2">Section 2.1.2: The <code><nobr>-f</nobr></code> Option: Specifying the Output File Format</a><br> +<a href="nasmdoc2.html#section-2.1.3">Section 2.1.3: The <code><nobr>-l</nobr></code> Option: Generating a Listing File</a><br> +<a href="nasmdoc2.html#section-2.1.4">Section 2.1.4: The <code><nobr>-M</nobr></code> Option: Generate Makefile Dependencies</a><br> +<a href="nasmdoc2.html#section-2.1.5">Section 2.1.5: The <code><nobr>-MG</nobr></code> Option: Generate Makefile Dependencies</a><br> +<a href="nasmdoc2.html#section-2.1.6">Section 2.1.6: The <code><nobr>-MF</nobr></code> Option: Set Makefile Dependency File</a><br> +<a href="nasmdoc2.html#section-2.1.7">Section 2.1.7: The <code><nobr>-MD</nobr></code> Option: Assemble and Generate Dependencies</a><br> +<a href="nasmdoc2.html#section-2.1.8">Section 2.1.8: The <code><nobr>-MT</nobr></code> Option: Dependency Target Name</a><br> +<a href="nasmdoc2.html#section-2.1.9">Section 2.1.9: The <code><nobr>-MQ</nobr></code> Option: Dependency Target Name (Quoted)</a><br> +<a href="nasmdoc2.html#section-2.1.10">Section 2.1.10: The <code><nobr>-MP</nobr></code> Option: Emit phony targets</a><br> +<a href="nasmdoc2.html#section-2.1.11">Section 2.1.11: The <code><nobr>-F</nobr></code> Option: Selecting a Debug Information Format</a><br> +<a href="nasmdoc2.html#section-2.1.12">Section 2.1.12: The <code><nobr>-g</nobr></code> Option: Enabling Debug Information.</a><br> +<a href="nasmdoc2.html#section-2.1.13">Section 2.1.13: The <code><nobr>-X</nobr></code> Option: Selecting an Error Reporting Format</a><br> +<a href="nasmdoc2.html#section-2.1.14">Section 2.1.14: The <code><nobr>-Z</nobr></code> Option: Send Errors to a File</a><br> +<a href="nasmdoc2.html#section-2.1.15">Section 2.1.15: The <code><nobr>-s</nobr></code> Option: Send Errors to <code><nobr>stdout</nobr></code></a><br> +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16: The <code><nobr>-i</nobr></code> Option: Include File Search Directories</a><br> +<a href="nasmdoc2.html#section-2.1.17">Section 2.1.17: The <code><nobr>-p</nobr></code> Option: Pre-Include a File</a><br> +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18: The <code><nobr>-d</nobr></code> Option: Pre-Define a Macro</a><br> +<a href="nasmdoc2.html#section-2.1.19">Section 2.1.19: The <code><nobr>-u</nobr></code> Option: Undefine a Macro</a><br> +<a href="nasmdoc2.html#section-2.1.20">Section 2.1.20: The <code><nobr>-E</nobr></code> Option: Preprocess Only</a><br> +<a href="nasmdoc2.html#section-2.1.21">Section 2.1.21: The <code><nobr>-a</nobr></code> Option: Don't Preprocess At All</a><br> +<a href="nasmdoc2.html#section-2.1.22">Section 2.1.22: The <code><nobr>-O</nobr></code> Option: Specifying Multipass Optimization</a><br> +<a href="nasmdoc2.html#section-2.1.23">Section 2.1.23: The <code><nobr>-t</nobr></code> Option: Enable TASM Compatibility Mode</a><br> +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24: The <code><nobr>-w</nobr></code> and <code><nobr>-W</nobr></code> Options: Enable or Disable Assembly Warnings</a><br> +<a href="nasmdoc2.html#section-2.1.25">Section 2.1.25: The <code><nobr>-v</nobr></code> Option: Display Version Info</a><br> +<a href="nasmdoc2.html#section-2.1.26">Section 2.1.26: The <code><nobr>-y</nobr></code> Option: Display Available Debug Info Formats</a><br> +<a href="nasmdoc2.html#section-2.1.27">Section 2.1.27: The <code><nobr>--prefix</nobr></code> and <code><nobr>--postfix</nobr></code> Options.</a><br> +<a href="nasmdoc2.html#section-2.1.28">Section 2.1.28: The <code><nobr>NASMENV</nobr></code> Environment Variable</a><br> +<a href="nasmdoc2.html#section-2.2">Section 2.2: Quick Start for MASM Users</a><br> +<a href="nasmdoc2.html#section-2.2.1">Section 2.2.1: NASM Is Case-Sensitive</a><br> +<a href="nasmdoc2.html#section-2.2.2">Section 2.2.2: NASM Requires Square Brackets For Memory References</a><br> +<a href="nasmdoc2.html#section-2.2.3">Section 2.2.3: NASM Doesn't Store Variable Types</a><br> +<a href="nasmdoc2.html#section-2.2.4">Section 2.2.4: NASM Doesn't <code><nobr>ASSUME</nobr></code></a><br> +<a href="nasmdoc2.html#section-2.2.5">Section 2.2.5: NASM Doesn't Support Memory Models</a><br> +<a href="nasmdoc2.html#section-2.2.6">Section 2.2.6: Floating-Point Differences</a><br> +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7: Other Differences</a><br> +<p><a href="nasmdoc3.html">Chapter 3: The NASM Language</a><br> +<a href="nasmdoc3.html#section-3.1">Section 3.1: Layout of a NASM Source Line</a><br> +<a href="nasmdoc3.html#section-3.2">Section 3.2: Pseudo-Instructions</a><br> +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1: <code><nobr>DB</nobr></code> and Friends: Declaring Initialized Data</a><br> +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2: <code><nobr>RESB</nobr></code> and Friends: Declaring Uninitialized Data</a><br> +<a href="nasmdoc3.html#section-3.2.3">Section 3.2.3: <code><nobr>INCBIN</nobr></code>: Including External Binary Files</a><br> +<a href="nasmdoc3.html#section-3.2.4">Section 3.2.4: <code><nobr>EQU</nobr></code>: Defining Constants</a><br> +<a href="nasmdoc3.html#section-3.2.5">Section 3.2.5: <code><nobr>TIMES</nobr></code>: Repeating Instructions or Data</a><br> +<a href="nasmdoc3.html#section-3.3">Section 3.3: Effective Addresses</a><br> +<a href="nasmdoc3.html#section-3.4">Section 3.4: Constants</a><br> +<a href="nasmdoc3.html#section-3.4.1">Section 3.4.1: Numeric Constants</a><br> +<a href="nasmdoc3.html#section-3.4.2">Section 3.4.2: Character Strings</a><br> +<a href="nasmdoc3.html#section-3.4.3">Section 3.4.3: Character Constants</a><br> +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4: String Constants</a><br> +<a href="nasmdoc3.html#section-3.4.5">Section 3.4.5: Unicode Strings</a><br> +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6: Floating-Point Constants</a><br> +<a href="nasmdoc3.html#section-3.4.7">Section 3.4.7: Packed BCD Constants</a><br> +<a href="nasmdoc3.html#section-3.5">Section 3.5: Expressions</a><br> +<a href="nasmdoc3.html#section-3.5.1">Section 3.5.1: <code><nobr>|</nobr></code>: Bitwise OR Operator</a><br> +<a href="nasmdoc3.html#section-3.5.2">Section 3.5.2: <code><nobr>^</nobr></code>: Bitwise XOR Operator</a><br> +<a href="nasmdoc3.html#section-3.5.3">Section 3.5.3: <code><nobr>&</nobr></code>: Bitwise AND Operator</a><br> +<a href="nasmdoc3.html#section-3.5.4">Section 3.5.4: <code><nobr><<</nobr></code> and <code><nobr>>></nobr></code>: Bit Shift Operators</a><br> +<a href="nasmdoc3.html#section-3.5.5">Section 3.5.5: <code><nobr>+</nobr></code> and <code><nobr>-</nobr></code>: Addition and Subtraction Operators</a><br> +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6: <code><nobr>*</nobr></code>, <code><nobr>/</nobr></code>, <code><nobr>//</nobr></code>, <code><nobr>%</nobr></code> and <code><nobr>%%</nobr></code>: Multiplication and Division</a><br> +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7: Unary Operators: <code><nobr>+</nobr></code>, <code><nobr>-</nobr></code>, <code><nobr>~</nobr></code>, <code><nobr>!</nobr></code> and <code><nobr>SEG</nobr></code></a><br> +<a href="nasmdoc3.html#section-3.6">Section 3.6: <code><nobr>SEG</nobr></code> and <code><nobr>WRT</nobr></code></a><br> +<a href="nasmdoc3.html#section-3.7">Section 3.7: <code><nobr>STRICT</nobr></code>: Inhibiting Optimization</a><br> +<a href="nasmdoc3.html#section-3.8">Section 3.8: Critical Expressions</a><br> +<a href="nasmdoc3.html#section-3.9">Section 3.9: Local Labels</a><br> +<p><a href="nasmdoc4.html">Chapter 4: The NASM Preprocessor</a><br> +<a href="nasmdoc4.html#section-4.1">Section 4.1: Single-Line Macros</a><br> +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1: The Normal Way: <code><nobr>%define</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.2">Section 4.1.2: Resolving <code><nobr>%define</nobr></code>: <code><nobr>%xdefine</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.3">Section 4.1.3: Macro Indirection: <code><nobr>%[...]</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.4">Section 4.1.4: Concatenating Single Line Macro Tokens: <code><nobr>%+</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.5">Section 4.1.5: The Macro Name Itself: <code><nobr>%?</nobr></code> and <code><nobr>%??</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.6">Section 4.1.6: Undefining Single-Line Macros: <code><nobr>%undef</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7: Preprocessor Variables: <code><nobr>%assign</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.8">Section 4.1.8: Defining Strings: <code><nobr>%defstr</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.1.9">Section 4.1.9: Defining Tokens: <code><nobr>%deftok</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.2">Section 4.2: String Manipulation in Macros</a><br> +<a href="nasmdoc4.html#section-4.2.1">Section 4.2.1: Concatenating Strings: <code><nobr>%strcat</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.2.2">Section 4.2.2: String Length: <code><nobr>%strlen</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.2.3">Section 4.2.3: Extracting Substrings: <code><nobr>%substr</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.3">Section 4.3: Multi-Line Macros: <code><nobr>%macro</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.3.1">Section 4.3.1: Recursive Multi-Line Macros: <code><nobr>%rmacro</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.3.2">Section 4.3.2: Overloading Multi-Line Macros</a><br> +<a href="nasmdoc4.html#section-4.3.3">Section 4.3.3: Macro-Local Labels</a><br> +<a href="nasmdoc4.html#section-4.3.4">Section 4.3.4: Greedy Macro Parameters</a><br> +<a href="nasmdoc4.html#section-4.3.5">Section 4.3.5: Default Macro Parameters</a><br> +<a href="nasmdoc4.html#section-4.3.6">Section 4.3.6: <code><nobr>%0</nobr></code>: Macro Parameter Counter</a><br> +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7: <code><nobr>%rotate</nobr></code>: Rotating Macro Parameters</a><br> +<a href="nasmdoc4.html#section-4.3.8">Section 4.3.8: Concatenating Macro Parameters</a><br> +<a href="nasmdoc4.html#section-4.3.9">Section 4.3.9: Condition Codes as Macro Parameters</a><br> +<a href="nasmdoc4.html#section-4.3.10">Section 4.3.10: Disabling Listing Expansion</a><br> +<a href="nasmdoc4.html#section-4.3.11">Section 4.3.11: Undefining Multi-Line Macros: <code><nobr>%unmacro</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.3.12">Section 4.3.12: Exiting Multi-Line Macros: <code><nobr>%exitmacro</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.4">Section 4.4: Conditional Assembly</a><br> +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1: <code><nobr>%ifdef</nobr></code>: Testing Single-Line Macro Existence</a><br> +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2: <code><nobr>%ifmacro</nobr></code>: Testing Multi-Line Macro Existence</a><br> +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3: <code><nobr>%ifctx</nobr></code>: Testing the Context Stack</a><br> +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4: <code><nobr>%if</nobr></code>: Testing Arbitrary Numeric Expressions</a><br> +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5: <code><nobr>%ifidn</nobr></code> and <code><nobr>%ifidni</nobr></code>: Testing Exact Text Identity</a><br> +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6: <code><nobr>%ifid</nobr></code>, <code><nobr>%ifnum</nobr></code>, <code><nobr>%ifstr</nobr></code>: Testing Token Types</a><br> +<a href="nasmdoc4.html#section-4.4.7">Section 4.4.7: <code><nobr>%iftoken</nobr></code>: Test for a Single Token</a><br> +<a href="nasmdoc4.html#section-4.4.8">Section 4.4.8: <code><nobr>%ifempty</nobr></code>: Test for Empty Expansion</a><br> +<a href="nasmdoc4.html#section-4.5">Section 4.5: Preprocessor Loops: <code><nobr>%rep</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.6">Section 4.6: Source Files and Dependencies</a><br> +<a href="nasmdoc4.html#section-4.6.1">Section 4.6.1: <code><nobr>%include</nobr></code>: Including Other Files</a><br> +<a href="nasmdoc4.html#section-4.6.2">Section 4.6.2: <code><nobr>%pathsearch</nobr></code>: Search the Include Path</a><br> +<a href="nasmdoc4.html#section-4.6.3">Section 4.6.3: <code><nobr>%depend</nobr></code>: Add Dependent Files</a><br> +<a href="nasmdoc4.html#section-4.6.4">Section 4.6.4: <code><nobr>%use</nobr></code>: Include Standard Macro Package</a><br> +<a href="nasmdoc4.html#section-4.7">Section 4.7: The Context Stack</a><br> +<a href="nasmdoc4.html#section-4.7.1">Section 4.7.1: <code><nobr>%push</nobr></code> and <code><nobr>%pop</nobr></code>: Creating and Removing Contexts</a><br> +<a href="nasmdoc4.html#section-4.7.2">Section 4.7.2: Context-Local Labels</a><br> +<a href="nasmdoc4.html#section-4.7.3">Section 4.7.3: Context-Local Single-Line Macros</a><br> +<a href="nasmdoc4.html#section-4.7.4">Section 4.7.4: <code><nobr>%repl</nobr></code>: Renaming a Context</a><br> +<a href="nasmdoc4.html#section-4.7.5">Section 4.7.5: Example Use of the Context Stack: Block IFs</a><br> +<a href="nasmdoc4.html#section-4.8">Section 4.8: Stack Relative Preprocessor Directives</a><br> +<a href="nasmdoc4.html#section-4.8.1">Section 4.8.1: <code><nobr>%arg</nobr></code> Directive</a><br> +<a href="nasmdoc4.html#section-4.8.2">Section 4.8.2: <code><nobr>%stacksize</nobr></code> Directive</a><br> +<a href="nasmdoc4.html#section-4.8.3">Section 4.8.3: <code><nobr>%local</nobr></code> Directive</a><br> +<a href="nasmdoc4.html#section-4.9">Section 4.9: Reporting User-Defined Errors: <code><nobr>%error</nobr></code>, <code><nobr>%warning</nobr></code>, <code><nobr>%fatal</nobr></code></a><br> +<a href="nasmdoc4.html#section-4.10">Section 4.10: Other Preprocessor Directives</a><br> +<a href="nasmdoc4.html#section-4.10.1">Section 4.10.1: <code><nobr>%line</nobr></code> Directive</a><br> +<a href="nasmdoc4.html#section-4.10.2">Section 4.10.2: <code><nobr>%!</nobr></code><code><nobr><env></nobr></code>: Read an environment variable.</a><br> +<a href="nasmdoc4.html#section-4.11">Section 4.11: Standard Macros</a><br> +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1: NASM Version Macros</a><br> +<a href="nasmdoc4.html#section-4.11.2">Section 4.11.2: <code><nobr>__NASM_VERSION_ID__</nobr></code>: NASM Version ID</a><br> +<a href="nasmdoc4.html#section-4.11.3">Section 4.11.3: <code><nobr>__NASM_VER__</nobr></code>: NASM Version string</a><br> +<a href="nasmdoc4.html#section-4.11.4">Section 4.11.4: <code><nobr>__FILE__</nobr></code> and <code><nobr>__LINE__</nobr></code>: File Name and Line Number</a><br> +<a href="nasmdoc4.html#section-4.11.5">Section 4.11.5: <code><nobr>__BITS__</nobr></code>: Current BITS Mode</a><br> +<a href="nasmdoc4.html#section-4.11.6">Section 4.11.6: <code><nobr>__OUTPUT_FORMAT__</nobr></code>: Current Output Format</a><br> +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7: Assembly Date and Time Macros</a><br> +<a href="nasmdoc4.html#section-4.11.8">Section 4.11.8: <code><nobr>__USE_</nobr></code><em>package</em><code><nobr>__</nobr></code>: Package Include Test</a><br> +<a href="nasmdoc4.html#section-4.11.9">Section 4.11.9: <code><nobr>__PASS__</nobr></code>: Assembly Pass</a><br> +<a href="nasmdoc4.html#section-4.11.10">Section 4.11.10: <code><nobr>STRUC</nobr></code> and <code><nobr>ENDSTRUC</nobr></code>: Declaring Structure Data Types</a><br> +<a href="nasmdoc4.html#section-4.11.11">Section 4.11.11: <code><nobr>ISTRUC</nobr></code>, <code><nobr>AT</nobr></code> and <code><nobr>IEND</nobr></code>: Declaring Instances of Structures</a><br> +<a href="nasmdoc4.html#section-4.11.12">Section 4.11.12: <code><nobr>ALIGN</nobr></code> and <code><nobr>ALIGNB</nobr></code>: Data Alignment</a><br> +<p><a href="nasmdoc5.html">Chapter 5: Standard Macro Packages</a><br> +<a href="nasmdoc5.html#section-5.1">Section 5.1: <code><nobr>altreg</nobr></code>: Alternate Register Names</a><br> +<a href="nasmdoc5.html#section-5.2">Section 5.2: <code><nobr>smartalign</nobr></code>: Smart <code><nobr>ALIGN</nobr></code> Macro</a><br> +<p><a href="nasmdoc6.html">Chapter 6: Assembler Directives</a><br> +<a href="nasmdoc6.html#section-6.1">Section 6.1: <code><nobr>BITS</nobr></code>: Specifying Target Processor Mode</a><br> +<a href="nasmdoc6.html#section-6.1.1">Section 6.1.1: <code><nobr>USE16</nobr></code> & <code><nobr>USE32</nobr></code>: Aliases for BITS</a><br> +<a href="nasmdoc6.html#section-6.2">Section 6.2: <code><nobr>DEFAULT</nobr></code>: Change the assembler defaults</a><br> +<a href="nasmdoc6.html#section-6.3">Section 6.3: <code><nobr>SECTION</nobr></code> or <code><nobr>SEGMENT</nobr></code>: Changing and Defining Sections</a><br> +<a href="nasmdoc6.html#section-6.3.1">Section 6.3.1: The <code><nobr>__SECT__</nobr></code> Macro</a><br> +<a href="nasmdoc6.html#section-6.4">Section 6.4: <code><nobr>ABSOLUTE</nobr></code>: Defining Absolute Labels</a><br> +<a href="nasmdoc6.html#section-6.5">Section 6.5: <code><nobr>EXTERN</nobr></code>: Importing Symbols from Other Modules</a><br> +<a href="nasmdoc6.html#section-6.6">Section 6.6: <code><nobr>GLOBAL</nobr></code>: Exporting Symbols to Other Modules</a><br> +<a href="nasmdoc6.html#section-6.7">Section 6.7: <code><nobr>COMMON</nobr></code>: Defining Common Data Areas</a><br> +<a href="nasmdoc6.html#section-6.8">Section 6.8: <code><nobr>CPU</nobr></code>: Defining CPU Dependencies</a><br> +<a href="nasmdoc6.html#section-6.9">Section 6.9: <code><nobr>FLOAT</nobr></code>: Handling of floating-point constants</a><br> +<p><a href="nasmdoc7.html">Chapter 7: Output Formats</a><br> +<a href="nasmdoc7.html#section-7.1">Section 7.1: <code><nobr>bin</nobr></code>: Flat-Form Binary Output</a><br> +<a href="nasmdoc7.html#section-7.1.1">Section 7.1.1: <code><nobr>ORG</nobr></code>: Binary File Program Origin</a><br> +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2: <code><nobr>bin</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3: Multisection Support for the <code><nobr>bin</nobr></code> Format</a><br> +<a href="nasmdoc7.html#section-7.1.4">Section 7.1.4: Map Files</a><br> +<a href="nasmdoc7.html#section-7.2">Section 7.2: <code><nobr>ith</nobr></code>: Intel Hex Output</a><br> +<a href="nasmdoc7.html#section-7.3">Section 7.3: <code><nobr>srec</nobr></code>: Motorola S-Records Output</a><br> +<a href="nasmdoc7.html#section-7.4">Section 7.4: <code><nobr>obj</nobr></code>: Microsoft OMF Object Files</a><br> +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1: <code><nobr>obj</nobr></code> Extensions to the <code><nobr>SEGMENT</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.4.2">Section 7.4.2: <code><nobr>GROUP</nobr></code>: Defining Groups of Segments</a><br> +<a href="nasmdoc7.html#section-7.4.3">Section 7.4.3: <code><nobr>UPPERCASE</nobr></code>: Disabling Case Sensitivity in Output</a><br> +<a href="nasmdoc7.html#section-7.4.4">Section 7.4.4: <code><nobr>IMPORT</nobr></code>: Importing DLL Symbols</a><br> +<a href="nasmdoc7.html#section-7.4.5">Section 7.4.5: <code><nobr>EXPORT</nobr></code>: Exporting DLL Symbols</a><br> +<a href="nasmdoc7.html#section-7.4.6">Section 7.4.6: <code><nobr>..start</nobr></code>: Defining the Program Entry Point</a><br> +<a href="nasmdoc7.html#section-7.4.7">Section 7.4.7: <code><nobr>obj</nobr></code> Extensions to the <code><nobr>EXTERN</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.4.8">Section 7.4.8: <code><nobr>obj</nobr></code> Extensions to the <code><nobr>COMMON</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.5">Section 7.5: <code><nobr>win32</nobr></code>: Microsoft Win32 Object Files</a><br> +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1: <code><nobr>win32</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.5.2">Section 7.5.2: <code><nobr>win32</nobr></code>: Safe Structured Exception Handling</a><br> +<a href="nasmdoc7.html#section-7.6">Section 7.6: <code><nobr>win64</nobr></code>: Microsoft Win64 Object Files</a><br> +<a href="nasmdoc7.html#section-7.6.1">Section 7.6.1: <code><nobr>win64</nobr></code>: Writing Position-Independent Code</a><br> +<a href="nasmdoc7.html#section-7.6.2">Section 7.6.2: <code><nobr>win64</nobr></code>: Structured Exception Handling</a><br> +<a href="nasmdoc7.html#section-7.7">Section 7.7: <code><nobr>coff</nobr></code>: Common Object File Format</a><br> +<a href="nasmdoc7.html#section-7.8">Section 7.8: <code><nobr>macho32</nobr></code> and <code><nobr>macho64</nobr></code>: Mach Object File Format</a><br> +<a href="nasmdoc7.html#section-7.9">Section 7.9: <code><nobr>elf32</nobr></code> and <code><nobr>elf64</nobr></code>: Executable and Linkable Format Object Files</a><br> +<a href="nasmdoc7.html#section-7.9.1">Section 7.9.1: ELF specific directive <code><nobr>osabi</nobr></code></a><br> +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2: <code><nobr>elf</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3: Position-Independent Code: <code><nobr>elf</nobr></code> Special Symbols and <code><nobr>WRT</nobr></code></a><br> +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4: Thread Local Storage: <code><nobr>elf</nobr></code> Special Symbols and <code><nobr>WRT</nobr></code></a><br> +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5: <code><nobr>elf</nobr></code> Extensions to the <code><nobr>GLOBAL</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.9.6">Section 7.9.6: <code><nobr>elf</nobr></code> Extensions to the <code><nobr>COMMON</nobr></code> Directive </a><br> +<a href="nasmdoc7.html#section-7.9.7">Section 7.9.7: 16-bit code and ELF </a><br> +<a href="nasmdoc7.html#section-7.9.8">Section 7.9.8: Debug formats and ELF </a><br> +<a href="nasmdoc7.html#section-7.10">Section 7.10: <code><nobr>aout</nobr></code>: Linux <code><nobr>a.out</nobr></code> Object Files</a><br> +<a href="nasmdoc7.html#section-7.11">Section 7.11: <code><nobr>aoutb</nobr></code>: NetBSD/FreeBSD/OpenBSD <code><nobr>a.out</nobr></code> Object Files</a><br> +<a href="nasmdoc7.html#section-7.12">Section 7.12: <code><nobr>as86</nobr></code>: Minix/Linux <code><nobr>as86</nobr></code> Object Files</a><br> +<a href="nasmdoc7.html#section-7.13">Section 7.13: <code><nobr>rdf</nobr></code>: Relocatable Dynamic Object File Format</a><br> +<a href="nasmdoc7.html#section-7.13.1">Section 7.13.1: Requiring a Library: The <code><nobr>LIBRARY</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.13.2">Section 7.13.2: Specifying a Module Name: The <code><nobr>MODULE</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3: <code><nobr>rdf</nobr></code> Extensions to the <code><nobr>GLOBAL</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.13.4">Section 7.13.4: <code><nobr>rdf</nobr></code> Extensions to the <code><nobr>EXTERN</nobr></code> Directive</a><br> +<a href="nasmdoc7.html#section-7.14">Section 7.14: <code><nobr>dbg</nobr></code>: Debugging Format</a><br> +<p><a href="nasmdoc8.html">Chapter 8: Writing 16-bit Code (DOS, Windows 3/3.1)</a><br> +<a href="nasmdoc8.html#section-8.1">Section 8.1: Producing <code><nobr>.EXE</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1: Using the <code><nobr>obj</nobr></code> Format To Generate <code><nobr>.EXE</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2: Using the <code><nobr>bin</nobr></code> Format To Generate <code><nobr>.EXE</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.2">Section 8.2: Producing <code><nobr>.COM</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.2.1">Section 8.2.1: Using the <code><nobr>bin</nobr></code> Format To Generate <code><nobr>.COM</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.2.2">Section 8.2.2: Using the <code><nobr>obj</nobr></code> Format To Generate <code><nobr>.COM</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.3">Section 8.3: Producing <code><nobr>.SYS</nobr></code> Files</a><br> +<a href="nasmdoc8.html#section-8.4">Section 8.4: Interfacing to 16-bit C Programs</a><br> +<a href="nasmdoc8.html#section-8.4.1">Section 8.4.1: External Symbol Names</a><br> +<a href="nasmdoc8.html#section-8.4.2">Section 8.4.2: Memory Models</a><br> +<a href="nasmdoc8.html#section-8.4.3">Section 8.4.3: Function Definitions and Function Calls</a><br> +<a href="nasmdoc8.html#section-8.4.4">Section 8.4.4: Accessing Data Items</a><br> +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5: <code><nobr>c16.mac</nobr></code>: Helper Macros for the 16-bit C Interface</a><br> +<a href="nasmdoc8.html#section-8.5">Section 8.5: Interfacing to Borland Pascal Programs</a><br> +<a href="nasmdoc8.html#section-8.5.1">Section 8.5.1: The Pascal Calling Convention</a><br> +<a href="nasmdoc8.html#section-8.5.2">Section 8.5.2: Borland Pascal Segment Name Restrictions</a><br> +<a href="nasmdoc8.html#section-8.5.3">Section 8.5.3: Using <code><nobr>c16.mac</nobr></code> With Pascal Programs</a><br> +<p><a href="nasmdoc9.html">Chapter 9: Writing 32-bit Code (Unix, Win32, DJGPP)</a><br> +<a href="nasmdoc9.html#section-9.1">Section 9.1: Interfacing to 32-bit C Programs</a><br> +<a href="nasmdoc9.html#section-9.1.1">Section 9.1.1: External Symbol Names</a><br> +<a href="nasmdoc9.html#section-9.1.2">Section 9.1.2: Function Definitions and Function Calls</a><br> +<a href="nasmdoc9.html#section-9.1.3">Section 9.1.3: Accessing Data Items</a><br> +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4: <code><nobr>c32.mac</nobr></code>: Helper Macros for the 32-bit C Interface</a><br> +<a href="nasmdoc9.html#section-9.2">Section 9.2: Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries</a><br> +<a href="nasmdoc9.html#section-9.2.1">Section 9.2.1: Obtaining the Address of the GOT</a><br> +<a href="nasmdoc9.html#section-9.2.2">Section 9.2.2: Finding Your Local Data Items</a><br> +<a href="nasmdoc9.html#section-9.2.3">Section 9.2.3: Finding External and Common Data Items</a><br> +<a href="nasmdoc9.html#section-9.2.4">Section 9.2.4: Exporting Symbols to the Library User</a><br> +<a href="nasmdoc9.html#section-9.2.5">Section 9.2.5: Calling Procedures Outside the Library</a><br> +<a href="nasmdoc9.html#section-9.2.6">Section 9.2.6: Generating the Library File</a><br> +<p><a href="nasmdo10.html">Chapter 10: Mixing 16 and 32 Bit Code</a><br> +<a href="nasmdo10.html#section-10.1">Section 10.1: Mixed-Size Jumps</a><br> +<a href="nasmdo10.html#section-10.2">Section 10.2: Addressing Between Different-Size Segments</a><br> +<a href="nasmdo10.html#section-10.3">Section 10.3: Other Mixed-Size Instructions</a><br> +<p><a href="nasmdo11.html">Chapter 11: Writing 64-bit Code (Unix, Win64)</a><br> +<a href="nasmdo11.html#section-11.1">Section 11.1: Register Names in 64-bit Mode</a><br> +<a href="nasmdo11.html#section-11.2">Section 11.2: Immediates and Displacements in 64-bit Mode</a><br> +<a href="nasmdo11.html#section-11.3">Section 11.3: Interfacing to 64-bit C Programs (Unix)</a><br> +<a href="nasmdo11.html#section-11.4">Section 11.4: Interfacing to 64-bit C Programs (Win64)</a><br> +<p><a href="nasmdo12.html">Chapter 12: Troubleshooting</a><br> +<a href="nasmdo12.html#section-12.1">Section 12.1: Common Problems</a><br> +<a href="nasmdo12.html#section-12.1.1">Section 12.1.1: NASM Generates Inefficient Code</a><br> +<a href="nasmdo12.html#section-12.1.2">Section 12.1.2: My Jumps are Out of Range</a><br> +<a href="nasmdo12.html#section-12.1.3">Section 12.1.3: <code><nobr>ORG</nobr></code> Doesn't Work</a><br> +<a href="nasmdo12.html#section-12.1.4">Section 12.1.4: <code><nobr>TIMES</nobr></code> Doesn't Work</a><br> +<a href="nasmdo12.html#section-12.2">Section 12.2: Bugs</a><br> +<p><a href="nasmdoca.html">Appendix A: Ndisasm</a><br> +<a href="nasmdoca.html#section-A.1">Section A.1: Introduction</a><br> +<a href="nasmdoca.html#section-A.2">Section A.2: Getting Started: Installation</a><br> +<a href="nasmdoca.html#section-A.3">Section A.3: Running NDISASM</a><br> +<a href="nasmdoca.html#section-A.3.1">Section A.3.1: COM Files: Specifying an Origin</a><br> +<a href="nasmdoca.html#section-A.3.2">Section A.3.2: Code Following Data: Synchronisation</a><br> +<a href="nasmdoca.html#section-A.3.3">Section A.3.3: Mixed Code and Data: Automatic (Intelligent) Synchronisation </a><br> +<a href="nasmdoca.html#section-A.3.4">Section A.3.4: Other Options</a><br> +<a href="nasmdoca.html#section-A.4">Section A.4: Bugs and Improvements</a><br> +<p><a href="nasmdocb.html">Appendix B: Instruction List</a><br> +<a href="nasmdocb.html#section-B.1">Section B.1: Introduction</a><br> +<a href="nasmdocb.html#section-B.1.1">Section B.1.1: Special instructions...</a><br> +<a href="nasmdocb.html#section-B.1.2">Section B.1.2: Conventional instructions</a><br> +<a href="nasmdocb.html#section-B.1.3">Section B.1.3: Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)</a><br> +<a href="nasmdocb.html#section-B.1.4">Section B.1.4: Introduced in Deschutes but necessary for SSE support</a><br> +<a href="nasmdocb.html#section-B.1.5">Section B.1.5: XSAVE group (AVX and extended state)</a><br> +<a href="nasmdocb.html#section-B.1.6">Section B.1.6: Generic memory operations</a><br> +<a href="nasmdocb.html#section-B.1.7">Section B.1.7: New MMX instructions introduced in Katmai</a><br> +<a href="nasmdocb.html#section-B.1.8">Section B.1.8: AMD Enhanced 3DNow! (Athlon) instructions</a><br> +<a href="nasmdocb.html#section-B.1.9">Section B.1.9: Willamette SSE2 Cacheability Instructions</a><br> +<a href="nasmdocb.html#section-B.1.10">Section B.1.10: Willamette MMX instructions (SSE2 SIMD Integer Instructions)</a><br> +<a href="nasmdocb.html#section-B.1.11">Section B.1.11: Willamette Streaming SIMD instructions (SSE2)</a><br> +<a href="nasmdocb.html#section-B.1.12">Section B.1.12: Prescott New Instructions (SSE3)</a><br> +<a href="nasmdocb.html#section-B.1.13">Section B.1.13: VMX Instructions</a><br> +<a href="nasmdocb.html#section-B.1.14">Section B.1.14: Extended Page Tables VMX instructions</a><br> +<a href="nasmdocb.html#section-B.1.15">Section B.1.15: Tejas New Instructions (SSSE3)</a><br> +<a href="nasmdocb.html#section-B.1.16">Section B.1.16: AMD SSE4A</a><br> +<a href="nasmdocb.html#section-B.1.17">Section B.1.17: New instructions in Barcelona</a><br> +<a href="nasmdocb.html#section-B.1.18">Section B.1.18: Penryn New Instructions (SSE4.1)</a><br> +<a href="nasmdocb.html#section-B.1.19">Section B.1.19: Nehalem New Instructions (SSE4.2)</a><br> +<a href="nasmdocb.html#section-B.1.20">Section B.1.20: Intel SMX</a><br> +<a href="nasmdocb.html#section-B.1.21">Section B.1.21: Geode (Cyrix) 3DNow! additions</a><br> +<a href="nasmdocb.html#section-B.1.22">Section B.1.22: Intel new instructions in ???</a><br> +<a href="nasmdocb.html#section-B.1.23">Section B.1.23: Intel AES instructions</a><br> +<a href="nasmdocb.html#section-B.1.24">Section B.1.24: Intel AVX AES instructions</a><br> +<a href="nasmdocb.html#section-B.1.25">Section B.1.25: Intel AVX instructions</a><br> +<a href="nasmdocb.html#section-B.1.26">Section B.1.26: Intel Carry-Less Multiplication instructions (CLMUL)</a><br> +<a href="nasmdocb.html#section-B.1.27">Section B.1.27: Intel AVX Carry-Less Multiplication instructions (CLMUL)</a><br> +<a href="nasmdocb.html#section-B.1.28">Section B.1.28: Intel Fused Multiply-Add instructions (FMA)</a><br> +<a href="nasmdocb.html#section-B.1.29">Section B.1.29: VIA (Centaur) security instructions</a><br> +<a href="nasmdocb.html#section-B.1.30">Section B.1.30: AMD Lightweight Profiling (LWP) instructions</a><br> +<a href="nasmdocb.html#section-B.1.31">Section B.1.31: AMD XOP, FMA4 and CVT16 instructions (SSE5)</a><br> +<a href="nasmdocb.html#section-B.1.32">Section B.1.32: Systematic names for the hinting nop instructions</a><br> +<p><a href="nasmdocc.html">Appendix C: NASM Version History</a><br> +<a href="nasmdocc.html#section-C.1">Section C.1: NASM 2 Series</a><br> +<a href="nasmdocc.html#section-C.1.1">Section C.1.1: Version 2.08</a><br> +<a href="nasmdocc.html#section-C.1.2">Section C.1.2: Version 2.07</a><br> +<a href="nasmdocc.html#section-C.1.3">Section C.1.3: Version 2.06</a><br> +<a href="nasmdocc.html#section-C.1.4">Section C.1.4: Version 2.05.01</a><br> +<a href="nasmdocc.html#section-C.1.5">Section C.1.5: Version 2.05</a><br> +<a href="nasmdocc.html#section-C.1.6">Section C.1.6: Version 2.04</a><br> +<a href="nasmdocc.html#section-C.1.7">Section C.1.7: Version 2.03.01</a><br> +<a href="nasmdocc.html#section-C.1.8">Section C.1.8: Version 2.03</a><br> +<a href="nasmdocc.html#section-C.1.9">Section C.1.9: Version 2.02</a><br> +<a href="nasmdocc.html#section-C.1.10">Section C.1.10: Version 2.01</a><br> +<a href="nasmdocc.html#section-C.1.11">Section C.1.11: Version 2.00</a><br> +<a href="nasmdocc.html#section-C.2">Section C.2: NASM 0.98 Series</a><br> +<a href="nasmdocc.html#section-C.2.1">Section C.2.1: Version 0.98.39</a><br> +<a href="nasmdocc.html#section-C.2.2">Section C.2.2: Version 0.98.38</a><br> +<a href="nasmdocc.html#section-C.2.3">Section C.2.3: Version 0.98.37</a><br> +<a href="nasmdocc.html#section-C.2.4">Section C.2.4: Version 0.98.36</a><br> +<a href="nasmdocc.html#section-C.2.5">Section C.2.5: Version 0.98.35</a><br> +<a href="nasmdocc.html#section-C.2.6">Section C.2.6: Version 0.98.34</a><br> +<a href="nasmdocc.html#section-C.2.7">Section C.2.7: Version 0.98.33</a><br> +<a href="nasmdocc.html#section-C.2.8">Section C.2.8: Version 0.98.32</a><br> +<a href="nasmdocc.html#section-C.2.9">Section C.2.9: Version 0.98.31</a><br> +<a href="nasmdocc.html#section-C.2.10">Section C.2.10: Version 0.98.30</a><br> +<a href="nasmdocc.html#section-C.2.11">Section C.2.11: Version 0.98.28</a><br> +<a href="nasmdocc.html#section-C.2.12">Section C.2.12: Version 0.98.26</a><br> +<a href="nasmdocc.html#section-C.2.13">Section C.2.13: Version 0.98.25alt</a><br> +<a href="nasmdocc.html#section-C.2.14">Section C.2.14: Version 0.98.25</a><br> +<a href="nasmdocc.html#section-C.2.15">Section C.2.15: Version 0.98.24p1</a><br> +<a href="nasmdocc.html#section-C.2.16">Section C.2.16: Version 0.98.24</a><br> +<a href="nasmdocc.html#section-C.2.17">Section C.2.17: Version 0.98.23</a><br> +<a href="nasmdocc.html#section-C.2.18">Section C.2.18: Version 0.98.22</a><br> +<a href="nasmdocc.html#section-C.2.19">Section C.2.19: Version 0.98.21</a><br> +<a href="nasmdocc.html#section-C.2.20">Section C.2.20: Version 0.98.20</a><br> +<a href="nasmdocc.html#section-C.2.21">Section C.2.21: Version 0.98.19</a><br> +<a href="nasmdocc.html#section-C.2.22">Section C.2.22: Version 0.98.18</a><br> +<a href="nasmdocc.html#section-C.2.23">Section C.2.23: Version 0.98.17</a><br> +<a href="nasmdocc.html#section-C.2.24">Section C.2.24: Version 0.98.16</a><br> +<a href="nasmdocc.html#section-C.2.25">Section C.2.25: Version 0.98.15</a><br> +<a href="nasmdocc.html#section-C.2.26">Section C.2.26: Version 0.98.14</a><br> +<a href="nasmdocc.html#section-C.2.27">Section C.2.27: Version 0.98.13</a><br> +<a href="nasmdocc.html#section-C.2.28">Section C.2.28: Version 0.98.12</a><br> +<a href="nasmdocc.html#section-C.2.29">Section C.2.29: Version 0.98.11</a><br> +<a href="nasmdocc.html#section-C.2.30">Section C.2.30: Version 0.98.10</a><br> +<a href="nasmdocc.html#section-C.2.31">Section C.2.31: Version 0.98.09</a><br> +<a href="nasmdocc.html#section-C.2.32">Section C.2.32: Version 0.98.08</a><br> +<a href="nasmdocc.html#section-C.2.33">Section C.2.33: Version 0.98.09b with John Coffman patches released 28-Oct-2001</a><br> +<a href="nasmdocc.html#section-C.2.34">Section C.2.34: Version 0.98.07 released 01/28/01</a><br> +<a href="nasmdocc.html#section-C.2.35">Section C.2.35: Version 0.98.06f released 01/18/01</a><br> +<a href="nasmdocc.html#section-C.2.36">Section C.2.36: Version 0.98.06e released 01/09/01</a><br> +<a href="nasmdocc.html#section-C.2.37">Section C.2.37: Version 0.98p1</a><br> +<a href="nasmdocc.html#section-C.2.38">Section C.2.38: Version 0.98bf (bug-fixed)</a><br> +<a href="nasmdocc.html#section-C.2.39">Section C.2.39: Version 0.98.03 with John Coffman's changes released 27-Jul-2000</a><br> +<a href="nasmdocc.html#section-C.2.40">Section C.2.40: Version 0.98.03</a><br> +<a href="nasmdocc.html#section-C.2.41">Section C.2.41: Version 0.98</a><br> +<a href="nasmdocc.html#section-C.2.42">Section C.2.42: Version 0.98p9</a><br> +<a href="nasmdocc.html#section-C.2.43">Section C.2.43: Version 0.98p8</a><br> +<a href="nasmdocc.html#section-C.2.44">Section C.2.44: Version 0.98p7</a><br> +<a href="nasmdocc.html#section-C.2.45">Section C.2.45: Version 0.98p6</a><br> +<a href="nasmdocc.html#section-C.2.46">Section C.2.46: Version 0.98p3.7</a><br> +<a href="nasmdocc.html#section-C.2.47">Section C.2.47: Version 0.98p3.6</a><br> +<a href="nasmdocc.html#section-C.2.48">Section C.2.48: Version 0.98p3.5</a><br> +<a href="nasmdocc.html#section-C.2.49">Section C.2.49: Version 0.98p3.4</a><br> +<a href="nasmdocc.html#section-C.2.50">Section C.2.50: Version 0.98p3.3</a><br> +<a href="nasmdocc.html#section-C.2.51">Section C.2.51: Version 0.98p3.2</a><br> +<a href="nasmdocc.html#section-C.2.52">Section C.2.52: Version 0.98p3-hpa</a><br> +<a href="nasmdocc.html#section-C.2.53">Section C.2.53: Version 0.98 pre-release 3</a><br> +<a href="nasmdocc.html#section-C.2.54">Section C.2.54: Version 0.98 pre-release 2</a><br> +<a href="nasmdocc.html#section-C.2.55">Section C.2.55: Version 0.98 pre-release 1</a><br> +<a href="nasmdocc.html#section-C.3">Section C.3: NASM 0.9 Series</a><br> +<a href="nasmdocc.html#section-C.3.1">Section C.3.1: Version 0.97 released December 1997</a><br> +<a href="nasmdocc.html#section-C.3.2">Section C.3.2: Version 0.96 released November 1997</a><br> +<a href="nasmdocc.html#section-C.3.3">Section C.3.3: Version 0.95 released July 1997</a><br> +<a href="nasmdocc.html#section-C.3.4">Section C.3.4: Version 0.94 released April 1997</a><br> +<a href="nasmdocc.html#section-C.3.5">Section C.3.5: Version 0.93 released January 1997</a><br> +<a href="nasmdocc.html#section-C.3.6">Section C.3.6: Version 0.92 released January 1997</a><br> +<a href="nasmdocc.html#section-C.3.7">Section C.3.7: Version 0.91 released November 1996</a><br> +<a href="nasmdocc.html#section-C.3.8">Section C.3.8: Version 0.90 released October 1996</a><br> +<p><a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc1.html b/doc/html/nasmdoc1.html new file mode 100644 index 0000000..d370895 --- /dev/null +++ b/doc/html/nasmdoc1.html @@ -0,0 +1,159 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc2.html">Next Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-1">Chapter 1: Introduction</a></h2> +<h3><a name="section-1.1">1.1 What Is NASM?</a></h3> +<p>The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler designed +for portability and modularity. It supports a range of object file formats, +including Linux and <code><nobr>*BSD</nobr></code> +<code><nobr>a.out</nobr></code>, <code><nobr>ELF</nobr></code>, +<code><nobr>COFF</nobr></code>, <code><nobr>Mach-O</nobr></code>, Microsoft +16-bit <code><nobr>OBJ</nobr></code>, <code><nobr>Win32</nobr></code> and +<code><nobr>Win64</nobr></code>. It will also output plain binary files. +Its syntax is designed to be simple and easy to understand, similar to +Intel's but less complex. It supports all currently known x86 architectural +extensions, and has strong support for macros. +<h4><a name="section-1.1.1">1.1.1 Why Yet Another Assembler?</a></h4> +<p>The Netwide Assembler grew out of an idea on +<code><nobr>comp.lang.asm.x86</nobr></code> (or possibly +<code><nobr>alt.lang.asm</nobr></code> - I forget which), which was +essentially that there didn't seem to be a good <em>free</em> x86-series +assembler around, and that maybe someone ought to write one. +<ul> +<li><code><nobr>a86</nobr></code> is good, but not free, and in particular +you don't get any 32-bit capability until you pay. It's DOS only, too. +<li><code><nobr>gas</nobr></code> is free, and ports over to DOS and Unix, +but it's not very good, since it's designed to be a back end to +<code><nobr>gcc</nobr></code>, which always feeds it correct code. So its +error checking is minimal. Also, its syntax is horrible, from the point of +view of anyone trying to actually <em>write</em> anything in it. Plus you +can't write 16-bit code in it (properly.) +<li><code><nobr>as86</nobr></code> is specific to Minix and Linux, and (my +version at least) doesn't seem to have much (or any) documentation. +<li><code><nobr>MASM</nobr></code> isn't very good, and it's (was) +expensive, and it runs only under DOS. +<li><code><nobr>TASM</nobr></code> is better, but still strives for MASM +compatibility, which means millions of directives and tons of red tape. And +its syntax is essentially MASM's, with the contradictions and quirks that +entails (although it sorts out some of those by means of Ideal mode.) It's +expensive too. And it's DOS-only. +</ul> +<p>So here, for your coding pleasure, is NASM. At present it's still in +prototype stage - we don't promise that it can outperform any of these +assemblers. But please, <em>please</em> send us bug reports, fixes, helpful +information, and anything else you can get your hands on (and thanks to the +many people who've done this already! You all know who you are), and we'll +improve it out of all recognition. Again. +<h4><a name="section-1.1.2">1.1.2 License Conditions</a></h4> +<p>Please see the file <code><nobr>LICENSE</nobr></code>, supplied as part +of any NASM distribution archive, for the license conditions under which +you may use NASM. NASM is now under the so-called 2-clause BSD license, +also known as the simplified BSD license. +<p>Copyright 1996-2009 the NASM Authors - All rights reserved. +<p>Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +<ul> +<li>Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +<li>Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +</ul> +<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +<h3><a name="section-1.2">1.2 Contact Information</a></h3> +<p>The current version of NASM (since about 0.98.08) is maintained by a +team of developers, accessible through the +<code><nobr>nasm-devel</nobr></code> mailing list (see below for the link). +If you want to report a bug, please read +<a href="nasmdo12.html#section-12.2">section 12.2</a> first. +<p>NASM has a website at +<a href="http://www.nasm.us/"><code><nobr>http://www.nasm.us/</nobr></code></a>. +If it's not there, google for us! +<p>New releases, release candidates, and daily development snapshots of +NASM are available from the official web site. +<p>Announcements are posted to +<a href="news:comp.lang.asm.x86"><code><nobr>comp.lang.asm.x86</nobr></code></a>, +and to the web site +<a href="http://www.freshmeat.net/"><code><nobr>http://www.freshmeat.net/</nobr></code></a>. +<p>If you want information about the current development status, please +subscribe to the <code><nobr>nasm-devel</nobr></code> email list; see link +from the website. +<h3><a name="section-1.3">1.3 Installation</a></h3> +<h4><a name="section-1.3.1">1.3.1 Installing NASM under MS-DOS or Windows</a></h4> +<p>Once you've obtained the appropriate archive for NASM, +<code><nobr>nasm-XXX-dos.zip</nobr></code> or +<code><nobr>nasm-XXX-win32.zip</nobr></code> (where +<code><nobr>XXX</nobr></code> denotes the version number of NASM contained +in the archive), unpack it into its own directory (for example +<code><nobr>c:\nasm</nobr></code>). +<p>The archive will contain a set of executable files: the NASM executable +file <code><nobr>nasm.exe</nobr></code>, the NDISASM executable file +<code><nobr>ndisasm.exe</nobr></code>, and possibly additional utilities to +handle the RDOFF file format. +<p>The only file NASM needs to run is its own executable, so copy +<code><nobr>nasm.exe</nobr></code> to a directory on your PATH, or +alternatively edit <code><nobr>autoexec.bat</nobr></code> to add the +<code><nobr>nasm</nobr></code> directory to your +<code><nobr>PATH</nobr></code> (to do that under Windows XP, go to Start +> Control Panel > System > Advanced > Environment Variables; +these instructions may work under other versions of Windows as well.) +<p>That's it - NASM is installed. You don't need the nasm directory to be +present to run NASM (unless you've added it to your +<code><nobr>PATH</nobr></code>), so you can delete it if you need to save +space; however, you may want to keep the documentation or test programs. +<p>If you've downloaded the DOS source archive, +<code><nobr>nasm-XXX.zip</nobr></code>, the <code><nobr>nasm</nobr></code> +directory will also contain the full NASM source code, and a selection of +Makefiles you can (hopefully) use to rebuild your copy of NASM from +scratch. See the file <code><nobr>INSTALL</nobr></code> in the source +archive. +<p>Note that a number of files are generated from other files by Perl +scripts. Although the NASM source distribution includes these generated +files, you will need to rebuild them (and hence, will need a Perl +interpreter) if you change insns.dat, standard.mac or the documentation. It +is possible future source distributions may not include these files at all. +Ports of Perl for a variety of platforms, including DOS and Windows, are +available from <a href="http://www.cpan.org/ports/">www.cpan.org</a>. +<h4><a name="section-1.3.2">1.3.2 Installing NASM under Unix</a></h4> +<p>Once you've obtained the Unix source archive for NASM, +<code><nobr>nasm-XXX.tar.gz</nobr></code> (where +<code><nobr>XXX</nobr></code> denotes the version number of NASM contained +in the archive), unpack it into a directory such as +<code><nobr>/usr/local/src</nobr></code>. The archive, when unpacked, will +create its own subdirectory <code><nobr>nasm-XXX</nobr></code>. +<p>NASM is an auto-configuring package: once you've unpacked it, +<code><nobr>cd</nobr></code> to the directory it's been unpacked into and +type <code><nobr>./configure</nobr></code>. This shell script will find the +best C compiler to use for building NASM and set up Makefiles accordingly. +<p>Once NASM has auto-configured, you can type +<code><nobr>make</nobr></code> to build the <code><nobr>nasm</nobr></code> +and <code><nobr>ndisasm</nobr></code> binaries, and then +<code><nobr>make install</nobr></code> to install them in +<code><nobr>/usr/local/bin</nobr></code> and install the man pages +<code><nobr>nasm.1</nobr></code> and <code><nobr>ndisasm.1</nobr></code> in +<code><nobr>/usr/local/man/man1</nobr></code>. Alternatively, you can give +options such as <code><nobr>--prefix</nobr></code> to the configure script +(see the file <code><nobr>INSTALL</nobr></code> for more details), or +install the programs yourself. +<p>NASM also comes with a set of utilities for handling the +<code><nobr>RDOFF</nobr></code> custom object-file format, which are in the +<code><nobr>rdoff</nobr></code> subdirectory of the NASM archive. You can +build these with <code><nobr>make rdf</nobr></code> and install them with +<code><nobr>make rdf_install</nobr></code>, if you want them. +<p align=center><a href="nasmdoc2.html">Next Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc2.html b/doc/html/nasmdoc2.html new file mode 100644 index 0000000..a639a4a --- /dev/null +++ b/doc/html/nasmdoc2.html @@ -0,0 +1,650 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc3.html">Next Chapter</a> | +<a href="nasmdoc1.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-2">Chapter 2: Running NASM</a></h2> +<h3><a name="section-2.1">2.1 NASM Command-Line Syntax</a></h3> +<p>To assemble a file, you issue a command of the form +<p><pre> +nasm -f <format> <filename> [-o <output>] +</pre> +<p>For example, +<p><pre> +nasm -f elf myfile.asm +</pre> +<p>will assemble <code><nobr>myfile.asm</nobr></code> into an +<code><nobr>ELF</nobr></code> object file +<code><nobr>myfile.o</nobr></code>. And +<p><pre> +nasm -f bin myfile.asm -o myfile.com +</pre> +<p>will assemble <code><nobr>myfile.asm</nobr></code> into a raw binary +file <code><nobr>myfile.com</nobr></code>. +<p>To produce a listing file, with the hex codes output from NASM displayed +on the left of the original sources, use the <code><nobr>-l</nobr></code> +option to give a listing file name, for example: +<p><pre> +nasm -f coff myfile.asm -l myfile.lst +</pre> +<p>To get further usage instructions from NASM, try typing +<p><pre> +nasm -h +</pre> +<p>As <code><nobr>-hf</nobr></code>, this will also list the available +output file formats, and what they are. +<p>If you use Linux but aren't sure whether your system is +<code><nobr>a.out</nobr></code> or <code><nobr>ELF</nobr></code>, type +<p><pre> +file nasm +</pre> +<p>(in the directory in which you put the NASM binary when you installed +it). If it says something like +<p><pre> +nasm: ELF 32-bit LSB executable i386 (386 and up) Version 1 +</pre> +<p>then your system is <code><nobr>ELF</nobr></code>, and you should use +the option <code><nobr>-f elf</nobr></code> when you want NASM to produce +Linux object files. If it says +<p><pre> +nasm: Linux/i386 demand-paged executable (QMAGIC) +</pre> +<p>or something similar, your system is <code><nobr>a.out</nobr></code>, +and you should use <code><nobr>-f aout</nobr></code> instead (Linux +<code><nobr>a.out</nobr></code> systems have long been obsolete, and are +rare these days.) +<p>Like Unix compilers and assemblers, NASM is silent unless it goes wrong: +you won't see any output at all, unless it gives error messages. +<h4><a name="section-2.1.1">2.1.1 The <code><nobr>-o</nobr></code> Option: Specifying the Output File Name</a></h4> +<p>NASM will normally choose the name of your output file for you; +precisely how it does this is dependent on the object file format. For +Microsoft object file formats (<code><nobr>obj</nobr></code>, +<code><nobr>win32</nobr></code> and <code><nobr>win64</nobr></code>), it +will remove the <code><nobr>.asm</nobr></code> extension (or whatever +extension you like to use - NASM doesn't care) from your source file name +and substitute <code><nobr>.obj</nobr></code>. For Unix object file formats +(<code><nobr>aout</nobr></code>, <code><nobr>as86</nobr></code>, +<code><nobr>coff</nobr></code>, <code><nobr>elf32</nobr></code>, +<code><nobr>elf64</nobr></code>, <code><nobr>ieee</nobr></code>, +<code><nobr>macho32</nobr></code> and <code><nobr>macho64</nobr></code>) it +will substitute <code><nobr>.o</nobr></code>. For +<code><nobr>dbg</nobr></code>, <code><nobr>rdf</nobr></code>, +<code><nobr>ith</nobr></code> and <code><nobr>srec</nobr></code>, it will +use <code><nobr>.dbg</nobr></code>, <code><nobr>.rdf</nobr></code>, +<code><nobr>.ith</nobr></code> and <code><nobr>.srec</nobr></code>, +respectively, and for the <code><nobr>bin</nobr></code> format it will +simply remove the extension, so that <code><nobr>myfile.asm</nobr></code> +produces the output file <code><nobr>myfile</nobr></code>. +<p>If the output file already exists, NASM will overwrite it, unless it has +the same name as the input file, in which case it will give a warning and +use <code><nobr>nasm.out</nobr></code> as the output file name instead. +<p>For situations in which this behaviour is unacceptable, NASM provides +the <code><nobr>-o</nobr></code> command-line option, which allows you to +specify your desired output file name. You invoke +<code><nobr>-o</nobr></code> by following it with the name you wish for the +output file, either with or without an intervening space. For example: +<p><pre> +nasm -f bin program.asm -o program.com +nasm -f bin driver.asm -odriver.sys +</pre> +<p>Note that this is a small o, and is different from a capital O , which +is used to specify the number of optimisation passes required. See +<a href="#section-2.1.22">section 2.1.22</a>. +<h4><a name="section-2.1.2">2.1.2 The <code><nobr>-f</nobr></code> Option: Specifying the Output File Format</a></h4> +<p>If you do not supply the <code><nobr>-f</nobr></code> option to NASM, it +will choose an output file format for you itself. In the distribution +versions of NASM, the default is always <code><nobr>bin</nobr></code>; if +you've compiled your own copy of NASM, you can redefine +<code><nobr>OF_DEFAULT</nobr></code> at compile time and choose what you +want the default to be. +<p>Like <code><nobr>-o</nobr></code>, the intervening space between +<code><nobr>-f</nobr></code> and the output file format is optional; so +<code><nobr>-f elf</nobr></code> and <code><nobr>-felf</nobr></code> are +both valid. +<p>A complete list of the available output file formats can be given by +issuing the command <code><nobr>nasm -hf</nobr></code>. +<h4><a name="section-2.1.3">2.1.3 The <code><nobr>-l</nobr></code> Option: Generating a Listing File</a></h4> +<p>If you supply the <code><nobr>-l</nobr></code> option to NASM, followed +(with the usual optional space) by a file name, NASM will generate a +source-listing file for you, in which addresses and generated code are +listed on the left, and the actual source code, with expansions of +multi-line macros (except those which specifically request no expansion in +source listings: see <a href="nasmdoc4.html#section-4.3.10">section +4.3.10</a>) on the right. For example: +<p><pre> +nasm -f elf myfile.asm -l myfile.lst +</pre> +<p>If a list file is selected, you may turn off listing for a section of +your source with <code><nobr>[list -]</nobr></code>, and turn it back on +with <code><nobr>[list +]</nobr></code>, (the default, obviously). There is +no "user form" (without the brackets). This can be used to list only +sections of interest, avoiding excessively long listings. +<h4><a name="section-2.1.4">2.1.4 The <code><nobr>-M</nobr></code> Option: Generate Makefile Dependencies</a></h4> +<p>This option can be used to generate makefile dependencies on stdout. +This can be redirected to a file for further processing. For example: +<p><pre> +nasm -M myfile.asm > myfile.dep +</pre> +<h4><a name="section-2.1.5">2.1.5 The <code><nobr>-MG</nobr></code> Option: Generate Makefile Dependencies</a></h4> +<p>This option can be used to generate makefile dependencies on stdout. +This differs from the <code><nobr>-M</nobr></code> option in that if a +nonexisting file is encountered, it is assumed to be a generated file and +is added to the dependency list without a prefix. +<h4><a name="section-2.1.6">2.1.6 The <code><nobr>-MF</nobr></code> Option: Set Makefile Dependency File</a></h4> +<p>This option can be used with the <code><nobr>-M</nobr></code> or +<code><nobr>-MG</nobr></code> options to send the output to a file, rather +than to stdout. For example: +<p><pre> +nasm -M -MF myfile.dep myfile.asm +</pre> +<h4><a name="section-2.1.7">2.1.7 The <code><nobr>-MD</nobr></code> Option: Assemble and Generate Dependencies</a></h4> +<p>The <code><nobr>-MD</nobr></code> option acts as the combination of the +<code><nobr>-M</nobr></code> and <code><nobr>-MF</nobr></code> options +(i.e. a filename has to be specified.) However, unlike the +<code><nobr>-M</nobr></code> or <code><nobr>-MG</nobr></code> options, +<code><nobr>-MD</nobr></code> does <em>not</em> inhibit the normal +operation of the assembler. Use this to automatically generate updated +dependencies with every assembly session. For example: +<p><pre> +nasm -f elf -o myfile.o -MD myfile.dep myfile.asm +</pre> +<h4><a name="section-2.1.8">2.1.8 The <code><nobr>-MT</nobr></code> Option: Dependency Target Name</a></h4> +<p>The <code><nobr>-MT</nobr></code> option can be used to override the +default name of the dependency target. This is normally the same as the +output filename, specified by the <code><nobr>-o</nobr></code> option. +<h4><a name="section-2.1.9">2.1.9 The <code><nobr>-MQ</nobr></code> Option: Dependency Target Name (Quoted)</a></h4> +<p>The <code><nobr>-MQ</nobr></code> option acts as the +<code><nobr>-MT</nobr></code> option, except it tries to quote characters +that have special meaning in Makefile syntax. This is not foolproof, as not +all characters with special meaning are quotable in Make. +<h4><a name="section-2.1.10">2.1.10 The <code><nobr>-MP</nobr></code> Option: Emit phony targets</a></h4> +<p>When used with any of the dependency generation options, the +<code><nobr>-MP</nobr></code> option causes NASM to emit a phony target +without dependencies for each header file. This prevents Make from +complaining if a header file has been removed. +<h4><a name="section-2.1.11">2.1.11 The <code><nobr>-F</nobr></code> Option: Selecting a Debug Information Format</a></h4> +<p>This option is used to select the format of the debug information +emitted into the output file, to be used by a debugger (or <em>will</em> +be). Prior to version 2.03.01, the use of this switch did <em>not</em> +enable output of the selected debug info format. Use +<code><nobr>-g</nobr></code>, see <a href="#section-2.1.12">section +2.1.12</a>, to enable output. Versions 2.03.01 and later automatically +enable <code><nobr>-g</nobr></code> if <code><nobr>-F</nobr></code> is +specified. +<p>A complete list of the available debug file formats for an output format +can be seen by issuing the command +<code><nobr>nasm -f <format> -y</nobr></code>. Not all output formats +currently support debugging output. See <a href="#section-2.1.26">section +2.1.26</a>. +<p>This should not be confused with the <code><nobr>-f dbg</nobr></code> +output format option which is not built into NASM by default. For +information on how to enable it when building from the sources, see +<a href="nasmdoc7.html#section-7.14">section 7.14</a>. +<h4><a name="section-2.1.12">2.1.12 The <code><nobr>-g</nobr></code> Option: Enabling Debug Information.</a></h4> +<p>This option can be used to generate debugging information in the +specified format. See <a href="#section-2.1.11">section 2.1.11</a>. Using +<code><nobr>-g</nobr></code> without <code><nobr>-F</nobr></code> results +in emitting debug info in the default format, if any, for the selected +output format. If no debug information is currently implemented in the +selected output format, <code><nobr>-g</nobr></code> is <em>silently +ignored</em>. +<h4><a name="section-2.1.13">2.1.13 The <code><nobr>-X</nobr></code> Option: Selecting an Error Reporting Format</a></h4> +<p>This option can be used to select an error reporting format for any +error messages that might be produced by NASM. +<p>Currently, two error reporting formats may be selected. They are the +<code><nobr>-Xvc</nobr></code> option and the +<code><nobr>-Xgnu</nobr></code> option. The GNU format is the default and +looks like this: +<p><pre> +filename.asm:65: error: specific error message +</pre> +<p>where <code><nobr>filename.asm</nobr></code> is the name of the source +file in which the error was detected, <code><nobr>65</nobr></code> is the +source file line number on which the error was detected, +<code><nobr>error</nobr></code> is the severity of the error (this could be +<code><nobr>warning</nobr></code>), and +<code><nobr>specific error message</nobr></code> is a more detailed text +message which should help pinpoint the exact problem. +<p>The other format, specified by <code><nobr>-Xvc</nobr></code> is the +style used by Microsoft Visual C++ and some other programs. It looks like +this: +<p><pre> +filename.asm(65) : error: specific error message +</pre> +<p>where the only difference is that the line number is in parentheses +instead of being delimited by colons. +<p>See also the <code><nobr>Visual C++</nobr></code> output format, +<a href="nasmdoc7.html#section-7.5">section 7.5</a>. +<h4><a name="section-2.1.14">2.1.14 The <code><nobr>-Z</nobr></code> Option: Send Errors to a File</a></h4> +<p>Under <code><nobr>MS-DOS</nobr></code> it can be difficult (though there +are ways) to redirect the standard-error output of a program to a file. +Since NASM usually produces its warning and error messages on +<code><nobr>stderr</nobr></code>, this can make it hard to capture the +errors if (for example) you want to load them into an editor. +<p>NASM therefore provides the <code><nobr>-Z</nobr></code> option, taking +a filename argument which causes errors to be sent to the specified files +rather than standard error. Therefore you can redirect the errors into a +file by typing +<p><pre> +nasm -Z myfile.err -f obj myfile.asm +</pre> +<p>In earlier versions of NASM, this option was called +<code><nobr>-E</nobr></code>, but it was changed since +<code><nobr>-E</nobr></code> is an option conventionally used for +preprocessing only, with disastrous results. See +<a href="#section-2.1.20">section 2.1.20</a>. +<h4><a name="section-2.1.15">2.1.15 The <code><nobr>-s</nobr></code> Option: Send Errors to <code><nobr>stdout</nobr></code></a></h4> +<p>The <code><nobr>-s</nobr></code> option redirects error messages to +<code><nobr>stdout</nobr></code> rather than +<code><nobr>stderr</nobr></code>, so it can be redirected under +<code><nobr>MS-DOS</nobr></code>. To assemble the file +<code><nobr>myfile.asm</nobr></code> and pipe its output to the +<code><nobr>more</nobr></code> program, you can type: +<p><pre> +nasm -s -f obj myfile.asm | more +</pre> +<p>See also the <code><nobr>-Z</nobr></code> option, +<a href="#section-2.1.14">section 2.1.14</a>. +<h4><a name="section-2.1.16">2.1.16 The <code><nobr>-i</nobr></code> Option: Include File Search Directories</a></h4> +<p>When NASM sees the <code><nobr>%include</nobr></code> or +<code><nobr>%pathsearch</nobr></code> directive in a source file (see +<a href="nasmdoc4.html#section-4.6.1">section 4.6.1</a>, +<a href="nasmdoc4.html#section-4.6.2">section 4.6.2</a> or +<a href="nasmdoc3.html#section-3.2.3">section 3.2.3</a>), it will search +for the given file not only in the current directory, but also in any +directories specified on the command line by the use of the +<code><nobr>-i</nobr></code> option. Therefore you can include files from a +macro library, for example, by typing +<p><pre> +nasm -ic:\macrolib\ -f obj myfile.asm +</pre> +<p>(As usual, a space between <code><nobr>-i</nobr></code> and the path +name is allowed, and optional). +<p>NASM, in the interests of complete source-code portability, does not +understand the file naming conventions of the OS it is running on; the +string you provide as an argument to the <code><nobr>-i</nobr></code> +option will be prepended exactly as written to the name of the include +file. Therefore the trailing backslash in the above example is necessary. +Under Unix, a trailing forward slash is similarly necessary. +<p>(You can use this to your advantage, if you're really perverse, by +noting that the option <code><nobr>-ifoo</nobr></code> will cause +<code><nobr>%include "bar.i"</nobr></code> to search for the file +<code><nobr>foobar.i</nobr></code>...) +<p>If you want to define a <em>standard</em> include search path, similar +to <code><nobr>/usr/include</nobr></code> on Unix systems, you should place +one or more <code><nobr>-i</nobr></code> directives in the +<code><nobr>NASMENV</nobr></code> environment variable (see +<a href="#section-2.1.28">section 2.1.28</a>). +<p>For Makefile compatibility with many C compilers, this option can also +be specified as <code><nobr>-I</nobr></code>. +<h4><a name="section-2.1.17">2.1.17 The <code><nobr>-p</nobr></code> Option: Pre-Include a File</a></h4> +<p>NASM allows you to specify files to be <em>pre-included</em> into your +source file, by the use of the <code><nobr>-p</nobr></code> option. So +running +<p><pre> +nasm myfile.asm -p myinc.inc +</pre> +<p>is equivalent to running <code><nobr>nasm myfile.asm</nobr></code> and +placing the directive <code><nobr>%include "myinc.inc"</nobr></code> at the +start of the file. +<p>For consistency with the <code><nobr>-I</nobr></code>, +<code><nobr>-D</nobr></code> and <code><nobr>-U</nobr></code> options, this +option can also be specified as <code><nobr>-P</nobr></code>. +<h4><a name="section-2.1.18">2.1.18 The <code><nobr>-d</nobr></code> Option: Pre-Define a Macro</a></h4> +<p>Just as the <code><nobr>-p</nobr></code> option gives an alternative to +placing <code><nobr>%include</nobr></code> directives at the start of a +source file, the <code><nobr>-d</nobr></code> option gives an alternative +to placing a <code><nobr>%define</nobr></code> directive. You could code +<p><pre> +nasm myfile.asm -dFOO=100 +</pre> +<p>as an alternative to placing the directive +<p><pre> +%define FOO 100 +</pre> +<p>at the start of the file. You can miss off the macro value, as well: the +option <code><nobr>-dFOO</nobr></code> is equivalent to coding +<code><nobr>%define FOO</nobr></code>. This form of the directive may be +useful for selecting assembly-time options which are then tested using +<code><nobr>%ifdef</nobr></code>, for example +<code><nobr>-dDEBUG</nobr></code>. +<p>For Makefile compatibility with many C compilers, this option can also +be specified as <code><nobr>-D</nobr></code>. +<h4><a name="section-2.1.19">2.1.19 The <code><nobr>-u</nobr></code> Option: Undefine a Macro</a></h4> +<p>The <code><nobr>-u</nobr></code> option undefines a macro that would +otherwise have been pre-defined, either automatically or by a +<code><nobr>-p</nobr></code> or <code><nobr>-d</nobr></code> option +specified earlier on the command lines. +<p>For example, the following command line: +<p><pre> +nasm myfile.asm -dFOO=100 -uFOO +</pre> +<p>would result in <code><nobr>FOO</nobr></code> <em>not</em> being a +predefined macro in the program. This is useful to override options +specified at a different point in a Makefile. +<p>For Makefile compatibility with many C compilers, this option can also +be specified as <code><nobr>-U</nobr></code>. +<h4><a name="section-2.1.20">2.1.20 The <code><nobr>-E</nobr></code> Option: Preprocess Only</a></h4> +<p>NASM allows the preprocessor to be run on its own, up to a point. Using +the <code><nobr>-E</nobr></code> option (which requires no arguments) will +cause NASM to preprocess its input file, expand all the macro references, +remove all the comments and preprocessor directives, and print the +resulting file on standard output (or save it to a file, if the +<code><nobr>-o</nobr></code> option is also used). +<p>This option cannot be applied to programs which require the preprocessor +to evaluate expressions which depend on the values of symbols: so code such +as +<p><pre> +%assign tablesize ($-tablestart) +</pre> +<p>will cause an error in preprocess-only mode. +<p>For compatiblity with older version of NASM, this option can also be +written <code><nobr>-e</nobr></code>. <code><nobr>-E</nobr></code> in older +versions of NASM was the equivalent of the current +<code><nobr>-Z</nobr></code> option, <a href="#section-2.1.14">section +2.1.14</a>. +<h4><a name="section-2.1.21">2.1.21 The <code><nobr>-a</nobr></code> Option: Don't Preprocess At All</a></h4> +<p>If NASM is being used as the back end to a compiler, it might be +desirable to suppress preprocessing completely and assume the compiler has +already done it, to save time and increase compilation speeds. The +<code><nobr>-a</nobr></code> option, requiring no argument, instructs NASM +to replace its powerful preprocessor with a stub preprocessor which does +nothing. +<h4><a name="section-2.1.22">2.1.22 The <code><nobr>-O</nobr></code> Option: Specifying Multipass Optimization</a></h4> +<p>NASM defaults to not optimizing operands which can fit into a signed +byte. This means that if you want the shortest possible object code, you +have to enable optimization. +<p>Using the <code><nobr>-O</nobr></code> option, you can tell NASM to +carry out different levels of optimization. The syntax is: +<ul> +<li><code><nobr>-O0</nobr></code>: No optimization. All operands take their +long forms, if a short form is not specified, except conditional jumps. +This is intended to match NASM 0.98 behavior. +<li><code><nobr>-O1</nobr></code>: Minimal optimization. As above, but +immediate operands which will fit in a signed byte are optimized, unless +the long form is specified. Conditional jumps default to the long form +unless otherwise specified. +<li><code><nobr>-Ox</nobr></code> (where <code><nobr>x</nobr></code> is the +actual letter <code><nobr>x</nobr></code>): Multipass optimization. +Minimize branch offsets and signed immediate bytes, overriding size +specification unless the <code><nobr>strict</nobr></code> keyword has been +used (see <a href="nasmdoc3.html#section-3.7">section 3.7</a>). For +compatability with earlier releases, the letter <code><nobr>x</nobr></code> +may also be any number greater than one. This number has no effect on the +actual number of passes. +</ul> +<p>The <code><nobr>-Ox</nobr></code> mode is recommended for most uses. +<p>Note that this is a capital <code><nobr>O</nobr></code>, and is +different from a small <code><nobr>o</nobr></code>, which is used to +specify the output file name. See <a href="#section-2.1.1">section +2.1.1</a>. +<h4><a name="section-2.1.23">2.1.23 The <code><nobr>-t</nobr></code> Option: Enable TASM Compatibility Mode</a></h4> +<p>NASM includes a limited form of compatibility with Borland's +<code><nobr>TASM</nobr></code>. When NASM's <code><nobr>-t</nobr></code> +option is used, the following changes are made: +<ul> +<li>local labels may be prefixed with <code><nobr>@@</nobr></code> instead +of <code><nobr>.</nobr></code> +<li>size override is supported within brackets. In TASM compatible mode, a +size override inside square brackets changes the size of the operand, and +not the address type of the operand as it does in NASM syntax. E.g. +<code><nobr>mov eax,[DWORD val]</nobr></code> is valid syntax in TASM +compatibility mode. Note that you lose the ability to override the default +address type for the instruction. +<li>unprefixed forms of some directives supported +(<code><nobr>arg</nobr></code>, <code><nobr>elif</nobr></code>, +<code><nobr>else</nobr></code>, <code><nobr>endif</nobr></code>, +<code><nobr>if</nobr></code>, <code><nobr>ifdef</nobr></code>, +<code><nobr>ifdifi</nobr></code>, <code><nobr>ifndef</nobr></code>, +<code><nobr>include</nobr></code>, <code><nobr>local</nobr></code>) +</ul> +<h4><a name="section-2.1.24">2.1.24 The <code><nobr>-w</nobr></code> and <code><nobr>-W</nobr></code> Options: Enable or Disable Assembly Warnings</a></h4> +<p>NASM can observe many conditions during the course of assembly which are +worth mentioning to the user, but not a sufficiently severe error to +justify NASM refusing to generate an output file. These conditions are +reported like errors, but come up with the word `warning' before the +message. Warnings do not prevent NASM from generating an output file and +returning a success status to the operating system. +<p>Some conditions are even less severe than that: they are only sometimes +worth mentioning to the user. Therefore NASM supports the +<code><nobr>-w</nobr></code> command-line option, which enables or disables +certain classes of assembly warning. Such warning classes are described by +a name, for example <code><nobr>orphan-labels</nobr></code>; you can enable +warnings of this class by the command-line option +<code><nobr>-w+orphan-labels</nobr></code> and disable it by +<code><nobr>-w-orphan-labels</nobr></code>. +<p>The suppressible warning classes are: +<ul> +<li><code><nobr>macro-params</nobr></code> covers warnings about multi-line +macros being invoked with the wrong number of parameters. This warning +class is enabled by default; see +<a href="nasmdoc4.html#section-4.3.2">section 4.3.2</a> for an example of +why you might want to disable it. +<li><code><nobr>macro-selfref</nobr></code> warns if a macro references +itself. This warning class is disabled by default. +<li><code><nobr>macro-defaults</nobr></code> warns when a macro has more +default parameters than optional parameters. This warning class is enabled +by default; see <a href="nasmdoc4.html#section-4.3.5">section 4.3.5</a> for +why you might want to disable it. +<li><code><nobr>orphan-labels</nobr></code> covers warnings about source +lines which contain no instruction but define a label without a trailing +colon. NASM warns about this somewhat obscure condition by default; see +<a href="nasmdoc3.html#section-3.1">section 3.1</a> for more information. +<li><code><nobr>number-overflow</nobr></code> covers warnings about numeric +constants which don't fit in 64 bits. This warning class is enabled by +default. +<li><code><nobr>gnu-elf-extensions</nobr></code> warns if 8-bit or 16-bit +relocations are used in <code><nobr>-f elf</nobr></code> format. The GNU +extensions allow this. This warning class is disabled by default. +<li><code><nobr>float-overflow</nobr></code> warns about floating point +overflow. Enabled by default. +<li><code><nobr>float-denorm</nobr></code> warns about floating point +denormals. Disabled by default. +<li><code><nobr>float-underflow</nobr></code> warns about floating point +underflow. Disabled by default. +<li><code><nobr>float-toolong</nobr></code> warns about too many digits in +floating-point numbers. Enabled by default. +<li><code><nobr>user</nobr></code> controls +<code><nobr>%warning</nobr></code> directives (see +<a href="nasmdoc4.html#section-4.9">section 4.9</a>). Enabled by default. +<li><code><nobr>error</nobr></code> causes warnings to be treated as +errors. Disabled by default. +<li><code><nobr>all</nobr></code> is an alias for <em>all</em> suppressible +warning classes (not including <code><nobr>error</nobr></code>). Thus, +<code><nobr>-w+all</nobr></code> enables all available warnings. +</ul> +<p>In addition, you can set warning classes across sections. Warning +classes may be enabled with +<code><nobr>[warning +warning-name]</nobr></code>, disabled with +<code><nobr>[warning -warning-name]</nobr></code> or reset to their +original value with <code><nobr>[warning *warning-name]</nobr></code>. No +"user form" (without the brackets) exists. +<p>Since version 2.00, NASM has also supported the gcc-like syntax +<code><nobr>-Wwarning</nobr></code> and +<code><nobr>-Wno-warning</nobr></code> instead of +<code><nobr>-w+warning</nobr></code> and +<code><nobr>-w-warning</nobr></code>, respectively. +<h4><a name="section-2.1.25">2.1.25 The <code><nobr>-v</nobr></code> Option: Display Version Info</a></h4> +<p>Typing <code><nobr>NASM -v</nobr></code> will display the version of +NASM which you are using, and the date on which it was compiled. +<p>You will need the version number if you report a bug. +<h4><a name="section-2.1.26">2.1.26 The <code><nobr>-y</nobr></code> Option: Display Available Debug Info Formats</a></h4> +<p>Typing <code><nobr>nasm -f <option> -y</nobr></code> will display +a list of the available debug info formats for the given output format. The +default format is indicated by an asterisk. For example: +<p><pre> +nasm -f elf -y +</pre> +<p><pre> +valid debug formats for 'elf32' output format are + ('*' denotes default): + * stabs ELF32 (i386) stabs debug format for Linux + dwarf elf32 (i386) dwarf debug format for Linux +</pre> +<h4><a name="section-2.1.27">2.1.27 The <code><nobr>--prefix</nobr></code> and <code><nobr>--postfix</nobr></code> Options.</a></h4> +<p>The <code><nobr>--prefix</nobr></code> and +<code><nobr>--postfix</nobr></code> options prepend or append +(respectively) the given argument to all <code><nobr>global</nobr></code> +or <code><nobr>extern</nobr></code> variables. E.g. +<code><nobr>--prefix _</nobr></code> will prepend the underscore to all +global and external variables, as C sometimes (but not always) likes it. +<h4><a name="section-2.1.28">2.1.28 The <code><nobr>NASMENV</nobr></code> Environment Variable</a></h4> +<p>If you define an environment variable called +<code><nobr>NASMENV</nobr></code>, the program will interpret it as a list +of extra command-line options, which are processed before the real command +line. You can use this to define standard search directories for include +files, by putting <code><nobr>-i</nobr></code> options in the +<code><nobr>NASMENV</nobr></code> variable. +<p>The value of the variable is split up at white space, so that the value +<code><nobr>-s -ic:\nasmlib\</nobr></code> will be treated as two separate +options. However, that means that the value +<code><nobr>-dNAME="my name"</nobr></code> won't do what you might want, +because it will be split at the space and the NASM command-line processing +will get confused by the two nonsensical words +<code><nobr>-dNAME="my</nobr></code> and <code><nobr>name"</nobr></code>. +<p>To get round this, NASM provides a feature whereby, if you begin the +<code><nobr>NASMENV</nobr></code> environment variable with some character +that isn't a minus sign, then NASM will treat this character as the +separator character for options. So setting the +<code><nobr>NASMENV</nobr></code> variable to the value +<code><nobr>!-s!-ic:\nasmlib\</nobr></code> is equivalent to setting it to +<code><nobr>-s -ic:\nasmlib\</nobr></code>, but +<code><nobr>!-dNAME="my name"</nobr></code> will work. +<p>This environment variable was previously called +<code><nobr>NASM</nobr></code>. This was changed with version 0.98.31. +<h3><a name="section-2.2">2.2 Quick Start for MASM Users</a></h3> +<p>If you're used to writing programs with MASM, or with TASM in +MASM-compatible (non-Ideal) mode, or with <code><nobr>a86</nobr></code>, +this section attempts to outline the major differences between MASM's +syntax and NASM's. If you're not already used to MASM, it's probably worth +skipping this section. +<h4><a name="section-2.2.1">2.2.1 NASM Is Case-Sensitive</a></h4> +<p>One simple difference is that NASM is case-sensitive. It makes a +difference whether you call your label <code><nobr>foo</nobr></code>, +<code><nobr>Foo</nobr></code> or <code><nobr>FOO</nobr></code>. If you're +assembling to <code><nobr>DOS</nobr></code> or +<code><nobr>OS/2</nobr></code> <code><nobr>.OBJ</nobr></code> files, you +can invoke the <code><nobr>UPPERCASE</nobr></code> directive (documented in +<a href="nasmdoc7.html#section-7.4">section 7.4</a>) to ensure that all +symbols exported to other code modules are forced to be upper case; but +even then, <em>within</em> a single module, NASM will distinguish between +labels differing only in case. +<h4><a name="section-2.2.2">2.2.2 NASM Requires Square Brackets For Memory References</a></h4> +<p>NASM was designed with simplicity of syntax in mind. One of the design +goals of NASM is that it should be possible, as far as is practical, for +the user to look at a single line of NASM code and tell what opcode is +generated by it. You can't do this in MASM: if you declare, for example, +<p><pre> +foo equ 1 +bar dw 2 +</pre> +<p>then the two lines of code +<p><pre> + mov ax,foo + mov ax,bar +</pre> +<p>generate completely different opcodes, despite having identical-looking +syntaxes. +<p>NASM avoids this undesirable situation by having a much simpler syntax +for memory references. The rule is simply that any access to the +<em>contents</em> of a memory location requires square brackets around the +address, and any access to the <em>address</em> of a variable doesn't. So +an instruction of the form <code><nobr>mov ax,foo</nobr></code> will +<em>always</em> refer to a compile-time constant, whether it's an +<code><nobr>EQU</nobr></code> or the address of a variable; and to access +the <em>contents</em> of the variable <code><nobr>bar</nobr></code>, you +must code <code><nobr>mov ax,[bar]</nobr></code>. +<p>This also means that NASM has no need for MASM's +<code><nobr>OFFSET</nobr></code> keyword, since the MASM code +<code><nobr>mov ax,offset bar</nobr></code> means exactly the same thing as +NASM's <code><nobr>mov ax,bar</nobr></code>. If you're trying to get large +amounts of MASM code to assemble sensibly under NASM, you can always code +<code><nobr>%idefine offset</nobr></code> to make the preprocessor treat +the <code><nobr>OFFSET</nobr></code> keyword as a no-op. +<p>This issue is even more confusing in <code><nobr>a86</nobr></code>, +where declaring a label with a trailing colon defines it to be a `label' as +opposed to a `variable' and causes <code><nobr>a86</nobr></code> to adopt +NASM-style semantics; so in <code><nobr>a86</nobr></code>, +<code><nobr>mov ax,var</nobr></code> has different behaviour depending on +whether <code><nobr>var</nobr></code> was declared as +<code><nobr>var: dw 0</nobr></code> (a label) or +<code><nobr>var dw 0</nobr></code> (a word-size variable). NASM is very +simple by comparison: <em>everything</em> is a label. +<p>NASM, in the interests of simplicity, also does not support the hybrid +syntaxes supported by MASM and its clones, such as +<code><nobr>mov ax,table[bx]</nobr></code>, where a memory reference is +denoted by one portion outside square brackets and another portion inside. +The correct syntax for the above is +<code><nobr>mov ax,[table+bx]</nobr></code>. Likewise, +<code><nobr>mov ax,es:[di]</nobr></code> is wrong and +<code><nobr>mov ax,[es:di]</nobr></code> is right. +<h4><a name="section-2.2.3">2.2.3 NASM Doesn't Store Variable Types</a></h4> +<p>NASM, by design, chooses not to remember the types of variables you +declare. Whereas MASM will remember, on seeing +<code><nobr>var dw 0</nobr></code>, that you declared +<code><nobr>var</nobr></code> as a word-size variable, and will then be +able to fill in the ambiguity in the size of the instruction +<code><nobr>mov var,2</nobr></code>, NASM will deliberately remember +nothing about the symbol <code><nobr>var</nobr></code> except where it +begins, and so you must explicitly code +<code><nobr>mov word [var],2</nobr></code>. +<p>For this reason, NASM doesn't support the +<code><nobr>LODS</nobr></code>, <code><nobr>MOVS</nobr></code>, +<code><nobr>STOS</nobr></code>, <code><nobr>SCAS</nobr></code>, +<code><nobr>CMPS</nobr></code>, <code><nobr>INS</nobr></code>, or +<code><nobr>OUTS</nobr></code> instructions, but only supports the forms +such as <code><nobr>LODSB</nobr></code>, <code><nobr>MOVSW</nobr></code>, +and <code><nobr>SCASD</nobr></code>, which explicitly specify the size of +the components of the strings being manipulated. +<h4><a name="section-2.2.4">2.2.4 NASM Doesn't <code><nobr>ASSUME</nobr></code></a></h4> +<p>As part of NASM's drive for simplicity, it also does not support the +<code><nobr>ASSUME</nobr></code> directive. NASM will not keep track of +what values you choose to put in your segment registers, and will never +<em>automatically</em> generate a segment override prefix. +<h4><a name="section-2.2.5">2.2.5 NASM Doesn't Support Memory Models</a></h4> +<p>NASM also does not have any directives to support different 16-bit +memory models. The programmer has to keep track of which functions are +supposed to be called with a far call and which with a near call, and is +responsible for putting the correct form of <code><nobr>RET</nobr></code> +instruction (<code><nobr>RETN</nobr></code> or +<code><nobr>RETF</nobr></code>; NASM accepts <code><nobr>RET</nobr></code> +itself as an alternate form for <code><nobr>RETN</nobr></code>); in +addition, the programmer is responsible for coding CALL FAR instructions +where necessary when calling <em>external</em> functions, and must also +keep track of which external variable definitions are far and which are +near. +<h4><a name="section-2.2.6">2.2.6 Floating-Point Differences</a></h4> +<p>NASM uses different names to refer to floating-point registers from +MASM: where MASM would call them <code><nobr>ST(0)</nobr></code>, +<code><nobr>ST(1)</nobr></code> and so on, and +<code><nobr>a86</nobr></code> would call them simply +<code><nobr>0</nobr></code>, <code><nobr>1</nobr></code> and so on, NASM +chooses to call them <code><nobr>st0</nobr></code>, +<code><nobr>st1</nobr></code> etc. +<p>As of version 0.96, NASM now treats the instructions with `nowait' forms +in the same way as MASM-compatible assemblers. The idiosyncratic treatment +employed by 0.95 and earlier was based on a misunderstanding by the +authors. +<h4><a name="section-2.2.7">2.2.7 Other Differences</a></h4> +<p>For historical reasons, NASM uses the keyword +<code><nobr>TWORD</nobr></code> where MASM and compatible assemblers use +<code><nobr>TBYTE</nobr></code>. +<p>NASM does not declare uninitialized storage in the same way as MASM: +where a MASM programmer might use +<code><nobr>stack db 64 dup (?)</nobr></code>, NASM requires +<code><nobr>stack resb 64</nobr></code>, intended to be read as `reserve 64 +bytes'. For a limited amount of compatibility, since NASM treats +<code><nobr>?</nobr></code> as a valid character in symbol names, you can +code <code><nobr>? equ 0</nobr></code> and then writing +<code><nobr>dw ?</nobr></code> will at least do something vaguely useful. +<code><nobr>DUP</nobr></code> is still not a supported syntax, however. +<p>In addition to all of this, macros and directives work completely +differently to MASM. See <a href="nasmdoc4.html">chapter 4</a> and +<a href="nasmdoc6.html">chapter 6</a> for further details. +<p align=center><a href="nasmdoc3.html">Next Chapter</a> | +<a href="nasmdoc1.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc3.html b/doc/html/nasmdoc3.html new file mode 100644 index 0000000..b70e438 --- /dev/null +++ b/doc/html/nasmdoc3.html @@ -0,0 +1,753 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc4.html">Next Chapter</a> | +<a href="nasmdoc2.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-3">Chapter 3: The NASM Language</a></h2> +<h3><a name="section-3.1">3.1 Layout of a NASM Source Line</a></h3> +<p>Like most assemblers, each NASM source line contains (unless it is a +macro, a preprocessor directive or an assembler directive: see +<a href="nasmdoc4.html">chapter 4</a> and <a href="nasmdoc6.html">chapter +6</a>) some combination of the four fields +<p><pre> +label: instruction operands ; comment +</pre> +<p>As usual, most of these fields are optional; the presence or absence of +any combination of a label, an instruction and a comment is allowed. Of +course, the operand field is either required or forbidden by the presence +and nature of the instruction field. +<p>NASM uses backslash (\) as the line continuation character; if a line +ends with backslash, the next line is considered to be a part of the +backslash-ended line. +<p>NASM places no restrictions on white space within a line: labels may +have white space before them, or instructions may have no space before +them, or anything. The colon after a label is also optional. (Note that +this means that if you intend to code <code><nobr>lodsb</nobr></code> alone +on a line, and type <code><nobr>lodab</nobr></code> by accident, then +that's still a valid source line which does nothing but define a label. +Running NASM with the command-line option +<code><nobr>-w+orphan-labels</nobr></code> will cause it to warn you if you +define a label alone on a line without a trailing colon.) +<p>Valid characters in labels are letters, numbers, +<code><nobr>_</nobr></code>, <code><nobr>$</nobr></code>, +<code><nobr>#</nobr></code>, <code><nobr>@</nobr></code>, +<code><nobr>~</nobr></code>, <code><nobr>.</nobr></code>, and +<code><nobr>?</nobr></code>. The only characters which may be used as the +<em>first</em> character of an identifier are letters, +<code><nobr>.</nobr></code> (with special meaning: see +<a href="#section-3.9">section 3.9</a>), <code><nobr>_</nobr></code> and +<code><nobr>?</nobr></code>. An identifier may also be prefixed with a +<code><nobr>$</nobr></code> to indicate that it is intended to be read as +an identifier and not a reserved word; thus, if some other module you are +linking with defines a symbol called <code><nobr>eax</nobr></code>, you can +refer to <code><nobr>$eax</nobr></code> in NASM code to distinguish the +symbol from the register. Maximum length of an identifier is 4095 +characters. +<p>The instruction field may contain any machine instruction: Pentium and +P6 instructions, FPU instructions, MMX instructions and even undocumented +instructions are all supported. The instruction may be prefixed by +<code><nobr>LOCK</nobr></code>, <code><nobr>REP</nobr></code>, +<code><nobr>REPE</nobr></code>/<code><nobr>REPZ</nobr></code> or +<code><nobr>REPNE</nobr></code>/<code><nobr>REPNZ</nobr></code>, in the +usual way. Explicit address-size and operand-size prefixes +<code><nobr>A16</nobr></code>, <code><nobr>A32</nobr></code>, +<code><nobr>A64</nobr></code>, <code><nobr>O16</nobr></code> and +<code><nobr>O32</nobr></code>, <code><nobr>O64</nobr></code> are provided - +one example of their use is given in <a href="nasmdo10.html">chapter +10</a>. You can also use the name of a segment register as an instruction +prefix: coding <code><nobr>es mov [bx],ax</nobr></code> is equivalent to +coding <code><nobr>mov [es:bx],ax</nobr></code>. We recommend the latter +syntax, since it is consistent with other syntactic features of the +language, but for instructions such as <code><nobr>LODSB</nobr></code>, +which has no operands and yet can require a segment override, there is no +clean syntactic way to proceed apart from +<code><nobr>es lodsb</nobr></code>. +<p>An instruction is not required to use a prefix: prefixes such as +<code><nobr>CS</nobr></code>, <code><nobr>A32</nobr></code>, +<code><nobr>LOCK</nobr></code> or <code><nobr>REPE</nobr></code> can appear +on a line by themselves, and NASM will just generate the prefix bytes. +<p>In addition to actual machine instructions, NASM also supports a number +of pseudo-instructions, described in <a href="#section-3.2">section +3.2</a>. +<p>Instruction operands may take a number of forms: they can be registers, +described simply by the register name (e.g. <code><nobr>ax</nobr></code>, +<code><nobr>bp</nobr></code>, <code><nobr>ebx</nobr></code>, +<code><nobr>cr0</nobr></code>: NASM does not use the +<code><nobr>gas</nobr></code>-style syntax in which register names must be +prefixed by a <code><nobr>%</nobr></code> sign), or they can be effective +addresses (see <a href="#section-3.3">section 3.3</a>), constants +(<a href="#section-3.4">section 3.4</a>) or expressions +(<a href="#section-3.5">section 3.5</a>). +<p>For x87 floating-point instructions, NASM accepts a wide range of +syntaxes: you can use two-operand forms like MASM supports, or you can use +NASM's native single-operand forms in most cases. For example, you can +code: +<p><pre> + fadd st1 ; this sets st0 := st0 + st1 + fadd st0,st1 ; so does this + + fadd st1,st0 ; this sets st1 := st1 + st0 + fadd to st1 ; so does this +</pre> +<p>Almost any x87 floating-point instruction that references memory must +use one of the prefixes <code><nobr>DWORD</nobr></code>, +<code><nobr>QWORD</nobr></code> or <code><nobr>TWORD</nobr></code> to +indicate what size of memory operand it refers to. +<h3><a name="section-3.2">3.2 Pseudo-Instructions</a></h3> +<p>Pseudo-instructions are things which, though not real x86 machine +instructions, are used in the instruction field anyway because that's the +most convenient place to put them. The current pseudo-instructions are +<code><nobr>DB</nobr></code>, <code><nobr>DW</nobr></code>, +<code><nobr>DD</nobr></code>, <code><nobr>DQ</nobr></code>, +<code><nobr>DT</nobr></code>, <code><nobr>DO</nobr></code> and +<code><nobr>DY</nobr></code>; their uninitialized counterparts +<code><nobr>RESB</nobr></code>, <code><nobr>RESW</nobr></code>, +<code><nobr>RESD</nobr></code>, <code><nobr>RESQ</nobr></code>, +<code><nobr>REST</nobr></code>, <code><nobr>RESO</nobr></code> and +<code><nobr>RESY</nobr></code>; the <code><nobr>INCBIN</nobr></code> +command, the <code><nobr>EQU</nobr></code> command, and the +<code><nobr>TIMES</nobr></code> prefix. +<h4><a name="section-3.2.1">3.2.1 <code><nobr>DB</nobr></code> and Friends: Declaring Initialized Data</a></h4> +<p><code><nobr>DB</nobr></code>, <code><nobr>DW</nobr></code>, +<code><nobr>DD</nobr></code>, <code><nobr>DQ</nobr></code>, +<code><nobr>DT</nobr></code>, <code><nobr>DO</nobr></code> and +<code><nobr>DY</nobr></code> are used, much as in MASM, to declare +initialized data in the output file. They can be invoked in a wide range of +ways: +<p><pre> + db 0x55 ; just the byte 0x55 + db 0x55,0x56,0x57 ; three bytes in succession + db 'a',0x55 ; character constants are OK + db 'hello',13,10,'$' ; so are string constants + dw 0x1234 ; 0x34 0x12 + dw 'a' ; 0x61 0x00 (it's just a number) + dw 'ab' ; 0x61 0x62 (character constant) + dw 'abc' ; 0x61 0x62 0x63 0x00 (string) + dd 0x12345678 ; 0x78 0x56 0x34 0x12 + dd 1.234567e20 ; floating-point constant + dq 0x123456789abcdef0 ; eight byte constant + dq 1.234567e20 ; double-precision float + dt 1.234567e20 ; extended-precision float +</pre> +<p><code><nobr>DT</nobr></code>, <code><nobr>DO</nobr></code> and +<code><nobr>DY</nobr></code> do not accept numeric constants as operands. +<h4><a name="section-3.2.2">3.2.2 <code><nobr>RESB</nobr></code> and Friends: Declaring Uninitialized Data</a></h4> +<p><code><nobr>RESB</nobr></code>, <code><nobr>RESW</nobr></code>, +<code><nobr>RESD</nobr></code>, <code><nobr>RESQ</nobr></code>, +<code><nobr>REST</nobr></code>, <code><nobr>RESO</nobr></code> and +<code><nobr>RESY</nobr></code> are designed to be used in the BSS section +of a module: they declare <em>uninitialized</em> storage space. Each takes +a single operand, which is the number of bytes, words, doublewords or +whatever to reserve. As stated in +<a href="nasmdoc2.html#section-2.2.7">section 2.2.7</a>, NASM does not +support the MASM/TASM syntax of reserving uninitialized space by writing +<code><nobr>DW ?</nobr></code> or similar things: this is what it does +instead. The operand to a <code><nobr>RESB</nobr></code>-type +pseudo-instruction is a <em>critical expression</em>: see +<a href="#section-3.8">section 3.8</a>. +<p>For example: +<p><pre> +buffer: resb 64 ; reserve 64 bytes +wordvar: resw 1 ; reserve a word +realarray resq 10 ; array of ten reals +ymmval: resy 1 ; one YMM register +</pre> +<h4><a name="section-3.2.3">3.2.3 <code><nobr>INCBIN</nobr></code>: Including External Binary Files</a></h4> +<p><code><nobr>INCBIN</nobr></code> is borrowed from the old Amiga +assembler DevPac: it includes a binary file verbatim into the output file. +This can be handy for (for example) including graphics and sound data +directly into a game executable file. It can be called in one of these +three ways: +<p><pre> + incbin "file.dat" ; include the whole file + incbin "file.dat",1024 ; skip the first 1024 bytes + incbin "file.dat",1024,512 ; skip the first 1024, and + ; actually include at most 512 +</pre> +<p><code><nobr>INCBIN</nobr></code> is both a directive and a standard +macro; the standard macro version searches for the file in the include file +search path and adds the file to the dependency lists. This macro can be +overridden if desired. +<h4><a name="section-3.2.4">3.2.4 <code><nobr>EQU</nobr></code>: Defining Constants</a></h4> +<p><code><nobr>EQU</nobr></code> defines a symbol to a given constant +value: when <code><nobr>EQU</nobr></code> is used, the source line must +contain a label. The action of <code><nobr>EQU</nobr></code> is to define +the given label name to the value of its (only) operand. This definition is +absolute, and cannot change later. So, for example, +<p><pre> +message db 'hello, world' +msglen equ $-message +</pre> +<p>defines <code><nobr>msglen</nobr></code> to be the constant 12. +<code><nobr>msglen</nobr></code> may not then be redefined later. This is +not a preprocessor definition either: the value of +<code><nobr>msglen</nobr></code> is evaluated <em>once</em>, using the +value of <code><nobr>$</nobr></code> (see <a href="#section-3.5">section +3.5</a> for an explanation of <code><nobr>$</nobr></code>) at the point of +definition, rather than being evaluated wherever it is referenced and using +the value of <code><nobr>$</nobr></code> at the point of reference. +<h4><a name="section-3.2.5">3.2.5 <code><nobr>TIMES</nobr></code>: Repeating Instructions or Data</a></h4> +<p>The <code><nobr>TIMES</nobr></code> prefix causes the instruction to be +assembled multiple times. This is partly present as NASM's equivalent of +the <code><nobr>DUP</nobr></code> syntax supported by MASM-compatible +assemblers, in that you can code +<p><pre> +zerobuf: times 64 db 0 +</pre> +<p>or similar things; but <code><nobr>TIMES</nobr></code> is more versatile +than that. The argument to <code><nobr>TIMES</nobr></code> is not just a +numeric constant, but a numeric <em>expression</em>, so you can do things +like +<p><pre> +buffer: db 'hello, world' + times 64-$+buffer db ' ' +</pre> +<p>which will store exactly enough spaces to make the total length of +<code><nobr>buffer</nobr></code> up to 64. Finally, +<code><nobr>TIMES</nobr></code> can be applied to ordinary instructions, so +you can code trivial unrolled loops in it: +<p><pre> + times 100 movsb +</pre> +<p>Note that there is no effective difference between +<code><nobr>times 100 resb 1</nobr></code> and +<code><nobr>resb 100</nobr></code>, except that the latter will be +assembled about 100 times faster due to the internal structure of the +assembler. +<p>The operand to <code><nobr>TIMES</nobr></code> is a critical expression +(<a href="#section-3.8">section 3.8</a>). +<p>Note also that <code><nobr>TIMES</nobr></code> can't be applied to +macros: the reason for this is that <code><nobr>TIMES</nobr></code> is +processed after the macro phase, which allows the argument to +<code><nobr>TIMES</nobr></code> to contain expressions such as +<code><nobr>64-$+buffer</nobr></code> as above. To repeat more than one +line of code, or a complex macro, use the preprocessor +<code><nobr>%rep</nobr></code> directive. +<h3><a name="section-3.3">3.3 Effective Addresses</a></h3> +<p>An effective address is any operand to an instruction which references +memory. Effective addresses, in NASM, have a very simple syntax: they +consist of an expression evaluating to the desired address, enclosed in +square brackets. For example: +<p><pre> +wordvar dw 123 + mov ax,[wordvar] + mov ax,[wordvar+1] + mov ax,[es:wordvar+bx] +</pre> +<p>Anything not conforming to this simple system is not a valid memory +reference in NASM, for example <code><nobr>es:wordvar[bx]</nobr></code>. +<p>More complicated effective addresses, such as those involving more than +one register, work in exactly the same way: +<p><pre> + mov eax,[ebx*2+ecx+offset] + mov ax,[bp+di+8] +</pre> +<p>NASM is capable of doing algebra on these effective addresses, so that +things which don't necessarily <em>look</em> legal are perfectly all right: +<p><pre> + mov eax,[ebx*5] ; assembles as [ebx*4+ebx] + mov eax,[label1*2-label2] ; ie [label1+(label1-label2)] +</pre> +<p>Some forms of effective address have more than one assembled form; in +most such cases NASM will generate the smallest form it can. For example, +there are distinct assembled forms for the 32-bit effective addresses +<code><nobr>[eax*2+0]</nobr></code> and +<code><nobr>[eax+eax]</nobr></code>, and NASM will generally generate the +latter on the grounds that the former requires four bytes to store a zero +offset. +<p>NASM has a hinting mechanism which will cause +<code><nobr>[eax+ebx]</nobr></code> and <code><nobr>[ebx+eax]</nobr></code> +to generate different opcodes; this is occasionally useful because +<code><nobr>[esi+ebp]</nobr></code> and <code><nobr>[ebp+esi]</nobr></code> +have different default segment registers. +<p>However, you can force NASM to generate an effective address in a +particular form by the use of the keywords <code><nobr>BYTE</nobr></code>, +<code><nobr>WORD</nobr></code>, <code><nobr>DWORD</nobr></code> and +<code><nobr>NOSPLIT</nobr></code>. If you need +<code><nobr>[eax+3]</nobr></code> to be assembled using a double-word +offset field instead of the one byte NASM will normally generate, you can +code <code><nobr>[dword eax+3]</nobr></code>. Similarly, you can force NASM +to use a byte offset for a small value which it hasn't seen on the first +pass (see <a href="#section-3.8">section 3.8</a> for an example of such a +code fragment) by using <code><nobr>[byte eax+offset]</nobr></code>. As +special cases, <code><nobr>[byte eax]</nobr></code> will code +<code><nobr>[eax+0]</nobr></code> with a byte offset of zero, and +<code><nobr>[dword eax]</nobr></code> will code it with a double-word +offset of zero. The normal form, <code><nobr>[eax]</nobr></code>, will be +coded with no offset field. +<p>The form described in the previous paragraph is also useful if you are +trying to access data in a 32-bit segment from within 16 bit code. For more +information on this see the section on mixed-size addressing +(<a href="nasmdo10.html#section-10.2">section 10.2</a>). In particular, if +you need to access data with a known offset that is larger than will fit in +a 16-bit value, if you don't specify that it is a dword offset, nasm will +cause the high word of the offset to be lost. +<p>Similarly, NASM will split <code><nobr>[eax*2]</nobr></code> into +<code><nobr>[eax+eax]</nobr></code> because that allows the offset field to +be absent and space to be saved; in fact, it will also split +<code><nobr>[eax*2+offset]</nobr></code> into +<code><nobr>[eax+eax+offset]</nobr></code>. You can combat this behaviour +by the use of the <code><nobr>NOSPLIT</nobr></code> keyword: +<code><nobr>[nosplit eax*2]</nobr></code> will force +<code><nobr>[eax*2+0]</nobr></code> to be generated literally. +<p>In 64-bit mode, NASM will by default generate absolute addresses. The +<code><nobr>REL</nobr></code> keyword makes it produce +<code><nobr>RIP</nobr></code>-relative addresses. Since this is frequently +the normally desired behaviour, see the <code><nobr>DEFAULT</nobr></code> +directive (<a href="nasmdoc6.html#section-6.2">section 6.2</a>). The +keyword <code><nobr>ABS</nobr></code> overrides +<code><nobr>REL</nobr></code>. +<h3><a name="section-3.4">3.4 Constants</a></h3> +<p>NASM understands four different types of constant: numeric, character, +string and floating-point. +<h4><a name="section-3.4.1">3.4.1 Numeric Constants</a></h4> +<p>A numeric constant is simply a number. NASM allows you to specify +numbers in a variety of number bases, in a variety of ways: you can suffix +<code><nobr>H</nobr></code> or <code><nobr>X</nobr></code>, +<code><nobr>Q</nobr></code> or <code><nobr>O</nobr></code>, and +<code><nobr>B</nobr></code> for hexadecimal, octal and binary respectively, +or you can prefix <code><nobr>0x</nobr></code> for hexadecimal in the style +of C, or you can prefix <code><nobr>$</nobr></code> for hexadecimal in the +style of Borland Pascal. Note, though, that the <code><nobr>$</nobr></code> +prefix does double duty as a prefix on identifiers (see +<a href="#section-3.1">section 3.1</a>), so a hex number prefixed with a +<code><nobr>$</nobr></code> sign must have a digit after the +<code><nobr>$</nobr></code> rather than a letter. In addition, current +versions of NASM accept the prefix <code><nobr>0h</nobr></code> for +hexadecimal, <code><nobr>0o</nobr></code> or <code><nobr>0q</nobr></code> +for octal, and <code><nobr>0b</nobr></code> for binary. Please note that +unlike C, a <code><nobr>0</nobr></code> prefix by itself does <em>not</em> +imply an octal constant! +<p>Numeric constants can have underscores (<code><nobr>_</nobr></code>) +interspersed to break up long strings. +<p>Some examples (all producing exactly the same code): +<p><pre> + mov ax,200 ; decimal + mov ax,0200 ; still decimal + mov ax,0200d ; explicitly decimal + mov ax,0d200 ; also decimal + mov ax,0c8h ; hex + mov ax,$0c8 ; hex again: the 0 is required + mov ax,0xc8 ; hex yet again + mov ax,0hc8 ; still hex + mov ax,310q ; octal + mov ax,310o ; octal again + mov ax,0o310 ; octal yet again + mov ax,0q310 ; hex yet again + mov ax,11001000b ; binary + mov ax,1100_1000b ; same binary constant + mov ax,0b1100_1000 ; same binary constant yet again +</pre> +<h4><a name="section-3.4.2">3.4.2 Character Strings</a></h4> +<p>A character string consists of up to eight characters enclosed in either +single quotes (<code><nobr>'...'</nobr></code>), double quotes +(<code><nobr>"..."</nobr></code>) or backquotes +(<code><nobr>`...`</nobr></code>). Single or double quotes are equivalent +to NASM (except of course that surrounding the constant with single quotes +allows double quotes to appear within it and vice versa); the contents of +those are represented verbatim. Strings enclosed in backquotes support +C-style <code><nobr>\</nobr></code>-escapes for special characters. +<p>The following escape sequences are recognized by backquoted strings: +<p><pre> + \' single quote (') + \" double quote (") + \` backquote (`) + \\ backslash (\) + \? question mark (?) + \a BEL (ASCII 7) + \b BS (ASCII 8) + \t TAB (ASCII 9) + \n LF (ASCII 10) + \v VT (ASCII 11) + \f FF (ASCII 12) + \r CR (ASCII 13) + \e ESC (ASCII 27) + \377 Up to 3 octal digits - literal byte + \xFF Up to 2 hexadecimal digits - literal byte + \u1234 4 hexadecimal digits - Unicode character + \U12345678 8 hexadecimal digits - Unicode character +</pre> +<p>All other escape sequences are reserved. Note that +<code><nobr>\0</nobr></code>, meaning a <code><nobr>NUL</nobr></code> +character (ASCII 0), is a special case of the octal escape sequence. +<p>Unicode characters specified with <code><nobr>\u</nobr></code> or +<code><nobr>\U</nobr></code> are converted to UTF-8. For example, the +following lines are all equivalent: +<p><pre> + db `\u263a` ; UTF-8 smiley face + db `\xe2\x98\xba` ; UTF-8 smiley face + db 0E2h, 098h, 0BAh ; UTF-8 smiley face +</pre> +<h4><a name="section-3.4.3">3.4.3 Character Constants</a></h4> +<p>A character constant consists of a string up to eight bytes long, used +in an expression context. It is treated as if it was an integer. +<p>A character constant with more than one byte will be arranged with +little-endian order in mind: if you code +<p><pre> + mov eax,'abcd' +</pre> +<p>then the constant generated is not <code><nobr>0x61626364</nobr></code>, +but <code><nobr>0x64636261</nobr></code>, so that if you were then to store +the value into memory, it would read <code><nobr>abcd</nobr></code> rather +than <code><nobr>dcba</nobr></code>. This is also the sense of character +constants understood by the Pentium's <code><nobr>CPUID</nobr></code> +instruction. +<h4><a name="section-3.4.4">3.4.4 String Constants</a></h4> +<p>String constants are character strings used in the context of some +pseudo-instructions, namely the <code><nobr>DB</nobr></code> family and +<code><nobr>INCBIN</nobr></code> (where it represents a filename.) They are +also used in certain preprocessor directives. +<p>A string constant looks like a character constant, only longer. It is +treated as a concatenation of maximum-size character constants for the +conditions. So the following are equivalent: +<p><pre> + db 'hello' ; string constant + db 'h','e','l','l','o' ; equivalent character constants +</pre> +<p>And the following are also equivalent: +<p><pre> + dd 'ninechars' ; doubleword string constant + dd 'nine','char','s' ; becomes three doublewords + db 'ninechars',0,0,0 ; and really looks like this +</pre> +<p>Note that when used in a string-supporting context, quoted strings are +treated as a string constants even if they are short enough to be a +character constant, because otherwise <code><nobr>db 'ab'</nobr></code> +would have the same effect as <code><nobr>db 'a'</nobr></code>, which would +be silly. Similarly, three-character or four-character constants are +treated as strings when they are operands to <code><nobr>DW</nobr></code>, +and so forth. +<h4><a name="section-3.4.5">3.4.5 Unicode Strings</a></h4> +<p>The special operators <code><nobr>__utf16__</nobr></code> and +<code><nobr>__utf32__</nobr></code> allows definition of Unicode strings. +They take a string in UTF-8 format and converts it to (littleendian) UTF-16 +or UTF-32, respectively. +<p>For example: +<p><pre> +%define u(x) __utf16__(x) +%define w(x) __utf32__(x) + + dw u('C:\WINDOWS'), 0 ; Pathname in UTF-16 + dd w(`A + B = \u206a`), 0 ; String in UTF-32 +</pre> +<p><code><nobr>__utf16__</nobr></code> and +<code><nobr>__utf32__</nobr></code> can be applied either to strings passed +to the <code><nobr>DB</nobr></code> family instructions, or to character +constants in an expression context. +<h4><a name="section-3.4.6">3.4.6 Floating-Point Constants</a></h4> +<p>Floating-point constants are acceptable only as arguments to +<code><nobr>DB</nobr></code>, <code><nobr>DW</nobr></code>, +<code><nobr>DD</nobr></code>, <code><nobr>DQ</nobr></code>, +<code><nobr>DT</nobr></code>, and <code><nobr>DO</nobr></code>, or as +arguments to the special operators <code><nobr>__float8__</nobr></code>, +<code><nobr>__float16__</nobr></code>, +<code><nobr>__float32__</nobr></code>, +<code><nobr>__float64__</nobr></code>, +<code><nobr>__float80m__</nobr></code>, +<code><nobr>__float80e__</nobr></code>, +<code><nobr>__float128l__</nobr></code>, and +<code><nobr>__float128h__</nobr></code>. +<p>Floating-point constants are expressed in the traditional form: digits, +then a period, then optionally more digits, then optionally an +<code><nobr>E</nobr></code> followed by an exponent. The period is +mandatory, so that NASM can distinguish between +<code><nobr>dd 1</nobr></code>, which declares an integer constant, and +<code><nobr>dd 1.0</nobr></code> which declares a floating-point constant. +NASM also support C99-style hexadecimal floating-point: +<code><nobr>0x</nobr></code>, hexadecimal digits, period, optionally more +hexadeximal digits, then optionally a <code><nobr>P</nobr></code> followed +by a <em>binary</em> (not hexadecimal) exponent in decimal notation. +<p>Underscores to break up groups of digits are permitted in floating-point +constants as well. +<p>Some examples: +<p><pre> + db -0.2 ; "Quarter precision" + dw -0.5 ; IEEE 754r/SSE5 half precision + dd 1.2 ; an easy one + dd 1.222_222_222 ; underscores are permitted + dd 0x1p+2 ; 1.0x2^2 = 4.0 + dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0 + dq 1.e10 ; 10 000 000 000.0 + dq 1.e+10 ; synonymous with 1.e10 + dq 1.e-10 ; 0.000 000 000 1 + dt 3.141592653589793238462 ; pi + do 1.e+4000 ; IEEE 754r quad precision +</pre> +<p>The 8-bit "quarter-precision" floating-point format is +sign:exponent:mantissa = 1:4:3 with an exponent bias of 7. This appears to +be the most frequently used 8-bit floating-point format, although it is not +covered by any formal standard. This is sometimes called a "minifloat." +<p>The special operators are used to produce floating-point numbers in +other contexts. They produce the binary representation of a specific +floating-point number as an integer, and can use anywhere integer constants +are used in an expression. <code><nobr>__float80m__</nobr></code> and +<code><nobr>__float80e__</nobr></code> produce the 64-bit mantissa and +16-bit exponent of an 80-bit floating-point number, and +<code><nobr>__float128l__</nobr></code> and +<code><nobr>__float128h__</nobr></code> produce the lower and upper 64-bit +halves of a 128-bit floating-point number, respectively. +<p>For example: +<p><pre> + mov rax,__float64__(3.141592653589793238462) +</pre> +<p>... would assign the binary representation of pi as a 64-bit floating +point number into <code><nobr>RAX</nobr></code>. This is exactly equivalent +to: +<p><pre> + mov rax,0x400921fb54442d18 +</pre> +<p>NASM cannot do compile-time arithmetic on floating-point constants. This +is because NASM is designed to be portable - although it always generates +code to run on x86 processors, the assembler itself can run on any system +with an ANSI C compiler. Therefore, the assembler cannot guarantee the +presence of a floating-point unit capable of handling the Intel number +formats, and so for NASM to be able to do floating arithmetic it would have +to include its own complete set of floating-point routines, which would +significantly increase the size of the assembler for very little benefit. +<p>The special tokens <code><nobr>__Infinity__</nobr></code>, +<code><nobr>__QNaN__</nobr></code> (or <code><nobr>__NaN__</nobr></code>) +and <code><nobr>__SNaN__</nobr></code> can be used to generate infinities, +quiet NaNs, and signalling NaNs, respectively. These are normally used as +macros: +<p><pre> +%define Inf __Infinity__ +%define NaN __QNaN__ + + dq +1.5, -Inf, NaN ; Double-precision constants +</pre> +<h4><a name="section-3.4.7">3.4.7 Packed BCD Constants</a></h4> +<p>x87-style packed BCD constants can be used in the same contexts as +80-bit floating-point numbers. They are suffixed with +<code><nobr>p</nobr></code> or prefixed with <code><nobr>0p</nobr></code>, +and can include up to 18 decimal digits. +<p>As with other numeric constants, underscores can be used to separate +digits. +<p>For example: +<p><pre> + dt 12_345_678_901_245_678p + dt -12_345_678_901_245_678p + dt +0p33 + dt 33p +</pre> +<h3><a name="section-3.5">3.5 Expressions</a></h3> +<p>Expressions in NASM are similar in syntax to those in C. Expressions are +evaluated as 64-bit integers which are then adjusted to the appropriate +size. +<p>NASM supports two special tokens in expressions, allowing calculations +to involve the current assembly position: the <code><nobr>$</nobr></code> +and <code><nobr>$$</nobr></code> tokens. <code><nobr>$</nobr></code> +evaluates to the assembly position at the beginning of the line containing +the expression; so you can code an infinite loop using +<code><nobr>JMP $</nobr></code>. <code><nobr>$$</nobr></code> evaluates to +the beginning of the current section; so you can tell how far into the +section you are by using <code><nobr>($-$$)</nobr></code>. +<p>The arithmetic operators provided by NASM are listed here, in increasing +order of precedence. +<h4><a name="section-3.5.1">3.5.1 <code><nobr>|</nobr></code>: Bitwise OR Operator</a></h4> +<p>The <code><nobr>|</nobr></code> operator gives a bitwise OR, exactly as +performed by the <code><nobr>OR</nobr></code> machine instruction. Bitwise +OR is the lowest-priority arithmetic operator supported by NASM. +<h4><a name="section-3.5.2">3.5.2 <code><nobr>^</nobr></code>: Bitwise XOR Operator</a></h4> +<p><code><nobr>^</nobr></code> provides the bitwise XOR operation. +<h4><a name="section-3.5.3">3.5.3 <code><nobr>&</nobr></code>: Bitwise AND Operator</a></h4> +<p><code><nobr>&</nobr></code> provides the bitwise AND operation. +<h4><a name="section-3.5.4">3.5.4 <code><nobr><<</nobr></code> and <code><nobr>>></nobr></code>: Bit Shift Operators</a></h4> +<p><code><nobr><<</nobr></code> gives a bit-shift to the left, just +as it does in C. So <code><nobr>5<<3</nobr></code> evaluates to 5 +times 8, or 40. <code><nobr>>></nobr></code> gives a bit-shift to the +right; in NASM, such a shift is <em>always</em> unsigned, so that the bits +shifted in from the left-hand end are filled with zero rather than a +sign-extension of the previous highest bit. +<h4><a name="section-3.5.5">3.5.5 <code><nobr>+</nobr></code> and <code><nobr>-</nobr></code>: Addition and Subtraction Operators</a></h4> +<p>The <code><nobr>+</nobr></code> and <code><nobr>-</nobr></code> +operators do perfectly ordinary addition and subtraction. +<h4><a name="section-3.5.6">3.5.6 <code><nobr>*</nobr></code>, <code><nobr>/</nobr></code>, <code><nobr>//</nobr></code>, <code><nobr>%</nobr></code> and <code><nobr>%%</nobr></code>: Multiplication and Division</a></h4> +<p><code><nobr>*</nobr></code> is the multiplication operator. +<code><nobr>/</nobr></code> and <code><nobr>//</nobr></code> are both +division operators: <code><nobr>/</nobr></code> is unsigned division and +<code><nobr>//</nobr></code> is signed division. Similarly, +<code><nobr>%</nobr></code> and <code><nobr>%%</nobr></code> provide +unsigned and signed modulo operators respectively. +<p>NASM, like ANSI C, provides no guarantees about the sensible operation +of the signed modulo operator. +<p>Since the <code><nobr>%</nobr></code> character is used extensively by +the macro preprocessor, you should ensure that both the signed and unsigned +modulo operators are followed by white space wherever they appear. +<h4><a name="section-3.5.7">3.5.7 Unary Operators: <code><nobr>+</nobr></code>, <code><nobr>-</nobr></code>, <code><nobr>~</nobr></code>, <code><nobr>!</nobr></code> and <code><nobr>SEG</nobr></code></a></h4> +<p>The highest-priority operators in NASM's expression grammar are those +which only apply to one argument. <code><nobr>-</nobr></code> negates its +operand, <code><nobr>+</nobr></code> does nothing (it's provided for +symmetry with <code><nobr>-</nobr></code>), <code><nobr>~</nobr></code> +computes the one's complement of its operand, <code><nobr>!</nobr></code> +is the logical negation operator, and <code><nobr>SEG</nobr></code> +provides the segment address of its operand (explained in more detail in +<a href="#section-3.6">section 3.6</a>). +<h3><a name="section-3.6">3.6 <code><nobr>SEG</nobr></code> and <code><nobr>WRT</nobr></code></a></h3> +<p>When writing large 16-bit programs, which must be split into multiple +segments, it is often necessary to be able to refer to the segment part of +the address of a symbol. NASM supports the <code><nobr>SEG</nobr></code> +operator to perform this function. +<p>The <code><nobr>SEG</nobr></code> operator returns the +<em>preferred</em> segment base of a symbol, defined as the segment base +relative to which the offset of the symbol makes sense. So the code +<p><pre> + mov ax,seg symbol + mov es,ax + mov bx,symbol +</pre> +<p>will load <code><nobr>ES:BX</nobr></code> with a valid pointer to the +symbol <code><nobr>symbol</nobr></code>. +<p>Things can be more complex than this: since 16-bit segments and groups +may overlap, you might occasionally want to refer to some symbol using a +different segment base from the preferred one. NASM lets you do this, by +the use of the <code><nobr>WRT</nobr></code> (With Reference To) keyword. +So you can do things like +<p><pre> + mov ax,weird_seg ; weird_seg is a segment base + mov es,ax + mov bx,symbol wrt weird_seg +</pre> +<p>to load <code><nobr>ES:BX</nobr></code> with a different, but +functionally equivalent, pointer to the symbol +<code><nobr>symbol</nobr></code>. +<p>NASM supports far (inter-segment) calls and jumps by means of the syntax +<code><nobr>call segment:offset</nobr></code>, where +<code><nobr>segment</nobr></code> and <code><nobr>offset</nobr></code> both +represent immediate values. So to call a far procedure, you could code +either of +<p><pre> + call (seg procedure):procedure + call weird_seg:(procedure wrt weird_seg) +</pre> +<p>(The parentheses are included for clarity, to show the intended parsing +of the above instructions. They are not necessary in practice.) +<p>NASM supports the syntax <code><nobr>call far procedure</nobr></code> as +a synonym for the first of the above usages. <code><nobr>JMP</nobr></code> +works identically to <code><nobr>CALL</nobr></code> in these examples. +<p>To declare a far pointer to a data item in a data segment, you must code +<p><pre> + dw symbol, seg symbol +</pre> +<p>NASM supports no convenient synonym for this, though you can always +invent one using the macro processor. +<h3><a name="section-3.7">3.7 <code><nobr>STRICT</nobr></code>: Inhibiting Optimization</a></h3> +<p>When assembling with the optimizer set to level 2 or higher (see +<a href="nasmdoc2.html#section-2.1.22">section 2.1.22</a>), NASM will use +size specifiers (<code><nobr>BYTE</nobr></code>, +<code><nobr>WORD</nobr></code>, <code><nobr>DWORD</nobr></code>, +<code><nobr>QWORD</nobr></code>, <code><nobr>TWORD</nobr></code>, +<code><nobr>OWORD</nobr></code> or <code><nobr>YWORD</nobr></code>), but +will give them the smallest possible size. The keyword +<code><nobr>STRICT</nobr></code> can be used to inhibit optimization and +force a particular operand to be emitted in the specified size. For +example, with the optimizer on, and in <code><nobr>BITS 16</nobr></code> +mode, +<p><pre> + push dword 33 +</pre> +<p>is encoded in three bytes <code><nobr>66 6A 21</nobr></code>, whereas +<p><pre> + push strict dword 33 +</pre> +<p>is encoded in six bytes, with a full dword immediate operand +<code><nobr>66 68 21 00 00 00</nobr></code>. +<p>With the optimizer off, the same code (six bytes) is generated whether +the <code><nobr>STRICT</nobr></code> keyword was used or not. +<h3><a name="section-3.8">3.8 Critical Expressions</a></h3> +<p>Although NASM has an optional multi-pass optimizer, there are some +expressions which must be resolvable on the first pass. These are called +<em>Critical Expressions</em>. +<p>The first pass is used to determine the size of all the assembled code +and data, so that the second pass, when generating all the code, knows all +the symbol addresses the code refers to. So one thing NASM can't handle is +code whose size depends on the value of a symbol declared after the code in +question. For example, +<p><pre> + times (label-$) db 0 +label: db 'Where am I?' +</pre> +<p>The argument to <code><nobr>TIMES</nobr></code> in this case could +equally legally evaluate to anything at all; NASM will reject this example +because it cannot tell the size of the <code><nobr>TIMES</nobr></code> line +when it first sees it. It will just as firmly reject the slightly +paradoxical code +<p><pre> + times (label-$+1) db 0 +label: db 'NOW where am I?' +</pre> +<p>in which <em>any</em> value for the <code><nobr>TIMES</nobr></code> +argument is by definition wrong! +<p>NASM rejects these examples by means of a concept called a <em>critical +expression</em>, which is defined to be an expression whose value is +required to be computable in the first pass, and which must therefore +depend only on symbols defined before it. The argument to the +<code><nobr>TIMES</nobr></code> prefix is a critical expression. +<h3><a name="section-3.9">3.9 Local Labels</a></h3> +<p>NASM gives special treatment to symbols beginning with a period. A label +beginning with a single period is treated as a <em>local</em> label, which +means that it is associated with the previous non-local label. So, for +example: +<p><pre> +label1 ; some code + +.loop + ; some more code + + jne .loop + ret + +label2 ; some code + +.loop + ; some more code + + jne .loop + ret +</pre> +<p>In the above code fragment, each <code><nobr>JNE</nobr></code> +instruction jumps to the line immediately before it, because the two +definitions of <code><nobr>.loop</nobr></code> are kept separate by virtue +of each being associated with the previous non-local label. +<p>This form of local label handling is borrowed from the old Amiga +assembler DevPac; however, NASM goes one step further, in allowing access +to local labels from other parts of the code. This is achieved by means of +<em>defining</em> a local label in terms of the previous non-local label: +the first definition of <code><nobr>.loop</nobr></code> above is really +defining a symbol called <code><nobr>label1.loop</nobr></code>, and the +second defines a symbol called <code><nobr>label2.loop</nobr></code>. So, +if you really needed to, you could write +<p><pre> +label3 ; some more code + ; and some more + + jmp label1.loop +</pre> +<p>Sometimes it is useful - in a macro, for instance - to be able to define +a label which can be referenced from anywhere but which doesn't interfere +with the normal local-label mechanism. Such a label can't be non-local +because it would interfere with subsequent definitions of, and references +to, local labels; and it can't be local because the macro that defined it +wouldn't know the label's full name. NASM therefore introduces a third type +of label, which is probably only useful in macro definitions: if a label +begins with the special prefix <code><nobr>..@</nobr></code>, then it does +nothing to the local label mechanism. So you could code +<p><pre> +label1: ; a non-local label +.local: ; this is really label1.local +..@foo: ; this is a special symbol +label2: ; another non-local label +.local: ; this is really label2.local + + jmp ..@foo ; this will jump three lines up +</pre> +<p>NASM has the capacity to define other special symbols beginning with a +double period: for example, <code><nobr>..start</nobr></code> is used to +specify the entry point in the <code><nobr>obj</nobr></code> output format +(see <a href="nasmdoc7.html#section-7.4.6">section 7.4.6</a>). +<p align=center><a href="nasmdoc4.html">Next Chapter</a> | +<a href="nasmdoc2.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc4.html b/doc/html/nasmdoc4.html new file mode 100644 index 0000000..8c71881 --- /dev/null +++ b/doc/html/nasmdoc4.html @@ -0,0 +1,1970 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc5.html">Next Chapter</a> | +<a href="nasmdoc3.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-4">Chapter 4: The NASM Preprocessor</a></h2> +<p>NASM contains a powerful macro processor, which supports conditional +assembly, multi-level file inclusion, two forms of macro (single-line and +multi-line), and a `context stack' mechanism for extra macro power. +Preprocessor directives all begin with a <code><nobr>%</nobr></code> sign. +<p>The preprocessor collapses all lines which end with a backslash (\) +character into a single line. Thus: +<p><pre> +%define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \ + THIS_VALUE +</pre> +<p>will work like a single-line macro without the backslash-newline +sequence. +<h3><a name="section-4.1">4.1 Single-Line Macros</a></h3> +<h4><a name="section-4.1.1">4.1.1 The Normal Way: <code><nobr>%define</nobr></code></a></h4> +<p>Single-line macros are defined using the +<code><nobr>%define</nobr></code> preprocessor directive. The definitions +work in a similar way to C; so you can do things like +<p><pre> +%define ctrl 0x1F & +%define param(a,b) ((a)+(a)*(b)) + + mov byte [param(2,ebx)], ctrl 'D' +</pre> +<p>which will expand to +<p><pre> + mov byte [(2)+(2)*(ebx)], 0x1F & 'D' +</pre> +<p>When the expansion of a single-line macro contains tokens which invoke +another macro, the expansion is performed at invocation time, not at +definition time. Thus the code +<p><pre> +%define a(x) 1+b(x) +%define b(x) 2*x + + mov ax,a(8) +</pre> +<p>will evaluate in the expected way to +<code><nobr>mov ax,1+2*8</nobr></code>, even though the macro +<code><nobr>b</nobr></code> wasn't defined at the time of definition of +<code><nobr>a</nobr></code>. +<p>Macros defined with <code><nobr>%define</nobr></code> are case +sensitive: after <code><nobr>%define foo bar</nobr></code>, only +<code><nobr>foo</nobr></code> will expand to <code><nobr>bar</nobr></code>: +<code><nobr>Foo</nobr></code> or <code><nobr>FOO</nobr></code> will not. By +using <code><nobr>%idefine</nobr></code> instead of +<code><nobr>%define</nobr></code> (the `i' stands for `insensitive') you +can define all the case variants of a macro at once, so that +<code><nobr>%idefine foo bar</nobr></code> would cause +<code><nobr>foo</nobr></code>, <code><nobr>Foo</nobr></code>, +<code><nobr>FOO</nobr></code>, <code><nobr>fOO</nobr></code> and so on all +to expand to <code><nobr>bar</nobr></code>. +<p>There is a mechanism which detects when a macro call has occurred as a +result of a previous expansion of the same macro, to guard against circular +references and infinite loops. If this happens, the preprocessor will only +expand the first occurrence of the macro. Hence, if you code +<p><pre> +%define a(x) 1+a(x) + + mov ax,a(3) +</pre> +<p>the macro <code><nobr>a(3)</nobr></code> will expand once, becoming +<code><nobr>1+a(3)</nobr></code>, and will then expand no further. This +behaviour can be useful: see <a href="nasmdoc9.html#section-9.1">section +9.1</a> for an example of its use. +<p>You can overload single-line macros: if you write +<p><pre> +%define foo(x) 1+x +%define foo(x,y) 1+x*y +</pre> +<p>the preprocessor will be able to handle both types of macro call, by +counting the parameters you pass; so <code><nobr>foo(3)</nobr></code> will +become <code><nobr>1+3</nobr></code> whereas +<code><nobr>foo(ebx,2)</nobr></code> will become +<code><nobr>1+ebx*2</nobr></code>. However, if you define +<p><pre> +%define foo bar +</pre> +<p>then no other definition of <code><nobr>foo</nobr></code> will be +accepted: a macro with no parameters prohibits the definition of the same +name as a macro <em>with</em> parameters, and vice versa. +<p>This doesn't prevent single-line macros being <em>redefined</em>: you +can perfectly well define a macro with +<p><pre> +%define foo bar +</pre> +<p>and then re-define it later in the same source file with +<p><pre> +%define foo baz +</pre> +<p>Then everywhere the macro <code><nobr>foo</nobr></code> is invoked, it +will be expanded according to the most recent definition. This is +particularly useful when defining single-line macros with +<code><nobr>%assign</nobr></code> (see <a href="#section-4.1.7">section +4.1.7</a>). +<p>You can pre-define single-line macros using the `-d' option on the NASM +command line: see <a href="nasmdoc2.html#section-2.1.18">section +2.1.18</a>. +<h4><a name="section-4.1.2">4.1.2 Resolving <code><nobr>%define</nobr></code>: <code><nobr>%xdefine</nobr></code></a></h4> +<p>To have a reference to an embedded single-line macro resolved at the +time that the embedding macro is <em>defined</em>, as opposed to when the +embedding macro is <em>expanded</em>, you need a different mechanism to the +one offered by <code><nobr>%define</nobr></code>. The solution is to use +<code><nobr>%xdefine</nobr></code>, or it's case-insensitive counterpart +<code><nobr>%ixdefine</nobr></code>. +<p>Suppose you have the following code: +<p><pre> +%define isTrue 1 +%define isFalse isTrue +%define isTrue 0 + +val1: db isFalse + +%define isTrue 1 + +val2: db isFalse +</pre> +<p>In this case, <code><nobr>val1</nobr></code> is equal to 0, and +<code><nobr>val2</nobr></code> is equal to 1. This is because, when a +single-line macro is defined using <code><nobr>%define</nobr></code>, it is +expanded only when it is called. As <code><nobr>isFalse</nobr></code> +expands to <code><nobr>isTrue</nobr></code>, the expansion will be the +current value of <code><nobr>isTrue</nobr></code>. The first time it is +called that is 0, and the second time it is 1. +<p>If you wanted <code><nobr>isFalse</nobr></code> to expand to the value +assigned to the embedded macro <code><nobr>isTrue</nobr></code> at the time +that <code><nobr>isFalse</nobr></code> was defined, you need to change the +above code to use <code><nobr>%xdefine</nobr></code>. +<p><pre> +%xdefine isTrue 1 +%xdefine isFalse isTrue +%xdefine isTrue 0 + +val1: db isFalse + +%xdefine isTrue 1 + +val2: db isFalse +</pre> +<p>Now, each time that <code><nobr>isFalse</nobr></code> is called, it +expands to 1, as that is what the embedded macro +<code><nobr>isTrue</nobr></code> expanded to at the time that +<code><nobr>isFalse</nobr></code> was defined. +<h4><a name="section-4.1.3">4.1.3 Macro Indirection: <code><nobr>%[...]</nobr></code></a></h4> +<p>The <code><nobr>%[...]</nobr></code> construct can be used to expand +macros in contexts where macro expansion would otherwise not occur, +including in the names other macros. For example, if you have a set of +macros named <code><nobr>Foo16</nobr></code>, +<code><nobr>Foo32</nobr></code> and <code><nobr>Foo64</nobr></code>, you +could write: +<p><pre> + mov ax,Foo%[__BITS__] ; The Foo value +</pre> +<p>to use the builtin macro <code><nobr>__BITS__</nobr></code> (see +<a href="#section-4.11.5">section 4.11.5</a>) to automatically select +between them. Similarly, the two statements: +<p><pre> +%xdefine Bar Quux ; Expands due to %xdefine +%define Bar %[Quux] ; Expands due to %[...] +</pre> +<p>have, in fact, exactly the same effect. +<p><code><nobr>%[...]</nobr></code> concatenates to adjacent tokens in the +same way that multi-line macro parameters do, see +<a href="#section-4.3.8">section 4.3.8</a> for details. +<h4><a name="section-4.1.4">4.1.4 Concatenating Single Line Macro Tokens: <code><nobr>%+</nobr></code></a></h4> +<p>Individual tokens in single line macros can be concatenated, to produce +longer tokens for later processing. This can be useful if there are several +similar macros that perform similar functions. +<p>Please note that a space is required after <code><nobr>%+</nobr></code>, +in order to disambiguate it from the syntax <code><nobr>%+1</nobr></code> +used in multiline macros. +<p>As an example, consider the following: +<p><pre> +%define BDASTART 400h ; Start of BIOS data area +</pre> +<p><pre> +struc tBIOSDA ; its structure + .COM1addr RESW 1 + .COM2addr RESW 1 + ; ..and so on +endstruc +</pre> +<p>Now, if we need to access the elements of tBIOSDA in different places, +we can end up with: +<p><pre> + mov ax,BDASTART + tBIOSDA.COM1addr + mov bx,BDASTART + tBIOSDA.COM2addr +</pre> +<p>This will become pretty ugly (and tedious) if used in many places, and +can be reduced in size significantly by using the following macro: +<p><pre> +; Macro to access BIOS variables by their names (from tBDA): +</pre> +<p><pre> +%define BDA(x) BDASTART + tBIOSDA. %+ x +</pre> +<p>Now the above code can be written as: +<p><pre> + mov ax,BDA(COM1addr) + mov bx,BDA(COM2addr) +</pre> +<p>Using this feature, we can simplify references to a lot of macros (and, +in turn, reduce typing errors). +<h4><a name="section-4.1.5">4.1.5 The Macro Name Itself: <code><nobr>%?</nobr></code> and <code><nobr>%??</nobr></code></a></h4> +<p>The special symbols <code><nobr>%?</nobr></code> and +<code><nobr>%??</nobr></code> can be used to reference the macro name +itself inside a macro expansion, this is supported for both single-and +multi-line macros. <code><nobr>%?</nobr></code> refers to the macro name as +<em>invoked</em>, whereas <code><nobr>%??</nobr></code> refers to the macro +name as <em>declared</em>. The two are always the same for case-sensitive +macros, but for case-insensitive macros, they can differ. +<p>For example: +<p><pre> +%idefine Foo mov %?,%?? + + foo + FOO +</pre> +<p>will expand to: +<p><pre> + mov foo,Foo + mov FOO,Foo +</pre> +<p>The sequence: +<p><pre> +%idefine keyword $%? +</pre> +<p>can be used to make a keyword "disappear", for example in case a new +instruction has been used as a label in older code. For example: +<p><pre> +%idefine pause $%? ; Hide the PAUSE instruction +</pre> +<h4><a name="section-4.1.6">4.1.6 Undefining Single-Line Macros: <code><nobr>%undef</nobr></code></a></h4> +<p>Single-line macros can be removed with the +<code><nobr>%undef</nobr></code> directive. For example, the following +sequence: +<p><pre> +%define foo bar +%undef foo + + mov eax, foo +</pre> +<p>will expand to the instruction <code><nobr>mov eax, foo</nobr></code>, +since after <code><nobr>%undef</nobr></code> the macro +<code><nobr>foo</nobr></code> is no longer defined. +<p>Macros that would otherwise be pre-defined can be undefined on the +command-line using the `-u' option on the NASM command line: see +<a href="nasmdoc2.html#section-2.1.19">section 2.1.19</a>. +<h4><a name="section-4.1.7">4.1.7 Preprocessor Variables: <code><nobr>%assign</nobr></code></a></h4> +<p>An alternative way to define single-line macros is by means of the +<code><nobr>%assign</nobr></code> command (and its case-insensitive +counterpart <code><nobr>%iassign</nobr></code>, which differs from +<code><nobr>%assign</nobr></code> in exactly the same way that +<code><nobr>%idefine</nobr></code> differs from +<code><nobr>%define</nobr></code>). +<p><code><nobr>%assign</nobr></code> is used to define single-line macros +which take no parameters and have a numeric value. This value can be +specified in the form of an expression, and it will be evaluated once, when +the <code><nobr>%assign</nobr></code> directive is processed. +<p>Like <code><nobr>%define</nobr></code>, macros defined using +<code><nobr>%assign</nobr></code> can be re-defined later, so you can do +things like +<p><pre> +%assign i i+1 +</pre> +<p>to increment the numeric value of a macro. +<p><code><nobr>%assign</nobr></code> is useful for controlling the +termination of <code><nobr>%rep</nobr></code> preprocessor loops: see +<a href="#section-4.5">section 4.5</a> for an example of this. Another use +for <code><nobr>%assign</nobr></code> is given in +<a href="nasmdoc8.html#section-8.4">section 8.4</a> and +<a href="nasmdoc9.html#section-9.1">section 9.1</a>. +<p>The expression passed to <code><nobr>%assign</nobr></code> is a critical +expression (see <a href="nasmdoc3.html#section-3.8">section 3.8</a>), and +must also evaluate to a pure number (rather than a relocatable reference +such as a code or data address, or anything involving a register). +<h4><a name="section-4.1.8">4.1.8 Defining Strings: <code><nobr>%defstr</nobr></code></a></h4> +<p><code><nobr>%defstr</nobr></code>, and its case-insensitive counterpart +<code><nobr>%idefstr</nobr></code>, define or redefine a single-line macro +without parameters but converts the entire right-hand side, after macro +expansion, to a quoted string before definition. +<p>For example: +<p><pre> +%defstr test TEST +</pre> +<p>is equivalent to +<p><pre> +%define test 'TEST' +</pre> +<p>This can be used, for example, with the <code><nobr>%!</nobr></code> +construct (see <a href="#section-4.10.2">section 4.10.2</a>): +<p><pre> +%defstr PATH %!PATH ; The operating system PATH variable +</pre> +<h4><a name="section-4.1.9">4.1.9 Defining Tokens: <code><nobr>%deftok</nobr></code></a></h4> +<p><code><nobr>%deftok</nobr></code>, and its case-insensitive counterpart +<code><nobr>%ideftok</nobr></code>, define or redefine a single-line macro +without parameters but converts the second parameter, after string +conversion, to a sequence of tokens. +<p>For example: +<p><pre> +%deftok test 'TEST' +</pre> +<p>is equivalent to +<p><pre> +%define test TEST +</pre> +<h3><a name="section-4.2">4.2 String Manipulation in Macros</a></h3> +<p>It's often useful to be able to handle strings in macros. NASM supports +a few simple string handling macro operators from which more complex +operations can be constructed. +<p>All the string operators define or redefine a value (either a string or +a numeric value) to a single-line macro. When producing a string value, it +may change the style of quoting of the input string or strings, and +possibly use <code><nobr>\</nobr></code>-escapes inside +<code><nobr>`</nobr></code>-quoted strings. +<h4><a name="section-4.2.1">4.2.1 Concatenating Strings: <code><nobr>%strcat</nobr></code></a></h4> +<p>The <code><nobr>%strcat</nobr></code> operator concatenates quoted +strings and assign them to a single-line macro. +<p>For example: +<p><pre> +%strcat alpha "Alpha: ", '12" screen' +</pre> +<p>... would assign the value <code><nobr>'Alpha: 12" screen'</nobr></code> +to <code><nobr>alpha</nobr></code>. Similarly: +<p><pre> +%strcat beta '"foo"\', "'bar'" +</pre> +<p>... would assign the value <code><nobr>`"foo"\\'bar'`</nobr></code> to +<code><nobr>beta</nobr></code>. +<p>The use of commas to separate strings is permitted but optional. +<h4><a name="section-4.2.2">4.2.2 String Length: <code><nobr>%strlen</nobr></code></a></h4> +<p>The <code><nobr>%strlen</nobr></code> operator assigns the length of a +string to a macro. For example: +<p><pre> +%strlen charcnt 'my string' +</pre> +<p>In this example, <code><nobr>charcnt</nobr></code> would receive the +value 9, just as if an <code><nobr>%assign</nobr></code> had been used. In +this example, <code><nobr>'my string'</nobr></code> was a literal string +but it could also have been a single-line macro that expands to a string, +as in the following example: +<p><pre> +%define sometext 'my string' +%strlen charcnt sometext +</pre> +<p>As in the first case, this would result in +<code><nobr>charcnt</nobr></code> being assigned the value of 9. +<h4><a name="section-4.2.3">4.2.3 Extracting Substrings: <code><nobr>%substr</nobr></code></a></h4> +<p>Individual letters or substrings in strings can be extracted using the +<code><nobr>%substr</nobr></code> operator. An example of its use is +probably more useful than the description: +<p><pre> +%substr mychar 'xyzw' 1 ; equivalent to %define mychar 'x' +%substr mychar 'xyzw' 2 ; equivalent to %define mychar 'y' +%substr mychar 'xyzw' 3 ; equivalent to %define mychar 'z' +%substr mychar 'xyzw' 2,2 ; equivalent to %define mychar 'yz' +%substr mychar 'xyzw' 2,-1 ; equivalent to %define mychar 'yzw' +%substr mychar 'xyzw' 2,-2 ; equivalent to %define mychar 'yz' +</pre> +<p>As with <code><nobr>%strlen</nobr></code> (see +<a href="#section-4.2.2">section 4.2.2</a>), the first parameter is the +single-line macro to be created and the second is the string. The third +parameter specifies the first character to be selected, and the optional +fourth parameter preceeded by comma) is the length. Note that the first +index is 1, not 0 and the last index is equal to the value that +<code><nobr>%strlen</nobr></code> would assign given the same string. Index +values out of range result in an empty string. A negative length means +"until N-1 characters before the end of string", i.e. +<code><nobr>-1</nobr></code> means until end of string, +<code><nobr>-2</nobr></code> until one character before, etc. +<h3><a name="section-4.3">4.3 Multi-Line Macros: <code><nobr>%macro</nobr></code></a></h3> +<p>Multi-line macros are much more like the type of macro seen in MASM and +TASM: a multi-line macro definition in NASM looks something like this. +<p><pre> +%macro prologue 1 + + push ebp + mov ebp,esp + sub esp,%1 + +%endmacro +</pre> +<p>This defines a C-like function prologue as a macro: so you would invoke +the macro with a call such as +<p><pre> +myfunc: prologue 12 +</pre> +<p>which would expand to the three lines of code +<p><pre> +myfunc: push ebp + mov ebp,esp + sub esp,12 +</pre> +<p>The number <code><nobr>1</nobr></code> after the macro name in the +<code><nobr>%macro</nobr></code> line defines the number of parameters the +macro <code><nobr>prologue</nobr></code> expects to receive. The use of +<code><nobr>%1</nobr></code> inside the macro definition refers to the +first parameter to the macro call. With a macro taking more than one +parameter, subsequent parameters would be referred to as +<code><nobr>%2</nobr></code>, <code><nobr>%3</nobr></code> and so on. +<p>Multi-line macros, like single-line macros, are case-sensitive, unless +you define them using the alternative directive +<code><nobr>%imacro</nobr></code>. +<p>If you need to pass a comma as <em>part</em> of a parameter to a +multi-line macro, you can do that by enclosing the entire parameter in +braces. So you could code things like +<p><pre> +%macro silly 2 + + %2: db %1 + +%endmacro + + silly 'a', letter_a ; letter_a: db 'a' + silly 'ab', string_ab ; string_ab: db 'ab' + silly {13,10}, crlf ; crlf: db 13,10 +</pre> +<h4><a name="section-4.3.1">4.3.1 Recursive Multi-Line Macros: <code><nobr>%rmacro</nobr></code></a></h4> +<p>A multi-line macro cannot be referenced within itself, in order to +prevent accidental infinite recursion. +<p>Recursive multi-line macros allow for self-referencing, with the caveat +that the user is aware of the existence, use and purpose of recursive +multi-line macros. There is also a generous, but sane, upper limit to the +number of recursions, in order to prevent run-away memory consumption in +case of accidental infinite recursion. +<p>As with non-recursive multi-line macros, recursive multi-line macros are +case-sensitive, unless you define them using the alternative directive +<code><nobr>%irmacro</nobr></code>. +<h4><a name="section-4.3.2">4.3.2 Overloading Multi-Line Macros</a></h4> +<p>As with single-line macros, multi-line macros can be overloaded by +defining the same macro name several times with different numbers of +parameters. This time, no exception is made for macros with no parameters +at all. So you could define +<p><pre> +%macro prologue 0 + + push ebp + mov ebp,esp + +%endmacro +</pre> +<p>to define an alternative form of the function prologue which allocates +no local stack space. +<p>Sometimes, however, you might want to `overload' a machine instruction; +for example, you might want to define +<p><pre> +%macro push 2 + + push %1 + push %2 + +%endmacro +</pre> +<p>so that you could code +<p><pre> + push ebx ; this line is not a macro call + push eax,ecx ; but this one is +</pre> +<p>Ordinarily, NASM will give a warning for the first of the above two +lines, since <code><nobr>push</nobr></code> is now defined to be a macro, +and is being invoked with a number of parameters for which no definition +has been given. The correct code will still be generated, but the assembler +will give a warning. This warning can be disabled by the use of the +<code><nobr>-w-macro-params</nobr></code> command-line option (see +<a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a>). +<h4><a name="section-4.3.3">4.3.3 Macro-Local Labels</a></h4> +<p>NASM allows you to define labels within a multi-line macro definition in +such a way as to make them local to the macro call: so calling the same +macro multiple times will use a different label each time. You do this by +prefixing <code><nobr>%%</nobr></code> to the label name. So you can invent +an instruction which executes a <code><nobr>RET</nobr></code> if the +<code><nobr>Z</nobr></code> flag is set by doing this: +<p><pre> +%macro retz 0 + + jnz %%skip + ret + %%skip: + +%endmacro +</pre> +<p>You can call this macro as many times as you want, and every time you +call it NASM will make up a different `real' name to substitute for the +label <code><nobr>%%skip</nobr></code>. The names NASM invents are of the +form <code><nobr>..@2345.skip</nobr></code>, where the number 2345 changes +with every macro call. The <code><nobr>..@</nobr></code> prefix prevents +macro-local labels from interfering with the local label mechanism, as +described in <a href="nasmdoc3.html#section-3.9">section 3.9</a>. You +should avoid defining your own labels in this form (the +<code><nobr>..@</nobr></code> prefix, then a number, then another period) +in case they interfere with macro-local labels. +<h4><a name="section-4.3.4">4.3.4 Greedy Macro Parameters</a></h4> +<p>Occasionally it is useful to define a macro which lumps its entire +command line into one parameter definition, possibly after extracting one +or two smaller parameters from the front. An example might be a macro to +write a text string to a file in MS-DOS, where you might want to be able to +write +<p><pre> + writefile [filehandle],"hello, world",13,10 +</pre> +<p>NASM allows you to define the last parameter of a macro to be +<em>greedy</em>, meaning that if you invoke the macro with more parameters +than it expects, all the spare parameters get lumped into the last defined +one along with the separating commas. So if you code: +<p><pre> +%macro writefile 2+ + + jmp %%endstr + %%str: db %2 + %%endstr: + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + +%endmacro +</pre> +<p>then the example call to <code><nobr>writefile</nobr></code> above will +work as expected: the text before the first comma, +<code><nobr>[filehandle]</nobr></code>, is used as the first macro +parameter and expanded when <code><nobr>%1</nobr></code> is referred to, +and all the subsequent text is lumped into <code><nobr>%2</nobr></code> and +placed after the <code><nobr>db</nobr></code>. +<p>The greedy nature of the macro is indicated to NASM by the use of the +<code><nobr>+</nobr></code> sign after the parameter count on the +<code><nobr>%macro</nobr></code> line. +<p>If you define a greedy macro, you are effectively telling NASM how it +should expand the macro given <em>any</em> number of parameters from the +actual number specified up to infinity; in this case, for example, NASM now +knows what to do when it sees a call to <code><nobr>writefile</nobr></code> +with 2, 3, 4 or more parameters. NASM will take this into account when +overloading macros, and will not allow you to define another form of +<code><nobr>writefile</nobr></code> taking 4 parameters (for example). +<p>Of course, the above macro could have been implemented as a non-greedy +macro, in which case the call to it would have had to look like +<p><pre> + writefile [filehandle], {"hello, world",13,10} +</pre> +<p>NASM provides both mechanisms for putting commas in macro parameters, +and you choose which one you prefer for each macro definition. +<p>See <a href="nasmdoc6.html#section-6.3.1">section 6.3.1</a> for a better +way to write the above macro. +<h4><a name="section-4.3.5">4.3.5 Default Macro Parameters</a></h4> +<p>NASM also allows you to define a multi-line macro with a <em>range</em> +of allowable parameter counts. If you do this, you can specify defaults for +omitted parameters. So, for example: +<p><pre> +%macro die 0-1 "Painful program death has occurred." + + writefile 2,%1 + mov ax,0x4c01 + int 0x21 + +%endmacro +</pre> +<p>This macro (which makes use of the <code><nobr>writefile</nobr></code> +macro defined in <a href="#section-4.3.4">section 4.3.4</a>) can be called +with an explicit error message, which it will display on the error output +stream before exiting, or it can be called with no parameters, in which +case it will use the default error message supplied in the macro +definition. +<p>In general, you supply a minimum and maximum number of parameters for a +macro of this type; the minimum number of parameters are then required in +the macro call, and then you provide defaults for the optional ones. So if +a macro definition began with the line +<p><pre> +%macro foobar 1-3 eax,[ebx+2] +</pre> +<p>then it could be called with between one and three parameters, and +<code><nobr>%1</nobr></code> would always be taken from the macro call. +<code><nobr>%2</nobr></code>, if not specified by the macro call, would +default to <code><nobr>eax</nobr></code>, and <code><nobr>%3</nobr></code> +if not specified would default to <code><nobr>[ebx+2]</nobr></code>. +<p>You can provide extra information to a macro by providing too many +default parameters: +<p><pre> +%macro quux 1 something +</pre> +<p>This will trigger a warning by default; see +<a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a> for more +information. When <code><nobr>quux</nobr></code> is invoked, it receives +not one but two parameters. <code><nobr>something</nobr></code> can be +referred to as <code><nobr>%2</nobr></code>. The difference between passing +<code><nobr>something</nobr></code> this way and writing +<code><nobr>something</nobr></code> in the macro body is that with this way +<code><nobr>something</nobr></code> is evaluated when the macro is defined, +not when it is expanded. +<p>You may omit parameter defaults from the macro definition, in which case +the parameter default is taken to be blank. This can be useful for macros +which can take a variable number of parameters, since the +<code><nobr>%0</nobr></code> token (see <a href="#section-4.3.6">section +4.3.6</a>) allows you to determine how many parameters were really passed +to the macro call. +<p>This defaulting mechanism can be combined with the greedy-parameter +mechanism; so the <code><nobr>die</nobr></code> macro above could be made +more powerful, and more useful, by changing the first line of the +definition to +<p><pre> +%macro die 0-1+ "Painful program death has occurred.",13,10 +</pre> +<p>The maximum parameter count can be infinite, denoted by +<code><nobr>*</nobr></code>. In this case, of course, it is impossible to +provide a <em>full</em> set of default parameters. Examples of this usage +are shown in <a href="#section-4.3.7">section 4.3.7</a>. +<h4><a name="section-4.3.6">4.3.6 <code><nobr>%0</nobr></code>: Macro Parameter Counter</a></h4> +<p>The parameter reference <code><nobr>%0</nobr></code> will return a +numeric constant giving the number of parameters received, that is, if +<code><nobr>%0</nobr></code> is n then <code><nobr>%</nobr></code>n is the +last parameter. <code><nobr>%0</nobr></code> is mostly useful for macros +that can take a variable number of parameters. It can be used as an +argument to <code><nobr>%rep</nobr></code> (see +<a href="#section-4.5">section 4.5</a>) in order to iterate through all the +parameters of a macro. Examples are given in +<a href="#section-4.3.7">section 4.3.7</a>. +<h4><a name="section-4.3.7">4.3.7 <code><nobr>%rotate</nobr></code>: Rotating Macro Parameters</a></h4> +<p>Unix shell programmers will be familiar with the +<code><nobr>shift</nobr></code> shell command, which allows the arguments +passed to a shell script (referenced as <code><nobr>$1</nobr></code>, +<code><nobr>$2</nobr></code> and so on) to be moved left by one place, so +that the argument previously referenced as <code><nobr>$2</nobr></code> +becomes available as <code><nobr>$1</nobr></code>, and the argument +previously referenced as <code><nobr>$1</nobr></code> is no longer +available at all. +<p>NASM provides a similar mechanism, in the form of +<code><nobr>%rotate</nobr></code>. As its name suggests, it differs from +the Unix <code><nobr>shift</nobr></code> in that no parameters are lost: +parameters rotated off the left end of the argument list reappear on the +right, and vice versa. +<p><code><nobr>%rotate</nobr></code> is invoked with a single numeric +argument (which may be an expression). The macro parameters are rotated to +the left by that many places. If the argument to +<code><nobr>%rotate</nobr></code> is negative, the macro parameters are +rotated to the right. +<p>So a pair of macros to save and restore a set of registers might work as +follows: +<p><pre> +%macro multipush 1-* + + %rep %0 + push %1 + %rotate 1 + %endrep + +%endmacro +</pre> +<p>This macro invokes the <code><nobr>PUSH</nobr></code> instruction on +each of its arguments in turn, from left to right. It begins by pushing its +first argument, <code><nobr>%1</nobr></code>, then invokes +<code><nobr>%rotate</nobr></code> to move all the arguments one place to +the left, so that the original second argument is now available as +<code><nobr>%1</nobr></code>. Repeating this procedure as many times as +there were arguments (achieved by supplying <code><nobr>%0</nobr></code> as +the argument to <code><nobr>%rep</nobr></code>) causes each argument in +turn to be pushed. +<p>Note also the use of <code><nobr>*</nobr></code> as the maximum +parameter count, indicating that there is no upper limit on the number of +parameters you may supply to the <code><nobr>multipush</nobr></code> macro. +<p>It would be convenient, when using this macro, to have a +<code><nobr>POP</nobr></code> equivalent, which <em>didn't</em> require the +arguments to be given in reverse order. Ideally, you would write the +<code><nobr>multipush</nobr></code> macro call, then cut-and-paste the line +to where the pop needed to be done, and change the name of the called macro +to <code><nobr>multipop</nobr></code>, and the macro would take care of +popping the registers in the opposite order from the one in which they were +pushed. +<p>This can be done by the following definition: +<p><pre> +%macro multipop 1-* + + %rep %0 + %rotate -1 + pop %1 + %endrep + +%endmacro +</pre> +<p>This macro begins by rotating its arguments one place to the +<em>right</em>, so that the original <em>last</em> argument appears as +<code><nobr>%1</nobr></code>. This is then popped, and the arguments are +rotated right again, so the second-to-last argument becomes +<code><nobr>%1</nobr></code>. Thus the arguments are iterated through in +reverse order. +<h4><a name="section-4.3.8">4.3.8 Concatenating Macro Parameters</a></h4> +<p>NASM can concatenate macro parameters and macro indirection constructs +on to other text surrounding them. This allows you to declare a family of +symbols, for example, in a macro definition. If, for example, you wanted to +generate a table of key codes along with offsets into the table, you could +code something like +<p><pre> +%macro keytab_entry 2 + + keypos%1 equ $-keytab + db %2 + +%endmacro + +keytab: + keytab_entry F1,128+1 + keytab_entry F2,128+2 + keytab_entry Return,13 +</pre> +<p>which would expand to +<p><pre> +keytab: +keyposF1 equ $-keytab + db 128+1 +keyposF2 equ $-keytab + db 128+2 +keyposReturn equ $-keytab + db 13 +</pre> +<p>You can just as easily concatenate text on to the other end of a macro +parameter, by writing <code><nobr>%1foo</nobr></code>. +<p>If you need to append a <em>digit</em> to a macro parameter, for example +defining labels <code><nobr>foo1</nobr></code> and +<code><nobr>foo2</nobr></code> when passed the parameter +<code><nobr>foo</nobr></code>, you can't code <code><nobr>%11</nobr></code> +because that would be taken as the eleventh macro parameter. Instead, you +must code <code><nobr>%{1}1</nobr></code>, which will separate the first +<code><nobr>1</nobr></code> (giving the number of the macro parameter) from +the second (literal text to be concatenated to the parameter). +<p>This concatenation can also be applied to other preprocessor in-line +objects, such as macro-local labels (<a href="#section-4.3.3">section +4.3.3</a>) and context-local labels (<a href="#section-4.7.2">section +4.7.2</a>). In all cases, ambiguities in syntax can be resolved by +enclosing everything after the <code><nobr>%</nobr></code> sign and before +the literal text in braces: so <code><nobr>%{%foo}bar</nobr></code> +concatenates the text <code><nobr>bar</nobr></code> to the end of the real +name of the macro-local label <code><nobr>%%foo</nobr></code>. (This is +unnecessary, since the form NASM uses for the real names of macro-local +labels means that the two usages <code><nobr>%{%foo}bar</nobr></code> and +<code><nobr>%%foobar</nobr></code> would both expand to the same thing +anyway; nevertheless, the capability is there.) +<p>The single-line macro indirection construct, +<code><nobr>%[...]</nobr></code> (<a href="#section-4.1.3">section +4.1.3</a>), behaves the same way as macro parameters for the purpose of +concatenation. +<p>See also the <code><nobr>%+</nobr></code> operator, +<a href="#section-4.1.4">section 4.1.4</a>. +<h4><a name="section-4.3.9">4.3.9 Condition Codes as Macro Parameters</a></h4> +<p>NASM can give special treatment to a macro parameter which contains a +condition code. For a start, you can refer to the macro parameter +<code><nobr>%1</nobr></code> by means of the alternative syntax +<code><nobr>%+1</nobr></code>, which informs NASM that this macro parameter +is supposed to contain a condition code, and will cause the preprocessor to +report an error message if the macro is called with a parameter which is +<em>not</em> a valid condition code. +<p>Far more usefully, though, you can refer to the macro parameter by means +of <code><nobr>%-1</nobr></code>, which NASM will expand as the +<em>inverse</em> condition code. So the <code><nobr>retz</nobr></code> +macro defined in <a href="#section-4.3.3">section 4.3.3</a> can be replaced +by a general conditional-return macro like this: +<p><pre> +%macro retc 1 + + j%-1 %%skip + ret + %%skip: + +%endmacro +</pre> +<p>This macro can now be invoked using calls like +<code><nobr>retc ne</nobr></code>, which will cause the conditional-jump +instruction in the macro expansion to come out as +<code><nobr>JE</nobr></code>, or <code><nobr>retc po</nobr></code> which +will make the jump a <code><nobr>JPE</nobr></code>. +<p>The <code><nobr>%+1</nobr></code> macro-parameter reference is quite +happy to interpret the arguments <code><nobr>CXZ</nobr></code> and +<code><nobr>ECXZ</nobr></code> as valid condition codes; however, +<code><nobr>%-1</nobr></code> will report an error if passed either of +these, because no inverse condition code exists. +<h4><a name="section-4.3.10">4.3.10 Disabling Listing Expansion</a></h4> +<p>When NASM is generating a listing file from your program, it will +generally expand multi-line macros by means of writing the macro call and +then listing each line of the expansion. This allows you to see which +instructions in the macro expansion are generating what code; however, for +some macros this clutters the listing up unnecessarily. +<p>NASM therefore provides the <code><nobr>.nolist</nobr></code> qualifier, +which you can include in a macro definition to inhibit the expansion of the +macro in the listing file. The <code><nobr>.nolist</nobr></code> qualifier +comes directly after the number of parameters, like this: +<p><pre> +%macro foo 1.nolist +</pre> +<p>Or like this: +<p><pre> +%macro bar 1-5+.nolist a,b,c,d,e,f,g,h +</pre> +<h4><a name="section-4.3.11">4.3.11 Undefining Multi-Line Macros: <code><nobr>%unmacro</nobr></code></a></h4> +<p>Multi-line macros can be removed with the +<code><nobr>%unmacro</nobr></code> directive. Unlike the +<code><nobr>%undef</nobr></code> directive, however, +<code><nobr>%unmacro</nobr></code> takes an argument specification, and +will only remove exact matches with that argument specification. +<p>For example: +<p><pre> +%macro foo 1-3 + ; Do something +%endmacro +%unmacro foo 1-3 +</pre> +<p>removes the previously defined macro <code><nobr>foo</nobr></code>, but +<p><pre> +%macro bar 1-3 + ; Do something +%endmacro +%unmacro bar 1 +</pre> +<p>does <em>not</em> remove the macro <code><nobr>bar</nobr></code>, since +the argument specification does not match exactly. +<h4><a name="section-4.3.12">4.3.12 Exiting Multi-Line Macros: <code><nobr>%exitmacro</nobr></code></a></h4> +<p>Multi-line macro expansions can be arbitrarily terminated with the +<code><nobr>%exitmacro</nobr></code> directive. +<p>For example: +<p><pre> +%macro foo 1-3 + ; Do something + %if<condition> + %exitmacro + %endif + ; Do something +%endmacro +</pre> +<h3><a name="section-4.4">4.4 Conditional Assembly</a></h3> +<p>Similarly to the C preprocessor, NASM allows sections of a source file +to be assembled only if certain conditions are met. The general syntax of +this feature looks like this: +<p><pre> +%if<condition> + ; some code which only appears if <condition> is met +%elif<condition2> + ; only appears if <condition> is not met but <condition2> is +%else + ; this appears if neither <condition> nor <condition2> was met +%endif +</pre> +<p>The inverse forms <code><nobr>%ifn</nobr></code> and +<code><nobr>%elifn</nobr></code> are also supported. +<p>The <code><nobr>%else</nobr></code> clause is optional, as is the +<code><nobr>%elif</nobr></code> clause. You can have more than one +<code><nobr>%elif</nobr></code> clause as well. +<p>There are a number of variants of the <code><nobr>%if</nobr></code> +directive. Each has its corresponding <code><nobr>%elif</nobr></code>, +<code><nobr>%ifn</nobr></code>, and <code><nobr>%elifn</nobr></code> +directives; for example, the equivalents to the +<code><nobr>%ifdef</nobr></code> directive are +<code><nobr>%elifdef</nobr></code>, <code><nobr>%ifndef</nobr></code>, and +<code><nobr>%elifndef</nobr></code>. +<h4><a name="section-4.4.1">4.4.1 <code><nobr>%ifdef</nobr></code>: Testing Single-Line Macro Existence</a></h4> +<p>Beginning a conditional-assembly block with the line +<code><nobr>%ifdef MACRO</nobr></code> will assemble the subsequent code +if, and only if, a single-line macro called <code><nobr>MACRO</nobr></code> +is defined. If not, then the <code><nobr>%elif</nobr></code> and +<code><nobr>%else</nobr></code> blocks (if any) will be processed instead. +<p>For example, when debugging a program, you might want to write code such +as +<p><pre> + ; perform some function +%ifdef DEBUG + writefile 2,"Function performed successfully",13,10 +%endif + ; go and do something else +</pre> +<p>Then you could use the command-line option +<code><nobr>-dDEBUG</nobr></code> to create a version of the program which +produced debugging messages, and remove the option to generate the final +release version of the program. +<p>You can test for a macro <em>not</em> being defined by using +<code><nobr>%ifndef</nobr></code> instead of +<code><nobr>%ifdef</nobr></code>. You can also test for macro definitions +in <code><nobr>%elif</nobr></code> blocks by using +<code><nobr>%elifdef</nobr></code> and <code><nobr>%elifndef</nobr></code>. +<h4><a name="section-4.4.2">4.4.2 <code><nobr>%ifmacro</nobr></code>: Testing Multi-Line Macro Existence</a></h4> +<p>The <code><nobr>%ifmacro</nobr></code> directive operates in the same +way as the <code><nobr>%ifdef</nobr></code> directive, except that it +checks for the existence of a multi-line macro. +<p>For example, you may be working with a large project and not have +control over the macros in a library. You may want to create a macro with +one name if it doesn't already exist, and another name if one with that +name does exist. +<p>The <code><nobr>%ifmacro</nobr></code> is considered true if defining a +macro with the given name and number of arguments would cause a definitions +conflict. For example: +<p><pre> +%ifmacro MyMacro 1-3 + + %error "MyMacro 1-3" causes a conflict with an existing macro. + +%else + + %macro MyMacro 1-3 + + ; insert code to define the macro + + %endmacro + +%endif +</pre> +<p>This will create the macro "MyMacro 1-3" if no macro already exists +which would conflict with it, and emits a warning if there would be a +definition conflict. +<p>You can test for the macro not existing by using the +<code><nobr>%ifnmacro</nobr></code> instead of +<code><nobr>%ifmacro</nobr></code>. Additional tests can be performed in +<code><nobr>%elif</nobr></code> blocks by using +<code><nobr>%elifmacro</nobr></code> and +<code><nobr>%elifnmacro</nobr></code>. +<h4><a name="section-4.4.3">4.4.3 <code><nobr>%ifctx</nobr></code>: Testing the Context Stack</a></h4> +<p>The conditional-assembly construct <code><nobr>%ifctx</nobr></code> will +cause the subsequent code to be assembled if and only if the top context on +the preprocessor's context stack has the same name as one of the arguments. +As with <code><nobr>%ifdef</nobr></code>, the inverse and +<code><nobr>%elif</nobr></code> forms <code><nobr>%ifnctx</nobr></code>, +<code><nobr>%elifctx</nobr></code> and <code><nobr>%elifnctx</nobr></code> +are also supported. +<p>For more details of the context stack, see +<a href="#section-4.7">section 4.7</a>. For a sample use of +<code><nobr>%ifctx</nobr></code>, see <a href="#section-4.7.5">section +4.7.5</a>. +<h4><a name="section-4.4.4">4.4.4 <code><nobr>%if</nobr></code>: Testing Arbitrary Numeric Expressions</a></h4> +<p>The conditional-assembly construct <code><nobr>%if expr</nobr></code> +will cause the subsequent code to be assembled if and only if the value of +the numeric expression <code><nobr>expr</nobr></code> is non-zero. An +example of the use of this feature is in deciding when to break out of a +<code><nobr>%rep</nobr></code> preprocessor loop: see +<a href="#section-4.5">section 4.5</a> for a detailed example. +<p>The expression given to <code><nobr>%if</nobr></code>, and its +counterpart <code><nobr>%elif</nobr></code>, is a critical expression (see +<a href="nasmdoc3.html#section-3.8">section 3.8</a>). +<p><code><nobr>%if</nobr></code> extends the normal NASM expression syntax, +by providing a set of relational operators which are not normally available +in expressions. The operators <code><nobr>=</nobr></code>, +<code><nobr><</nobr></code>, <code><nobr>></nobr></code>, +<code><nobr><=</nobr></code>, <code><nobr>>=</nobr></code> and +<code><nobr><></nobr></code> test equality, less-than, greater-than, +less-or-equal, greater-or-equal and not-equal respectively. The C-like +forms <code><nobr>==</nobr></code> and <code><nobr>!=</nobr></code> are +supported as alternative forms of <code><nobr>=</nobr></code> and +<code><nobr><></nobr></code>. In addition, low-priority logical +operators <code><nobr>&&</nobr></code>, +<code><nobr>^^</nobr></code> and <code><nobr>||</nobr></code> are provided, +supplying logical AND, logical XOR and logical OR. These work like the C +logical operators (although C has no logical XOR), in that they always +return either 0 or 1, and treat any non-zero input as 1 (so that +<code><nobr>^^</nobr></code>, for example, returns 1 if exactly one of its +inputs is zero, and 0 otherwise). The relational operators also return 1 +for true and 0 for false. +<p>Like other <code><nobr>%if</nobr></code> constructs, +<code><nobr>%if</nobr></code> has a counterpart +<code><nobr>%elif</nobr></code>, and negative forms +<code><nobr>%ifn</nobr></code> and <code><nobr>%elifn</nobr></code>. +<h4><a name="section-4.4.5">4.4.5 <code><nobr>%ifidn</nobr></code> and <code><nobr>%ifidni</nobr></code>: Testing Exact Text Identity</a></h4> +<p>The construct <code><nobr>%ifidn text1,text2</nobr></code> will cause +the subsequent code to be assembled if and only if +<code><nobr>text1</nobr></code> and <code><nobr>text2</nobr></code>, after +expanding single-line macros, are identical pieces of text. Differences in +white space are not counted. +<p><code><nobr>%ifidni</nobr></code> is similar to +<code><nobr>%ifidn</nobr></code>, but is case-insensitive. +<p>For example, the following macro pushes a register or number on the +stack, and allows you to treat <code><nobr>IP</nobr></code> as a real +register: +<p><pre> +%macro pushparam 1 + + %ifidni %1,ip + call %%label + %%label: + %else + push %1 + %endif + +%endmacro +</pre> +<p>Like other <code><nobr>%if</nobr></code> constructs, +<code><nobr>%ifidn</nobr></code> has a counterpart +<code><nobr>%elifidn</nobr></code>, and negative forms +<code><nobr>%ifnidn</nobr></code> and <code><nobr>%elifnidn</nobr></code>. +Similarly, <code><nobr>%ifidni</nobr></code> has counterparts +<code><nobr>%elifidni</nobr></code>, <code><nobr>%ifnidni</nobr></code> and +<code><nobr>%elifnidni</nobr></code>. +<h4><a name="section-4.4.6">4.4.6 <code><nobr>%ifid</nobr></code>, <code><nobr>%ifnum</nobr></code>, <code><nobr>%ifstr</nobr></code>: Testing Token Types</a></h4> +<p>Some macros will want to perform different tasks depending on whether +they are passed a number, a string, or an identifier. For example, a string +output macro might want to be able to cope with being passed either a +string constant or a pointer to an existing string. +<p>The conditional assembly construct <code><nobr>%ifid</nobr></code>, +taking one parameter (which may be blank), assembles the subsequent code if +and only if the first token in the parameter exists and is an identifier. +<code><nobr>%ifnum</nobr></code> works similarly, but tests for the token +being a numeric constant; <code><nobr>%ifstr</nobr></code> tests for it +being a string. +<p>For example, the <code><nobr>writefile</nobr></code> macro defined in +<a href="#section-4.3.4">section 4.3.4</a> can be extended to take +advantage of <code><nobr>%ifstr</nobr></code> in the following fashion: +<p><pre> +%macro writefile 2-3+ + + %ifstr %2 + jmp %%endstr + %if %0 = 3 + %%str: db %2,%3 + %else + %%str: db %2 + %endif + %%endstr: mov dx,%%str + mov cx,%%endstr-%%str + %else + mov dx,%2 + mov cx,%3 + %endif + mov bx,%1 + mov ah,0x40 + int 0x21 + +%endmacro +</pre> +<p>Then the <code><nobr>writefile</nobr></code> macro can cope with being +called in either of the following two ways: +<p><pre> + writefile [file], strpointer, length + writefile [file], "hello", 13, 10 +</pre> +<p>In the first, <code><nobr>strpointer</nobr></code> is used as the +address of an already-declared string, and <code><nobr>length</nobr></code> +is used as its length; in the second, a string is given to the macro, which +therefore declares it itself and works out the address and length for +itself. +<p>Note the use of <code><nobr>%if</nobr></code> inside the +<code><nobr>%ifstr</nobr></code>: this is to detect whether the macro was +passed two arguments (so the string would be a single string constant, and +<code><nobr>db %2</nobr></code> would be adequate) or more (in which case, +all but the first two would be lumped together into +<code><nobr>%3</nobr></code>, and <code><nobr>db %2,%3</nobr></code> would +be required). +<p>The usual <code><nobr>%elif</nobr></code>..., +<code><nobr>%ifn</nobr></code>..., and <code><nobr>%elifn</nobr></code>... +versions exist for each of <code><nobr>%ifid</nobr></code>, +<code><nobr>%ifnum</nobr></code> and <code><nobr>%ifstr</nobr></code>. +<h4><a name="section-4.4.7">4.4.7 <code><nobr>%iftoken</nobr></code>: Test for a Single Token</a></h4> +<p>Some macros will want to do different things depending on if it is +passed a single token (e.g. paste it to something else using +<code><nobr>%+</nobr></code>) versus a multi-token sequence. +<p>The conditional assembly construct <code><nobr>%iftoken</nobr></code> +assembles the subsequent code if and only if the expanded parameters +consist of exactly one token, possibly surrounded by whitespace. +<p>For example: +<p><pre> +%iftoken 1 +</pre> +<p>will assemble the subsequent code, but +<p><pre> +%iftoken -1 +</pre> +<p>will not, since <code><nobr>-1</nobr></code> contains two tokens: the +unary minus operator <code><nobr>-</nobr></code>, and the number +<code><nobr>1</nobr></code>. +<p>The usual <code><nobr>%eliftoken</nobr></code>, +<code><nobr>%ifntoken</nobr></code>, and +<code><nobr>%elifntoken</nobr></code> variants are also provided. +<h4><a name="section-4.4.8">4.4.8 <code><nobr>%ifempty</nobr></code>: Test for Empty Expansion</a></h4> +<p>The conditional assembly construct <code><nobr>%ifempty</nobr></code> +assembles the subsequent code if and only if the expanded parameters do not +contain any tokens at all, whitespace excepted. +<p>The usual <code><nobr>%elifempty</nobr></code>, +<code><nobr>%ifnempty</nobr></code>, and +<code><nobr>%elifnempty</nobr></code> variants are also provided. +<h3><a name="section-4.5">4.5 Preprocessor Loops: <code><nobr>%rep</nobr></code></a></h3> +<p>NASM's <code><nobr>TIMES</nobr></code> prefix, though useful, cannot be +used to invoke a multi-line macro multiple times, because it is processed +by NASM after macros have already been expanded. Therefore NASM provides +another form of loop, this time at the preprocessor level: +<code><nobr>%rep</nobr></code>. +<p>The directives <code><nobr>%rep</nobr></code> and +<code><nobr>%endrep</nobr></code> (<code><nobr>%rep</nobr></code> takes a +numeric argument, which can be an expression; +<code><nobr>%endrep</nobr></code> takes no arguments) can be used to +enclose a chunk of code, which is then replicated as many times as +specified by the preprocessor: +<p><pre> +%assign i 0 +%rep 64 + inc word [table+2*i] +%assign i i+1 +%endrep +</pre> +<p>This will generate a sequence of 64 <code><nobr>INC</nobr></code> +instructions, incrementing every word of memory from +<code><nobr>[table]</nobr></code> to <code><nobr>[table+126]</nobr></code>. +<p>For more complex termination conditions, or to break out of a repeat +loop part way along, you can use the <code><nobr>%exitrep</nobr></code> +directive to terminate the loop, like this: +<p><pre> +fibonacci: +%assign i 0 +%assign j 1 +%rep 100 +%if j > 65535 + %exitrep +%endif + dw j +%assign k j+i +%assign i j +%assign j k +%endrep + +fib_number equ ($-fibonacci)/2 +</pre> +<p>This produces a list of all the Fibonacci numbers that will fit in 16 +bits. Note that a maximum repeat count must still be given to +<code><nobr>%rep</nobr></code>. This is to prevent the possibility of NASM +getting into an infinite loop in the preprocessor, which (on multitasking +or multi-user systems) would typically cause all the system memory to be +gradually used up and other applications to start crashing. +<h3><a name="section-4.6">4.6 Source Files and Dependencies</a></h3> +<p>These commands allow you to split your sources into multiple files. +<h4><a name="section-4.6.1">4.6.1 <code><nobr>%include</nobr></code>: Including Other Files</a></h4> +<p>Using, once again, a very similar syntax to the C preprocessor, NASM's +preprocessor lets you include other source files into your code. This is +done by the use of the <code><nobr>%include</nobr></code> directive: +<p><pre> +%include "macros.mac" +</pre> +<p>will include the contents of the file +<code><nobr>macros.mac</nobr></code> into the source file containing the +<code><nobr>%include</nobr></code> directive. +<p>Include files are searched for in the current directory (the directory +you're in when you run NASM, as opposed to the location of the NASM +executable or the location of the source file), plus any directories +specified on the NASM command line using the <code><nobr>-i</nobr></code> +option. +<p>The standard C idiom for preventing a file being included more than once +is just as applicable in NASM: if the file +<code><nobr>macros.mac</nobr></code> has the form +<p><pre> +%ifndef MACROS_MAC + %define MACROS_MAC + ; now define some macros +%endif +</pre> +<p>then including the file more than once will not cause errors, because +the second time the file is included nothing will happen because the macro +<code><nobr>MACROS_MAC</nobr></code> will already be defined. +<p>You can force a file to be included even if there is no +<code><nobr>%include</nobr></code> directive that explicitly includes it, +by using the <code><nobr>-p</nobr></code> option on the NASM command line +(see <a href="nasmdoc2.html#section-2.1.17">section 2.1.17</a>). +<h4><a name="section-4.6.2">4.6.2 <code><nobr>%pathsearch</nobr></code>: Search the Include Path</a></h4> +<p>The <code><nobr>%pathsearch</nobr></code> directive takes a single-line +macro name and a filename, and declare or redefines the specified +single-line macro to be the include-path-resolved version of the filename, +if the file exists (otherwise, it is passed unchanged.) +<p>For example, +<p><pre> +%pathsearch MyFoo "foo.bin" +</pre> +<p>... with <code><nobr>-Ibins/</nobr></code> in the include path may end +up defining the macro <code><nobr>MyFoo</nobr></code> to be +<code><nobr>"bins/foo.bin"</nobr></code>. +<h4><a name="section-4.6.3">4.6.3 <code><nobr>%depend</nobr></code>: Add Dependent Files</a></h4> +<p>The <code><nobr>%depend</nobr></code> directive takes a filename and +adds it to the list of files to be emitted as dependency generation when +the <code><nobr>-M</nobr></code> options and its relatives (see +<a href="nasmdoc2.html#section-2.1.4">section 2.1.4</a>) are used. It +produces no output. +<p>This is generally used in conjunction with +<code><nobr>%pathsearch</nobr></code>. For example, a simplified version of +the standard macro wrapper for the <code><nobr>INCBIN</nobr></code> +directive looks like: +<p><pre> +%imacro incbin 1-2+ 0 +%pathsearch dep %1 +%depend dep + incbin dep,%2 +%endmacro +</pre> +<p>This first resolves the location of the file into the macro +<code><nobr>dep</nobr></code>, then adds it to the dependency lists, and +finally issues the assembler-level <code><nobr>INCBIN</nobr></code> +directive. +<h4><a name="section-4.6.4">4.6.4 <code><nobr>%use</nobr></code>: Include Standard Macro Package</a></h4> +<p>The <code><nobr>%use</nobr></code> directive is similar to +<code><nobr>%include</nobr></code>, but rather than including the contents +of a file, it includes a named standard macro package. The standard macro +packages are part of NASM, and are described in +<a href="nasmdoc5.html">chapter 5</a>. +<p>Unlike the <code><nobr>%include</nobr></code> directive, package names +for the <code><nobr>%use</nobr></code> directive do not require quotes, but +quotes are permitted. In NASM 2.04 and 2.05 the unquoted form would be +macro-expanded; this is no longer true. Thus, the following lines are +equivalent: +<p><pre> +%use altreg +%use 'altreg' +</pre> +<p>Standard macro packages are protected from multiple inclusion. When a +standard macro package is used, a testable single-line macro of the form +<code><nobr>__USE_</nobr></code><em>package</em><code><nobr>__</nobr></code> +is also defined, see <a href="#section-4.11.8">section 4.11.8</a>. +<h3><a name="section-4.7">4.7 The Context Stack</a></h3> +<p>Having labels that are local to a macro definition is sometimes not +quite powerful enough: sometimes you want to be able to share labels +between several macro calls. An example might be a +<code><nobr>REPEAT</nobr></code> ... <code><nobr>UNTIL</nobr></code> loop, +in which the expansion of the <code><nobr>REPEAT</nobr></code> macro would +need to be able to refer to a label which the +<code><nobr>UNTIL</nobr></code> macro had defined. However, for such a +macro you would also want to be able to nest these loops. +<p>NASM provides this level of power by means of a <em>context stack</em>. +The preprocessor maintains a stack of <em>contexts</em>, each of which is +characterized by a name. You add a new context to the stack using the +<code><nobr>%push</nobr></code> directive, and remove one using +<code><nobr>%pop</nobr></code>. You can define labels that are local to a +particular context on the stack. +<h4><a name="section-4.7.1">4.7.1 <code><nobr>%push</nobr></code> and <code><nobr>%pop</nobr></code>: Creating and Removing Contexts</a></h4> +<p>The <code><nobr>%push</nobr></code> directive is used to create a new +context and place it on the top of the context stack. +<code><nobr>%push</nobr></code> takes an optional argument, which is the +name of the context. For example: +<p><pre> +%push foobar +</pre> +<p>This pushes a new context called <code><nobr>foobar</nobr></code> on the +stack. You can have several contexts on the stack with the same name: they +can still be distinguished. If no name is given, the context is unnamed +(this is normally used when both the <code><nobr>%push</nobr></code> and +the <code><nobr>%pop</nobr></code> are inside a single macro definition.) +<p>The directive <code><nobr>%pop</nobr></code>, taking one optional +argument, removes the top context from the context stack and destroys it, +along with any labels associated with it. If an argument is given, it must +match the name of the current context, otherwise it will issue an error. +<h4><a name="section-4.7.2">4.7.2 Context-Local Labels</a></h4> +<p>Just as the usage <code><nobr>%%foo</nobr></code> defines a label which +is local to the particular macro call in which it is used, the usage +<code><nobr>%$foo</nobr></code> is used to define a label which is local to +the context on the top of the context stack. So the +<code><nobr>REPEAT</nobr></code> and <code><nobr>UNTIL</nobr></code> +example given above could be implemented by means of: +<p><pre> +%macro repeat 0 + + %push repeat + %$begin: + +%endmacro + +%macro until 1 + + j%-1 %$begin + %pop + +%endmacro +</pre> +<p>and invoked by means of, for example, +<p><pre> + mov cx,string + repeat + add cx,3 + scasb + until e +</pre> +<p>which would scan every fourth byte of a string in search of the byte in +<code><nobr>AL</nobr></code>. +<p>If you need to define, or access, labels local to the context +<em>below</em> the top one on the stack, you can use +<code><nobr>%$$foo</nobr></code>, or <code><nobr>%$$$foo</nobr></code> for +the context below that, and so on. +<h4><a name="section-4.7.3">4.7.3 Context-Local Single-Line Macros</a></h4> +<p>NASM also allows you to define single-line macros which are local to a +particular context, in just the same way: +<p><pre> +%define %$localmac 3 +</pre> +<p>will define the single-line macro <code><nobr>%$localmac</nobr></code> +to be local to the top context on the stack. Of course, after a subsequent +<code><nobr>%push</nobr></code>, it can then still be accessed by the name +<code><nobr>%$$localmac</nobr></code>. +<h4><a name="section-4.7.4">4.7.4 <code><nobr>%repl</nobr></code>: Renaming a Context</a></h4> +<p>If you need to change the name of the top context on the stack (in +order, for example, to have it respond differently to +<code><nobr>%ifctx</nobr></code>), you can execute a +<code><nobr>%pop</nobr></code> followed by a +<code><nobr>%push</nobr></code>; but this will have the side effect of +destroying all context-local labels and macros associated with the context +that was just popped. +<p>NASM provides the directive <code><nobr>%repl</nobr></code>, which +<em>replaces</em> a context with a different name, without touching the +associated macros and labels. So you could replace the destructive code +<p><pre> +%pop +%push newname +</pre> +<p>with the non-destructive version +<code><nobr>%repl newname</nobr></code>. +<h4><a name="section-4.7.5">4.7.5 Example Use of the Context Stack: Block IFs</a></h4> +<p>This example makes use of almost all the context-stack features, +including the conditional-assembly construct +<code><nobr>%ifctx</nobr></code>, to implement a block IF statement as a +set of macros. +<p><pre> +%macro if 1 + + %push if + j%-1 %$ifnot + +%endmacro + +%macro else 0 + + %ifctx if + %repl else + jmp %$ifend + %$ifnot: + %else + %error "expected `if' before `else'" + %endif + +%endmacro + +%macro endif 0 + + %ifctx if + %$ifnot: + %pop + %elifctx else + %$ifend: + %pop + %else + %error "expected `if' or `else' before `endif'" + %endif + +%endmacro +</pre> +<p>This code is more robust than the <code><nobr>REPEAT</nobr></code> and +<code><nobr>UNTIL</nobr></code> macros given in +<a href="#section-4.7.2">section 4.7.2</a>, because it uses conditional +assembly to check that the macros are issued in the right order (for +example, not calling <code><nobr>endif</nobr></code> before +<code><nobr>if</nobr></code>) and issues a <code><nobr>%error</nobr></code> +if they're not. +<p>In addition, the <code><nobr>endif</nobr></code> macro has to be able to +cope with the two distinct cases of either directly following an +<code><nobr>if</nobr></code>, or following an +<code><nobr>else</nobr></code>. It achieves this, again, by using +conditional assembly to do different things depending on whether the +context on top of the stack is <code><nobr>if</nobr></code> or +<code><nobr>else</nobr></code>. +<p>The <code><nobr>else</nobr></code> macro has to preserve the context on +the stack, in order to have the <code><nobr>%$ifnot</nobr></code> referred +to by the <code><nobr>if</nobr></code> macro be the same as the one defined +by the <code><nobr>endif</nobr></code> macro, but has to change the +context's name so that <code><nobr>endif</nobr></code> will know there was +an intervening <code><nobr>else</nobr></code>. It does this by the use of +<code><nobr>%repl</nobr></code>. +<p>A sample usage of these macros might look like: +<p><pre> + cmp ax,bx + + if ae + cmp bx,cx + + if ae + mov ax,cx + else + mov ax,bx + endif + + else + cmp ax,cx + + if ae + mov ax,cx + endif + + endif +</pre> +<p>The block-<code><nobr>IF</nobr></code> macros handle nesting quite +happily, by means of pushing another context, describing the inner +<code><nobr>if</nobr></code>, on top of the one describing the outer +<code><nobr>if</nobr></code>; thus <code><nobr>else</nobr></code> and +<code><nobr>endif</nobr></code> always refer to the last unmatched +<code><nobr>if</nobr></code> or <code><nobr>else</nobr></code>. +<h3><a name="section-4.8">4.8 Stack Relative Preprocessor Directives</a></h3> +<p>The following preprocessor directives provide a way to use labels to +refer to local variables allocated on the stack. +<ul> +<li><code><nobr>%arg</nobr></code> (see <a href="#section-4.8.1">section +4.8.1</a>) +<li><code><nobr>%stacksize</nobr></code> (see +<a href="#section-4.8.2">section 4.8.2</a>) +<li><code><nobr>%local</nobr></code> (see <a href="#section-4.8.3">section +4.8.3</a>) +</ul> +<h4><a name="section-4.8.1">4.8.1 <code><nobr>%arg</nobr></code> Directive</a></h4> +<p>The <code><nobr>%arg</nobr></code> directive is used to simplify the +handling of parameters passed on the stack. Stack based parameter passing +is used by many high level languages, including C, C++ and Pascal. +<p>While NASM has macros which attempt to duplicate this functionality (see +<a href="nasmdoc8.html#section-8.4.5">section 8.4.5</a>), the syntax is not +particularly convenient to use. and is not TASM compatible. Here is an +example which shows the use of <code><nobr>%arg</nobr></code> without any +external macros: +<p><pre> +some_function: + + %push mycontext ; save the current context + %stacksize large ; tell NASM to use bp + %arg i:word, j_ptr:word + + mov ax,[i] + mov bx,[j_ptr] + add ax,[bx] + ret + + %pop ; restore original context +</pre> +<p>This is similar to the procedure defined in +<a href="nasmdoc8.html#section-8.4.5">section 8.4.5</a> and adds the value +in i to the value pointed to by j_ptr and returns the sum in the ax +register. See <a href="#section-4.7.1">section 4.7.1</a> for an explanation +of <code><nobr>push</nobr></code> and <code><nobr>pop</nobr></code> and the +use of context stacks. +<h4><a name="section-4.8.2">4.8.2 <code><nobr>%stacksize</nobr></code> Directive</a></h4> +<p>The <code><nobr>%stacksize</nobr></code> directive is used in +conjunction with the <code><nobr>%arg</nobr></code> (see +<a href="#section-4.8.1">section 4.8.1</a>) and the +<code><nobr>%local</nobr></code> (see <a href="#section-4.8.3">section +4.8.3</a>) directives. It tells NASM the default size to use for subsequent +<code><nobr>%arg</nobr></code> and <code><nobr>%local</nobr></code> +directives. The <code><nobr>%stacksize</nobr></code> directive takes one +required argument which is one of <code><nobr>flat</nobr></code>, +<code><nobr>flat64</nobr></code>, <code><nobr>large</nobr></code> or +<code><nobr>small</nobr></code>. +<p><pre> +%stacksize flat +</pre> +<p>This form causes NASM to use stack-based parameter addressing relative +to <code><nobr>ebp</nobr></code> and it assumes that a near form of call +was used to get to this label (i.e. that <code><nobr>eip</nobr></code> is +on the stack). +<p><pre> +%stacksize flat64 +</pre> +<p>This form causes NASM to use stack-based parameter addressing relative +to <code><nobr>rbp</nobr></code> and it assumes that a near form of call +was used to get to this label (i.e. that <code><nobr>rip</nobr></code> is +on the stack). +<p><pre> +%stacksize large +</pre> +<p>This form uses <code><nobr>bp</nobr></code> to do stack-based parameter +addressing and assumes that a far form of call was used to get to this +address (i.e. that <code><nobr>ip</nobr></code> and +<code><nobr>cs</nobr></code> are on the stack). +<p><pre> +%stacksize small +</pre> +<p>This form also uses <code><nobr>bp</nobr></code> to address stack +parameters, but it is different from <code><nobr>large</nobr></code> +because it also assumes that the old value of bp is pushed onto the stack +(i.e. it expects an <code><nobr>ENTER</nobr></code> instruction). In other +words, it expects that <code><nobr>bp</nobr></code>, +<code><nobr>ip</nobr></code> and <code><nobr>cs</nobr></code> are on the +top of the stack, underneath any local space which may have been allocated +by <code><nobr>ENTER</nobr></code>. This form is probably most useful when +used in combination with the <code><nobr>%local</nobr></code> directive +(see <a href="#section-4.8.3">section 4.8.3</a>). +<h4><a name="section-4.8.3">4.8.3 <code><nobr>%local</nobr></code> Directive</a></h4> +<p>The <code><nobr>%local</nobr></code> directive is used to simplify the +use of local temporary stack variables allocated in a stack frame. +Automatic local variables in C are an example of this kind of variable. The +<code><nobr>%local</nobr></code> directive is most useful when used with +the <code><nobr>%stacksize</nobr></code> (see +<a href="#section-4.8.2">section 4.8.2</a> and is also compatible with the +<code><nobr>%arg</nobr></code> directive (see +<a href="#section-4.8.1">section 4.8.1</a>). It allows simplified reference +to variables on the stack which have been allocated typically by using the +<code><nobr>ENTER</nobr></code> instruction. An example of its use is the +following: +<p><pre> +silly_swap: + + %push mycontext ; save the current context + %stacksize small ; tell NASM to use bp + %assign %$localsize 0 ; see text for explanation + %local old_ax:word, old_dx:word + + enter %$localsize,0 ; see text for explanation + mov [old_ax],ax ; swap ax & bx + mov [old_dx],dx ; and swap dx & cx + mov ax,bx + mov dx,cx + mov bx,[old_ax] + mov cx,[old_dx] + leave ; restore old bp + ret ; + + %pop ; restore original context +</pre> +<p>The <code><nobr>%$localsize</nobr></code> variable is used internally by +the <code><nobr>%local</nobr></code> directive and <em>must</em> be defined +within the current context before the <code><nobr>%local</nobr></code> +directive may be used. Failure to do so will result in one expression +syntax error for each <code><nobr>%local</nobr></code> variable declared. +It then may be used in the construction of an appropriately sized ENTER +instruction as shown in the example. +<h3><a name="section-4.9">4.9 Reporting User-Defined Errors: <code><nobr>%error</nobr></code>, <code><nobr>%warning</nobr></code>, <code><nobr>%fatal</nobr></code></a></h3> +<p>The preprocessor directive <code><nobr>%error</nobr></code> will cause +NASM to report an error if it occurs in assembled code. So if other users +are going to try to assemble your source files, you can ensure that they +define the right macros by means of code like this: +<p><pre> +%ifdef F1 + ; do some setup +%elifdef F2 + ; do some different setup +%else + %error "Neither F1 nor F2 was defined." +%endif +</pre> +<p>Then any user who fails to understand the way your code is supposed to +be assembled will be quickly warned of their mistake, rather than having to +wait until the program crashes on being run and then not knowing what went +wrong. +<p>Similarly, <code><nobr>%warning</nobr></code> issues a warning, but +allows assembly to continue: +<p><pre> +%ifdef F1 + ; do some setup +%elifdef F2 + ; do some different setup +%else + %warning "Neither F1 nor F2 was defined, assuming F1." + %define F1 +%endif +</pre> +<p><code><nobr>%error</nobr></code> and <code><nobr>%warning</nobr></code> +are issued only on the final assembly pass. This makes them safe to use in +conjunction with tests that depend on symbol values. +<p><code><nobr>%fatal</nobr></code> terminates assembly immediately, +regardless of pass. This is useful when there is no point in continuing the +assembly further, and doing so is likely just going to cause a spew of +confusing error messages. +<p>It is optional for the message string after +<code><nobr>%error</nobr></code>, <code><nobr>%warning</nobr></code> or +<code><nobr>%fatal</nobr></code> to be quoted. If it is <em>not</em>, then +single-line macros are expanded in it, which can be used to display more +information to the user. For example: +<p><pre> +%if foo > 64 + %assign foo_over foo-64 + %error foo is foo_over bytes too large +%endif +</pre> +<h3><a name="section-4.10">4.10 Other Preprocessor Directives</a></h3> +<p>NASM also has preprocessor directives which allow access to information +from external sources. Currently they include: +<ul> +<li><code><nobr>%line</nobr></code> enables NASM to correctly handle the +output of another preprocessor (see <a href="#section-4.10.1">section +4.10.1</a>). +<li><code><nobr>%!</nobr></code> enables NASM to read in the value of an +environment variable, which can then be used in your program (see +<a href="#section-4.10.2">section 4.10.2</a>). +</ul> +<h4><a name="section-4.10.1">4.10.1 <code><nobr>%line</nobr></code> Directive</a></h4> +<p>The <code><nobr>%line</nobr></code> directive is used to notify NASM +that the input line corresponds to a specific line number in another file. +Typically this other file would be an original source file, with the +current NASM input being the output of a pre-processor. The +<code><nobr>%line</nobr></code> directive allows NASM to output messages +which indicate the line number of the original source file, instead of the +file that is being read by NASM. +<p>This preprocessor directive is not generally of use to programmers, by +may be of interest to preprocessor authors. The usage of the +<code><nobr>%line</nobr></code> preprocessor directive is as follows: +<p><pre> +%line nnn[+mmm] [filename] +</pre> +<p>In this directive, <code><nobr>nnn</nobr></code> identifies the line of +the original source file which this line corresponds to. +<code><nobr>mmm</nobr></code> is an optional parameter which specifies a +line increment value; each line of the input file read in is considered to +correspond to <code><nobr>mmm</nobr></code> lines of the original source +file. Finally, <code><nobr>filename</nobr></code> is an optional parameter +which specifies the file name of the original source file. +<p>After reading a <code><nobr>%line</nobr></code> preprocessor directive, +NASM will report all file name and line numbers relative to the values +specified therein. +<h4><a name="section-4.10.2">4.10.2 <code><nobr>%!</nobr></code><code><nobr><env></nobr></code>: Read an environment variable.</a></h4> +<p>The <code><nobr>%!<env></nobr></code> directive makes it possible +to read the value of an environment variable at assembly time. This could, +for example, be used to store the contents of an environment variable into +a string, which could be used at some other point in your code. +<p>For example, suppose that you have an environment variable +<code><nobr>FOO</nobr></code>, and you want the contents of +<code><nobr>FOO</nobr></code> to be embedded in your program. You could do +that as follows: +<p><pre> +%defstr FOO %!FOO +</pre> +<p>See <a href="#section-4.1.8">section 4.1.8</a> for notes on the +<code><nobr>%defstr</nobr></code> directive. +<h3><a name="section-4.11">4.11 Standard Macros</a></h3> +<p>NASM defines a set of standard macros, which are already defined when it +starts to process any source file. If you really need a program to be +assembled with no pre-defined macros, you can use the +<code><nobr>%clear</nobr></code> directive to empty the preprocessor of +everything but context-local preprocessor variables and single-line macros. +<p>Most user-level assembler directives (see +<a href="nasmdoc6.html">chapter 6</a>) are implemented as macros which +invoke primitive directives; these are described in +<a href="nasmdoc6.html">chapter 6</a>. The rest of the standard macro set +is described here. +<h4><a name="section-4.11.1">4.11.1 NASM Version Macros</a></h4> +<p>The single-line macros <code><nobr>__NASM_MAJOR__</nobr></code>, +<code><nobr>__NASM_MINOR__</nobr></code>, +<code><nobr>__NASM_SUBMINOR__</nobr></code> and +<code><nobr>___NASM_PATCHLEVEL__</nobr></code> expand to the major, minor, +subminor and patch level parts of the version number of NASM being used. +So, under NASM 0.98.32p1 for example, +<code><nobr>__NASM_MAJOR__</nobr></code> would be defined to be 0, +<code><nobr>__NASM_MINOR__</nobr></code> would be defined as 98, +<code><nobr>__NASM_SUBMINOR__</nobr></code> would be defined to 32, and +<code><nobr>___NASM_PATCHLEVEL__</nobr></code> would be defined as 1. +<p>Additionally, the macro <code><nobr>__NASM_SNAPSHOT__</nobr></code> is +defined for automatically generated snapshot releases <em>only</em>. +<h4><a name="section-4.11.2">4.11.2 <code><nobr>__NASM_VERSION_ID__</nobr></code>: NASM Version ID</a></h4> +<p>The single-line macro <code><nobr>__NASM_VERSION_ID__</nobr></code> +expands to a dword integer representing the full version number of the +version of nasm being used. The value is the equivalent to +<code><nobr>__NASM_MAJOR__</nobr></code>, +<code><nobr>__NASM_MINOR__</nobr></code>, +<code><nobr>__NASM_SUBMINOR__</nobr></code> and +<code><nobr>___NASM_PATCHLEVEL__</nobr></code> concatenated to produce a +single doubleword. Hence, for 0.98.32p1, the returned number would be +equivalent to: +<p><pre> + dd 0x00622001 +</pre> +<p>or +<p><pre> + db 1,32,98,0 +</pre> +<p>Note that the above lines are generate exactly the same code, the second +line is used just to give an indication of the order that the separate +values will be present in memory. +<h4><a name="section-4.11.3">4.11.3 <code><nobr>__NASM_VER__</nobr></code>: NASM Version string</a></h4> +<p>The single-line macro <code><nobr>__NASM_VER__</nobr></code> expands to +a string which defines the version number of nasm being used. So, under +NASM 0.98.32 for example, +<p><pre> + db __NASM_VER__ +</pre> +<p>would expand to +<p><pre> + db "0.98.32" +</pre> +<h4><a name="section-4.11.4">4.11.4 <code><nobr>__FILE__</nobr></code> and <code><nobr>__LINE__</nobr></code>: File Name and Line Number</a></h4> +<p>Like the C preprocessor, NASM allows the user to find out the file name +and line number containing the current instruction. The macro +<code><nobr>__FILE__</nobr></code> expands to a string constant giving the +name of the current input file (which may change through the course of +assembly if <code><nobr>%include</nobr></code> directives are used), and +<code><nobr>__LINE__</nobr></code> expands to a numeric constant giving the +current line number in the input file. +<p>These macros could be used, for example, to communicate debugging +information to a macro, since invoking <code><nobr>__LINE__</nobr></code> +inside a macro definition (either single-line or multi-line) will return +the line number of the macro <em>call</em>, rather than +<em>definition</em>. So to determine where in a piece of code a crash is +occurring, for example, one could write a routine +<code><nobr>stillhere</nobr></code>, which is passed a line number in +<code><nobr>EAX</nobr></code> and outputs something like `line 155: still +here'. You could then write a macro +<p><pre> +%macro notdeadyet 0 + + push eax + mov eax,__LINE__ + call stillhere + pop eax + +%endmacro +</pre> +<p>and then pepper your code with calls to +<code><nobr>notdeadyet</nobr></code> until you find the crash point. +<h4><a name="section-4.11.5">4.11.5 <code><nobr>__BITS__</nobr></code>: Current BITS Mode</a></h4> +<p>The <code><nobr>__BITS__</nobr></code> standard macro is updated every +time that the BITS mode is set using the <code><nobr>BITS XX</nobr></code> +or <code><nobr>[BITS XX]</nobr></code> directive, where XX is a valid mode +number of 16, 32 or 64. <code><nobr>__BITS__</nobr></code> receives the +specified mode number and makes it globally available. This can be very +useful for those who utilize mode-dependent macros. +<h4><a name="section-4.11.6">4.11.6 <code><nobr>__OUTPUT_FORMAT__</nobr></code>: Current Output Format</a></h4> +<p>The <code><nobr>__OUTPUT_FORMAT__</nobr></code> standard macro holds the +current Output Format, as given by the <code><nobr>-f</nobr></code> option +or NASM's default. Type <code><nobr>nasm -hf</nobr></code> for a list. +<p><pre> +%ifidn __OUTPUT_FORMAT__, win32 + %define NEWLINE 13, 10 +%elifidn __OUTPUT_FORMAT__, elf32 + %define NEWLINE 10 +%endif +</pre> +<h4><a name="section-4.11.7">4.11.7 Assembly Date and Time Macros</a></h4> +<p>NASM provides a variety of macros that represent the timestamp of the +assembly session. +<ul> +<li>The <code><nobr>__DATE__</nobr></code> and +<code><nobr>__TIME__</nobr></code> macros give the assembly date and time +as strings, in ISO 8601 format (<code><nobr>"YYYY-MM-DD"</nobr></code> and +<code><nobr>"HH:MM:SS"</nobr></code>, respectively.) +<li>The <code><nobr>__DATE_NUM__</nobr></code> and +<code><nobr>__TIME_NUM__</nobr></code> macros give the assembly date and +time in numeric form; in the format <code><nobr>YYYYMMDD</nobr></code> and +<code><nobr>HHMMSS</nobr></code> respectively. +<li>The <code><nobr>__UTC_DATE__</nobr></code> and +<code><nobr>__UTC_TIME__</nobr></code> macros give the assembly date and +time in universal time (UTC) as strings, in ISO 8601 format +(<code><nobr>"YYYY-MM-DD"</nobr></code> and +<code><nobr>"HH:MM:SS"</nobr></code>, respectively.) If the host platform +doesn't provide UTC time, these macros are undefined. +<li>The <code><nobr>__UTC_DATE_NUM__</nobr></code> and +<code><nobr>__UTC_TIME_NUM__</nobr></code> macros give the assembly date +and time universal time (UTC) in numeric form; in the format +<code><nobr>YYYYMMDD</nobr></code> and <code><nobr>HHMMSS</nobr></code> +respectively. If the host platform doesn't provide UTC time, these macros +are undefined. +<li>The <code><nobr>__POSIX_TIME__</nobr></code> macro is defined as a +number containing the number of seconds since the POSIX epoch, 1 January +1970 00:00:00 UTC; excluding any leap seconds. This is computed using UTC +time if available on the host platform, otherwise it is computed using the +local time as if it was UTC. +</ul> +<p>All instances of time and date macros in the same assembly session +produce consistent output. For example, in an assembly session started at +42 seconds after midnight on January 1, 2010 in Moscow (timezone UTC+3) +these macros would have the following values, assuming, of course, a +properly configured environment with a correct clock: +<p><pre> + __DATE__ "2010-01-01" + __TIME__ "00:00:42" + __DATE_NUM__ 20100101 + __TIME_NUM__ 000042 + __UTC_DATE__ "2009-12-31" + __UTC_TIME__ "21:00:42" + __UTC_DATE_NUM__ 20091231 + __UTC_TIME_NUM__ 210042 + __POSIX_TIME__ 1262293242 +</pre> +<h4><a name="section-4.11.8">4.11.8 <code><nobr>__USE_</nobr></code><em>package</em><code><nobr>__</nobr></code>: Package Include Test</a></h4> +<p>When a standard macro package (see <a href="nasmdoc5.html">chapter +5</a>) is included with the <code><nobr>%use</nobr></code> directive (see +<a href="#section-4.6.4">section 4.6.4</a>), a single-line macro of the +form +<code><nobr>__USE_</nobr></code><em>package</em><code><nobr>__</nobr></code> +is automatically defined. This allows testing if a particular package is +invoked or not. +<p>For example, if the <code><nobr>altreg</nobr></code> package is included +(see <a href="nasmdoc5.html#section-5.1">section 5.1</a>), then the macro +<code><nobr>__USE_ALTREG__</nobr></code> is defined. +<h4><a name="section-4.11.9">4.11.9 <code><nobr>__PASS__</nobr></code>: Assembly Pass</a></h4> +<p>The macro <code><nobr>__PASS__</nobr></code> is defined to be +<code><nobr>1</nobr></code> on preparatory passes, and +<code><nobr>2</nobr></code> on the final pass. In preprocess-only mode, it +is set to <code><nobr>3</nobr></code>, and when running only to generate +dependencies (due to the <code><nobr>-M</nobr></code> or +<code><nobr>-MG</nobr></code> option, see +<a href="nasmdoc2.html#section-2.1.4">section 2.1.4</a>) it is set to +<code><nobr>0</nobr></code>. +<p><em>Avoid using this macro if at all possible. It is tremendously easy +to generate very strange errors by misusing it, and the semantics may +change in future versions of NASM.</em> +<h4><a name="section-4.11.10">4.11.10 <code><nobr>STRUC</nobr></code> and <code><nobr>ENDSTRUC</nobr></code>: Declaring Structure Data Types</a></h4> +<p>The core of NASM contains no intrinsic means of defining data +structures; instead, the preprocessor is sufficiently powerful that data +structures can be implemented as a set of macros. The macros +<code><nobr>STRUC</nobr></code> and <code><nobr>ENDSTRUC</nobr></code> are +used to define a structure data type. +<p><code><nobr>STRUC</nobr></code> takes one or two parameters. The first +parameter is the name of the data type. The second, optional parameter is +the base offset of the structure. The name of the data type is defined as a +symbol with the value of the base offset, and the name of the data type +with the suffix <code><nobr>_size</nobr></code> appended to it is defined +as an <code><nobr>EQU</nobr></code> giving the size of the structure. Once +<code><nobr>STRUC</nobr></code> has been issued, you are defining the +structure, and should define fields using the +<code><nobr>RESB</nobr></code> family of pseudo-instructions, and then +invoke <code><nobr>ENDSTRUC</nobr></code> to finish the definition. +<p>For example, to define a structure called +<code><nobr>mytype</nobr></code> containing a longword, a word, a byte and +a string of bytes, you might code +<p><pre> +struc mytype + + mt_long: resd 1 + mt_word: resw 1 + mt_byte: resb 1 + mt_str: resb 32 + +endstruc +</pre> +<p>The above code defines six symbols: <code><nobr>mt_long</nobr></code> as +0 (the offset from the beginning of a <code><nobr>mytype</nobr></code> +structure to the longword field), <code><nobr>mt_word</nobr></code> as 4, +<code><nobr>mt_byte</nobr></code> as 6, <code><nobr>mt_str</nobr></code> as +7, <code><nobr>mytype_size</nobr></code> as 39, and +<code><nobr>mytype</nobr></code> itself as zero. +<p>The reason why the structure type name is defined at zero by default is +a side effect of allowing structures to work with the local label +mechanism: if your structure members tend to have the same names in more +than one structure, you can define the above structure like this: +<p><pre> +struc mytype + + .long: resd 1 + .word: resw 1 + .byte: resb 1 + .str: resb 32 + +endstruc +</pre> +<p>This defines the offsets to the structure fields as +<code><nobr>mytype.long</nobr></code>, +<code><nobr>mytype.word</nobr></code>, +<code><nobr>mytype.byte</nobr></code> and +<code><nobr>mytype.str</nobr></code>. +<p>NASM, since it has no <em>intrinsic</em> structure support, does not +support any form of period notation to refer to the elements of a structure +once you have one (except the above local-label notation), so code such as +<code><nobr>mov ax,[mystruc.mt_word]</nobr></code> is not valid. +<code><nobr>mt_word</nobr></code> is a constant just like any other +constant, so the correct syntax is +<code><nobr>mov ax,[mystruc+mt_word]</nobr></code> or +<code><nobr>mov ax,[mystruc+mytype.word]</nobr></code>. +<p>Sometimes you only have the address of the structure displaced by an +offset. For example, consider this standard stack frame setup: +<p><pre> +push ebp +mov ebp, esp +sub esp, 40 +</pre> +<p>In this case, you could access an element by subtracting the offset: +<p><pre> +mov [ebp - 40 + mytype.word], ax +</pre> +<p>However, if you do not want to repeat this offset, you can use -40 as a +base offset: +<p><pre> +struc mytype, -40 +</pre> +<p>And access an element this way: +<p><pre> +mov [ebp + mytype.word], ax +</pre> +<h4><a name="section-4.11.11">4.11.11 <code><nobr>ISTRUC</nobr></code>, <code><nobr>AT</nobr></code> and <code><nobr>IEND</nobr></code>: Declaring Instances of Structures</a></h4> +<p>Having defined a structure type, the next thing you typically want to do +is to declare instances of that structure in your data segment. NASM +provides an easy way to do this in the <code><nobr>ISTRUC</nobr></code> +mechanism. To declare a structure of type <code><nobr>mytype</nobr></code> +in a program, you code something like this: +<p><pre> +mystruc: + istruc mytype + + at mt_long, dd 123456 + at mt_word, dw 1024 + at mt_byte, db 'x' + at mt_str, db 'hello, world', 13, 10, 0 + + iend +</pre> +<p>The function of the <code><nobr>AT</nobr></code> macro is to make use of +the <code><nobr>TIMES</nobr></code> prefix to advance the assembly position +to the correct point for the specified structure field, and then to declare +the specified data. Therefore the structure fields must be declared in the +same order as they were specified in the structure definition. +<p>If the data to go in a structure field requires more than one source +line to specify, the remaining source lines can easily come after the +<code><nobr>AT</nobr></code> line. For example: +<p><pre> + at mt_str, db 123,134,145,156,167,178,189 + db 190,100,0 +</pre> +<p>Depending on personal taste, you can also omit the code part of the +<code><nobr>AT</nobr></code> line completely, and start the structure field +on the next line: +<p><pre> + at mt_str + db 'hello, world' + db 13,10,0 +</pre> +<h4><a name="section-4.11.12">4.11.12 <code><nobr>ALIGN</nobr></code> and <code><nobr>ALIGNB</nobr></code>: Data Alignment</a></h4> +<p>The <code><nobr>ALIGN</nobr></code> and <code><nobr>ALIGNB</nobr></code> +macros provides a convenient way to align code or data on a word, longword, +paragraph or other boundary. (Some assemblers call this directive +<code><nobr>EVEN</nobr></code>.) The syntax of the +<code><nobr>ALIGN</nobr></code> and <code><nobr>ALIGNB</nobr></code> macros +is +<p><pre> + align 4 ; align on 4-byte boundary + align 16 ; align on 16-byte boundary + align 8,db 0 ; pad with 0s rather than NOPs + align 4,resb 1 ; align to 4 in the BSS + alignb 4 ; equivalent to previous line +</pre> +<p>Both macros require their first argument to be a power of two; they both +compute the number of additional bytes required to bring the length of the +current section up to a multiple of that power of two, and then apply the +<code><nobr>TIMES</nobr></code> prefix to their second argument to perform +the alignment. +<p>If the second argument is not specified, the default for +<code><nobr>ALIGN</nobr></code> is <code><nobr>NOP</nobr></code>, and the +default for <code><nobr>ALIGNB</nobr></code> is +<code><nobr>RESB 1</nobr></code>. So if the second argument is specified, +the two macros are equivalent. Normally, you can just use +<code><nobr>ALIGN</nobr></code> in code and data sections and +<code><nobr>ALIGNB</nobr></code> in BSS sections, and never need the second +argument except for special purposes. +<p><code><nobr>ALIGN</nobr></code> and <code><nobr>ALIGNB</nobr></code>, +being simple macros, perform no error checking: they cannot warn you if +their first argument fails to be a power of two, or if their second +argument generates more than one byte of code. In each of these cases they +will silently do the wrong thing. +<p><code><nobr>ALIGNB</nobr></code> (or <code><nobr>ALIGN</nobr></code> +with a second argument of <code><nobr>RESB 1</nobr></code>) can be used +within structure definitions: +<p><pre> +struc mytype2 + + mt_byte: + resb 1 + alignb 2 + mt_word: + resw 1 + alignb 4 + mt_long: + resd 1 + mt_str: + resb 32 + +endstruc +</pre> +<p>This will ensure that the structure members are sensibly aligned +relative to the base of the structure. +<p>A final caveat: <code><nobr>ALIGN</nobr></code> and +<code><nobr>ALIGNB</nobr></code> work relative to the beginning of the +<em>section</em>, not the beginning of the address space in the final +executable. Aligning to a 16-byte boundary when the section you're in is +only guaranteed to be aligned to a 4-byte boundary, for example, is a waste +of effort. Again, NASM does not check that the section's alignment +characteristics are sensible for the use of <code><nobr>ALIGN</nobr></code> +or <code><nobr>ALIGNB</nobr></code>. +<p>See also the <code><nobr>smartalign</nobr></code> standard macro +package, <a href="nasmdoc5.html#section-5.2">section 5.2</a>. +<p align=center><a href="nasmdoc5.html">Next Chapter</a> | +<a href="nasmdoc3.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc5.html b/doc/html/nasmdoc5.html new file mode 100644 index 0000000..7effbbb --- /dev/null +++ b/doc/html/nasmdoc5.html @@ -0,0 +1,83 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc6.html">Next Chapter</a> | +<a href="nasmdoc4.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-5">Chapter 5: Standard Macro Packages</a></h2> +<p>The <code><nobr>%use</nobr></code> directive (see +<a href="nasmdoc4.html#section-4.6.4">section 4.6.4</a>) includes one of +the standard macro packages included with the NASM distribution and +compiled into the NASM binary. It operates like the +<code><nobr>%include</nobr></code> directive (see +<a href="nasmdoc4.html#section-4.6.1">section 4.6.1</a>), but the included +contents is provided by NASM itself. +<p>The names of standard macro packages are case insensitive, and can be +quoted or not. +<h3><a name="section-5.1">5.1 <code><nobr>altreg</nobr></code>: Alternate Register Names</a></h3> +<p>The <code><nobr>altreg</nobr></code> standard macro package provides +alternate register names. It provides numeric register names for all +registers (not just +<code><nobr>R8</nobr></code>-<code><nobr>R15</nobr></code>), the +Intel-defined aliases +<code><nobr>R8L</nobr></code>-<code><nobr>R15L</nobr></code> for the low +bytes of register (as opposed to the NASM/AMD standard names +<code><nobr>R8B</nobr></code>-<code><nobr>R15B</nobr></code>), and the +names <code><nobr>R0H</nobr></code>-<code><nobr>R3H</nobr></code> (by +analogy with <code><nobr>R0L</nobr></code>-<code><nobr>R3L</nobr></code>) +for <code><nobr>AH</nobr></code>, <code><nobr>CH</nobr></code>, +<code><nobr>DH</nobr></code>, and <code><nobr>BH</nobr></code>. +<p>Example use: +<p><pre> +%use altreg + +proc: + mov r0l,r3h ; mov al,bh + ret +</pre> +<p>See also <a href="nasmdo11.html#section-11.1">section 11.1</a>. +<h3><a name="section-5.2">5.2 <code><nobr>smartalign</nobr></code>: Smart <code><nobr>ALIGN</nobr></code> Macro</a></h3> +<p>The <code><nobr>smartalign</nobr></code> standard macro package provides +for an <code><nobr>ALIGN</nobr></code> macro which is more powerful than +the default (and backwards-compatible) one (see +<a href="nasmdoc4.html#section-4.11.12">section 4.11.12</a>). When the +<code><nobr>smartalign</nobr></code> package is enabled, when +<code><nobr>ALIGN</nobr></code> is used without a second argument, NASM +will generate a sequence of instructions more efficient than a series of +<code><nobr>NOP</nobr></code>. Furthermore, if the padding exceeds a +specific threshold, then NASM will generate a jump over the entire padding +sequence. +<p>The specific instructions generated can be controlled with the new +<code><nobr>ALIGNMODE</nobr></code> macro. This macro takes two parameters: +one mode, and an optional jump threshold override. The modes are as +follows: +<ul> +<li><code><nobr>generic</nobr></code>: Works on all x86 CPUs and should +have reasonable performance. The default jump threshold is 8. This is the +default. +<li><code><nobr>nop</nobr></code>: Pad out with +<code><nobr>NOP</nobr></code> instructions. The only difference compared to +the standard <code><nobr>ALIGN</nobr></code> macro is that NASM can still +jump over a large padding area. The default jump threshold is 16. +<li><code><nobr>k7</nobr></code>: Optimize for the AMD K7 (Athlon/Althon +XP). These instructions should still work on all x86 CPUs. The default jump +threshold is 16. +<li><code><nobr>k8</nobr></code>: Optimize for the AMD K8 (Opteron/Althon +64). These instructions should still work on all x86 CPUs. The default jump +threshold is 16. +<li><code><nobr>p6</nobr></code>: Optimize for Intel CPUs. This uses the +long <code><nobr>NOP</nobr></code> instructions first introduced in Pentium +Pro. This is incompatible with all CPUs of family 5 or lower, as well as +some VIA CPUs and several virtualization solutions. The default jump +threshold is 16. +</ul> +<p>The macro <code><nobr>__ALIGNMODE__</nobr></code> is defined to contain +the current alignment mode. A number of other macros beginning with +<code><nobr>__ALIGN_</nobr></code> are used internally by this macro +package. +<p align=center><a href="nasmdoc6.html">Next Chapter</a> | +<a href="nasmdoc4.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc6.html b/doc/html/nasmdoc6.html new file mode 100644 index 0000000..144a661 --- /dev/null +++ b/doc/html/nasmdoc6.html @@ -0,0 +1,371 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc7.html">Next Chapter</a> | +<a href="nasmdoc5.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-6">Chapter 6: Assembler Directives</a></h2> +<p>NASM, though it attempts to avoid the bureaucracy of assemblers like +MASM and TASM, is nevertheless forced to support a <em>few</em> directives. +These are described in this chapter. +<p>NASM's directives come in two types: <em>user-level</em> directives and +<em>primitive</em> directives. Typically, each directive has a user-level +form and a primitive form. In almost all cases, we recommend that users use +the user-level forms of the directives, which are implemented as macros +which call the primitive forms. +<p>Primitive directives are enclosed in square brackets; user-level +directives are not. +<p>In addition to the universal directives described in this chapter, each +object file format can optionally supply extra directives in order to +control particular features of that file format. These +<em>format-specific</em> directives are documented along with the formats +that implement them, in <a href="nasmdoc7.html">chapter 7</a>. +<h3><a name="section-6.1">6.1 <code><nobr>BITS</nobr></code>: Specifying Target Processor Mode</a></h3> +<p>The <code><nobr>BITS</nobr></code> directive specifies whether NASM +should generate code designed to run on a processor operating in 16-bit +mode, 32-bit mode or 64-bit mode. The syntax is +<code><nobr>BITS XX</nobr></code>, where XX is 16, 32 or 64. +<p>In most cases, you should not need to use <code><nobr>BITS</nobr></code> +explicitly. The <code><nobr>aout</nobr></code>, +<code><nobr>coff</nobr></code>, <code><nobr>elf</nobr></code>, +<code><nobr>macho</nobr></code>, <code><nobr>win32</nobr></code> and +<code><nobr>win64</nobr></code> object formats, which are designed for use +in 32-bit or 64-bit operating systems, all cause NASM to select 32-bit or +64-bit mode, respectively, by default. The <code><nobr>obj</nobr></code> +object format allows you to specify each segment you define as either +<code><nobr>USE16</nobr></code> or <code><nobr>USE32</nobr></code>, and +NASM will set its operating mode accordingly, so the use of the +<code><nobr>BITS</nobr></code> directive is once again unnecessary. +<p>The most likely reason for using the <code><nobr>BITS</nobr></code> +directive is to write 32-bit or 64-bit code in a flat binary file; this is +because the <code><nobr>bin</nobr></code> output format defaults to 16-bit +mode in anticipation of it being used most frequently to write DOS +<code><nobr>.COM</nobr></code> programs, DOS <code><nobr>.SYS</nobr></code> +device drivers and boot loader software. +<p>You do <em>not</em> need to specify <code><nobr>BITS 32</nobr></code> +merely in order to use 32-bit instructions in a 16-bit DOS program; if you +do, the assembler will generate incorrect code because it will be writing +code targeted at a 32-bit platform, to be run on a 16-bit one. +<p>When NASM is in <code><nobr>BITS 16</nobr></code> mode, instructions +which use 32-bit data are prefixed with an 0x66 byte, and those referring +to 32-bit addresses have an 0x67 prefix. In +<code><nobr>BITS 32</nobr></code> mode, the reverse is true: 32-bit +instructions require no prefixes, whereas instructions using 16-bit data +need an 0x66 and those working on 16-bit addresses need an 0x67. +<p>When NASM is in <code><nobr>BITS 64</nobr></code> mode, most +instructions operate the same as they do for +<code><nobr>BITS 32</nobr></code> mode. However, there are 8 more general +and SSE registers, and 16-bit addressing is no longer supported. +<p>The default address size is 64 bits; 32-bit addressing can be selected +with the 0x67 prefix. The default operand size is still 32 bits, however, +and the 0x66 prefix selects 16-bit operand size. The +<code><nobr>REX</nobr></code> prefix is used both to select 64-bit operand +size, and to access the new registers. NASM automatically inserts REX +prefixes when necessary. +<p>When the <code><nobr>REX</nobr></code> prefix is used, the processor +does not know how to address the AH, BH, CH or DH (high 8-bit legacy) +registers. Instead, it is possible to access the the low 8-bits of the SP, +BP SI and DI registers as SPL, BPL, SIL and DIL, respectively; but only +when the REX prefix is used. +<p>The <code><nobr>BITS</nobr></code> directive has an exactly equivalent +primitive form, <code><nobr>[BITS 16]</nobr></code>, +<code><nobr>[BITS 32]</nobr></code> and +<code><nobr>[BITS 64]</nobr></code>. The user-level form is a macro which +has no function other than to call the primitive form. +<p>Note that the space is neccessary, e.g. <code><nobr>BITS32</nobr></code> +will <em>not</em> work! +<h4><a name="section-6.1.1">6.1.1 <code><nobr>USE16</nobr></code> & <code><nobr>USE32</nobr></code>: Aliases for BITS</a></h4> +<p>The `<code><nobr>USE16</nobr></code>' and +`<code><nobr>USE32</nobr></code>' directives can be used in place of +`<code><nobr>BITS 16</nobr></code>' and +`<code><nobr>BITS 32</nobr></code>', for compatibility with other +assemblers. +<h3><a name="section-6.2">6.2 <code><nobr>DEFAULT</nobr></code>: Change the assembler defaults</a></h3> +<p>The <code><nobr>DEFAULT</nobr></code> directive changes the assembler +defaults. Normally, NASM defaults to a mode where the programmer is +expected to explicitly specify most features directly. However, this is +occationally obnoxious, as the explicit form is pretty much the only one +one wishes to use. +<p>Currently, the only <code><nobr>DEFAULT</nobr></code> that is settable +is whether or not registerless instructions in 64-bit mode are +<code><nobr>RIP</nobr></code>-relative or not. By default, they are +absolute unless overridden with the <code><nobr>REL</nobr></code> specifier +(see <a href="nasmdoc3.html#section-3.3">section 3.3</a>). However, if +<code><nobr>DEFAULT REL</nobr></code> is specified, +<code><nobr>REL</nobr></code> is default, unless overridden with the +<code><nobr>ABS</nobr></code> specifier, <em>except when used with an FS or +GS segment override</em>. +<p>The special handling of <code><nobr>FS</nobr></code> and +<code><nobr>GS</nobr></code> overrides are due to the fact that these +registers are generally used as thread pointers or other special functions +in 64-bit mode, and generating <code><nobr>RIP</nobr></code>-relative +addresses would be extremely confusing. +<p><code><nobr>DEFAULT REL</nobr></code> is disabled with +<code><nobr>DEFAULT ABS</nobr></code>. +<h3><a name="section-6.3">6.3 <code><nobr>SECTION</nobr></code> or <code><nobr>SEGMENT</nobr></code>: Changing and Defining Sections</a></h3> +<p>The <code><nobr>SECTION</nobr></code> directive +(<code><nobr>SEGMENT</nobr></code> is an exactly equivalent synonym) +changes which section of the output file the code you write will be +assembled into. In some object file formats, the number and names of +sections are fixed; in others, the user may make up as many as they wish. +Hence <code><nobr>SECTION</nobr></code> may sometimes give an error +message, or may define a new section, if you try to switch to a section +that does not (yet) exist. +<p>The Unix object formats, and the <code><nobr>bin</nobr></code> object +format (but see <a href="nasmdoc7.html#section-7.1.3">section 7.1.3</a>, +all support the standardized section names <code><nobr>.text</nobr></code>, +<code><nobr>.data</nobr></code> and <code><nobr>.bss</nobr></code> for the +code, data and uninitialized-data sections. The +<code><nobr>obj</nobr></code> format, by contrast, does not recognize these +section names as being special, and indeed will strip off the leading +period of any section name that has one. +<h4><a name="section-6.3.1">6.3.1 The <code><nobr>__SECT__</nobr></code> Macro</a></h4> +<p>The <code><nobr>SECTION</nobr></code> directive is unusual in that its +user-level form functions differently from its primitive form. The +primitive form, <code><nobr>[SECTION xyz]</nobr></code>, simply switches +the current target section to the one given. The user-level form, +<code><nobr>SECTION xyz</nobr></code>, however, first defines the +single-line macro <code><nobr>__SECT__</nobr></code> to be the primitive +<code><nobr>[SECTION]</nobr></code> directive which it is about to issue, +and then issues it. So the user-level directive +<p><pre> + SECTION .text +</pre> +<p>expands to the two lines +<p><pre> +%define __SECT__ [SECTION .text] + [SECTION .text] +</pre> +<p>Users may find it useful to make use of this in their own macros. For +example, the <code><nobr>writefile</nobr></code> macro defined in +<a href="nasmdoc4.html#section-4.3.4">section 4.3.4</a> can be usefully +rewritten in the following more sophisticated form: +<p><pre> +%macro writefile 2+ + + [section .data] + + %%str: db %2 + %%endstr: + + __SECT__ + + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + +%endmacro +</pre> +<p>This form of the macro, once passed a string to output, first switches +temporarily to the data section of the file, using the primitive form of +the <code><nobr>SECTION</nobr></code> directive so as not to modify +<code><nobr>__SECT__</nobr></code>. It then declares its string in the data +section, and then invokes <code><nobr>__SECT__</nobr></code> to switch back +to <em>whichever</em> section the user was previously working in. It thus +avoids the need, in the previous version of the macro, to include a +<code><nobr>JMP</nobr></code> instruction to jump over the data, and also +does not fail if, in a complicated <code><nobr>OBJ</nobr></code> format +module, the user could potentially be assembling the code in any of several +separate code sections. +<h3><a name="section-6.4">6.4 <code><nobr>ABSOLUTE</nobr></code>: Defining Absolute Labels</a></h3> +<p>The <code><nobr>ABSOLUTE</nobr></code> directive can be thought of as an +alternative form of <code><nobr>SECTION</nobr></code>: it causes the +subsequent code to be directed at no physical section, but at the +hypothetical section starting at the given absolute address. The only +instructions you can use in this mode are the +<code><nobr>RESB</nobr></code> family. +<p><code><nobr>ABSOLUTE</nobr></code> is used as follows: +<p><pre> +absolute 0x1A + + kbuf_chr resw 1 + kbuf_free resw 1 + kbuf resw 16 +</pre> +<p>This example describes a section of the PC BIOS data area, at segment +address 0x40: the above code defines <code><nobr>kbuf_chr</nobr></code> to +be 0x1A, <code><nobr>kbuf_free</nobr></code> to be 0x1C, and +<code><nobr>kbuf</nobr></code> to be 0x1E. +<p>The user-level form of <code><nobr>ABSOLUTE</nobr></code>, like that of +<code><nobr>SECTION</nobr></code>, redefines the +<code><nobr>__SECT__</nobr></code> macro when it is invoked. +<p><code><nobr>STRUC</nobr></code> and <code><nobr>ENDSTRUC</nobr></code> +are defined as macros which use <code><nobr>ABSOLUTE</nobr></code> (and +also <code><nobr>__SECT__</nobr></code>). +<p><code><nobr>ABSOLUTE</nobr></code> doesn't have to take an absolute +constant as an argument: it can take an expression (actually, a critical +expression: see <a href="nasmdoc3.html#section-3.8">section 3.8</a>) and it +can be a value in a segment. For example, a TSR can re-use its setup code +as run-time BSS like this: +<p><pre> + org 100h ; it's a .COM program + + jmp setup ; setup code comes last + + ; the resident part of the TSR goes here +setup: + ; now write the code that installs the TSR here + +absolute setup + +runtimevar1 resw 1 +runtimevar2 resd 20 + +tsr_end: +</pre> +<p>This defines some variables `on top of' the setup code, so that after +the setup has finished running, the space it took up can be re-used as data +storage for the running TSR. The symbol `tsr_end' can be used to calculate +the total size of the part of the TSR that needs to be made resident. +<h3><a name="section-6.5">6.5 <code><nobr>EXTERN</nobr></code>: Importing Symbols from Other Modules</a></h3> +<p><code><nobr>EXTERN</nobr></code> is similar to the MASM directive +<code><nobr>EXTRN</nobr></code> and the C keyword +<code><nobr>extern</nobr></code>: it is used to declare a symbol which is +not defined anywhere in the module being assembled, but is assumed to be +defined in some other module and needs to be referred to by this one. Not +every object-file format can support external variables: the +<code><nobr>bin</nobr></code> format cannot. +<p>The <code><nobr>EXTERN</nobr></code> directive takes as many arguments +as you like. Each argument is the name of a symbol: +<p><pre> +extern _printf +extern _sscanf,_fscanf +</pre> +<p>Some object-file formats provide extra features to the +<code><nobr>EXTERN</nobr></code> directive. In all cases, the extra +features are used by suffixing a colon to the symbol name followed by +object-format specific text. For example, the <code><nobr>obj</nobr></code> +format allows you to declare that the default segment base of an external +should be the group <code><nobr>dgroup</nobr></code> by means of the +directive +<p><pre> +extern _variable:wrt dgroup +</pre> +<p>The primitive form of <code><nobr>EXTERN</nobr></code> differs from the +user-level form only in that it can take only one argument at a time: the +support for multiple arguments is implemented at the preprocessor level. +<p>You can declare the same variable as <code><nobr>EXTERN</nobr></code> +more than once: NASM will quietly ignore the second and later +redeclarations. You can't declare a variable as +<code><nobr>EXTERN</nobr></code> as well as something else, though. +<h3><a name="section-6.6">6.6 <code><nobr>GLOBAL</nobr></code>: Exporting Symbols to Other Modules</a></h3> +<p><code><nobr>GLOBAL</nobr></code> is the other end of +<code><nobr>EXTERN</nobr></code>: if one module declares a symbol as +<code><nobr>EXTERN</nobr></code> and refers to it, then in order to prevent +linker errors, some other module must actually <em>define</em> the symbol +and declare it as <code><nobr>GLOBAL</nobr></code>. Some assemblers use the +name <code><nobr>PUBLIC</nobr></code> for this purpose. +<p>The <code><nobr>GLOBAL</nobr></code> directive applying to a symbol must +appear <em>before</em> the definition of the symbol. +<p><code><nobr>GLOBAL</nobr></code> uses the same syntax as +<code><nobr>EXTERN</nobr></code>, except that it must refer to symbols +which <em>are</em> defined in the same module as the +<code><nobr>GLOBAL</nobr></code> directive. For example: +<p><pre> +global _main +_main: + ; some code +</pre> +<p><code><nobr>GLOBAL</nobr></code>, like <code><nobr>EXTERN</nobr></code>, +allows object formats to define private extensions by means of a colon. The +<code><nobr>elf</nobr></code> object format, for example, lets you specify +whether global data items are functions or data: +<p><pre> +global hashlookup:function, hashtable:data +</pre> +<p>Like <code><nobr>EXTERN</nobr></code>, the primitive form of +<code><nobr>GLOBAL</nobr></code> differs from the user-level form only in +that it can take only one argument at a time. +<h3><a name="section-6.7">6.7 <code><nobr>COMMON</nobr></code>: Defining Common Data Areas</a></h3> +<p>The <code><nobr>COMMON</nobr></code> directive is used to declare +<em>common variables</em>. A common variable is much like a global variable +declared in the uninitialized data section, so that +<p><pre> +common intvar 4 +</pre> +<p>is similar in function to +<p><pre> +global intvar +section .bss + +intvar resd 1 +</pre> +<p>The difference is that if more than one module defines the same common +variable, then at link time those variables will be <em>merged</em>, and +references to <code><nobr>intvar</nobr></code> in all modules will point at +the same piece of memory. +<p>Like <code><nobr>GLOBAL</nobr></code> and +<code><nobr>EXTERN</nobr></code>, <code><nobr>COMMON</nobr></code> supports +object-format specific extensions. For example, the +<code><nobr>obj</nobr></code> format allows common variables to be NEAR or +FAR, and the <code><nobr>elf</nobr></code> format allows you to specify the +alignment requirements of a common variable: +<p><pre> +common commvar 4:near ; works in OBJ +common intarray 100:4 ; works in ELF: 4 byte aligned +</pre> +<p>Once again, like <code><nobr>EXTERN</nobr></code> and +<code><nobr>GLOBAL</nobr></code>, the primitive form of +<code><nobr>COMMON</nobr></code> differs from the user-level form only in +that it can take only one argument at a time. +<h3><a name="section-6.8">6.8 <code><nobr>CPU</nobr></code>: Defining CPU Dependencies</a></h3> +<p>The <code><nobr>CPU</nobr></code> directive restricts assembly to those +instructions which are available on the specified CPU. +<p>Options are: +<ul> +<li><code><nobr>CPU 8086</nobr></code> Assemble only 8086 instruction set +<li><code><nobr>CPU 186</nobr></code> Assemble instructions up to the 80186 +instruction set +<li><code><nobr>CPU 286</nobr></code> Assemble instructions up to the 286 +instruction set +<li><code><nobr>CPU 386</nobr></code> Assemble instructions up to the 386 +instruction set +<li><code><nobr>CPU 486</nobr></code> 486 instruction set +<li><code><nobr>CPU 586</nobr></code> Pentium instruction set +<li><code><nobr>CPU PENTIUM</nobr></code> Same as 586 +<li><code><nobr>CPU 686</nobr></code> P6 instruction set +<li><code><nobr>CPU PPRO</nobr></code> Same as 686 +<li><code><nobr>CPU P2</nobr></code> Same as 686 +<li><code><nobr>CPU P3</nobr></code> Pentium III (Katmai) instruction sets +<li><code><nobr>CPU KATMAI</nobr></code> Same as P3 +<li><code><nobr>CPU P4</nobr></code> Pentium 4 (Willamette) instruction set +<li><code><nobr>CPU WILLAMETTE</nobr></code> Same as P4 +<li><code><nobr>CPU PRESCOTT</nobr></code> Prescott instruction set +<li><code><nobr>CPU X64</nobr></code> x86-64 (x64/AMD64/Intel 64) +instruction set +<li><code><nobr>CPU IA64</nobr></code> IA64 CPU (in x86 mode) instruction +set +</ul> +<p>All options are case insensitive. All instructions will be selected only +if they apply to the selected CPU or lower. By default, all instructions +are available. +<h3><a name="section-6.9">6.9 <code><nobr>FLOAT</nobr></code>: Handling of floating-point constants</a></h3> +<p>By default, floating-point constants are rounded to nearest, and IEEE +denormals are supported. The following options can be set to alter this +behaviour: +<ul> +<li><code><nobr>FLOAT DAZ</nobr></code> Flush denormals to zero +<li><code><nobr>FLOAT NODAZ</nobr></code> Do not flush denormals to zero +(default) +<li><code><nobr>FLOAT NEAR</nobr></code> Round to nearest (default) +<li><code><nobr>FLOAT UP</nobr></code> Round up (toward +Infinity) +<li><code><nobr>FLOAT DOWN</nobr></code> Round down (toward -Infinity) +<li><code><nobr>FLOAT ZERO</nobr></code> Round toward zero +<li><code><nobr>FLOAT DEFAULT</nobr></code> Restore default settings +</ul> +<p>The standard macros <code><nobr>__FLOAT_DAZ__</nobr></code>, +<code><nobr>__FLOAT_ROUND__</nobr></code>, and +<code><nobr>__FLOAT__</nobr></code> contain the current state, as long as +the programmer has avoided the use of the brackeded primitive form, +(<code><nobr>[FLOAT]</nobr></code>). +<p><code><nobr>__FLOAT__</nobr></code> contains the full set of +floating-point settings; this value can be saved away and invoked later to +restore the setting. +<p align=center><a href="nasmdoc7.html">Next Chapter</a> | +<a href="nasmdoc5.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc7.html b/doc/html/nasmdoc7.html new file mode 100644 index 0000000..d1339a8 --- /dev/null +++ b/doc/html/nasmdoc7.html @@ -0,0 +1,1267 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc8.html">Next Chapter</a> | +<a href="nasmdoc6.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-7">Chapter 7: Output Formats</a></h2> +<p>NASM is a portable assembler, designed to be able to compile on any ANSI +C-supporting platform and produce output to run on a variety of Intel x86 +operating systems. For this reason, it has a large number of available +output formats, selected using the <code><nobr>-f</nobr></code> option on +the NASM command line. Each of these formats, along with its extensions to +the base NASM syntax, is detailed in this chapter. +<p>As stated in <a href="nasmdoc2.html#section-2.1.1">section 2.1.1</a>, +NASM chooses a default name for your output file based on the input file +name and the chosen output format. This will be generated by removing the +extension (<code><nobr>.asm</nobr></code>, <code><nobr>.s</nobr></code>, or +whatever you like to use) from the input file name, and substituting an +extension defined by the output format. The extensions are given with each +format below. +<h3><a name="section-7.1">7.1 <code><nobr>bin</nobr></code>: Flat-Form Binary Output</a></h3> +<p>The <code><nobr>bin</nobr></code> format does not produce object files: +it generates nothing in the output file except the code you wrote. Such +`pure binary' files are used by MS-DOS: <code><nobr>.COM</nobr></code> +executables and <code><nobr>.SYS</nobr></code> device drivers are pure +binary files. Pure binary output is also useful for operating system and +boot loader development. +<p>The <code><nobr>bin</nobr></code> format supports multiple section +names. For details of how NASM handles sections in the +<code><nobr>bin</nobr></code> format, see <a href="#section-7.1.3">section +7.1.3</a>. +<p>Using the <code><nobr>bin</nobr></code> format puts NASM by default into +16-bit mode (see <a href="nasmdoc6.html#section-6.1">section 6.1</a>). In +order to use <code><nobr>bin</nobr></code> to write 32-bit or 64-bit code, +such as an OS kernel, you need to explicitly issue the +<code><nobr>BITS 32</nobr></code> or <code><nobr>BITS 64</nobr></code> +directive. +<p><code><nobr>bin</nobr></code> has no default output file name extension: +instead, it leaves your file name as it is once the original extension has +been removed. Thus, the default is for NASM to assemble +<code><nobr>binprog.asm</nobr></code> into a binary file called +<code><nobr>binprog</nobr></code>. +<h4><a name="section-7.1.1">7.1.1 <code><nobr>ORG</nobr></code>: Binary File Program Origin</a></h4> +<p>The <code><nobr>bin</nobr></code> format provides an additional +directive to the list given in <a href="nasmdoc6.html">chapter 6</a>: +<code><nobr>ORG</nobr></code>. The function of the +<code><nobr>ORG</nobr></code> directive is to specify the origin address +which NASM will assume the program begins at when it is loaded into memory. +<p>For example, the following code will generate the longword +<code><nobr>0x00000104</nobr></code>: +<p><pre> + org 0x100 + dd label +label: +</pre> +<p>Unlike the <code><nobr>ORG</nobr></code> directive provided by +MASM-compatible assemblers, which allows you to jump around in the object +file and overwrite code you have already generated, NASM's +<code><nobr>ORG</nobr></code> does exactly what the directive says: +<em>origin</em>. Its sole function is to specify one offset which is added +to all internal address references within the section; it does not permit +any of the trickery that MASM's version does. See +<a href="nasmdo12.html#section-12.1.3">section 12.1.3</a> for further +comments. +<h4><a name="section-7.1.2">7.1.2 <code><nobr>bin</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a></h4> +<p>The <code><nobr>bin</nobr></code> output format extends the +<code><nobr>SECTION</nobr></code> (or <code><nobr>SEGMENT</nobr></code>) +directive to allow you to specify the alignment requirements of segments. +This is done by appending the <code><nobr>ALIGN</nobr></code> qualifier to +the end of the section-definition line. For example, +<p><pre> +section .data align=16 +</pre> +<p>switches to the section <code><nobr>.data</nobr></code> and also +specifies that it must be aligned on a 16-byte boundary. +<p>The parameter to <code><nobr>ALIGN</nobr></code> specifies how many low +bits of the section start address must be forced to zero. The alignment +value given may be any power of two. +<h4><a name="section-7.1.3">7.1.3 Multisection Support for the <code><nobr>bin</nobr></code> Format</a></h4> +<p>The <code><nobr>bin</nobr></code> format allows the use of multiple +sections, of arbitrary names, besides the "known" +<code><nobr>.text</nobr></code>, <code><nobr>.data</nobr></code>, and +<code><nobr>.bss</nobr></code> names. +<ul> +<li>Sections may be designated <code><nobr>progbits</nobr></code> or +<code><nobr>nobits</nobr></code>. Default is +<code><nobr>progbits</nobr></code> (except <code><nobr>.bss</nobr></code>, +which defaults to <code><nobr>nobits</nobr></code>, of course). +<li>Sections can be aligned at a specified boundary following the previous +section with <code><nobr>align=</nobr></code>, or at an arbitrary +byte-granular position with <code><nobr>start=</nobr></code>. +<li>Sections can be given a virtual start address, which will be used for +the calculation of all memory references within that section with +<code><nobr>vstart=</nobr></code>. +<li>Sections can be ordered using +<code><nobr>follows=</nobr></code><code><nobr><section></nobr></code> +or +<code><nobr>vfollows=</nobr></code><code><nobr><section></nobr></code> +as an alternative to specifying an explicit start address. +<li>Arguments to <code><nobr>org</nobr></code>, +<code><nobr>start</nobr></code>, <code><nobr>vstart</nobr></code>, and +<code><nobr>align=</nobr></code> are critical expressions. See +<a href="nasmdoc3.html#section-3.8">section 3.8</a>. E.g. +<code><nobr>align=(1 << ALIGN_SHIFT)</nobr></code> - +<code><nobr>ALIGN_SHIFT</nobr></code> must be defined before it is used +here. +<li>Any code which comes before an explicit +<code><nobr>SECTION</nobr></code> directive is directed by default into the +<code><nobr>.text</nobr></code> section. +<li>If an <code><nobr>ORG</nobr></code> statement is not given, +<code><nobr>ORG 0</nobr></code> is used by default. +<li>The <code><nobr>.bss</nobr></code> section will be placed after the +last <code><nobr>progbits</nobr></code> section, unless +<code><nobr>start=</nobr></code>, <code><nobr>vstart=</nobr></code>, +<code><nobr>follows=</nobr></code>, or <code><nobr>vfollows=</nobr></code> +has been specified. +<li>All sections are aligned on dword boundaries, unless a different +alignment has been specified. +<li>Sections may not overlap. +<li>NASM creates the +<code><nobr>section.<secname>.start</nobr></code> for each section, +which may be used in your code. +</ul> +<h4><a name="section-7.1.4">7.1.4 Map Files</a></h4> +<p>Map files can be generated in <code><nobr>-f bin</nobr></code> format by +means of the <code><nobr>[map]</nobr></code> option. Map types of +<code><nobr>all</nobr></code> (default), <code><nobr>brief</nobr></code>, +<code><nobr>sections</nobr></code>, <code><nobr>segments</nobr></code>, or +<code><nobr>symbols</nobr></code> may be specified. Output may be directed +to <code><nobr>stdout</nobr></code> (default), +<code><nobr>stderr</nobr></code>, or a specified file. E.g. +<code><nobr>[map symbols myfile.map]</nobr></code>. No "user form" exists, +the square brackets must be used. +<h3><a name="section-7.2">7.2 <code><nobr>ith</nobr></code>: Intel Hex Output</a></h3> +<p>The <code><nobr>ith</nobr></code> file format produces Intel hex-format +files. Just as the <code><nobr>bin</nobr></code> format, this is a flat +memory image format with no support for relocation or linking. It is +usually used with ROM programmers and similar utilities. +<p>All extensions supported by the <code><nobr>bin</nobr></code> file +format is also supported by the <code><nobr>ith</nobr></code> file format. +<p><code><nobr>ith</nobr></code> provides a default output file-name +extension of <code><nobr>.ith</nobr></code>. +<h3><a name="section-7.3">7.3 <code><nobr>srec</nobr></code>: Motorola S-Records Output</a></h3> +<p>The <code><nobr>srec</nobr></code> file format produces Motorola +S-records files. Just as the <code><nobr>bin</nobr></code> format, this is +a flat memory image format with no support for relocation or linking. It is +usually used with ROM programmers and similar utilities. +<p>All extensions supported by the <code><nobr>bin</nobr></code> file +format is also supported by the <code><nobr>srec</nobr></code> file format. +<p><code><nobr>srec</nobr></code> provides a default output file-name +extension of <code><nobr>.srec</nobr></code>. +<h3><a name="section-7.4">7.4 <code><nobr>obj</nobr></code>: Microsoft OMF Object Files</a></h3> +<p>The <code><nobr>obj</nobr></code> file format (NASM calls it +<code><nobr>obj</nobr></code> rather than <code><nobr>omf</nobr></code> for +historical reasons) is the one produced by MASM and TASM, which is +typically fed to 16-bit DOS linkers to produce +<code><nobr>.EXE</nobr></code> files. It is also the format used by OS/2. +<p><code><nobr>obj</nobr></code> provides a default output file-name +extension of <code><nobr>.obj</nobr></code>. +<p><code><nobr>obj</nobr></code> is not exclusively a 16-bit format, +though: NASM has full support for the 32-bit extensions to the format. In +particular, 32-bit <code><nobr>obj</nobr></code> format files are used by +Borland's Win32 compilers, instead of using Microsoft's newer +<code><nobr>win32</nobr></code> object file format. +<p>The <code><nobr>obj</nobr></code> format does not define any special +segment names: you can call your segments anything you like. Typical names +for segments in <code><nobr>obj</nobr></code> format files are +<code><nobr>CODE</nobr></code>, <code><nobr>DATA</nobr></code> and +<code><nobr>BSS</nobr></code>. +<p>If your source file contains code before specifying an explicit +<code><nobr>SEGMENT</nobr></code> directive, then NASM will invent its own +segment called <code><nobr>__NASMDEFSEG</nobr></code> for you. +<p>When you define a segment in an <code><nobr>obj</nobr></code> file, NASM +defines the segment name as a symbol as well, so that you can access the +segment address of the segment. So, for example: +<p><pre> +segment data + +dvar: dw 1234 + +segment code + +function: + mov ax,data ; get segment address of data + mov ds,ax ; and move it into DS + inc word [dvar] ; now this reference will work + ret +</pre> +<p>The <code><nobr>obj</nobr></code> format also enables the use of the +<code><nobr>SEG</nobr></code> and <code><nobr>WRT</nobr></code> operators, +so that you can write code which does things like +<p><pre> +extern foo + + mov ax,seg foo ; get preferred segment of foo + mov ds,ax + mov ax,data ; a different segment + mov es,ax + mov ax,[ds:foo] ; this accesses `foo' + mov [es:foo wrt data],bx ; so does this +</pre> +<h4><a name="section-7.4.1">7.4.1 <code><nobr>obj</nobr></code> Extensions to the <code><nobr>SEGMENT</nobr></code> Directive</a></h4> +<p>The <code><nobr>obj</nobr></code> output format extends the +<code><nobr>SEGMENT</nobr></code> (or <code><nobr>SECTION</nobr></code>) +directive to allow you to specify various properties of the segment you are +defining. This is done by appending extra qualifiers to the end of the +segment-definition line. For example, +<p><pre> +segment code private align=16 +</pre> +<p>defines the segment <code><nobr>code</nobr></code>, but also declares it +to be a private segment, and requires that the portion of it described in +this code module must be aligned on a 16-byte boundary. +<p>The available qualifiers are: +<ul> +<li><code><nobr>PRIVATE</nobr></code>, <code><nobr>PUBLIC</nobr></code>, +<code><nobr>COMMON</nobr></code> and <code><nobr>STACK</nobr></code> +specify the combination characteristics of the segment. +<code><nobr>PRIVATE</nobr></code> segments do not get combined with any +others by the linker; <code><nobr>PUBLIC</nobr></code> and +<code><nobr>STACK</nobr></code> segments get concatenated together at link +time; and <code><nobr>COMMON</nobr></code> segments all get overlaid on top +of each other rather than stuck end-to-end. +<li><code><nobr>ALIGN</nobr></code> is used, as shown above, to specify how +many low bits of the segment start address must be forced to zero. The +alignment value given may be any power of two from 1 to 4096; in reality, +the only values supported are 1, 2, 4, 16, 256 and 4096, so if 8 is +specified it will be rounded up to 16, and 32, 64 and 128 will all be +rounded up to 256, and so on. Note that alignment to 4096-byte boundaries +is a PharLap extension to the format and may not be supported by all +linkers. +<li><code><nobr>CLASS</nobr></code> can be used to specify the segment +class; this feature indicates to the linker that segments of the same class +should be placed near each other in the output file. The class name can be +any word, e.g. <code><nobr>CLASS=CODE</nobr></code>. +<li><code><nobr>OVERLAY</nobr></code>, like +<code><nobr>CLASS</nobr></code>, is specified with an arbitrary word as an +argument, and provides overlay information to an overlay-capable linker. +<li>Segments can be declared as <code><nobr>USE16</nobr></code> or +<code><nobr>USE32</nobr></code>, which has the effect of recording the +choice in the object file and also ensuring that NASM's default assembly +mode when assembling in that segment is 16-bit or 32-bit respectively. +<li>When writing OS/2 object files, you should declare 32-bit segments as +<code><nobr>FLAT</nobr></code>, which causes the default segment base for +anything in the segment to be the special group +<code><nobr>FLAT</nobr></code>, and also defines the group if it is not +already defined. +<li>The <code><nobr>obj</nobr></code> file format also allows segments to +be declared as having a pre-defined absolute segment address, although no +linkers are currently known to make sensible use of this feature; +nevertheless, NASM allows you to declare a segment such as +<code><nobr>SEGMENT SCREEN ABSOLUTE=0xB800</nobr></code> if you need to. +The <code><nobr>ABSOLUTE</nobr></code> and <code><nobr>ALIGN</nobr></code> +keywords are mutually exclusive. +</ul> +<p>NASM's default segment attributes are <code><nobr>PUBLIC</nobr></code>, +<code><nobr>ALIGN=1</nobr></code>, no class, no overlay, and +<code><nobr>USE16</nobr></code>. +<h4><a name="section-7.4.2">7.4.2 <code><nobr>GROUP</nobr></code>: Defining Groups of Segments</a></h4> +<p>The <code><nobr>obj</nobr></code> format also allows segments to be +grouped, so that a single segment register can be used to refer to all the +segments in a group. NASM therefore supplies the +<code><nobr>GROUP</nobr></code> directive, whereby you can code +<p><pre> +segment data + + ; some data + +segment bss + + ; some uninitialized data + +group dgroup data bss +</pre> +<p>which will define a group called <code><nobr>dgroup</nobr></code> to +contain the segments <code><nobr>data</nobr></code> and +<code><nobr>bss</nobr></code>. Like <code><nobr>SEGMENT</nobr></code>, +<code><nobr>GROUP</nobr></code> causes the group name to be defined as a +symbol, so that you can refer to a variable <code><nobr>var</nobr></code> +in the <code><nobr>data</nobr></code> segment as +<code><nobr>var wrt data</nobr></code> or as +<code><nobr>var wrt dgroup</nobr></code>, depending on which segment value +is currently in your segment register. +<p>If you just refer to <code><nobr>var</nobr></code>, however, and +<code><nobr>var</nobr></code> is declared in a segment which is part of a +group, then NASM will default to giving you the offset of +<code><nobr>var</nobr></code> from the beginning of the <em>group</em>, not +the <em>segment</em>. Therefore <code><nobr>SEG var</nobr></code>, also, +will return the group base rather than the segment base. +<p>NASM will allow a segment to be part of more than one group, but will +generate a warning if you do this. Variables declared in a segment which is +part of more than one group will default to being relative to the first +group that was defined to contain the segment. +<p>A group does not have to contain any segments; you can still make +<code><nobr>WRT</nobr></code> references to a group which does not contain +the variable you are referring to. OS/2, for example, defines the special +group <code><nobr>FLAT</nobr></code> with no segments in it. +<h4><a name="section-7.4.3">7.4.3 <code><nobr>UPPERCASE</nobr></code>: Disabling Case Sensitivity in Output</a></h4> +<p>Although NASM itself is case sensitive, some OMF linkers are not; +therefore it can be useful for NASM to output single-case object files. The +<code><nobr>UPPERCASE</nobr></code> format-specific directive causes all +segment, group and symbol names that are written to the object file to be +forced to upper case just before being written. Within a source file, NASM +is still case-sensitive; but the object file can be written entirely in +upper case if desired. +<p><code><nobr>UPPERCASE</nobr></code> is used alone on a line; it requires +no parameters. +<h4><a name="section-7.4.4">7.4.4 <code><nobr>IMPORT</nobr></code>: Importing DLL Symbols</a></h4> +<p>The <code><nobr>IMPORT</nobr></code> format-specific directive defines a +symbol to be imported from a DLL, for use if you are writing a DLL's import +library in NASM. You still need to declare the symbol as +<code><nobr>EXTERN</nobr></code> as well as using the +<code><nobr>IMPORT</nobr></code> directive. +<p>The <code><nobr>IMPORT</nobr></code> directive takes two required +parameters, separated by white space, which are (respectively) the name of +the symbol you wish to import and the name of the library you wish to +import it from. For example: +<p><pre> + import WSAStartup wsock32.dll +</pre> +<p>A third optional parameter gives the name by which the symbol is known +in the library you are importing it from, in case this is not the same as +the name you wish the symbol to be known by to your code once you have +imported it. For example: +<p><pre> + import asyncsel wsock32.dll WSAAsyncSelect +</pre> +<h4><a name="section-7.4.5">7.4.5 <code><nobr>EXPORT</nobr></code>: Exporting DLL Symbols</a></h4> +<p>The <code><nobr>EXPORT</nobr></code> format-specific directive defines a +global symbol to be exported as a DLL symbol, for use if you are writing a +DLL in NASM. You still need to declare the symbol as +<code><nobr>GLOBAL</nobr></code> as well as using the +<code><nobr>EXPORT</nobr></code> directive. +<p><code><nobr>EXPORT</nobr></code> takes one required parameter, which is +the name of the symbol you wish to export, as it was defined in your source +file. An optional second parameter (separated by white space from the +first) gives the <em>external</em> name of the symbol: the name by which +you wish the symbol to be known to programs using the DLL. If this name is +the same as the internal name, you may leave the second parameter off. +<p>Further parameters can be given to define attributes of the exported +symbol. These parameters, like the second, are separated by white space. If +further parameters are given, the external name must also be specified, +even if it is the same as the internal name. The available attributes are: +<ul> +<li><code><nobr>resident</nobr></code> indicates that the exported name is +to be kept resident by the system loader. This is an optimisation for +frequently used symbols imported by name. +<li><code><nobr>nodata</nobr></code> indicates that the exported symbol is +a function which does not make use of any initialized data. +<li><code><nobr>parm=NNN</nobr></code>, where <code><nobr>NNN</nobr></code> +is an integer, sets the number of parameter words for the case in which the +symbol is a call gate between 32-bit and 16-bit segments. +<li>An attribute which is just a number indicates that the symbol should be +exported with an identifying number (ordinal), and gives the desired +number. +</ul> +<p>For example: +<p><pre> + export myfunc + export myfunc TheRealMoreFormalLookingFunctionName + export myfunc myfunc 1234 ; export by ordinal + export myfunc myfunc resident parm=23 nodata +</pre> +<h4><a name="section-7.4.6">7.4.6 <code><nobr>..start</nobr></code>: Defining the Program Entry Point</a></h4> +<p><code><nobr>OMF</nobr></code> linkers require exactly one of the object +files being linked to define the program entry point, where execution will +begin when the program is run. If the object file that defines the entry +point is assembled using NASM, you specify the entry point by declaring the +special symbol <code><nobr>..start</nobr></code> at the point where you +wish execution to begin. +<h4><a name="section-7.4.7">7.4.7 <code><nobr>obj</nobr></code> Extensions to the <code><nobr>EXTERN</nobr></code> Directive</a></h4> +<p>If you declare an external symbol with the directive +<p><pre> + extern foo +</pre> +<p>then references such as <code><nobr>mov ax,foo</nobr></code> will give +you the offset of <code><nobr>foo</nobr></code> from its preferred segment +base (as specified in whichever module <code><nobr>foo</nobr></code> is +actually defined in). So to access the contents of +<code><nobr>foo</nobr></code> you will usually need to do something like +<p><pre> + mov ax,seg foo ; get preferred segment base + mov es,ax ; move it into ES + mov ax,[es:foo] ; and use offset `foo' from it +</pre> +<p>This is a little unwieldy, particularly if you know that an external is +going to be accessible from a given segment or group, say +<code><nobr>dgroup</nobr></code>. So if <code><nobr>DS</nobr></code> +already contained <code><nobr>dgroup</nobr></code>, you could simply code +<p><pre> + mov ax,[foo wrt dgroup] +</pre> +<p>However, having to type this every time you want to access +<code><nobr>foo</nobr></code> can be a pain; so NASM allows you to declare +<code><nobr>foo</nobr></code> in the alternative form +<p><pre> + extern foo:wrt dgroup +</pre> +<p>This form causes NASM to pretend that the preferred segment base of +<code><nobr>foo</nobr></code> is in fact <code><nobr>dgroup</nobr></code>; +so the expression <code><nobr>seg foo</nobr></code> will now return +<code><nobr>dgroup</nobr></code>, and the expression +<code><nobr>foo</nobr></code> is equivalent to +<code><nobr>foo wrt dgroup</nobr></code>. +<p>This default-<code><nobr>WRT</nobr></code> mechanism can be used to make +externals appear to be relative to any group or segment in your program. It +can also be applied to common variables: see +<a href="#section-7.4.8">section 7.4.8</a>. +<h4><a name="section-7.4.8">7.4.8 <code><nobr>obj</nobr></code> Extensions to the <code><nobr>COMMON</nobr></code> Directive</a></h4> +<p>The <code><nobr>obj</nobr></code> format allows common variables to be +either near or far; NASM allows you to specify which your variables should +be by the use of the syntax +<p><pre> +common nearvar 2:near ; `nearvar' is a near common +common farvar 10:far ; and `farvar' is far +</pre> +<p>Far common variables may be greater in size than 64Kb, and so the OMF +specification says that they are declared as a number of <em>elements</em> +of a given size. So a 10-byte far common variable could be declared as ten +one-byte elements, five two-byte elements, two five-byte elements or one +ten-byte element. +<p>Some <code><nobr>OMF</nobr></code> linkers require the element size, as +well as the variable size, to match when resolving common variables +declared in more than one module. Therefore NASM must allow you to specify +the element size on your far common variables. This is done by the +following syntax: +<p><pre> +common c_5by2 10:far 5 ; two five-byte elements +common c_2by5 10:far 2 ; five two-byte elements +</pre> +<p>If no element size is specified, the default is 1. Also, the +<code><nobr>FAR</nobr></code> keyword is not required when an element size +is specified, since only far commons may have element sizes at all. So the +above declarations could equivalently be +<p><pre> +common c_5by2 10:5 ; two five-byte elements +common c_2by5 10:2 ; five two-byte elements +</pre> +<p>In addition to these extensions, the <code><nobr>COMMON</nobr></code> +directive in <code><nobr>obj</nobr></code> also supports +default-<code><nobr>WRT</nobr></code> specification like +<code><nobr>EXTERN</nobr></code> does (explained in +<a href="#section-7.4.7">section 7.4.7</a>). So you can also declare things +like +<p><pre> +common foo 10:wrt dgroup +common bar 16:far 2:wrt data +common baz 24:wrt data:6 +</pre> +<h3><a name="section-7.5">7.5 <code><nobr>win32</nobr></code>: Microsoft Win32 Object Files</a></h3> +<p>The <code><nobr>win32</nobr></code> output format generates Microsoft +Win32 object files, suitable for passing to Microsoft linkers such as +Visual C++. Note that Borland Win32 compilers do not use this format, but +use <code><nobr>obj</nobr></code> instead (see +<a href="#section-7.4">section 7.4</a>). +<p><code><nobr>win32</nobr></code> provides a default output file-name +extension of <code><nobr>.obj</nobr></code>. +<p>Note that although Microsoft say that Win32 object files follow the +<code><nobr>COFF</nobr></code> (Common Object File Format) standard, the +object files produced by Microsoft Win32 compilers are not compatible with +COFF linkers such as DJGPP's, and vice versa. This is due to a difference +of opinion over the precise semantics of PC-relative relocations. To +produce COFF files suitable for DJGPP, use NASM's +<code><nobr>coff</nobr></code> output format; conversely, the +<code><nobr>coff</nobr></code> format does not produce object files that +Win32 linkers can generate correct output from. +<h4><a name="section-7.5.1">7.5.1 <code><nobr>win32</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a></h4> +<p>Like the <code><nobr>obj</nobr></code> format, +<code><nobr>win32</nobr></code> allows you to specify additional +information on the <code><nobr>SECTION</nobr></code> directive line, to +control the type and properties of sections you declare. Section types and +properties are generated automatically by NASM for the standard section +names <code><nobr>.text</nobr></code>, <code><nobr>.data</nobr></code> and +<code><nobr>.bss</nobr></code>, but may still be overridden by these +qualifiers. +<p>The available qualifiers are: +<ul> +<li><code><nobr>code</nobr></code>, or equivalently +<code><nobr>text</nobr></code>, defines the section to be a code section. +This marks the section as readable and executable, but not writable, and +also indicates to the linker that the type of the section is code. +<li><code><nobr>data</nobr></code> and <code><nobr>bss</nobr></code> define +the section to be a data section, analogously to +<code><nobr>code</nobr></code>. Data sections are marked as readable and +writable, but not executable. <code><nobr>data</nobr></code> declares an +initialized data section, whereas <code><nobr>bss</nobr></code> declares an +uninitialized data section. +<li><code><nobr>rdata</nobr></code> declares an initialized data section +that is readable but not writable. Microsoft compilers use this section to +place constants in it. +<li><code><nobr>info</nobr></code> defines the section to be an +informational section, which is not included in the executable file by the +linker, but may (for example) pass information <em>to</em> the linker. For +example, declaring an <code><nobr>info</nobr></code>-type section called +<code><nobr>.drectve</nobr></code> causes the linker to interpret the +contents of the section as command-line options. +<li><code><nobr>align=</nobr></code>, used with a trailing number as in +<code><nobr>obj</nobr></code>, gives the alignment requirements of the +section. The maximum you may specify is 64: the Win32 object file format +contains no means to request a greater section alignment than this. If +alignment is not explicitly specified, the defaults are 16-byte alignment +for code sections, 8-byte alignment for rdata sections and 4-byte alignment +for data (and BSS) sections. Informational sections get a default alignment +of 1 byte (no alignment), though the value does not matter. +</ul> +<p>The defaults assumed by NASM if you do not specify the above qualifiers +are: +<p><pre> +section .text code align=16 +section .data data align=4 +section .rdata rdata align=8 +section .bss bss align=4 +</pre> +<p>Any other section name is treated by default like +<code><nobr>.text</nobr></code>. +<h4><a name="section-7.5.2">7.5.2 <code><nobr>win32</nobr></code>: Safe Structured Exception Handling</a></h4> +<p>Among other improvements in Windows XP SP2 and Windows Server 2003 +Microsoft has introduced concept of "safe structured exception handling." +General idea is to collect handlers' entry points in designated read-only +table and have alleged entry point verified against this table prior +exception control is passed to the handler. In order for an executable +module to be equipped with such "safe exception handler table," all object +modules on linker command line has to comply with certain criteria. If one +single module among them does not, then the table in question is omitted +and above mentioned run-time checks will not be performed for application +in question. Table omission is by default silent and therefore can be +easily overlooked. One can instruct linker to refuse to produce binary +without such table by passing <code><nobr>/safeseh</nobr></code> command +line option. +<p>Without regard to this run-time check merits it's natural to expect NASM +to be capable of generating modules suitable for +<code><nobr>/safeseh</nobr></code> linking. From developer's viewpoint the +problem is two-fold: +<ul> +<li>how to adapt modules not deploying exception handlers of their own; +<li>how to adapt/develop modules utilizing custom exception handling; +</ul> +<p>Former can be easily achieved with any NASM version by adding following +line to source code: +<p><pre> +$@feat.00 equ 1 +</pre> +<p>As of version 2.03 NASM adds this absolute symbol automatically. If it's +not already present to be precise. I.e. if for whatever reason developer +would choose to assign another value in source file, it would still be +perfectly possible. +<p>Registering custom exception handler on the other hand requires certain +"magic." As of version 2.03 additional directive is implemented, +<code><nobr>safeseh</nobr></code>, which instructs the assembler to produce +appropriately formatted input data for above mentioned "safe exception +handler table." Its typical use would be: +<p><pre> +section .text +extern _MessageBoxA@16 +%if __NASM_VERSION_ID__ >= 0x02030000 +safeseh handler ; register handler as "safe handler" +%endif +handler: + push DWORD 1 ; MB_OKCANCEL + push DWORD caption + push DWORD text + push DWORD 0 + call _MessageBoxA@16 + sub eax,1 ; incidentally suits as return value + ; for exception handler + ret +global _main +_main: + push DWORD handler + push DWORD [fs:0] + mov DWORD [fs:0],esp ; engage exception handler + xor eax,eax + mov eax,DWORD[eax] ; cause exception + pop DWORD [fs:0] ; disengage exception handler + add esp,4 + ret +text: db 'OK to rethrow, CANCEL to generate core dump',0 +caption:db 'SEGV',0 + +section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' +</pre> +<p>As you might imagine, it's perfectly possible to produce .exe binary +with "safe exception handler table" and yet engage unregistered exception +handler. Indeed, handler is engaged by simply manipulating +<code><nobr>[fs:0]</nobr></code> location at run-time, something linker has +no power over, run-time that is. It should be explicitly mentioned that +such failure to register handler's entry point with +<code><nobr>safeseh</nobr></code> directive has undesired side effect at +run-time. If exception is raised and unregistered handler is to be +executed, the application is abruptly terminated without any notification +whatsoever. One can argue that system could at least have logged some kind +"non-safe exception handler in x.exe at address n" message in event log, +but no, literally no notification is provided and user is left with no clue +on what caused application failure. +<p>Finally, all mentions of linker in this paragraph refer to Microsoft +linker version 7.x and later. Presence of +<code><nobr>@feat.00</nobr></code> symbol and input data for "safe +exception handler table" causes no backward incompatibilities and "safeseh" +modules generated by NASM 2.03 and later can still be linked by earlier +versions or non-Microsoft linkers. +<h3><a name="section-7.6">7.6 <code><nobr>win64</nobr></code>: Microsoft Win64 Object Files</a></h3> +<p>The <code><nobr>win64</nobr></code> output format generates Microsoft +Win64 object files, which is nearly 100% identical to the +<code><nobr>win32</nobr></code> object format +(<a href="#section-7.5">section 7.5</a>) with the exception that it is +meant to target 64-bit code and the x86-64 platform altogether. This object +file is used exactly the same as the <code><nobr>win32</nobr></code> object +format (<a href="#section-7.5">section 7.5</a>), in NASM, with regard to +this exception. +<h4><a name="section-7.6.1">7.6.1 <code><nobr>win64</nobr></code>: Writing Position-Independent Code</a></h4> +<p>While <code><nobr>REL</nobr></code> takes good care of RIP-relative +addressing, there is one aspect that is easy to overlook for a Win64 +programmer: indirect references. Consider a switch dispatch table: +<p><pre> + jmp QWORD[dsptch+rax*8] + ... +dsptch: dq case0 + dq case1 + ... +</pre> +<p>Even novice Win64 assembler programmer will soon realize that the code +is not 64-bit savvy. Most notably linker will refuse to link it with +"<code><nobr>'ADDR32' relocation to '.text' invalid without /LARGEADDRESSAWARE:NO</nobr></code>". +So [s]he will have to split jmp instruction as following: +<p><pre> + lea rbx,[rel dsptch] + jmp QWORD[rbx+rax*8] +</pre> +<p>What happens behind the scene is that effective address in +<code><nobr>lea</nobr></code> is encoded relative to instruction pointer, +or in perfectly position-independent manner. But this is only part of the +problem! Trouble is that in .dll context <code><nobr>caseN</nobr></code> +relocations will make their way to the final module and might have to be +adjusted at .dll load time. To be specific when it can't be loaded at +preferred address. And when this occurs, pages with such relocations will +be rendered private to current process, which kind of undermines the idea +of sharing .dll. But no worry, it's trivial to fix: +<p><pre> + lea rbx,[rel dsptch] + add rbx,QWORD[rbx+rax*8] + jmp rbx + ... +dsptch: dq case0-dsptch + dq case1-dsptch + ... +</pre> +<p>NASM version 2.03 and later provides another alternative, +<code><nobr>wrt ..imagebase</nobr></code> operator, which returns offset +from base address of the current image, be it .exe or .dll module, +therefore the name. For those acquainted with PE-COFF format base address +denotes start of <code><nobr>IMAGE_DOS_HEADER</nobr></code> structure. Here +is how to implement switch with these image-relative references: +<p><pre> + lea rbx,[rel dsptch] + mov eax,DWORD[rbx+rax*4] + sub rbx,dsptch wrt ..imagebase + add rbx,rax + jmp rbx + ... +dsptch: dd case0 wrt ..imagebase + dd case1 wrt ..imagebase +</pre> +<p>One can argue that the operator is redundant. Indeed, snippet before +last works just fine with any NASM version and is not even Windows +specific... The real reason for implementing +<code><nobr>wrt ..imagebase</nobr></code> will become apparent in next +paragraph. +<p>It should be noted that <code><nobr>wrt ..imagebase</nobr></code> is +defined as 32-bit operand only: +<p><pre> + dd label wrt ..imagebase ; ok + dq label wrt ..imagebase ; bad + mov eax,label wrt ..imagebase ; ok + mov rax,label wrt ..imagebase ; bad +</pre> +<h4><a name="section-7.6.2">7.6.2 <code><nobr>win64</nobr></code>: Structured Exception Handling</a></h4> +<p>Structured exception handing in Win64 is completely different matter +from Win32. Upon exception program counter value is noted, and +linker-generated table comprising start and end addresses of all the +functions [in given executable module] is traversed and compared to the +saved program counter. Thus so called <code><nobr>UNWIND_INFO</nobr></code> +structure is identified. If it's not found, then offending subroutine is +assumed to be "leaf" and just mentioned lookup procedure is attempted for +its caller. In Win64 leaf function is such function that does not call any +other function <em>nor</em> modifies any Win64 non-volatile registers, +including stack pointer. The latter ensures that it's possible to identify +leaf function's caller by simply pulling the value from the top of the +stack. +<p>While majority of subroutines written in assembler are not calling any +other function, requirement for non-volatile registers' immutability leaves +developer with not more than 7 registers and no stack frame, which is not +necessarily what [s]he counted with. Customarily one would meet the +requirement by saving non-volatile registers on stack and restoring them +upon return, so what can go wrong? If [and only if] an exception is raised +at run-time and no <code><nobr>UNWIND_INFO</nobr></code> structure is +associated with such "leaf" function, the stack unwind procedure will +expect to find caller's return address on the top of stack immediately +followed by its frame. Given that developer pushed caller's non-volatile +registers on stack, would the value on top point at some code segment or +even addressable space? Well, developer can attempt copying caller's return +address to the top of stack and this would actually work in some very +specific circumstances. But unless developer can guarantee that these +circumstances are always met, it's more appropriate to assume worst case +scenario, i.e. stack unwind procedure going berserk. Relevant question is +what happens then? Application is abruptly terminated without any +notification whatsoever. Just like in Win32 case, one can argue that system +could at least have logged "unwind procedure went berserk in x.exe at +address n" in event log, but no, no trace of failure is left. +<p>Now, when we understand significance of the +<code><nobr>UNWIND_INFO</nobr></code> structure, let's discuss what's in it +and/or how it's processed. First of all it is checked for presence of +reference to custom language-specific exception handler. If there is one, +then it's invoked. Depending on the return value, execution flow is resumed +(exception is said to be "handled"), <em>or</em> rest of +<code><nobr>UNWIND_INFO</nobr></code> structure is processed as following. +Beside optional reference to custom handler, it carries information about +current callee's stack frame and where non-volatile registers are saved. +Information is detailed enough to be able to reconstruct contents of +caller's non-volatile registers upon call to current callee. And so +caller's context is reconstructed, and then unwind procedure is repeated, +i.e. another <code><nobr>UNWIND_INFO</nobr></code> structure is associated, +this time, with caller's instruction pointer, which is then checked for +presence of reference to language-specific handler, etc. The procedure is +recursively repeated till exception is handled. As last resort system +"handles" it by generating memory core dump and terminating the +application. +<p>As for the moment of this writing NASM unfortunately does not facilitate +generation of above mentioned detailed information about stack frame +layout. But as of version 2.03 it implements building blocks for generating +structures involved in stack unwinding. As simplest example, here is how to +deploy custom exception handler for leaf function: +<p><pre> +default rel +section .text +extern MessageBoxA +handler: + sub rsp,40 + mov rcx,0 + lea rdx,[text] + lea r8,[caption] + mov r9,1 ; MB_OKCANCEL + call MessageBoxA + sub eax,1 ; incidentally suits as return value + ; for exception handler + add rsp,40 + ret +global main +main: + xor rax,rax + mov rax,QWORD[rax] ; cause exception + ret +main_end: +text: db 'OK to rethrow, CANCEL to generate core dump',0 +caption:db 'SEGV',0 + +section .pdata rdata align=4 + dd main wrt ..imagebase + dd main_end wrt ..imagebase + dd xmain wrt ..imagebase +section .xdata rdata align=8 +xmain: db 9,0,0,0 + dd handler wrt ..imagebase +section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' +</pre> +<p>What you see in <code><nobr>.pdata</nobr></code> section is element of +the "table comprising start and end addresses of function" along with +reference to associated <code><nobr>UNWIND_INFO</nobr></code> structure. +And what you see in <code><nobr>.xdata</nobr></code> section is +<code><nobr>UNWIND_INFO</nobr></code> structure describing function with no +frame, but with designated exception handler. References are +<em>required</em> to be image-relative (which is the real reason for +implementing <code><nobr>wrt ..imagebase</nobr></code> operator). It should +be noted that <code><nobr>rdata align=n</nobr></code>, as well as +<code><nobr>wrt ..imagebase</nobr></code>, are optional in these two +segments' contexts, i.e. can be omitted. Latter means that <em>all</em> +32-bit references, not only above listed required ones, placed into these +two segments turn out image-relative. Why is it important to understand? +Developer is allowed to append handler-specific data to +<code><nobr>UNWIND_INFO</nobr></code> structure, and if [s]he adds a 32-bit +reference, then [s]he will have to remember to adjust its value to obtain +the real pointer. +<p>As already mentioned, in Win64 terms leaf function is one that does not +call any other function <em>nor</em> modifies any non-volatile register, +including stack pointer. But it's not uncommon that assembler programmer +plans to utilize every single register and sometimes even have variable +stack frame. Is there anything one can do with bare building blocks? I.e. +besides manually composing fully-fledged +<code><nobr>UNWIND_INFO</nobr></code> structure, which would surely be +considered error-prone? Yes, there is. Recall that exception handler is +called first, before stack layout is analyzed. As it turned out, it's +perfectly possible to manipulate current callee's context in custom handler +in manner that permits further stack unwinding. General idea is that +handler would not actually "handle" the exception, but instead restore +callee's context, as it was at its entry point and thus mimic leaf +function. In other words, handler would simply undertake part of unwinding +procedure. Consider following example: +<p><pre> +function: + mov rax,rsp ; copy rsp to volatile register + push r15 ; save non-volatile registers + push rbx + push rbp + mov r11,rsp ; prepare variable stack frame + sub r11,rcx + and r11,-64 + mov QWORD[r11],rax ; check for exceptions + mov rsp,r11 ; allocate stack frame + mov QWORD[rsp],rax ; save original rsp value +magic_point: + ... + mov r11,QWORD[rsp] ; pull original rsp value + mov rbp,QWORD[r11-24] + mov rbx,QWORD[r11-16] + mov r15,QWORD[r11-8] + mov rsp,r11 ; destroy frame + ret +</pre> +<p>The keyword is that up to <code><nobr>magic_point</nobr></code> original +<code><nobr>rsp</nobr></code> value remains in chosen volatile register and +no non-volatile register, except for <code><nobr>rsp</nobr></code>, is +modified. While past <code><nobr>magic_point</nobr></code> +<code><nobr>rsp</nobr></code> remains constant till the very end of the +<code><nobr>function</nobr></code>. In this case custom language-specific +exception handler would look like this: +<p><pre> +EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, + CONTEXT *context,DISPATCHER_CONTEXT *disp) +{ ULONG64 *rsp; + if (context->Rip<(ULONG64)magic_point) + rsp = (ULONG64 *)context->Rax; + else + { rsp = ((ULONG64 **)context->Rsp)[0]; + context->Rbp = rsp[-3]; + context->Rbx = rsp[-2]; + context->R15 = rsp[-1]; + } + context->Rsp = (ULONG64)rsp; + + memcpy (disp->ContextRecord,context,sizeof(CONTEXT)); + RtlVirtualUnwind(UNW_FLAG_NHANDLER,disp->ImageBase, + dips->ControlPc,disp->FunctionEntry,disp->ContextRecord, + &disp->HandlerData,&disp->EstablisherFrame,NULL); + return ExceptionContinueSearch; +} +</pre> +<p>As custom handler mimics leaf function, corresponding +<code><nobr>UNWIND_INFO</nobr></code> structure does not have to contain +any information about stack frame and its layout. +<h3><a name="section-7.7">7.7 <code><nobr>coff</nobr></code>: Common Object File Format</a></h3> +<p>The <code><nobr>coff</nobr></code> output type produces +<code><nobr>COFF</nobr></code> object files suitable for linking with the +DJGPP linker. +<p><code><nobr>coff</nobr></code> provides a default output file-name +extension of <code><nobr>.o</nobr></code>. +<p>The <code><nobr>coff</nobr></code> format supports the same extensions +to the <code><nobr>SECTION</nobr></code> directive as +<code><nobr>win32</nobr></code> does, except that the +<code><nobr>align</nobr></code> qualifier and the +<code><nobr>info</nobr></code> section type are not supported. +<h3><a name="section-7.8">7.8 <code><nobr>macho32</nobr></code> and <code><nobr>macho64</nobr></code>: Mach Object File Format</a></h3> +<p>The <code><nobr>macho32</nobr></code> and +<code><nobr>macho64</nobr></code> output formts produces +<code><nobr>Mach-O</nobr></code> object files suitable for linking with the +MacOS X linker. <code><nobr>macho</nobr></code> is a synonym for +<code><nobr>macho32</nobr></code>. +<p><code><nobr>macho</nobr></code> provides a default output file-name +extension of <code><nobr>.o</nobr></code>. +<h3><a name="section-7.9">7.9 <code><nobr>elf32</nobr></code> and <code><nobr>elf64</nobr></code>: Executable and Linkable Format Object Files</a></h3> +<p>The <code><nobr>elf32</nobr></code> and <code><nobr>elf64</nobr></code> +output formats generate <code><nobr>ELF32 and ELF64</nobr></code> +(Executable and Linkable Format) object files, as used by Linux as well as +Unix System V, including Solaris x86, UnixWare and SCO Unix. +<code><nobr>elf</nobr></code> provides a default output file-name extension +of <code><nobr>.o</nobr></code>. <code><nobr>elf</nobr></code> is a synonym +for <code><nobr>elf32</nobr></code>. +<h4><a name="section-7.9.1">7.9.1 ELF specific directive <code><nobr>osabi</nobr></code></a></h4> +<p>The ELF header specifies the application binary interface for the target +operating system (OSABI). This field can be set by using the +<code><nobr>osabi</nobr></code> directive with the numeric value (0-255) of +the target system. If this directive is not used, the default value will be +"UNIX System V ABI" (0) which will work on most systems which support ELF. +<h4><a name="section-7.9.2">7.9.2 <code><nobr>elf</nobr></code> Extensions to the <code><nobr>SECTION</nobr></code> Directive</a></h4> +<p>Like the <code><nobr>obj</nobr></code> format, +<code><nobr>elf</nobr></code> allows you to specify additional information +on the <code><nobr>SECTION</nobr></code> directive line, to control the +type and properties of sections you declare. Section types and properties +are generated automatically by NASM for the standard section names, but may +still be overridden by these qualifiers. +<p>The available qualifiers are: +<ul> +<li><code><nobr>alloc</nobr></code> defines the section to be one which is +loaded into memory when the program is run. +<code><nobr>noalloc</nobr></code> defines it to be one which is not, such +as an informational or comment section. +<li><code><nobr>exec</nobr></code> defines the section to be one which +should have execute permission when the program is run. +<code><nobr>noexec</nobr></code> defines it as one which should not. +<li><code><nobr>write</nobr></code> defines the section to be one which +should be writable when the program is run. +<code><nobr>nowrite</nobr></code> defines it as one which should not. +<li><code><nobr>progbits</nobr></code> defines the section to be one with +explicit contents stored in the object file: an ordinary code or data +section, for example, <code><nobr>nobits</nobr></code> defines the section +to be one with no explicit contents given, such as a BSS section. +<li><code><nobr>align=</nobr></code>, used with a trailing number as in +<code><nobr>obj</nobr></code>, gives the alignment requirements of the +section. +<li><code><nobr>tls</nobr></code> defines the section to be one which +contains thread local variables. +</ul> +<p>The defaults assumed by NASM if you do not specify the above qualifiers +are: +<p> +<p><pre> +section .text progbits alloc exec nowrite align=16 +section .rodata progbits alloc noexec nowrite align=4 +section .lrodata progbits alloc noexec nowrite align=4 +section .data progbits alloc noexec write align=4 +section .ldata progbits alloc noexec write align=4 +section .bss nobits alloc noexec write align=4 +section .lbss nobits alloc noexec write align=4 +section .tdata progbits alloc noexec write align=4 tls +section .tbss nobits alloc noexec write align=4 tls +section .comment progbits noalloc noexec nowrite align=1 +section other progbits alloc noexec nowrite align=1 +</pre> +<p>(Any section name other than those in the above table is treated by +default like <code><nobr>other</nobr></code> in the above table. Please +note that section names are case sensitive.) +<h4><a name="section-7.9.3">7.9.3 Position-Independent Code: <code><nobr>elf</nobr></code> Special Symbols and <code><nobr>WRT</nobr></code></a></h4> +<p>The <code><nobr>ELF</nobr></code> specification contains enough features +to allow position-independent code (PIC) to be written, which makes ELF +shared libraries very flexible. However, it also means NASM has to be able +to generate a variety of ELF specific relocation types in ELF object files, +if it is to be an assembler which can write PIC. +<p>Since <code><nobr>ELF</nobr></code> does not support segment-base +references, the <code><nobr>WRT</nobr></code> operator is not used for its +normal purpose; therefore NASM's <code><nobr>elf</nobr></code> output +format makes use of <code><nobr>WRT</nobr></code> for a different purpose, +namely the PIC-specific relocation types. +<p><code><nobr>elf</nobr></code> defines five special symbols which you can +use as the right-hand side of the <code><nobr>WRT</nobr></code> operator to +obtain PIC relocation types. They are <code><nobr>..gotpc</nobr></code>, +<code><nobr>..gotoff</nobr></code>, <code><nobr>..got</nobr></code>, +<code><nobr>..plt</nobr></code> and <code><nobr>..sym</nobr></code>. Their +functions are summarized here: +<ul> +<li>Referring to the symbol marking the global offset table base using +<code><nobr>wrt ..gotpc</nobr></code> will end up giving the distance from +the beginning of the current section to the global offset table. +(<code><nobr>_GLOBAL_OFFSET_TABLE_</nobr></code> is the standard symbol +name used to refer to the GOT.) So you would then need to add +<code><nobr>$$</nobr></code> to the result to get the real address of the +GOT. +<li>Referring to a location in one of your own sections using +<code><nobr>wrt ..gotoff</nobr></code> will give the distance from the +beginning of the GOT to the specified location, so that adding on the +address of the GOT would give the real address of the location you wanted. +<li>Referring to an external or global symbol using +<code><nobr>wrt ..got</nobr></code> causes the linker to build an entry +<em>in</em> the GOT containing the address of the symbol, and the reference +gives the distance from the beginning of the GOT to the entry; so you can +add on the address of the GOT, load from the resulting address, and end up +with the address of the symbol. +<li>Referring to a procedure name using <code><nobr>wrt ..plt</nobr></code> +causes the linker to build a procedure linkage table entry for the symbol, +and the reference gives the address of the PLT entry. You can only use this +in contexts which would generate a PC-relative relocation normally (i.e. as +the destination for <code><nobr>CALL</nobr></code> or +<code><nobr>JMP</nobr></code>), since ELF contains no relocation type to +refer to PLT entries absolutely. +<li>Referring to a symbol name using <code><nobr>wrt ..sym</nobr></code> +causes NASM to write an ordinary relocation, but instead of making the +relocation relative to the start of the section and then adding on the +offset to the symbol, it will write a relocation record aimed directly at +the symbol in question. The distinction is a necessary one due to a +peculiarity of the dynamic linker. +</ul> +<p>A fuller explanation of how to use these relocation types to write +shared libraries entirely in NASM is given in +<a href="nasmdoc9.html#section-9.2">section 9.2</a>. +<h4><a name="section-7.9.4">7.9.4 Thread Local Storage: <code><nobr>elf</nobr></code> Special Symbols and <code><nobr>WRT</nobr></code></a></h4> +<ul> +<li>In ELF32 mode, referring to an external or global symbol using +<code><nobr>wrt ..tlsie</nobr></code> causes the linker to build an entry +<em>in</em> the GOT containing the offset of the symbol within the TLS +block, so you can access the value of the symbol with code such as: +</ul> +<p><pre> + mov eax,[tid wrt ..tlsie] + mov [gs:eax],ebx +</pre> +<ul> +<li>In ELF64 mode, referring to an external or global symbol using +<code><nobr>wrt ..gottpoff</nobr></code> causes the linker to build an +entry <em>in</em> the GOT containing the offset of the symbol within the +TLS block, so you can access the value of the symbol with code such as: +</ul> +<p><pre> + mov rax,[rel tid wrt ..gottpoff] + mov rcx,[fs:rax] +</pre> +<h4><a name="section-7.9.5">7.9.5 <code><nobr>elf</nobr></code> Extensions to the <code><nobr>GLOBAL</nobr></code> Directive</a></h4> +<p><code><nobr>ELF</nobr></code> object files can contain more information +about a global symbol than just its address: they can contain the size of +the symbol and its type as well. These are not merely debugger +conveniences, but are actually necessary when the program being written is +a shared library. NASM therefore supports some extensions to the +<code><nobr>GLOBAL</nobr></code> directive, allowing you to specify these +features. +<p>You can specify whether a global variable is a function or a data object +by suffixing the name with a colon and the word +<code><nobr>function</nobr></code> or <code><nobr>data</nobr></code>. +(<code><nobr>object</nobr></code> is a synonym for +<code><nobr>data</nobr></code>.) For example: +<p><pre> +global hashlookup:function, hashtable:data +</pre> +<p>exports the global symbol <code><nobr>hashlookup</nobr></code> as a +function and <code><nobr>hashtable</nobr></code> as a data object. +<p>Optionally, you can control the ELF visibility of the symbol. Just add +one of the visibility keywords: <code><nobr>default</nobr></code>, +<code><nobr>internal</nobr></code>, <code><nobr>hidden</nobr></code>, or +<code><nobr>protected</nobr></code>. The default is +<code><nobr>default</nobr></code> of course. For example, to make +<code><nobr>hashlookup</nobr></code> hidden: +<p><pre> +global hashlookup:function hidden +</pre> +<p>You can also specify the size of the data associated with the symbol, as +a numeric expression (which may involve labels, and even forward +references) after the type specifier. Like this: +<p><pre> +global hashtable:data (hashtable.end - hashtable) + +hashtable: + db this,that,theother ; some data here +.end: +</pre> +<p>This makes NASM automatically calculate the length of the table and +place that information into the <code><nobr>ELF</nobr></code> symbol table. +<p>Declaring the type and size of global symbols is necessary when writing +shared library code. For more information, see +<a href="nasmdoc9.html#section-9.2.4">section 9.2.4</a>. +<h4><a name="section-7.9.6">7.9.6 <code><nobr>elf</nobr></code> Extensions to the <code><nobr>COMMON</nobr></code> Directive </a></h4> +<p><code><nobr>ELF</nobr></code> also allows you to specify alignment +requirements on common variables. This is done by putting a number (which +must be a power of two) after the name and size of the common variable, +separated (as usual) by a colon. For example, an array of doublewords would +benefit from 4-byte alignment: +<p><pre> +common dwordarray 128:4 +</pre> +<p>This declares the total size of the array to be 128 bytes, and requires +that it be aligned on a 4-byte boundary. +<h4><a name="section-7.9.7">7.9.7 16-bit code and ELF </a></h4> +<p>The <code><nobr>ELF32</nobr></code> specification doesn't provide +relocations for 8- and 16-bit values, but the GNU +<code><nobr>ld</nobr></code> linker adds these as an extension. NASM can +generate GNU-compatible relocations, to allow 16-bit code to be linked as +ELF using GNU <code><nobr>ld</nobr></code>. If NASM is used with the +<code><nobr>-w+gnu-elf-extensions</nobr></code> option, a warning is issued +when one of these relocations is generated. +<h4><a name="section-7.9.8">7.9.8 Debug formats and ELF </a></h4> +<p><code><nobr>ELF32</nobr></code> and <code><nobr>ELF64</nobr></code> +provide debug information in <code><nobr>STABS</nobr></code> and +<code><nobr>DWARF</nobr></code> formats. Line number information is +generated for all executable sections, but please note that only the +".text" section is executable by default. +<h3><a name="section-7.10">7.10 <code><nobr>aout</nobr></code>: Linux <code><nobr>a.out</nobr></code> Object Files</a></h3> +<p>The <code><nobr>aout</nobr></code> format generates +<code><nobr>a.out</nobr></code> object files, in the form used by early +Linux systems (current Linux systems use ELF, see +<a href="#section-7.9">section 7.9</a>.) These differ from other +<code><nobr>a.out</nobr></code> object files in that the magic number in +the first four bytes of the file is different; also, some implementations +of <code><nobr>a.out</nobr></code>, for example NetBSD's, support +position-independent code, which Linux's implementation does not. +<p><code><nobr>a.out</nobr></code> provides a default output file-name +extension of <code><nobr>.o</nobr></code>. +<p><code><nobr>a.out</nobr></code> is a very simple object format. It +supports no special directives, no special symbols, no use of +<code><nobr>SEG</nobr></code> or <code><nobr>WRT</nobr></code>, and no +extensions to any standard directives. It supports only the three standard +section names <code><nobr>.text</nobr></code>, +<code><nobr>.data</nobr></code> and <code><nobr>.bss</nobr></code>. +<h3><a name="section-7.11">7.11 <code><nobr>aoutb</nobr></code>: NetBSD/FreeBSD/OpenBSD <code><nobr>a.out</nobr></code> Object Files</a></h3> +<p>The <code><nobr>aoutb</nobr></code> format generates +<code><nobr>a.out</nobr></code> object files, in the form used by the +various free <code><nobr>BSD Unix</nobr></code> clones, +<code><nobr>NetBSD</nobr></code>, <code><nobr>FreeBSD</nobr></code> and +<code><nobr>OpenBSD</nobr></code>. For simple object files, this object +format is exactly the same as <code><nobr>aout</nobr></code> except for the +magic number in the first four bytes of the file. However, the +<code><nobr>aoutb</nobr></code> format supports position-independent code +in the same way as the <code><nobr>elf</nobr></code> format, so you can use +it to write <code><nobr>BSD</nobr></code> shared libraries. +<p><code><nobr>aoutb</nobr></code> provides a default output file-name +extension of <code><nobr>.o</nobr></code>. +<p><code><nobr>aoutb</nobr></code> supports no special directives, no +special symbols, and only the three standard section names +<code><nobr>.text</nobr></code>, <code><nobr>.data</nobr></code> and +<code><nobr>.bss</nobr></code>. However, it also supports the same use of +<code><nobr>WRT</nobr></code> as <code><nobr>elf</nobr></code> does, to +provide position-independent code relocation types. See +<a href="#section-7.9.3">section 7.9.3</a> for full documentation of this +feature. +<p><code><nobr>aoutb</nobr></code> also supports the same extensions to the +<code><nobr>GLOBAL</nobr></code> directive as <code><nobr>elf</nobr></code> +does: see <a href="#section-7.9.5">section 7.9.5</a> for documentation of +this. +<h3><a name="section-7.12">7.12 <code><nobr>as86</nobr></code>: Minix/Linux <code><nobr>as86</nobr></code> Object Files</a></h3> +<p>The Minix/Linux 16-bit assembler <code><nobr>as86</nobr></code> has its +own non-standard object file format. Although its companion linker +<code><nobr>ld86</nobr></code> produces something close to ordinary +<code><nobr>a.out</nobr></code> binaries as output, the object file format +used to communicate between <code><nobr>as86</nobr></code> and +<code><nobr>ld86</nobr></code> is not itself +<code><nobr>a.out</nobr></code>. +<p>NASM supports this format, just in case it is useful, as +<code><nobr>as86</nobr></code>. <code><nobr>as86</nobr></code> provides a +default output file-name extension of <code><nobr>.o</nobr></code>. +<p><code><nobr>as86</nobr></code> is a very simple object format (from the +NASM user's point of view). It supports no special directives, no use of +<code><nobr>SEG</nobr></code> or <code><nobr>WRT</nobr></code>, and no +extensions to any standard directives. It supports only the three standard +section names <code><nobr>.text</nobr></code>, +<code><nobr>.data</nobr></code> and <code><nobr>.bss</nobr></code>. The +only special symbol supported is <code><nobr>..start</nobr></code>. +<h3><a name="section-7.13">7.13 <code><nobr>rdf</nobr></code>: Relocatable Dynamic Object File Format</a></h3> +<p>The <code><nobr>rdf</nobr></code> output format produces +<code><nobr>RDOFF</nobr></code> object files. +<code><nobr>RDOFF</nobr></code> (Relocatable Dynamic Object File Format) is +a home-grown object-file format, designed alongside NASM itself and +reflecting in its file format the internal structure of the assembler. +<p><code><nobr>RDOFF</nobr></code> is not used by any well-known operating +systems. Those writing their own systems, however, may well wish to use +<code><nobr>RDOFF</nobr></code> as their object format, on the grounds that +it is designed primarily for simplicity and contains very little +file-header bureaucracy. +<p>The Unix NASM archive, and the DOS archive which includes sources, both +contain an <code><nobr>rdoff</nobr></code> subdirectory holding a set of +RDOFF utilities: an RDF linker, an <code><nobr>RDF</nobr></code> +static-library manager, an RDF file dump utility, and a program which will +load and execute an RDF executable under Linux. +<p><code><nobr>rdf</nobr></code> supports only the standard section names +<code><nobr>.text</nobr></code>, <code><nobr>.data</nobr></code> and +<code><nobr>.bss</nobr></code>. +<h4><a name="section-7.13.1">7.13.1 Requiring a Library: The <code><nobr>LIBRARY</nobr></code> Directive</a></h4> +<p><code><nobr>RDOFF</nobr></code> contains a mechanism for an object file +to demand a given library to be linked to the module, either at load time +or run time. This is done by the <code><nobr>LIBRARY</nobr></code> +directive, which takes one argument which is the name of the module: +<p><pre> + library mylib.rdl +</pre> +<h4><a name="section-7.13.2">7.13.2 Specifying a Module Name: The <code><nobr>MODULE</nobr></code> Directive</a></h4> +<p>Special <code><nobr>RDOFF</nobr></code> header record is used to store +the name of the module. It can be used, for example, by run-time loader to +perform dynamic linking. <code><nobr>MODULE</nobr></code> directive takes +one argument which is the name of current module: +<p><pre> + module mymodname +</pre> +<p>Note that when you statically link modules and tell linker to strip the +symbols from output file, all module names will be stripped too. To avoid +it, you should start module names with <code><nobr>$</nobr></code>, like: +<p><pre> + module $kernel.core +</pre> +<h4><a name="section-7.13.3">7.13.3 <code><nobr>rdf</nobr></code> Extensions to the <code><nobr>GLOBAL</nobr></code> Directive</a></h4> +<p><code><nobr>RDOFF</nobr></code> global symbols can contain additional +information needed by the static linker. You can mark a global symbol as +exported, thus telling the linker do not strip it from target executable or +library file. Like in <code><nobr>ELF</nobr></code>, you can also specify +whether an exported symbol is a procedure (function) or data object. +<p>Suffixing the name with a colon and the word +<code><nobr>export</nobr></code> you make the symbol exported: +<p><pre> + global sys_open:export +</pre> +<p>To specify that exported symbol is a procedure (function), you add the +word <code><nobr>proc</nobr></code> or <code><nobr>function</nobr></code> +after declaration: +<p><pre> + global sys_open:export proc +</pre> +<p>Similarly, to specify exported data object, add the word +<code><nobr>data</nobr></code> or <code><nobr>object</nobr></code> to the +directive: +<p><pre> + global kernel_ticks:export data +</pre> +<h4><a name="section-7.13.4">7.13.4 <code><nobr>rdf</nobr></code> Extensions to the <code><nobr>EXTERN</nobr></code> Directive</a></h4> +<p>By default the <code><nobr>EXTERN</nobr></code> directive in +<code><nobr>RDOFF</nobr></code> declares a "pure external" symbol (i.e. the +static linker will complain if such a symbol is not resolved). To declare +an "imported" symbol, which must be resolved later during a dynamic linking +phase, <code><nobr>RDOFF</nobr></code> offers an additional +<code><nobr>import</nobr></code> modifier. As in +<code><nobr>GLOBAL</nobr></code>, you can also specify whether an imported +symbol is a procedure (function) or data object. For example: +<p><pre> + library $libc + extern _open:import + extern _printf:import proc + extern _errno:import data +</pre> +<p>Here the directive <code><nobr>LIBRARY</nobr></code> is also included, +which gives the dynamic linker a hint as to where to find requested +symbols. +<h3><a name="section-7.14">7.14 <code><nobr>dbg</nobr></code>: Debugging Format</a></h3> +<p>The <code><nobr>dbg</nobr></code> output format is not built into NASM +in the default configuration. If you are building your own NASM executable +from the sources, you can define <code><nobr>OF_DBG</nobr></code> in +<code><nobr>output/outform.h</nobr></code> or on the compiler command line, +and obtain the <code><nobr>dbg</nobr></code> output format. +<p>The <code><nobr>dbg</nobr></code> format does not output an object file +as such; instead, it outputs a text file which contains a complete list of +all the transactions between the main body of NASM and the output-format +back end module. It is primarily intended to aid people who want to write +their own output drivers, so that they can get a clearer idea of the +various requests the main program makes of the output driver, and in what +order they happen. +<p>For simple files, one can easily use the <code><nobr>dbg</nobr></code> +format like this: +<p><pre> +nasm -f dbg filename.asm +</pre> +<p>which will generate a diagnostic file called +<code><nobr>filename.dbg</nobr></code>. However, this will not work well on +files which were designed for a different object format, because each +object format defines its own macros (usually user-level forms of +directives), and those macros will not be defined in the +<code><nobr>dbg</nobr></code> format. Therefore it can be useful to run +NASM twice, in order to do the preprocessing with the native object format +selected: +<p><pre> +nasm -e -f rdf -o rdfprog.i rdfprog.asm +nasm -a -f dbg rdfprog.i +</pre> +<p>This preprocesses <code><nobr>rdfprog.asm</nobr></code> into +<code><nobr>rdfprog.i</nobr></code>, keeping the +<code><nobr>rdf</nobr></code> object format selected in order to make sure +RDF special directives are converted into primitive form correctly. Then +the preprocessed source is fed through the <code><nobr>dbg</nobr></code> +format to generate the final diagnostic output. +<p>This workaround will still typically not work for programs intended for +<code><nobr>obj</nobr></code> format, because the +<code><nobr>obj</nobr></code> <code><nobr>SEGMENT</nobr></code> and +<code><nobr>GROUP</nobr></code> directives have side effects of defining +the segment and group names as symbols; <code><nobr>dbg</nobr></code> will +not do this, so the program will not assemble. You will have to work around +that by defining the symbols yourself (using +<code><nobr>EXTERN</nobr></code>, for example) if you really need to get a +<code><nobr>dbg</nobr></code> trace of an +<code><nobr>obj</nobr></code>-specific source file. +<p><code><nobr>dbg</nobr></code> accepts any section name and any +directives at all, and logs them all to its output file. +<p align=center><a href="nasmdoc8.html">Next Chapter</a> | +<a href="nasmdoc6.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc8.html b/doc/html/nasmdoc8.html new file mode 100644 index 0000000..a7c2869 --- /dev/null +++ b/doc/html/nasmdoc8.html @@ -0,0 +1,808 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc9.html">Next Chapter</a> | +<a href="nasmdoc7.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-8">Chapter 8: Writing 16-bit Code (DOS, Windows 3/3.1)</a></h2> +<p>This chapter attempts to cover some of the common issues encountered +when writing 16-bit code to run under <code><nobr>MS-DOS</nobr></code> or +<code><nobr>Windows 3.x</nobr></code>. It covers how to link programs to +produce <code><nobr>.EXE</nobr></code> or <code><nobr>.COM</nobr></code> +files, how to write <code><nobr>.SYS</nobr></code> device drivers, and how +to interface assembly language code with 16-bit C compilers and with +Borland Pascal. +<h3><a name="section-8.1">8.1 Producing <code><nobr>.EXE</nobr></code> Files</a></h3> +<p>Any large program written under DOS needs to be built as a +<code><nobr>.EXE</nobr></code> file: only <code><nobr>.EXE</nobr></code> +files have the necessary internal structure required to span more than one +64K segment. Windows programs, also, have to be built as +<code><nobr>.EXE</nobr></code> files, since Windows does not support the +<code><nobr>.COM</nobr></code> format. +<p>In general, you generate <code><nobr>.EXE</nobr></code> files by using +the <code><nobr>obj</nobr></code> output format to produce one or more +<code><nobr>.OBJ</nobr></code> files, and then linking them together using +a linker. However, NASM also supports the direct generation of simple DOS +<code><nobr>.EXE</nobr></code> files using the +<code><nobr>bin</nobr></code> output format (by using +<code><nobr>DB</nobr></code> and <code><nobr>DW</nobr></code> to construct +the <code><nobr>.EXE</nobr></code> file header), and a macro package is +supplied to do this. Thanks to Yann Guidon for contributing the code for +this. +<p>NASM may also support <code><nobr>.EXE</nobr></code> natively as another +output format in future releases. +<h4><a name="section-8.1.1">8.1.1 Using the <code><nobr>obj</nobr></code> Format To Generate <code><nobr>.EXE</nobr></code> Files</a></h4> +<p>This section describes the usual method of generating +<code><nobr>.EXE</nobr></code> files by linking +<code><nobr>.OBJ</nobr></code> files together. +<p>Most 16-bit programming language packages come with a suitable linker; +if you have none of these, there is a free linker called VAL, available in +<code><nobr>LZH</nobr></code> archive format from +<a href="ftp://x2ftp.oulu.fi/pub/msdos/programming/lang/"><code><nobr>x2ftp.oulu.fi</nobr></code></a>. +An LZH archiver can be found at +<a href="ftp://ftp.simtel.net/pub/simtelnet/msdos/arcers"><code><nobr>ftp.simtel.net</nobr></code></a>. +There is another `free' linker (though this one doesn't come with sources) +called FREELINK, available from +<a href="http://www.pcorner.com/tpc/old/3-101.html"><code><nobr>www.pcorner.com</nobr></code></a>. +A third, <code><nobr>djlink</nobr></code>, written by DJ Delorie, is +available at +<a href="http://www.delorie.com/djgpp/16bit/djlink/"><code><nobr>www.delorie.com</nobr></code></a>. +A fourth linker, <code><nobr>ALINK</nobr></code>, written by Anthony A.J. +Williams, is available at +<a href="http://alink.sourceforge.net"><code><nobr>alink.sourceforge.net</nobr></code></a>. +<p>When linking several <code><nobr>.OBJ</nobr></code> files into a +<code><nobr>.EXE</nobr></code> file, you should ensure that exactly one of +them has a start point defined (using the <code><nobr>..start</nobr></code> +special symbol defined by the <code><nobr>obj</nobr></code> format: see +<a href="nasmdoc7.html#section-7.4.6">section 7.4.6</a>). If no module +defines a start point, the linker will not know what value to give the +entry-point field in the output file header; if more than one defines a +start point, the linker will not know <em>which</em> value to use. +<p>An example of a NASM source file which can be assembled to a +<code><nobr>.OBJ</nobr></code> file and linked on its own to a +<code><nobr>.EXE</nobr></code> is given here. It demonstrates the basic +principles of defining a stack, initialising the segment registers, and +declaring a start point. This file is also provided in the +<code><nobr>test</nobr></code> subdirectory of the NASM archives, under the +name <code><nobr>objexe.asm</nobr></code>. +<p><pre> +segment code + +..start: + mov ax,data + mov ds,ax + mov ax,stack + mov ss,ax + mov sp,stacktop +</pre> +<p>This initial piece of code sets up <code><nobr>DS</nobr></code> to point +to the data segment, and initializes <code><nobr>SS</nobr></code> and +<code><nobr>SP</nobr></code> to point to the top of the provided stack. +Notice that interrupts are implicitly disabled for one instruction after a +move into <code><nobr>SS</nobr></code>, precisely for this situation, so +that there's no chance of an interrupt occurring between the loads of +<code><nobr>SS</nobr></code> and <code><nobr>SP</nobr></code> and not +having a stack to execute on. +<p>Note also that the special symbol <code><nobr>..start</nobr></code> is +defined at the beginning of this code, which means that will be the entry +point into the resulting executable file. +<p><pre> + mov dx,hello + mov ah,9 + int 0x21 +</pre> +<p>The above is the main program: load <code><nobr>DS:DX</nobr></code> with +a pointer to the greeting message (<code><nobr>hello</nobr></code> is +implicitly relative to the segment <code><nobr>data</nobr></code>, which +was loaded into <code><nobr>DS</nobr></code> in the setup code, so the full +pointer is valid), and call the DOS print-string function. +<p><pre> + mov ax,0x4c00 + int 0x21 +</pre> +<p>This terminates the program using another DOS system call. +<p><pre> +segment data + +hello: db 'hello, world', 13, 10, '$' +</pre> +<p>The data segment contains the string we want to display. +<p><pre> +segment stack stack + resb 64 +stacktop: +</pre> +<p>The above code declares a stack segment containing 64 bytes of +uninitialized stack space, and points <code><nobr>stacktop</nobr></code> at +the top of it. The directive <code><nobr>segment stack stack</nobr></code> +defines a segment <em>called</em> <code><nobr>stack</nobr></code>, and also +of <em>type</em> <code><nobr>STACK</nobr></code>. The latter is not +necessary to the correct running of the program, but linkers are likely to +issue warnings or errors if your program has no segment of type +<code><nobr>STACK</nobr></code>. +<p>The above file, when assembled into a <code><nobr>.OBJ</nobr></code> +file, will link on its own to a valid <code><nobr>.EXE</nobr></code> file, +which when run will print `hello, world' and then exit. +<h4><a name="section-8.1.2">8.1.2 Using the <code><nobr>bin</nobr></code> Format To Generate <code><nobr>.EXE</nobr></code> Files</a></h4> +<p>The <code><nobr>.EXE</nobr></code> file format is simple enough that +it's possible to build a <code><nobr>.EXE</nobr></code> file by writing a +pure-binary program and sticking a 32-byte header on the front. This header +is simple enough that it can be generated using +<code><nobr>DB</nobr></code> and <code><nobr>DW</nobr></code> commands by +NASM itself, so that you can use the <code><nobr>bin</nobr></code> output +format to directly generate <code><nobr>.EXE</nobr></code> files. +<p>Included in the NASM archives, in the <code><nobr>misc</nobr></code> +subdirectory, is a file <code><nobr>exebin.mac</nobr></code> of macros. It +defines three macros: <code><nobr>EXE_begin</nobr></code>, +<code><nobr>EXE_stack</nobr></code> and <code><nobr>EXE_end</nobr></code>. +<p>To produce a <code><nobr>.EXE</nobr></code> file using this method, you +should start by using <code><nobr>%include</nobr></code> to load the +<code><nobr>exebin.mac</nobr></code> macro package into your source file. +You should then issue the <code><nobr>EXE_begin</nobr></code> macro call +(which takes no arguments) to generate the file header data. Then write +code as normal for the <code><nobr>bin</nobr></code> format - you can use +all three standard sections <code><nobr>.text</nobr></code>, +<code><nobr>.data</nobr></code> and <code><nobr>.bss</nobr></code>. At the +end of the file you should call the <code><nobr>EXE_end</nobr></code> macro +(again, no arguments), which defines some symbols to mark section sizes, +and these symbols are referred to in the header code generated by +<code><nobr>EXE_begin</nobr></code>. +<p>In this model, the code you end up writing starts at +<code><nobr>0x100</nobr></code>, just like a <code><nobr>.COM</nobr></code> +file - in fact, if you strip off the 32-byte header from the resulting +<code><nobr>.EXE</nobr></code> file, you will have a valid +<code><nobr>.COM</nobr></code> program. All the segment bases are the same, +so you are limited to a 64K program, again just like a +<code><nobr>.COM</nobr></code> file. Note that an +<code><nobr>ORG</nobr></code> directive is issued by the +<code><nobr>EXE_begin</nobr></code> macro, so you should not explicitly +issue one of your own. +<p>You can't directly refer to your segment base value, unfortunately, +since this would require a relocation in the header, and things would get a +lot more complicated. So you should get your segment base by copying it out +of <code><nobr>CS</nobr></code> instead. +<p>On entry to your <code><nobr>.EXE</nobr></code> file, +<code><nobr>SS:SP</nobr></code> are already set up to point to the top of a +2Kb stack. You can adjust the default stack size of 2Kb by calling the +<code><nobr>EXE_stack</nobr></code> macro. For example, to change the stack +size of your program to 64 bytes, you would call +<code><nobr>EXE_stack 64</nobr></code>. +<p>A sample program which generates a <code><nobr>.EXE</nobr></code> file +in this way is given in the <code><nobr>test</nobr></code> subdirectory of +the NASM archive, as <code><nobr>binexe.asm</nobr></code>. +<h3><a name="section-8.2">8.2 Producing <code><nobr>.COM</nobr></code> Files</a></h3> +<p>While large DOS programs must be written as +<code><nobr>.EXE</nobr></code> files, small ones are often better written +as <code><nobr>.COM</nobr></code> files. <code><nobr>.COM</nobr></code> +files are pure binary, and therefore most easily produced using the +<code><nobr>bin</nobr></code> output format. +<h4><a name="section-8.2.1">8.2.1 Using the <code><nobr>bin</nobr></code> Format To Generate <code><nobr>.COM</nobr></code> Files</a></h4> +<p><code><nobr>.COM</nobr></code> files expect to be loaded at offset +<code><nobr>100h</nobr></code> into their segment (though the segment may +change). Execution then begins at <code><nobr>100h</nobr></code>, i.e. +right at the start of the program. So to write a +<code><nobr>.COM</nobr></code> program, you would create a source file +looking like +<p><pre> + org 100h + +section .text + +start: + ; put your code here + +section .data + + ; put data items here + +section .bss + + ; put uninitialized data here +</pre> +<p>The <code><nobr>bin</nobr></code> format puts the +<code><nobr>.text</nobr></code> section first in the file, so you can +declare data or BSS items before beginning to write code if you want to and +the code will still end up at the front of the file where it belongs. +<p>The BSS (uninitialized data) section does not take up space in the +<code><nobr>.COM</nobr></code> file itself: instead, addresses of BSS items +are resolved to point at space beyond the end of the file, on the grounds +that this will be free memory when the program is run. Therefore you should +not rely on your BSS being initialized to all zeros when you run. +<p>To assemble the above program, you should use a command line like +<p><pre> +nasm myprog.asm -fbin -o myprog.com +</pre> +<p>The <code><nobr>bin</nobr></code> format would produce a file called +<code><nobr>myprog</nobr></code> if no explicit output file name were +specified, so you have to override it and give the desired file name. +<h4><a name="section-8.2.2">8.2.2 Using the <code><nobr>obj</nobr></code> Format To Generate <code><nobr>.COM</nobr></code> Files</a></h4> +<p>If you are writing a <code><nobr>.COM</nobr></code> program as more than +one module, you may wish to assemble several <code><nobr>.OBJ</nobr></code> +files and link them together into a <code><nobr>.COM</nobr></code> program. +You can do this, provided you have a linker capable of outputting +<code><nobr>.COM</nobr></code> files directly (TLINK does this), or +alternatively a converter program such as <code><nobr>EXE2BIN</nobr></code> +to transform the <code><nobr>.EXE</nobr></code> file output from the linker +into a <code><nobr>.COM</nobr></code> file. +<p>If you do this, you need to take care of several things: +<ul> +<li>The first object file containing code should start its code segment +with a line like <code><nobr>RESB 100h</nobr></code>. This is to ensure +that the code begins at offset <code><nobr>100h</nobr></code> relative to +the beginning of the code segment, so that the linker or converter program +does not have to adjust address references within the file when generating +the <code><nobr>.COM</nobr></code> file. Other assemblers use an +<code><nobr>ORG</nobr></code> directive for this purpose, but +<code><nobr>ORG</nobr></code> in NASM is a format-specific directive to the +<code><nobr>bin</nobr></code> output format, and does not mean the same +thing as it does in MASM-compatible assemblers. +<li>You don't need to define a stack segment. +<li>All your segments should be in the same group, so that every time your +code or data references a symbol offset, all offsets are relative to the +same segment base. This is because, when a <code><nobr>.COM</nobr></code> +file is loaded, all the segment registers contain the same value. +</ul> +<h3><a name="section-8.3">8.3 Producing <code><nobr>.SYS</nobr></code> Files</a></h3> +<p>MS-DOS device drivers - <code><nobr>.SYS</nobr></code> files - are pure +binary files, similar to <code><nobr>.COM</nobr></code> files, except that +they start at origin zero rather than <code><nobr>100h</nobr></code>. +Therefore, if you are writing a device driver using the +<code><nobr>bin</nobr></code> format, you do not need the +<code><nobr>ORG</nobr></code> directive, since the default origin for +<code><nobr>bin</nobr></code> is zero. Similarly, if you are using +<code><nobr>obj</nobr></code>, you do not need the +<code><nobr>RESB 100h</nobr></code> at the start of your code segment. +<p><code><nobr>.SYS</nobr></code> files start with a header structure, +containing pointers to the various routines inside the driver which do the +work. This structure should be defined at the start of the code segment, +even though it is not actually code. +<p>For more information on the format of <code><nobr>.SYS</nobr></code> +files, and the data which has to go in the header structure, a list of +books is given in the Frequently Asked Questions list for the newsgroup +<a href="news:comp.os.msdos.programmer"><code><nobr>comp.os.msdos.programmer</nobr></code></a>. +<h3><a name="section-8.4">8.4 Interfacing to 16-bit C Programs</a></h3> +<p>This section covers the basics of writing assembly routines that call, +or are called from, C programs. To do this, you would typically write an +assembly module as a <code><nobr>.OBJ</nobr></code> file, and link it with +your C modules to produce a mixed-language program. +<h4><a name="section-8.4.1">8.4.1 External Symbol Names</a></h4> +<p>C compilers have the convention that the names of all global symbols +(functions or data) they define are formed by prefixing an underscore to +the name as it appears in the C program. So, for example, the function a C +programmer thinks of as <code><nobr>printf</nobr></code> appears to an +assembly language programmer as <code><nobr>_printf</nobr></code>. This +means that in your assembly programs, you can define symbols without a +leading underscore, and not have to worry about name clashes with C +symbols. +<p>If you find the underscores inconvenient, you can define macros to +replace the <code><nobr>GLOBAL</nobr></code> and +<code><nobr>EXTERN</nobr></code> directives as follows: +<p><pre> +%macro cglobal 1 + + global _%1 + %define %1 _%1 + +%endmacro + +%macro cextern 1 + + extern _%1 + %define %1 _%1 + +%endmacro +</pre> +<p>(These forms of the macros only take one argument at a time; a +<code><nobr>%rep</nobr></code> construct could solve this.) +<p>If you then declare an external like this: +<p><pre> +cextern printf +</pre> +<p>then the macro will expand it as +<p><pre> +extern _printf +%define printf _printf +</pre> +<p>Thereafter, you can reference <code><nobr>printf</nobr></code> as if it +was a symbol, and the preprocessor will put the leading underscore on where +necessary. +<p>The <code><nobr>cglobal</nobr></code> macro works similarly. You must +use <code><nobr>cglobal</nobr></code> before defining the symbol in +question, but you would have had to do that anyway if you used +<code><nobr>GLOBAL</nobr></code>. +<p>Also see <a href="nasmdoc2.html#section-2.1.27">section 2.1.27</a>. +<h4><a name="section-8.4.2">8.4.2 Memory Models</a></h4> +<p>NASM contains no mechanism to support the various C memory models +directly; you have to keep track yourself of which one you are writing for. +This means you have to keep track of the following things: +<ul> +<li>In models using a single code segment (tiny, small and compact), +functions are near. This means that function pointers, when stored in data +segments or pushed on the stack as function arguments, are 16 bits long and +contain only an offset field (the <code><nobr>CS</nobr></code> register +never changes its value, and always gives the segment part of the full +function address), and that functions are called using ordinary near +<code><nobr>CALL</nobr></code> instructions and return using +<code><nobr>RETN</nobr></code> (which, in NASM, is synonymous with +<code><nobr>RET</nobr></code> anyway). This means both that you should +write your own routines to return with <code><nobr>RETN</nobr></code>, and +that you should call external C routines with near +<code><nobr>CALL</nobr></code> instructions. +<li>In models using more than one code segment (medium, large and huge), +functions are far. This means that function pointers are 32 bits long +(consisting of a 16-bit offset followed by a 16-bit segment), and that +functions are called using <code><nobr>CALL FAR</nobr></code> (or +<code><nobr>CALL seg:offset</nobr></code>) and return using +<code><nobr>RETF</nobr></code>. Again, you should therefore write your own +routines to return with <code><nobr>RETF</nobr></code> and use +<code><nobr>CALL FAR</nobr></code> to call external routines. +<li>In models using a single data segment (tiny, small and medium), data +pointers are 16 bits long, containing only an offset field (the +<code><nobr>DS</nobr></code> register doesn't change its value, and always +gives the segment part of the full data item address). +<li>In models using more than one data segment (compact, large and huge), +data pointers are 32 bits long, consisting of a 16-bit offset followed by a +16-bit segment. You should still be careful not to modify +<code><nobr>DS</nobr></code> in your routines without restoring it +afterwards, but <code><nobr>ES</nobr></code> is free for you to use to +access the contents of 32-bit data pointers you are passed. +<li>The huge memory model allows single data items to exceed 64K in size. +In all other memory models, you can access the whole of a data item just by +doing arithmetic on the offset field of the pointer you are given, whether +a segment field is present or not; in huge model, you have to be more +careful of your pointer arithmetic. +<li>In most memory models, there is a <em>default</em> data segment, whose +segment address is kept in <code><nobr>DS</nobr></code> throughout the +program. This data segment is typically the same segment as the stack, kept +in <code><nobr>SS</nobr></code>, so that functions' local variables (which +are stored on the stack) and global data items can both be accessed easily +without changing <code><nobr>DS</nobr></code>. Particularly large data +items are typically stored in other segments. However, some memory models +(though not the standard ones, usually) allow the assumption that +<code><nobr>SS</nobr></code> and <code><nobr>DS</nobr></code> hold the same +value to be removed. Be careful about functions' local variables in this +latter case. +</ul> +<p>In models with a single code segment, the segment is called +<code><nobr>_TEXT</nobr></code>, so your code segment must also go by this +name in order to be linked into the same place as the main code segment. In +models with a single data segment, or with a default data segment, it is +called <code><nobr>_DATA</nobr></code>. +<h4><a name="section-8.4.3">8.4.3 Function Definitions and Function Calls</a></h4> +<p>The C calling convention in 16-bit programs is as follows. In the +following description, the words <em>caller</em> and <em>callee</em> are +used to denote the function doing the calling and the function which gets +called. +<ul> +<li>The caller pushes the function's parameters on the stack, one after +another, in reverse order (right to left, so that the first argument +specified to the function is pushed last). +<li>The caller then executes a <code><nobr>CALL</nobr></code> instruction +to pass control to the callee. This <code><nobr>CALL</nobr></code> is +either near or far depending on the memory model. +<li>The callee receives control, and typically (although this is not +actually necessary, in functions which do not need to access their +parameters) starts by saving the value of <code><nobr>SP</nobr></code> in +<code><nobr>BP</nobr></code> so as to be able to use +<code><nobr>BP</nobr></code> as a base pointer to find its parameters on +the stack. However, the caller was probably doing this too, so part of the +calling convention states that <code><nobr>BP</nobr></code> must be +preserved by any C function. Hence the callee, if it is going to set up +<code><nobr>BP</nobr></code> as a <em>frame pointer</em>, must push the +previous value first. +<li>The callee may then access its parameters relative to +<code><nobr>BP</nobr></code>. The word at <code><nobr>[BP]</nobr></code> +holds the previous value of <code><nobr>BP</nobr></code> as it was pushed; +the next word, at <code><nobr>[BP+2]</nobr></code>, holds the offset part +of the return address, pushed implicitly by <code><nobr>CALL</nobr></code>. +In a small-model (near) function, the parameters start after that, at +<code><nobr>[BP+4]</nobr></code>; in a large-model (far) function, the +segment part of the return address lives at +<code><nobr>[BP+4]</nobr></code>, and the parameters begin at +<code><nobr>[BP+6]</nobr></code>. The leftmost parameter of the function, +since it was pushed last, is accessible at this offset from +<code><nobr>BP</nobr></code>; the others follow, at successively greater +offsets. Thus, in a function such as <code><nobr>printf</nobr></code> which +takes a variable number of parameters, the pushing of the parameters in +reverse order means that the function knows where to find its first +parameter, which tells it the number and type of the remaining ones. +<li>The callee may also wish to decrease <code><nobr>SP</nobr></code> +further, so as to allocate space on the stack for local variables, which +will then be accessible at negative offsets from +<code><nobr>BP</nobr></code>. +<li>The callee, if it wishes to return a value to the caller, should leave +the value in <code><nobr>AL</nobr></code>, <code><nobr>AX</nobr></code> or +<code><nobr>DX:AX</nobr></code> depending on the size of the value. +Floating-point results are sometimes (depending on the compiler) returned +in <code><nobr>ST0</nobr></code>. +<li>Once the callee has finished processing, it restores +<code><nobr>SP</nobr></code> from <code><nobr>BP</nobr></code> if it had +allocated local stack space, then pops the previous value of +<code><nobr>BP</nobr></code>, and returns via +<code><nobr>RETN</nobr></code> or <code><nobr>RETF</nobr></code> depending +on memory model. +<li>When the caller regains control from the callee, the function +parameters are still on the stack, so it typically adds an immediate +constant to <code><nobr>SP</nobr></code> to remove them (instead of +executing a number of slow <code><nobr>POP</nobr></code> instructions). +Thus, if a function is accidentally called with the wrong number of +parameters due to a prototype mismatch, the stack will still be returned to +a sensible state since the caller, which <em>knows</em> how many parameters +it pushed, does the removing. +</ul> +<p>It is instructive to compare this calling convention with that for +Pascal programs (described in <a href="#section-8.5.1">section 8.5.1</a>). +Pascal has a simpler convention, since no functions have variable numbers +of parameters. Therefore the callee knows how many parameters it should +have been passed, and is able to deallocate them from the stack itself by +passing an immediate argument to the <code><nobr>RET</nobr></code> or +<code><nobr>RETF</nobr></code> instruction, so the caller does not have to +do it. Also, the parameters are pushed in left-to-right order, not +right-to-left, which means that a compiler can give better guarantees about +sequence points without performance suffering. +<p>Thus, you would define a function in C style in the following way. The +following example is for small model: +<p><pre> +global _myfunc + +_myfunc: + push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+4] ; first parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + ret +</pre> +<p>For a large-model function, you would replace +<code><nobr>RET</nobr></code> by <code><nobr>RETF</nobr></code>, and look +for the first parameter at <code><nobr>[BP+6]</nobr></code> instead of +<code><nobr>[BP+4]</nobr></code>. Of course, if one of the parameters is a +pointer, then the offsets of <em>subsequent</em> parameters will change +depending on the memory model as well: far pointers take up four bytes on +the stack when passed as a parameter, whereas near pointers take up two. +<p>At the other end of the process, to call a C function from your assembly +code, you would do something like this: +<p><pre> +extern _printf + + ; and then, further down... + + push word [myint] ; one of my integer variables + push word mystring ; pointer into my data segment + call _printf + add sp,byte 4 ; `byte' saves space + + ; then those data items... + +segment _DATA + +myint dw 1234 +mystring db 'This number -> %d <- should be 1234',10,0 +</pre> +<p>This piece of code is the small-model assembly equivalent of the C code +<p><pre> + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); +</pre> +<p>In large model, the function-call code might look more like this. In +this example, it is assumed that <code><nobr>DS</nobr></code> already holds +the segment base of the segment <code><nobr>_DATA</nobr></code>. If not, +you would have to initialize it first. +<p><pre> + push word [myint] + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + call far _printf + add sp,byte 6 +</pre> +<p>The integer value still takes up one word on the stack, since large +model does not affect the size of the <code><nobr>int</nobr></code> data +type. The first argument (pushed last) to <code><nobr>printf</nobr></code>, +however, is a data pointer, and therefore has to contain a segment and +offset part. The segment should be stored second in memory, and therefore +must be pushed first. (Of course, <code><nobr>PUSH DS</nobr></code> would +have been a shorter instruction than +<code><nobr>PUSH WORD SEG mystring</nobr></code>, if +<code><nobr>DS</nobr></code> was set up as the above example assumed.) Then +the actual call becomes a far call, since functions expect far calls in +large model; and <code><nobr>SP</nobr></code> has to be increased by 6 +rather than 4 afterwards to make up for the extra word of parameters. +<h4><a name="section-8.4.4">8.4.4 Accessing Data Items</a></h4> +<p>To get at the contents of C variables, or to declare variables which C +can access, you need only declare the names as +<code><nobr>GLOBAL</nobr></code> or <code><nobr>EXTERN</nobr></code>. +(Again, the names require leading underscores, as stated in +<a href="#section-8.4.1">section 8.4.1</a>.) Thus, a C variable declared as +<code><nobr>int i</nobr></code> can be accessed from assembler as +<p><pre> +extern _i + + mov ax,[_i] +</pre> +<p>And to declare your own integer variable which C programs can access as +<code><nobr>extern int j</nobr></code>, you do this (making sure you are +assembling in the <code><nobr>_DATA</nobr></code> segment, if necessary): +<p><pre> +global _j + +_j dw 0 +</pre> +<p>To access a C array, you need to know the size of the components of the +array. For example, <code><nobr>int</nobr></code> variables are two bytes +long, so if a C program declares an array as +<code><nobr>int a[10]</nobr></code>, you can access +<code><nobr>a[3]</nobr></code> by coding +<code><nobr>mov ax,[_a+6]</nobr></code>. (The byte offset 6 is obtained by +multiplying the desired array index, 3, by the size of the array element, +2.) The sizes of the C base types in 16-bit compilers are: 1 for +<code><nobr>char</nobr></code>, 2 for <code><nobr>short</nobr></code> and +<code><nobr>int</nobr></code>, 4 for <code><nobr>long</nobr></code> and +<code><nobr>float</nobr></code>, and 8 for +<code><nobr>double</nobr></code>. +<p>To access a C data structure, you need to know the offset from the base +of the structure to the field you are interested in. You can either do this +by converting the C structure definition into a NASM structure definition +(using <code><nobr>STRUC</nobr></code>), or by calculating the one offset +and using just that. +<p>To do either of these, you should read your C compiler's manual to find +out how it organizes data structures. NASM gives no special alignment to +structure members in its own <code><nobr>STRUC</nobr></code> macro, so you +have to specify alignment yourself if the C compiler generates it. +Typically, you might find that a structure like +<p><pre> +struct { + char c; + int i; +} foo; +</pre> +<p>might be four bytes long rather than three, since the +<code><nobr>int</nobr></code> field would be aligned to a two-byte +boundary. However, this sort of feature tends to be a configurable option +in the C compiler, either using command-line options or +<code><nobr>#pragma</nobr></code> lines, so you have to find out how your +own compiler does it. +<h4><a name="section-8.4.5">8.4.5 <code><nobr>c16.mac</nobr></code>: Helper Macros for the 16-bit C Interface</a></h4> +<p>Included in the NASM archives, in the <code><nobr>misc</nobr></code> +directory, is a file <code><nobr>c16.mac</nobr></code> of macros. It +defines three macros: <code><nobr>proc</nobr></code>, +<code><nobr>arg</nobr></code> and <code><nobr>endproc</nobr></code>. These +are intended to be used for C-style procedure definitions, and they +automate a lot of the work involved in keeping track of the calling +convention. +<p>(An alternative, TASM compatible form of <code><nobr>arg</nobr></code> +is also now built into NASM's preprocessor. See +<a href="nasmdoc4.html#section-4.8">section 4.8</a> for details.) +<p>An example of an assembly function using the macro set is given here: +<p><pre> +proc _nearproc + +%$i arg +%$j arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + add ax,[bx] + +endproc +</pre> +<p>This defines <code><nobr>_nearproc</nobr></code> to be a procedure +taking two arguments, the first (<code><nobr>i</nobr></code>) an integer +and the second (<code><nobr>j</nobr></code>) a pointer to an integer. It +returns <code><nobr>i + *j</nobr></code>. +<p>Note that the <code><nobr>arg</nobr></code> macro has an +<code><nobr>EQU</nobr></code> as the first line of its expansion, and since +the label before the macro call gets prepended to the first line of the +expanded macro, the <code><nobr>EQU</nobr></code> works, defining +<code><nobr>%$i</nobr></code> to be an offset from +<code><nobr>BP</nobr></code>. A context-local variable is used, local to +the context pushed by the <code><nobr>proc</nobr></code> macro and popped +by the <code><nobr>endproc</nobr></code> macro, so that the same argument +name can be used in later procedures. Of course, you don't <em>have</em> to +do that. +<p>The macro set produces code for near functions (tiny, small and +compact-model code) by default. You can have it generate far functions +(medium, large and huge-model code) by means of coding +<code><nobr>%define FARCODE</nobr></code>. This changes the kind of return +instruction generated by <code><nobr>endproc</nobr></code>, and also +changes the starting point for the argument offsets. The macro set contains +no intrinsic dependency on whether data pointers are far or not. +<p><code><nobr>arg</nobr></code> can take an optional parameter, giving the +size of the argument. If no size is given, 2 is assumed, since it is likely +that many function parameters will be of type +<code><nobr>int</nobr></code>. +<p>The large-model equivalent of the above function would look like this: +<p><pre> +%define FARCODE + +proc _farproc + +%$i arg +%$j arg 4 + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + +endproc +</pre> +<p>This makes use of the argument to the <code><nobr>arg</nobr></code> +macro to define a parameter of size 4, because <code><nobr>j</nobr></code> +is now a far pointer. When we load from <code><nobr>j</nobr></code>, we +must load a segment and an offset. +<h3><a name="section-8.5">8.5 Interfacing to Borland Pascal Programs</a></h3> +<p>Interfacing to Borland Pascal programs is similar in concept to +interfacing to 16-bit C programs. The differences are: +<ul> +<li>The leading underscore required for interfacing to C programs is not +required for Pascal. +<li>The memory model is always large: functions are far, data pointers are +far, and no data item can be more than 64K long. (Actually, some functions +are near, but only those functions that are local to a Pascal unit and +never called from outside it. All assembly functions that Pascal calls, and +all Pascal functions that assembly routines are able to call, are far.) +However, all static data declared in a Pascal program goes into the default +data segment, which is the one whose segment address will be in +<code><nobr>DS</nobr></code> when control is passed to your assembly code. +The only things that do not live in the default data segment are local +variables (they live in the stack segment) and dynamically allocated +variables. All data <em>pointers</em>, however, are far. +<li>The function calling convention is different - described below. +<li>Some data types, such as strings, are stored differently. +<li>There are restrictions on the segment names you are allowed to use - +Borland Pascal will ignore code or data declared in a segment it doesn't +like the name of. The restrictions are described below. +</ul> +<h4><a name="section-8.5.1">8.5.1 The Pascal Calling Convention</a></h4> +<p>The 16-bit Pascal calling convention is as follows. In the following +description, the words <em>caller</em> and <em>callee</em> are used to +denote the function doing the calling and the function which gets called. +<ul> +<li>The caller pushes the function's parameters on the stack, one after +another, in normal order (left to right, so that the first argument +specified to the function is pushed first). +<li>The caller then executes a far <code><nobr>CALL</nobr></code> +instruction to pass control to the callee. +<li>The callee receives control, and typically (although this is not +actually necessary, in functions which do not need to access their +parameters) starts by saving the value of <code><nobr>SP</nobr></code> in +<code><nobr>BP</nobr></code> so as to be able to use +<code><nobr>BP</nobr></code> as a base pointer to find its parameters on +the stack. However, the caller was probably doing this too, so part of the +calling convention states that <code><nobr>BP</nobr></code> must be +preserved by any function. Hence the callee, if it is going to set up +<code><nobr>BP</nobr></code> as a frame pointer, must push the previous +value first. +<li>The callee may then access its parameters relative to +<code><nobr>BP</nobr></code>. The word at <code><nobr>[BP]</nobr></code> +holds the previous value of <code><nobr>BP</nobr></code> as it was pushed. +The next word, at <code><nobr>[BP+2]</nobr></code>, holds the offset part +of the return address, and the next one at <code><nobr>[BP+4]</nobr></code> +the segment part. The parameters begin at <code><nobr>[BP+6]</nobr></code>. +The rightmost parameter of the function, since it was pushed last, is +accessible at this offset from <code><nobr>BP</nobr></code>; the others +follow, at successively greater offsets. +<li>The callee may also wish to decrease <code><nobr>SP</nobr></code> +further, so as to allocate space on the stack for local variables, which +will then be accessible at negative offsets from +<code><nobr>BP</nobr></code>. +<li>The callee, if it wishes to return a value to the caller, should leave +the value in <code><nobr>AL</nobr></code>, <code><nobr>AX</nobr></code> or +<code><nobr>DX:AX</nobr></code> depending on the size of the value. +Floating-point results are returned in <code><nobr>ST0</nobr></code>. +Results of type <code><nobr>Real</nobr></code> (Borland's own custom +floating-point data type, not handled directly by the FPU) are returned in +<code><nobr>DX:BX:AX</nobr></code>. To return a result of type +<code><nobr>String</nobr></code>, the caller pushes a pointer to a +temporary string before pushing the parameters, and the callee places the +returned string value at that location. The pointer is not a parameter, and +should not be removed from the stack by the <code><nobr>RETF</nobr></code> +instruction. +<li>Once the callee has finished processing, it restores +<code><nobr>SP</nobr></code> from <code><nobr>BP</nobr></code> if it had +allocated local stack space, then pops the previous value of +<code><nobr>BP</nobr></code>, and returns via +<code><nobr>RETF</nobr></code>. It uses the form of +<code><nobr>RETF</nobr></code> with an immediate parameter, giving the +number of bytes taken up by the parameters on the stack. This causes the +parameters to be removed from the stack as a side effect of the return +instruction. +<li>When the caller regains control from the callee, the function +parameters have already been removed from the stack, so it needs to do +nothing further. +</ul> +<p>Thus, you would define a function in Pascal style, taking two +<code><nobr>Integer</nobr></code>-type parameters, in the following way: +<p><pre> +global myfunc + +myfunc: push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+8] ; first parameter to function + mov bx,[bp+6] ; second parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + retf 4 ; total size of params is 4 +</pre> +<p>At the other end of the process, to call a Pascal function from your +assembly code, you would do something like this: +<p><pre> +extern SomeFunc + + ; and then, further down... + + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + push word [myint] ; one of my variables + call far SomeFunc +</pre> +<p>This is equivalent to the Pascal code +<p><pre> +procedure SomeFunc(String: PChar; Int: Integer); + SomeFunc(@mystring, myint); +</pre> +<h4><a name="section-8.5.2">8.5.2 Borland Pascal Segment Name Restrictions</a></h4> +<p>Since Borland Pascal's internal unit file format is completely different +from <code><nobr>OBJ</nobr></code>, it only makes a very sketchy job of +actually reading and understanding the various information contained in a +real <code><nobr>OBJ</nobr></code> file when it links that in. Therefore an +object file intended to be linked to a Pascal program must obey a number of +restrictions: +<ul> +<li>Procedures and functions must be in a segment whose name is either +<code><nobr>CODE</nobr></code>, <code><nobr>CSEG</nobr></code>, or +something ending in <code><nobr>_TEXT</nobr></code>. +<li>initialized data must be in a segment whose name is either +<code><nobr>CONST</nobr></code> or something ending in +<code><nobr>_DATA</nobr></code>. +<li>Uninitialized data must be in a segment whose name is either +<code><nobr>DATA</nobr></code>, <code><nobr>DSEG</nobr></code>, or +something ending in <code><nobr>_BSS</nobr></code>. +<li>Any other segments in the object file are completely ignored. +<code><nobr>GROUP</nobr></code> directives and segment attributes are also +ignored. +</ul> +<h4><a name="section-8.5.3">8.5.3 Using <code><nobr>c16.mac</nobr></code> With Pascal Programs</a></h4> +<p>The <code><nobr>c16.mac</nobr></code> macro package, described in +<a href="#section-8.4.5">section 8.4.5</a>, can also be used to simplify +writing functions to be called from Pascal programs, if you code +<code><nobr>%define PASCAL</nobr></code>. This definition ensures that +functions are far (it implies <code><nobr>FARCODE</nobr></code>), and also +causes procedure return instructions to be generated with an operand. +<p>Defining <code><nobr>PASCAL</nobr></code> does not change the code which +calculates the argument offsets; you must declare your function's arguments +in reverse order. For example: +<p><pre> +%define PASCAL + +proc _pascalproc + +%$j arg 4 +%$i arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + +endproc +</pre> +<p>This defines the same routine, conceptually, as the example in +<a href="#section-8.4.5">section 8.4.5</a>: it defines a function taking +two arguments, an integer and a pointer to an integer, which returns the +sum of the integer and the contents of the pointer. The only difference +between this code and the large-model C version is that +<code><nobr>PASCAL</nobr></code> is defined instead of +<code><nobr>FARCODE</nobr></code>, and that the arguments are declared in +reverse order. +<p align=center><a href="nasmdoc9.html">Next Chapter</a> | +<a href="nasmdoc7.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoc9.html b/doc/html/nasmdoc9.html new file mode 100644 index 0000000..811af7c --- /dev/null +++ b/doc/html/nasmdoc9.html @@ -0,0 +1,482 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdo10.html">Next Chapter</a> | +<a href="nasmdoc8.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="chapter-9">Chapter 9: Writing 32-bit Code (Unix, Win32, DJGPP)</a></h2> +<p>This chapter attempts to cover some of the common issues involved when +writing 32-bit code, to run under Win32 or Unix, or to be linked with C +code generated by a Unix-style C compiler such as DJGPP. It covers how to +write assembly code to interface with 32-bit C routines, and how to write +position-independent code for shared libraries. +<p>Almost all 32-bit code, and in particular all code running under +<code><nobr>Win32</nobr></code>, <code><nobr>DJGPP</nobr></code> or any of +the PC Unix variants, runs in <em>flat</em> memory model. This means that +the segment registers and paging have already been set up to give you the +same 32-bit 4Gb address space no matter what segment you work relative to, +and that you should ignore all segment registers completely. When writing +flat-model application code, you never need to use a segment override or +modify any segment register, and the code-section addresses you pass to +<code><nobr>CALL</nobr></code> and <code><nobr>JMP</nobr></code> live in +the same address space as the data-section addresses you access your +variables by and the stack-section addresses you access local variables and +procedure parameters by. Every address is 32 bits long and contains only an +offset part. +<h3><a name="section-9.1">9.1 Interfacing to 32-bit C Programs</a></h3> +<p>A lot of the discussion in <a href="nasmdoc8.html#section-8.4">section +8.4</a>, about interfacing to 16-bit C programs, still applies when working +in 32 bits. The absence of memory models or segmentation worries simplifies +things a lot. +<h4><a name="section-9.1.1">9.1.1 External Symbol Names</a></h4> +<p>Most 32-bit C compilers share the convention used by 16-bit compilers, +that the names of all global symbols (functions or data) they define are +formed by prefixing an underscore to the name as it appears in the C +program. However, not all of them do: the <code><nobr>ELF</nobr></code> +specification states that C symbols do <em>not</em> have a leading +underscore on their assembly-language names. +<p>The older Linux <code><nobr>a.out</nobr></code> C compiler, all +<code><nobr>Win32</nobr></code> compilers, <code><nobr>DJGPP</nobr></code>, +and <code><nobr>NetBSD</nobr></code> and <code><nobr>FreeBSD</nobr></code>, +all use the leading underscore; for these compilers, the macros +<code><nobr>cextern</nobr></code> and <code><nobr>cglobal</nobr></code>, as +given in <a href="nasmdoc8.html#section-8.4.1">section 8.4.1</a>, will +still work. For <code><nobr>ELF</nobr></code>, though, the leading +underscore should not be used. +<p>See also <a href="nasmdoc2.html#section-2.1.27">section 2.1.27</a>. +<h4><a name="section-9.1.2">9.1.2 Function Definitions and Function Calls</a></h4> +<p>The C calling convention in 32-bit programs is as follows. In the +following description, the words <em>caller</em> and <em>callee</em> are +used to denote the function doing the calling and the function which gets +called. +<ul> +<li>The caller pushes the function's parameters on the stack, one after +another, in reverse order (right to left, so that the first argument +specified to the function is pushed last). +<li>The caller then executes a near <code><nobr>CALL</nobr></code> +instruction to pass control to the callee. +<li>The callee receives control, and typically (although this is not +actually necessary, in functions which do not need to access their +parameters) starts by saving the value of <code><nobr>ESP</nobr></code> in +<code><nobr>EBP</nobr></code> so as to be able to use +<code><nobr>EBP</nobr></code> as a base pointer to find its parameters on +the stack. However, the caller was probably doing this too, so part of the +calling convention states that <code><nobr>EBP</nobr></code> must be +preserved by any C function. Hence the callee, if it is going to set up +<code><nobr>EBP</nobr></code> as a frame pointer, must push the previous +value first. +<li>The callee may then access its parameters relative to +<code><nobr>EBP</nobr></code>. The doubleword at +<code><nobr>[EBP]</nobr></code> holds the previous value of +<code><nobr>EBP</nobr></code> as it was pushed; the next doubleword, at +<code><nobr>[EBP+4]</nobr></code>, holds the return address, pushed +implicitly by <code><nobr>CALL</nobr></code>. The parameters start after +that, at <code><nobr>[EBP+8]</nobr></code>. The leftmost parameter of the +function, since it was pushed last, is accessible at this offset from +<code><nobr>EBP</nobr></code>; the others follow, at successively greater +offsets. Thus, in a function such as <code><nobr>printf</nobr></code> which +takes a variable number of parameters, the pushing of the parameters in +reverse order means that the function knows where to find its first +parameter, which tells it the number and type of the remaining ones. +<li>The callee may also wish to decrease <code><nobr>ESP</nobr></code> +further, so as to allocate space on the stack for local variables, which +will then be accessible at negative offsets from +<code><nobr>EBP</nobr></code>. +<li>The callee, if it wishes to return a value to the caller, should leave +the value in <code><nobr>AL</nobr></code>, <code><nobr>AX</nobr></code> or +<code><nobr>EAX</nobr></code> depending on the size of the value. +Floating-point results are typically returned in +<code><nobr>ST0</nobr></code>. +<li>Once the callee has finished processing, it restores +<code><nobr>ESP</nobr></code> from <code><nobr>EBP</nobr></code> if it had +allocated local stack space, then pops the previous value of +<code><nobr>EBP</nobr></code>, and returns via +<code><nobr>RET</nobr></code> (equivalently, +<code><nobr>RETN</nobr></code>). +<li>When the caller regains control from the callee, the function +parameters are still on the stack, so it typically adds an immediate +constant to <code><nobr>ESP</nobr></code> to remove them (instead of +executing a number of slow <code><nobr>POP</nobr></code> instructions). +Thus, if a function is accidentally called with the wrong number of +parameters due to a prototype mismatch, the stack will still be returned to +a sensible state since the caller, which <em>knows</em> how many parameters +it pushed, does the removing. +</ul> +<p>There is an alternative calling convention used by Win32 programs for +Windows API calls, and also for functions called <em>by</em> the Windows +API such as window procedures: they follow what Microsoft calls the +<code><nobr>__stdcall</nobr></code> convention. This is slightly closer to +the Pascal convention, in that the callee clears the stack by passing a +parameter to the <code><nobr>RET</nobr></code> instruction. However, the +parameters are still pushed in right-to-left order. +<p>Thus, you would define a function in C style in the following way: +<p><pre> +global _myfunc + +_myfunc: + push ebp + mov ebp,esp + sub esp,0x40 ; 64 bytes of local stack space + mov ebx,[ebp+8] ; first parameter to function + + ; some more code + + leave ; mov esp,ebp / pop ebp + ret +</pre> +<p>At the other end of the process, to call a C function from your assembly +code, you would do something like this: +<p><pre> +extern _printf + + ; and then, further down... + + push dword [myint] ; one of my integer variables + push dword mystring ; pointer into my data segment + call _printf + add esp,byte 8 ; `byte' saves space + + ; then those data items... + +segment _DATA + +myint dd 1234 +mystring db 'This number -> %d <- should be 1234',10,0 +</pre> +<p>This piece of code is the assembly equivalent of the C code +<p><pre> + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); +</pre> +<h4><a name="section-9.1.3">9.1.3 Accessing Data Items</a></h4> +<p>To get at the contents of C variables, or to declare variables which C +can access, you need only declare the names as +<code><nobr>GLOBAL</nobr></code> or <code><nobr>EXTERN</nobr></code>. +(Again, the names require leading underscores, as stated in +<a href="#section-9.1.1">section 9.1.1</a>.) Thus, a C variable declared as +<code><nobr>int i</nobr></code> can be accessed from assembler as +<p><pre> + extern _i + mov eax,[_i] +</pre> +<p>And to declare your own integer variable which C programs can access as +<code><nobr>extern int j</nobr></code>, you do this (making sure you are +assembling in the <code><nobr>_DATA</nobr></code> segment, if necessary): +<p><pre> + global _j +_j dd 0 +</pre> +<p>To access a C array, you need to know the size of the components of the +array. For example, <code><nobr>int</nobr></code> variables are four bytes +long, so if a C program declares an array as +<code><nobr>int a[10]</nobr></code>, you can access +<code><nobr>a[3]</nobr></code> by coding +<code><nobr>mov ax,[_a+12]</nobr></code>. (The byte offset 12 is obtained +by multiplying the desired array index, 3, by the size of the array +element, 4.) The sizes of the C base types in 32-bit compilers are: 1 for +<code><nobr>char</nobr></code>, 2 for <code><nobr>short</nobr></code>, 4 +for <code><nobr>int</nobr></code>, <code><nobr>long</nobr></code> and +<code><nobr>float</nobr></code>, and 8 for +<code><nobr>double</nobr></code>. Pointers, being 32-bit addresses, are +also 4 bytes long. +<p>To access a C data structure, you need to know the offset from the base +of the structure to the field you are interested in. You can either do this +by converting the C structure definition into a NASM structure definition +(using <code><nobr>STRUC</nobr></code>), or by calculating the one offset +and using just that. +<p>To do either of these, you should read your C compiler's manual to find +out how it organizes data structures. NASM gives no special alignment to +structure members in its own <code><nobr>STRUC</nobr></code> macro, so you +have to specify alignment yourself if the C compiler generates it. +Typically, you might find that a structure like +<p><pre> +struct { + char c; + int i; +} foo; +</pre> +<p>might be eight bytes long rather than five, since the +<code><nobr>int</nobr></code> field would be aligned to a four-byte +boundary. However, this sort of feature is sometimes a configurable option +in the C compiler, either using command-line options or +<code><nobr>#pragma</nobr></code> lines, so you have to find out how your +own compiler does it. +<h4><a name="section-9.1.4">9.1.4 <code><nobr>c32.mac</nobr></code>: Helper Macros for the 32-bit C Interface</a></h4> +<p>Included in the NASM archives, in the <code><nobr>misc</nobr></code> +directory, is a file <code><nobr>c32.mac</nobr></code> of macros. It +defines three macros: <code><nobr>proc</nobr></code>, +<code><nobr>arg</nobr></code> and <code><nobr>endproc</nobr></code>. These +are intended to be used for C-style procedure definitions, and they +automate a lot of the work involved in keeping track of the calling +convention. +<p>An example of an assembly function using the macro set is given here: +<p><pre> +proc _proc32 + +%$i arg +%$j arg + mov eax,[ebp + %$i] + mov ebx,[ebp + %$j] + add eax,[ebx] + +endproc +</pre> +<p>This defines <code><nobr>_proc32</nobr></code> to be a procedure taking +two arguments, the first (<code><nobr>i</nobr></code>) an integer and the +second (<code><nobr>j</nobr></code>) a pointer to an integer. It returns +<code><nobr>i + *j</nobr></code>. +<p>Note that the <code><nobr>arg</nobr></code> macro has an +<code><nobr>EQU</nobr></code> as the first line of its expansion, and since +the label before the macro call gets prepended to the first line of the +expanded macro, the <code><nobr>EQU</nobr></code> works, defining +<code><nobr>%$i</nobr></code> to be an offset from +<code><nobr>BP</nobr></code>. A context-local variable is used, local to +the context pushed by the <code><nobr>proc</nobr></code> macro and popped +by the <code><nobr>endproc</nobr></code> macro, so that the same argument +name can be used in later procedures. Of course, you don't <em>have</em> to +do that. +<p><code><nobr>arg</nobr></code> can take an optional parameter, giving the +size of the argument. If no size is given, 4 is assumed, since it is likely +that many function parameters will be of type <code><nobr>int</nobr></code> +or pointers. +<h3><a name="section-9.2">9.2 Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries</a></h3> +<p><code><nobr>ELF</nobr></code> replaced the older +<code><nobr>a.out</nobr></code> object file format under Linux because it +contains support for position-independent code (PIC), which makes writing +shared libraries much easier. NASM supports the +<code><nobr>ELF</nobr></code> position-independent code features, so you +can write Linux <code><nobr>ELF</nobr></code> shared libraries in NASM. +<p>NetBSD, and its close cousins FreeBSD and OpenBSD, take a different +approach by hacking PIC support into the <code><nobr>a.out</nobr></code> +format. NASM supports this as the <code><nobr>aoutb</nobr></code> output +format, so you can write BSD shared libraries in NASM too. +<p>The operating system loads a PIC shared library by memory-mapping the +library file at an arbitrarily chosen point in the address space of the +running process. The contents of the library's code section must therefore +not depend on where it is loaded in memory. +<p>Therefore, you cannot get at your variables by writing code like this: +<p><pre> + mov eax,[myvar] ; WRONG +</pre> +<p>Instead, the linker provides an area of memory called the <em>global +offset table</em>, or GOT; the GOT is situated at a constant distance from +your library's code, so if you can find out where your library is loaded +(which is typically done using a <code><nobr>CALL</nobr></code> and +<code><nobr>POP</nobr></code> combination), you can obtain the address of +the GOT, and you can then load the addresses of your variables out of +linker-generated entries in the GOT. +<p>The <em>data</em> section of a PIC shared library does not have these +restrictions: since the data section is writable, it has to be copied into +memory anyway rather than just paged in from the library file, so as long +as it's being copied it can be relocated too. So you can put ordinary types +of relocation in the data section without too much worry (but see +<a href="#section-9.2.4">section 9.2.4</a> for a caveat). +<h4><a name="section-9.2.1">9.2.1 Obtaining the Address of the GOT</a></h4> +<p>Each code module in your shared library should define the GOT as an +external symbol: +<p><pre> +extern _GLOBAL_OFFSET_TABLE_ ; in ELF +extern __GLOBAL_OFFSET_TABLE_ ; in BSD a.out +</pre> +<p>At the beginning of any function in your shared library which plans to +access your data or BSS sections, you must first calculate the address of +the GOT. This is typically done by writing the function in this form: +<p><pre> +func: push ebp + mov ebp,esp + push ebx + call .get_GOT +.get_GOT: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc + + ; the function body comes here + + mov ebx,[ebp-4] + mov esp,ebp + pop ebp + ret +</pre> +<p>(For BSD, again, the symbol +<code><nobr>_GLOBAL_OFFSET_TABLE</nobr></code> requires a second leading +underscore.) +<p>The first two lines of this function are simply the standard C prologue +to set up a stack frame, and the last three lines are standard C function +epilogue. The third line, and the fourth to last line, save and restore the +<code><nobr>EBX</nobr></code> register, because PIC shared libraries use +this register to store the address of the GOT. +<p>The interesting bit is the <code><nobr>CALL</nobr></code> instruction +and the following two lines. The <code><nobr>CALL</nobr></code> and +<code><nobr>POP</nobr></code> combination obtains the address of the label +<code><nobr>.get_GOT</nobr></code>, without having to know in advance where +the program was loaded (since the <code><nobr>CALL</nobr></code> +instruction is encoded relative to the current position). The +<code><nobr>ADD</nobr></code> instruction makes use of one of the special +PIC relocation types: GOTPC relocation. With the +<code><nobr>WRT ..gotpc</nobr></code> qualifier specified, the symbol +referenced (here <code><nobr>_GLOBAL_OFFSET_TABLE_</nobr></code>, the +special symbol assigned to the GOT) is given as an offset from the +beginning of the section. (Actually, <code><nobr>ELF</nobr></code> encodes +it as the offset from the operand field of the +<code><nobr>ADD</nobr></code> instruction, but NASM simplifies this +deliberately, so you do things the same way for both +<code><nobr>ELF</nobr></code> and <code><nobr>BSD</nobr></code>.) So the +instruction then <em>adds</em> the beginning of the section, to get the +real address of the GOT, and subtracts the value of +<code><nobr>.get_GOT</nobr></code> which it knows is in +<code><nobr>EBX</nobr></code>. Therefore, by the time that instruction has +finished, <code><nobr>EBX</nobr></code> contains the address of the GOT. +<p>If you didn't follow that, don't worry: it's never necessary to obtain +the address of the GOT by any other means, so you can put those three +instructions into a macro and safely ignore them: +<p><pre> +%macro get_GOT 0 + + call %%getgot + %%getgot: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-%%getgot wrt ..gotpc + +%endmacro +</pre> +<h4><a name="section-9.2.2">9.2.2 Finding Your Local Data Items</a></h4> +<p>Having got the GOT, you can then use it to obtain the addresses of your +data items. Most variables will reside in the sections you have declared; +they can be accessed using the <code><nobr>..gotoff</nobr></code> special +<code><nobr>WRT</nobr></code> type. The way this works is like this: +<p><pre> + lea eax,[ebx+myvar wrt ..gotoff] +</pre> +<p>The expression <code><nobr>myvar wrt ..gotoff</nobr></code> is +calculated, when the shared library is linked, to be the offset to the +local variable <code><nobr>myvar</nobr></code> from the beginning of the +GOT. Therefore, adding it to <code><nobr>EBX</nobr></code> as above will +place the real address of <code><nobr>myvar</nobr></code> in +<code><nobr>EAX</nobr></code>. +<p>If you declare variables as <code><nobr>GLOBAL</nobr></code> without +specifying a size for them, they are shared between code modules in the +library, but do not get exported from the library to the program that +loaded it. They will still be in your ordinary data and BSS sections, so +you can access them in the same way as local variables, using the above +<code><nobr>..gotoff</nobr></code> mechanism. +<p>Note that due to a peculiarity of the way BSD +<code><nobr>a.out</nobr></code> format handles this relocation type, there +must be at least one non-local symbol in the same section as the address +you're trying to access. +<h4><a name="section-9.2.3">9.2.3 Finding External and Common Data Items</a></h4> +<p>If your library needs to get at an external variable (external to the +<em>library</em>, not just to one of the modules within it), you must use +the <code><nobr>..got</nobr></code> type to get at it. The +<code><nobr>..got</nobr></code> type, instead of giving you the offset from +the GOT base to the variable, gives you the offset from the GOT base to a +GOT <em>entry</em> containing the address of the variable. The linker will +set up this GOT entry when it builds the library, and the dynamic linker +will place the correct address in it at load time. So to obtain the address +of an external variable <code><nobr>extvar</nobr></code> in +<code><nobr>EAX</nobr></code>, you would code +<p><pre> + mov eax,[ebx+extvar wrt ..got] +</pre> +<p>This loads the address of <code><nobr>extvar</nobr></code> out of an +entry in the GOT. The linker, when it builds the shared library, collects +together every relocation of type <code><nobr>..got</nobr></code>, and +builds the GOT so as to ensure it has every necessary entry present. +<p>Common variables must also be accessed in this way. +<h4><a name="section-9.2.4">9.2.4 Exporting Symbols to the Library User</a></h4> +<p>If you want to export symbols to the user of the library, you have to +declare whether they are functions or data, and if they are data, you have +to give the size of the data item. This is because the dynamic linker has +to build procedure linkage table entries for any exported functions, and +also moves exported data items away from the library's data section in +which they were declared. +<p>So to export a function to users of the library, you must use +<p><pre> +global func:function ; declare it as a function + +func: push ebp + + ; etc. +</pre> +<p>And to export a data item such as an array, you would have to code +<p><pre> +global array:data array.end-array ; give the size too + +array: resd 128 +.end: +</pre> +<p>Be careful: If you export a variable to the library user, by declaring +it as <code><nobr>GLOBAL</nobr></code> and supplying a size, the variable +will end up living in the data section of the main program, rather than in +your library's data section, where you declared it. So you will have to +access your own global variable with the <code><nobr>..got</nobr></code> +mechanism rather than <code><nobr>..gotoff</nobr></code>, as if it were +external (which, effectively, it has become). +<p>Equally, if you need to store the address of an exported global in one +of your data sections, you can't do it by means of the standard sort of +code: +<p><pre> +dataptr: dd global_data_item ; WRONG +</pre> +<p>NASM will interpret this code as an ordinary relocation, in which +<code><nobr>global_data_item</nobr></code> is merely an offset from the +beginning of the <code><nobr>.data</nobr></code> section (or whatever); so +this reference will end up pointing at your data section instead of at the +exported global which resides elsewhere. +<p>Instead of the above code, then, you must write +<p><pre> +dataptr: dd global_data_item wrt ..sym +</pre> +<p>which makes use of the special <code><nobr>WRT</nobr></code> type +<code><nobr>..sym</nobr></code> to instruct NASM to search the symbol table +for a particular symbol at that address, rather than just relocating by +section base. +<p>Either method will work for functions: referring to one of your +functions by means of +<p><pre> +funcptr: dd my_function +</pre> +<p>will give the user the address of the code you wrote, whereas +<p><pre> +funcptr: dd my_function wrt .sym +</pre> +<p>will give the address of the procedure linkage table for the function, +which is where the calling program will <em>believe</em> the function +lives. Either address is a valid way to call the function. +<h4><a name="section-9.2.5">9.2.5 Calling Procedures Outside the Library</a></h4> +<p>Calling procedures outside your shared library has to be done by means +of a <em>procedure linkage table</em>, or PLT. The PLT is placed at a known +offset from where the library is loaded, so the library code can make calls +to the PLT in a position-independent way. Within the PLT there is code to +jump to offsets contained in the GOT, so function calls to other shared +libraries or to routines in the main program can be transparently passed +off to their real destinations. +<p>To call an external routine, you must use another special PIC relocation +type, <code><nobr>WRT ..plt</nobr></code>. This is much easier than the +GOT-based ones: you simply replace calls such as +<code><nobr>CALL printf</nobr></code> with the PLT-relative version +<code><nobr>CALL printf WRT ..plt</nobr></code>. +<h4><a name="section-9.2.6">9.2.6 Generating the Library File</a></h4> +<p>Having written some code modules and assembled them to +<code><nobr>.o</nobr></code> files, you then generate your shared library +with a command such as +<p><pre> +ld -shared -o library.so module1.o module2.o # for ELF +ld -Bshareable -o library.so module1.o module2.o # for BSD +</pre> +<p>For ELF, if your shared library is going to reside in system directories +such as <code><nobr>/usr/lib</nobr></code> or +<code><nobr>/lib</nobr></code>, it is usually worth using the +<code><nobr>-soname</nobr></code> flag to the linker, to store the final +library file name, with a version number, into the library: +<p><pre> +ld -shared -soname library.so.1 -o library.so.1.2 *.o +</pre> +<p>You would then copy <code><nobr>library.so.1.2</nobr></code> into the +library directory, and create <code><nobr>library.so.1</nobr></code> as a +symbolic link to it. +<p align=center><a href="nasmdo10.html">Next Chapter</a> | +<a href="nasmdoc8.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoca.html b/doc/html/nasmdoca.html new file mode 100644 index 0000000..fda553d --- /dev/null +++ b/doc/html/nasmdoca.html @@ -0,0 +1,165 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdocb.html">Next Chapter</a> | +<a href="nasmdo12.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="appendix-A">Appendix A: Ndisasm</a></h2> +<p>The Netwide Disassembler, NDISASM +<h3><a name="section-A.1">A.1 Introduction</a></h3> +<p>The Netwide Disassembler is a small companion program to the Netwide +Assembler, NASM. It seemed a shame to have an x86 assembler, complete with +a full instruction table, and not make as much use of it as possible, so +here's a disassembler which shares the instruction table (and some other +bits of code) with NASM. +<p>The Netwide Disassembler does nothing except to produce disassemblies of +<em>binary</em> source files. NDISASM does not have any understanding of +object file formats, like <code><nobr>objdump</nobr></code>, and it will +not understand <code><nobr>DOS .EXE</nobr></code> files like +<code><nobr>debug</nobr></code> will. It just disassembles. +<h3><a name="section-A.2">A.2 Getting Started: Installation</a></h3> +<p>See <a href="nasmdoc1.html#section-1.3">section 1.3</a> for installation +instructions. NDISASM, like NASM, has a <code><nobr>man page</nobr></code> +which you may want to put somewhere useful, if you are on a Unix system. +<h3><a name="section-A.3">A.3 Running NDISASM</a></h3> +<p>To disassemble a file, you will typically use a command of the form +<p><pre> + ndisasm -b {16|32|64} filename +</pre> +<p>NDISASM can disassemble 16-, 32- or 64-bit code equally easily, provided +of course that you remember to specify which it is to work with. If no +<code><nobr>-b</nobr></code> switch is present, NDISASM works in 16-bit +mode by default. The <code><nobr>-u</nobr></code> switch (for USE32) also +invokes 32-bit mode. +<p>Two more command line options are <code><nobr>-r</nobr></code> which +reports the version number of NDISASM you are running, and +<code><nobr>-h</nobr></code> which gives a short summary of command line +options. +<h4><a name="section-A.3.1">A.3.1 COM Files: Specifying an Origin</a></h4> +<p>To disassemble a <code><nobr>DOS .COM</nobr></code> file correctly, a +disassembler must assume that the first instruction in the file is loaded +at address <code><nobr>0x100</nobr></code>, rather than at zero. NDISASM, +which assumes by default that any file you give it is loaded at zero, will +therefore need to be informed of this. +<p>The <code><nobr>-o</nobr></code> option allows you to declare a +different origin for the file you are disassembling. Its argument may be +expressed in any of the NASM numeric formats: decimal by default, if it +begins with `<code><nobr>$</nobr></code>' or `<code><nobr>0x</nobr></code>' +or ends in `<code><nobr>H</nobr></code>' it's +<code><nobr>hex</nobr></code>, if it ends in `<code><nobr>Q</nobr></code>' +it's <code><nobr>octal</nobr></code>, and if it ends in +`<code><nobr>B</nobr></code>' it's <code><nobr>binary</nobr></code>. +<p>Hence, to disassemble a <code><nobr>.COM</nobr></code> file: +<p><pre> + ndisasm -o100h filename.com +</pre> +<p>will do the trick. +<h4><a name="section-A.3.2">A.3.2 Code Following Data: Synchronisation</a></h4> +<p>Suppose you are disassembling a file which contains some data which +isn't machine code, and <em>then</em> contains some machine code. NDISASM +will faithfully plough through the data section, producing machine +instructions wherever it can (although most of them will look bizarre, and +some may have unusual prefixes, e.g. +`<code><nobr>FS OR AX,0x240A</nobr></code>'), and generating `DB' +instructions ever so often if it's totally stumped. Then it will reach the +code section. +<p>Supposing NDISASM has just finished generating a strange machine +instruction from part of the data section, and its file position is now one +byte <em>before</em> the beginning of the code section. It's entirely +possible that another spurious instruction will get generated, starting +with the final byte of the data section, and then the correct first +instruction in the code section will not be seen because the starting point +skipped over it. This isn't really ideal. +<p>To avoid this, you can specify a +`<code><nobr>synchronisation</nobr></code>' point, or indeed as many +synchronisation points as you like (although NDISASM can only handle +2147483647 sync points internally). The definition of a sync point is this: +NDISASM guarantees to hit sync points exactly during disassembly. If it is +thinking about generating an instruction which would cause it to jump over +a sync point, it will discard that instruction and output a +`<code><nobr>db</nobr></code>' instead. So it <em>will</em> start +disassembly exactly from the sync point, and so you <em>will</em> see all +the instructions in your code section. +<p>Sync points are specified using the <code><nobr>-s</nobr></code> option: +they are measured in terms of the program origin, not the file position. So +if you want to synchronize after 32 bytes of a +<code><nobr>.COM</nobr></code> file, you would have to do +<p><pre> + ndisasm -o100h -s120h file.com +</pre> +<p>rather than +<p><pre> + ndisasm -o100h -s20h file.com +</pre> +<p>As stated above, you can specify multiple sync markers if you need to, +just by repeating the <code><nobr>-s</nobr></code> option. +<h4><a name="section-A.3.3">A.3.3 Mixed Code and Data: Automatic (Intelligent) Synchronisation </a></h4> +<p>Suppose you are disassembling the boot sector of a +<code><nobr>DOS</nobr></code> floppy (maybe it has a virus, and you need to +understand the virus so that you know what kinds of damage it might have +done you). Typically, this will contain a <code><nobr>JMP</nobr></code> +instruction, then some data, then the rest of the code. So there is a very +good chance of NDISASM being <em>misaligned</em> when the data ends and the +code begins. Hence a sync point is needed. +<p>On the other hand, why should you have to specify the sync point +manually? What you'd do in order to find where the sync point would be, +surely, would be to read the <code><nobr>JMP</nobr></code> instruction, and +then to use its target address as a sync point. So can NDISASM do that for +you? +<p>The answer, of course, is yes: using either of the synonymous switches +<code><nobr>-a</nobr></code> (for automatic sync) or +<code><nobr>-i</nobr></code> (for intelligent sync) will enable +<code><nobr>auto-sync</nobr></code> mode. Auto-sync mode automatically +generates a sync point for any forward-referring PC-relative jump or call +instruction that NDISASM encounters. (Since NDISASM is one-pass, if it +encounters a PC-relative jump whose target has already been processed, +there isn't much it can do about it...) +<p>Only PC-relative jumps are processed, since an absolute jump is either +through a register (in which case NDISASM doesn't know what the register +contains) or involves a segment address (in which case the target code +isn't in the same segment that NDISASM is working in, and so the sync point +can't be placed anywhere useful). +<p>For some kinds of file, this mechanism will automatically put sync +points in all the right places, and save you from having to place any sync +points manually. However, it should be stressed that auto-sync mode is +<em>not</em> guaranteed to catch all the sync points, and you may still +have to place some manually. +<p>Auto-sync mode doesn't prevent you from declaring manual sync points: it +just adds automatically generated ones to the ones you provide. It's +perfectly feasible to specify <code><nobr>-i</nobr></code> <em>and</em> +some <code><nobr>-s</nobr></code> options. +<p>Another caveat with auto-sync mode is that if, by some unpleasant fluke, +something in your data section should disassemble to a PC-relative call or +jump instruction, NDISASM may obediently place a sync point in a totally +random place, for example in the middle of one of the instructions in your +code section. So you may end up with a wrong disassembly even if you use +auto-sync. Again, there isn't much I can do about this. If you have +problems, you'll have to use manual sync points, or use the +<code><nobr>-k</nobr></code> option (documented below) to suppress +disassembly of the data area. +<h4><a name="section-A.3.4">A.3.4 Other Options</a></h4> +<p>The <code><nobr>-e</nobr></code> option skips a header on the file, by +ignoring the first N bytes. This means that the header is <em>not</em> +counted towards the disassembly offset: if you give +<code><nobr>-e10 -o10</nobr></code>, disassembly will start at byte 10 in +the file, and this will be given offset 10, not 20. +<p>The <code><nobr>-k</nobr></code> option is provided with two +comma-separated numeric arguments, the first of which is an assembly offset +and the second is a number of bytes to skip. This <em>will</em> count the +skipped bytes towards the assembly offset: its use is to suppress +disassembly of a data section which wouldn't contain anything you wanted to +see anyway. +<h3><a name="section-A.4">A.4 Bugs and Improvements</a></h3> +<p>There are no known bugs. However, any you find, with patches if +possible, should be sent to +<a href="mailto:nasm-bugs@lists.sourceforge.net"><code><nobr>nasm-bugs@lists.sourceforge.net</nobr></code></a>, +or to the developer's site at +<a href="https://sourceforge.net/projects/nasm/"><code><nobr>https://sourceforge.net/projects/nasm/</nobr></code></a> +and we'll try to fix them. Feel free to send contributions and new features +as well. +<p align=center><a href="nasmdocb.html">Next Chapter</a> | +<a href="nasmdo12.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdocb.html b/doc/html/nasmdocb.html new file mode 100644 index 0000000..15bca45 --- /dev/null +++ b/doc/html/nasmdocb.html @@ -0,0 +1,3148 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdocc.html">Next Chapter</a> | +<a href="nasmdoca.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="appendix-B">Appendix B: Instruction List</a></h2> +<h3><a name="section-B.1">B.1 Introduction</a></h3> +<p>The following sections show the instructions which NASM currently +supports. For each instruction, there is a separate entry for each +supported addressing mode. The third column shows the processor type in +which the instruction was introduced and, when appropriate, one or more +usage flags. +<h4><a name="section-B.1.1">B.1.1 Special instructions...</a></h4> +<p><pre> +DB +DW +DD +DQ +DT +DO +DY +RESB imm 8086 +RESW +RESD +RESQ +REST +RESO +RESY +</pre> +<h4><a name="section-B.1.2">B.1.2 Conventional instructions</a></h4> +<p><pre> +AAA 8086,NOLONG +AAD 8086,NOLONG +AAD imm 8086,NOLONG +AAM 8086,NOLONG +AAM imm 8086,NOLONG +AAS 8086,NOLONG +ADC mem,reg8 8086 +ADC reg8,reg8 8086 +ADC mem,reg16 8086 +ADC reg16,reg16 8086 +ADC mem,reg32 386 +ADC reg32,reg32 386 +ADC mem,reg64 X64 +ADC reg64,reg64 X64 +ADC reg8,mem 8086 +ADC reg8,reg8 8086 +ADC reg16,mem 8086 +ADC reg16,reg16 8086 +ADC reg32,mem 386 +ADC reg32,reg32 386 +ADC reg64,mem X64 +ADC reg64,reg64 X64 +ADC rm16,imm8 8086 +ADC rm32,imm8 386 +ADC rm64,imm8 X64 +ADC reg_al,imm 8086 +ADC reg_ax,sbyte16 8086 +ADC reg_ax,imm 8086 +ADC reg_eax,sbyte32 386 +ADC reg_eax,imm 386 +ADC reg_rax,sbyte64 X64 +ADC reg_rax,imm X64 +ADC rm8,imm 8086 +ADC rm16,imm 8086 +ADC rm32,imm 386 +ADC rm64,imm X64 +ADC mem,imm8 8086 +ADC mem,imm16 8086 +ADC mem,imm32 386 +ADD mem,reg8 8086 +ADD reg8,reg8 8086 +ADD mem,reg16 8086 +ADD reg16,reg16 8086 +ADD mem,reg32 386 +ADD reg32,reg32 386 +ADD mem,reg64 X64 +ADD reg64,reg64 X64 +ADD reg8,mem 8086 +ADD reg8,reg8 8086 +ADD reg16,mem 8086 +ADD reg16,reg16 8086 +ADD reg32,mem 386 +ADD reg32,reg32 386 +ADD reg64,mem X64 +ADD reg64,reg64 X64 +ADD rm16,imm8 8086 +ADD rm32,imm8 386 +ADD rm64,imm8 X64 +ADD reg_al,imm 8086 +ADD reg_ax,sbyte16 8086 +ADD reg_ax,imm 8086 +ADD reg_eax,sbyte32 386 +ADD reg_eax,imm 386 +ADD reg_rax,sbyte64 X64 +ADD reg_rax,imm X64 +ADD rm8,imm 8086 +ADD rm16,imm 8086 +ADD rm32,imm 386 +ADD rm64,imm X64 +ADD mem,imm8 8086 +ADD mem,imm16 8086 +ADD mem,imm32 386 +AND mem,reg8 8086 +AND reg8,reg8 8086 +AND mem,reg16 8086 +AND reg16,reg16 8086 +AND mem,reg32 386 +AND reg32,reg32 386 +AND mem,reg64 X64 +AND reg64,reg64 X64 +AND reg8,mem 8086 +AND reg8,reg8 8086 +AND reg16,mem 8086 +AND reg16,reg16 8086 +AND reg32,mem 386 +AND reg32,reg32 386 +AND reg64,mem X64 +AND reg64,reg64 X64 +AND rm16,imm8 8086 +AND rm32,imm8 386 +AND rm64,imm8 X64 +AND reg_al,imm 8086 +AND reg_ax,sbyte16 8086 +AND reg_ax,imm 8086 +AND reg_eax,sbyte32 386 +AND reg_eax,imm 386 +AND reg_rax,sbyte64 X64 +AND reg_rax,imm X64 +AND rm8,imm 8086 +AND rm16,imm 8086 +AND rm32,imm 386 +AND rm64,imm X64 +AND mem,imm8 8086 +AND mem,imm16 8086 +AND mem,imm32 386 +ARPL mem,reg16 286,PROT,NOLONG +ARPL reg16,reg16 286,PROT,NOLONG +BB0_RESET PENT,CYRIX,ND +BB1_RESET PENT,CYRIX,ND +BOUND reg16,mem 186,NOLONG +BOUND reg32,mem 386,NOLONG +BSF reg16,mem 386 +BSF reg16,reg16 386 +BSF reg32,mem 386 +BSF reg32,reg32 386 +BSF reg64,mem X64 +BSF reg64,reg64 X64 +BSR reg16,mem 386 +BSR reg16,reg16 386 +BSR reg32,mem 386 +BSR reg32,reg32 386 +BSR reg64,mem X64 +BSR reg64,reg64 X64 +BSWAP reg32 486 +BSWAP reg64 X64 +BT mem,reg16 386 +BT reg16,reg16 386 +BT mem,reg32 386 +BT reg32,reg32 386 +BT mem,reg64 X64 +BT reg64,reg64 X64 +BT rm16,imm 386 +BT rm32,imm 386 +BT rm64,imm X64 +BTC mem,reg16 386 +BTC reg16,reg16 386 +BTC mem,reg32 386 +BTC reg32,reg32 386 +BTC mem,reg64 X64 +BTC reg64,reg64 X64 +BTC rm16,imm 386 +BTC rm32,imm 386 +BTC rm64,imm X64 +BTR mem,reg16 386 +BTR reg16,reg16 386 +BTR mem,reg32 386 +BTR reg32,reg32 386 +BTR mem,reg64 X64 +BTR reg64,reg64 X64 +BTR rm16,imm 386 +BTR rm32,imm 386 +BTR rm64,imm X64 +BTS mem,reg16 386 +BTS reg16,reg16 386 +BTS mem,reg32 386 +BTS reg32,reg32 386 +BTS mem,reg64 X64 +BTS reg64,reg64 X64 +BTS rm16,imm 386 +BTS rm32,imm 386 +BTS rm64,imm X64 +CALL imm 8086 +CALL imm|near 8086 +CALL imm|far 8086,ND,NOLONG +CALL imm16 8086 +CALL imm16|near 8086 +CALL imm16|far 8086,ND,NOLONG +CALL imm32 386 +CALL imm32|near 386 +CALL imm32|far 386,ND,NOLONG +CALL imm:imm 8086,NOLONG +CALL imm16:imm 8086,NOLONG +CALL imm:imm16 8086,NOLONG +CALL imm32:imm 386,NOLONG +CALL imm:imm32 386,NOLONG +CALL mem|far 8086,NOLONG +CALL mem|far X64 +CALL mem16|far 8086 +CALL mem32|far 386 +CALL mem64|far X64 +CALL mem|near 8086 +CALL mem16|near 8086 +CALL mem32|near 386,NOLONG +CALL mem64|near X64 +CALL reg16 8086 +CALL reg32 386,NOLONG +CALL reg64 X64 +CALL mem 8086 +CALL mem16 8086 +CALL mem32 386,NOLONG +CALL mem64 X64 +CBW 8086 +CDQ 386 +CDQE X64 +CLC 8086 +CLD 8086 +CLGI X64,AMD +CLI 8086 +CLTS 286,PRIV +CMC 8086 +CMP mem,reg8 8086 +CMP reg8,reg8 8086 +CMP mem,reg16 8086 +CMP reg16,reg16 8086 +CMP mem,reg32 386 +CMP reg32,reg32 386 +CMP mem,reg64 X64 +CMP reg64,reg64 X64 +CMP reg8,mem 8086 +CMP reg8,reg8 8086 +CMP reg16,mem 8086 +CMP reg16,reg16 8086 +CMP reg32,mem 386 +CMP reg32,reg32 386 +CMP reg64,mem X64 +CMP reg64,reg64 X64 +CMP rm16,imm8 8086 +CMP rm32,imm8 386 +CMP rm64,imm8 X64 +CMP reg_al,imm 8086 +CMP reg_ax,sbyte16 8086 +CMP reg_ax,imm 8086 +CMP reg_eax,sbyte32 386 +CMP reg_eax,imm 386 +CMP reg_rax,sbyte64 X64 +CMP reg_rax,imm X64 +CMP rm8,imm 8086 +CMP rm16,imm 8086 +CMP rm32,imm 386 +CMP rm64,imm X64 +CMP mem,imm8 8086 +CMP mem,imm16 8086 +CMP mem,imm32 386 +CMPSB 8086 +CMPSD 386 +CMPSQ X64 +CMPSW 8086 +CMPXCHG mem,reg8 PENT +CMPXCHG reg8,reg8 PENT +CMPXCHG mem,reg16 PENT +CMPXCHG reg16,reg16 PENT +CMPXCHG mem,reg32 PENT +CMPXCHG reg32,reg32 PENT +CMPXCHG mem,reg64 X64 +CMPXCHG reg64,reg64 X64 +CMPXCHG486 mem,reg8 486,UNDOC,ND +CMPXCHG486 reg8,reg8 486,UNDOC,ND +CMPXCHG486 mem,reg16 486,UNDOC,ND +CMPXCHG486 reg16,reg16 486,UNDOC,ND +CMPXCHG486 mem,reg32 486,UNDOC,ND +CMPXCHG486 reg32,reg32 486,UNDOC,ND +CMPXCHG8B mem PENT +CMPXCHG16B mem X64 +CPUID PENT +CPU_READ PENT,CYRIX +CPU_WRITE PENT,CYRIX +CQO X64 +CWD 8086 +CWDE 386 +DAA 8086,NOLONG +DAS 8086,NOLONG +DEC reg16 8086,NOLONG +DEC reg32 386,NOLONG +DEC rm8 8086 +DEC rm16 8086 +DEC rm32 386 +DEC rm64 X64 +DIV rm8 8086 +DIV rm16 8086 +DIV rm32 386 +DIV rm64 X64 +DMINT P6,CYRIX +EMMS PENT,MMX +ENTER imm,imm 186 +EQU imm 8086 +EQU imm:imm 8086 +F2XM1 8086,FPU +FABS 8086,FPU +FADD mem32 8086,FPU +FADD mem64 8086,FPU +FADD fpureg|to 8086,FPU +FADD fpureg 8086,FPU +FADD fpureg,fpu0 8086,FPU +FADD fpu0,fpureg 8086,FPU +FADD 8086,FPU,ND +FADDP fpureg 8086,FPU +FADDP fpureg,fpu0 8086,FPU +FADDP 8086,FPU,ND +FBLD mem80 8086,FPU +FBLD mem 8086,FPU +FBSTP mem80 8086,FPU +FBSTP mem 8086,FPU +FCHS 8086,FPU +FCLEX 8086,FPU +FCMOVB fpureg P6,FPU +FCMOVB fpu0,fpureg P6,FPU +FCMOVB P6,FPU,ND +FCMOVBE fpureg P6,FPU +FCMOVBE fpu0,fpureg P6,FPU +FCMOVBE P6,FPU,ND +FCMOVE fpureg P6,FPU +FCMOVE fpu0,fpureg P6,FPU +FCMOVE P6,FPU,ND +FCMOVNB fpureg P6,FPU +FCMOVNB fpu0,fpureg P6,FPU +FCMOVNB P6,FPU,ND +FCMOVNBE fpureg P6,FPU +FCMOVNBE fpu0,fpureg P6,FPU +FCMOVNBE P6,FPU,ND +FCMOVNE fpureg P6,FPU +FCMOVNE fpu0,fpureg P6,FPU +FCMOVNE P6,FPU,ND +FCMOVNU fpureg P6,FPU +FCMOVNU fpu0,fpureg P6,FPU +FCMOVNU P6,FPU,ND +FCMOVU fpureg P6,FPU +FCMOVU fpu0,fpureg P6,FPU +FCMOVU P6,FPU,ND +FCOM mem32 8086,FPU +FCOM mem64 8086,FPU +FCOM fpureg 8086,FPU +FCOM fpu0,fpureg 8086,FPU +FCOM 8086,FPU,ND +FCOMI fpureg P6,FPU +FCOMI fpu0,fpureg P6,FPU +FCOMI P6,FPU,ND +FCOMIP fpureg P6,FPU +FCOMIP fpu0,fpureg P6,FPU +FCOMIP P6,FPU,ND +FCOMP mem32 8086,FPU +FCOMP mem64 8086,FPU +FCOMP fpureg 8086,FPU +FCOMP fpu0,fpureg 8086,FPU +FCOMP 8086,FPU,ND +FCOMPP 8086,FPU +FCOS 386,FPU +FDECSTP 8086,FPU +FDISI 8086,FPU +FDIV mem32 8086,FPU +FDIV mem64 8086,FPU +FDIV fpureg|to 8086,FPU +FDIV fpureg 8086,FPU +FDIV fpureg,fpu0 8086,FPU +FDIV fpu0,fpureg 8086,FPU +FDIV 8086,FPU,ND +FDIVP fpureg 8086,FPU +FDIVP fpureg,fpu0 8086,FPU +FDIVP 8086,FPU,ND +FDIVR mem32 8086,FPU +FDIVR mem64 8086,FPU +FDIVR fpureg|to 8086,FPU +FDIVR fpureg,fpu0 8086,FPU +FDIVR fpureg 8086,FPU +FDIVR fpu0,fpureg 8086,FPU +FDIVR 8086,FPU,ND +FDIVRP fpureg 8086,FPU +FDIVRP fpureg,fpu0 8086,FPU +FDIVRP 8086,FPU,ND +FEMMS PENT,3DNOW +FENI 8086,FPU +FFREE fpureg 8086,FPU +FFREE 8086,FPU +FFREEP fpureg 286,FPU,UNDOC +FFREEP 286,FPU,UNDOC +FIADD mem32 8086,FPU +FIADD mem16 8086,FPU +FICOM mem32 8086,FPU +FICOM mem16 8086,FPU +FICOMP mem32 8086,FPU +FICOMP mem16 8086,FPU +FIDIV mem32 8086,FPU +FIDIV mem16 8086,FPU +FIDIVR mem32 8086,FPU +FIDIVR mem16 8086,FPU +FILD mem32 8086,FPU +FILD mem16 8086,FPU +FILD mem64 8086,FPU +FIMUL mem32 8086,FPU +FIMUL mem16 8086,FPU +FINCSTP 8086,FPU +FINIT 8086,FPU +FIST mem32 8086,FPU +FIST mem16 8086,FPU +FISTP mem32 8086,FPU +FISTP mem16 8086,FPU +FISTP mem64 8086,FPU +FISTTP mem16 PRESCOTT,FPU +FISTTP mem32 PRESCOTT,FPU +FISTTP mem64 PRESCOTT,FPU +FISUB mem32 8086,FPU +FISUB mem16 8086,FPU +FISUBR mem32 8086,FPU +FISUBR mem16 8086,FPU +FLD mem32 8086,FPU +FLD mem64 8086,FPU +FLD mem80 8086,FPU +FLD fpureg 8086,FPU +FLD 8086,FPU,ND +FLD1 8086,FPU +FLDCW mem 8086,FPU,SW +FLDENV mem 8086,FPU +FLDL2E 8086,FPU +FLDL2T 8086,FPU +FLDLG2 8086,FPU +FLDLN2 8086,FPU +FLDPI 8086,FPU +FLDZ 8086,FPU +FMUL mem32 8086,FPU +FMUL mem64 8086,FPU +FMUL fpureg|to 8086,FPU +FMUL fpureg,fpu0 8086,FPU +FMUL fpureg 8086,FPU +FMUL fpu0,fpureg 8086,FPU +FMUL 8086,FPU,ND +FMULP fpureg 8086,FPU +FMULP fpureg,fpu0 8086,FPU +FMULP 8086,FPU,ND +FNCLEX 8086,FPU +FNDISI 8086,FPU +FNENI 8086,FPU +FNINIT 8086,FPU +FNOP 8086,FPU +FNSAVE mem 8086,FPU +FNSTCW mem 8086,FPU,SW +FNSTENV mem 8086,FPU +FNSTSW mem 8086,FPU,SW +FNSTSW reg_ax 286,FPU +FPATAN 8086,FPU +FPREM 8086,FPU +FPREM1 386,FPU +FPTAN 8086,FPU +FRNDINT 8086,FPU +FRSTOR mem 8086,FPU +FSAVE mem 8086,FPU +FSCALE 8086,FPU +FSETPM 286,FPU +FSIN 386,FPU +FSINCOS 386,FPU +FSQRT 8086,FPU +FST mem32 8086,FPU +FST mem64 8086,FPU +FST fpureg 8086,FPU +FST 8086,FPU,ND +FSTCW mem 8086,FPU,SW +FSTENV mem 8086,FPU +FSTP mem32 8086,FPU +FSTP mem64 8086,FPU +FSTP mem80 8086,FPU +FSTP fpureg 8086,FPU +FSTP 8086,FPU,ND +FSTSW mem 8086,FPU,SW +FSTSW reg_ax 286,FPU +FSUB mem32 8086,FPU +FSUB mem64 8086,FPU +FSUB fpureg|to 8086,FPU +FSUB fpureg,fpu0 8086,FPU +FSUB fpureg 8086,FPU +FSUB fpu0,fpureg 8086,FPU +FSUB 8086,FPU,ND +FSUBP fpureg 8086,FPU +FSUBP fpureg,fpu0 8086,FPU +FSUBP 8086,FPU,ND +FSUBR mem32 8086,FPU +FSUBR mem64 8086,FPU +FSUBR fpureg|to 8086,FPU +FSUBR fpureg,fpu0 8086,FPU +FSUBR fpureg 8086,FPU +FSUBR fpu0,fpureg 8086,FPU +FSUBR 8086,FPU,ND +FSUBRP fpureg 8086,FPU +FSUBRP fpureg,fpu0 8086,FPU +FSUBRP 8086,FPU,ND +FTST 8086,FPU +FUCOM fpureg 386,FPU +FUCOM fpu0,fpureg 386,FPU +FUCOM 386,FPU,ND +FUCOMI fpureg P6,FPU +FUCOMI fpu0,fpureg P6,FPU +FUCOMI P6,FPU,ND +FUCOMIP fpureg P6,FPU +FUCOMIP fpu0,fpureg P6,FPU +FUCOMIP P6,FPU,ND +FUCOMP fpureg 386,FPU +FUCOMP fpu0,fpureg 386,FPU +FUCOMP 386,FPU,ND +FUCOMPP 386,FPU +FXAM 8086,FPU +FXCH fpureg 8086,FPU +FXCH fpureg,fpu0 8086,FPU +FXCH fpu0,fpureg 8086,FPU +FXCH 8086,FPU,ND +FXTRACT 8086,FPU +FYL2X 8086,FPU +FYL2XP1 8086,FPU +HLT 8086,PRIV +IBTS mem,reg16 386,SW,UNDOC,ND +IBTS reg16,reg16 386,UNDOC,ND +IBTS mem,reg32 386,SD,UNDOC,ND +IBTS reg32,reg32 386,UNDOC,ND +ICEBP 386,ND +IDIV rm8 8086 +IDIV rm16 8086 +IDIV rm32 386 +IDIV rm64 X64 +IMUL rm8 8086 +IMUL rm16 8086 +IMUL rm32 386 +IMUL rm64 X64 +IMUL reg16,mem 386 +IMUL reg16,reg16 386 +IMUL reg32,mem 386 +IMUL reg32,reg32 386 +IMUL reg64,mem X64 +IMUL reg64,reg64 X64 +IMUL reg16,mem,imm8 186 +IMUL reg16,mem,sbyte16 186,ND +IMUL reg16,mem,imm16 186 +IMUL reg16,mem,imm 186,ND +IMUL reg16,reg16,imm8 186 +IMUL reg16,reg16,sbyte16 186,ND +IMUL reg16,reg16,imm16 186 +IMUL reg16,reg16,imm 186,ND +IMUL reg32,mem,imm8 386 +IMUL reg32,mem,sbyte32 386,ND +IMUL reg32,mem,imm32 386 +IMUL reg32,mem,imm 386,ND +IMUL reg32,reg32,imm8 386 +IMUL reg32,reg32,sbyte32 386,ND +IMUL reg32,reg32,imm32 386 +IMUL reg32,reg32,imm 386,ND +IMUL reg64,mem,imm8 X64 +IMUL reg64,mem,sbyte64 X64,ND +IMUL reg64,mem,imm32 X64 +IMUL reg64,mem,imm X64,ND +IMUL reg64,reg64,imm8 X64 +IMUL reg64,reg64,sbyte64 X64,ND +IMUL reg64,reg64,imm32 X64 +IMUL reg64,reg64,imm X64,ND +IMUL reg16,imm8 186 +IMUL reg16,sbyte16 186,ND +IMUL reg16,imm16 186 +IMUL reg16,imm 186,ND +IMUL reg32,imm8 386 +IMUL reg32,sbyte32 386,ND +IMUL reg32,imm32 386 +IMUL reg32,imm 386,ND +IMUL reg64,imm8 X64 +IMUL reg64,sbyte64 X64,ND +IMUL reg64,imm32 X64 +IMUL reg64,imm X64,ND +IN reg_al,imm 8086 +IN reg_ax,imm 8086 +IN reg_eax,imm 386 +IN reg_al,reg_dx 8086 +IN reg_ax,reg_dx 8086 +IN reg_eax,reg_dx 386 +INC reg16 8086,NOLONG +INC reg32 386,NOLONG +INC rm8 8086 +INC rm16 8086 +INC rm32 386 +INC rm64 X64 +INCBIN +INSB 186 +INSD 386 +INSW 186 +INT imm 8086 +INT01 386,ND +INT1 386 +INT03 8086,ND +INT3 8086 +INTO 8086,NOLONG +INVD 486,PRIV +INVLPG mem 486,PRIV +INVLPGA reg_ax,reg_ecx X86_64,AMD,NOLONG +INVLPGA reg_eax,reg_ecx X86_64,AMD +INVLPGA reg_rax,reg_ecx X64,AMD +INVLPGA X86_64,AMD +IRET 8086 +IRETD 386 +IRETQ X64 +IRETW 8086 +JCXZ imm 8086,NOLONG +JECXZ imm 386 +JRCXZ imm X64 +JMP imm|short 8086 +JMP imm 8086,ND +JMP imm 8086 +JMP imm|near 8086,ND +JMP imm|far 8086,ND,NOLONG +JMP imm16 8086 +JMP imm16|near 8086,ND +JMP imm16|far 8086,ND,NOLONG +JMP imm32 386 +JMP imm32|near 386,ND +JMP imm32|far 386,ND,NOLONG +JMP imm:imm 8086,NOLONG +JMP imm16:imm 8086,NOLONG +JMP imm:imm16 8086,NOLONG +JMP imm32:imm 386,NOLONG +JMP imm:imm32 386,NOLONG +JMP mem|far 8086,NOLONG +JMP mem|far X64 +JMP mem16|far 8086 +JMP mem32|far 386 +JMP mem64|far X64 +JMP mem|near 8086 +JMP mem16|near 8086 +JMP mem32|near 386,NOLONG +JMP mem64|near X64 +JMP reg16 8086 +JMP reg32 386,NOLONG +JMP reg64 X64 +JMP mem 8086 +JMP mem16 8086 +JMP mem32 386,NOLONG +JMP mem64 X64 +JMPE imm IA64 +JMPE imm16 IA64 +JMPE imm32 IA64 +JMPE rm16 IA64 +JMPE rm32 IA64 +LAHF 8086 +LAR reg16,mem 286,PROT,SW +LAR reg16,reg16 286,PROT +LAR reg16,reg32 386,PROT +LAR reg16,reg64 X64,PROT,ND +LAR reg32,mem 386,PROT,SW +LAR reg32,reg16 386,PROT +LAR reg32,reg32 386,PROT +LAR reg32,reg64 X64,PROT,ND +LAR reg64,mem X64,PROT,SW +LAR reg64,reg16 X64,PROT +LAR reg64,reg32 X64,PROT +LAR reg64,reg64 X64,PROT +LDS reg16,mem 8086,NOLONG +LDS reg32,mem 386,NOLONG +LEA reg16,mem 8086 +LEA reg32,mem 386 +LEA reg64,mem X64 +LEAVE 186 +LES reg16,mem 8086,NOLONG +LES reg32,mem 386,NOLONG +LFENCE X64,AMD +LFS reg16,mem 386 +LFS reg32,mem 386 +LGDT mem 286,PRIV +LGS reg16,mem 386 +LGS reg32,mem 386 +LIDT mem 286,PRIV +LLDT mem 286,PROT,PRIV +LLDT mem16 286,PROT,PRIV +LLDT reg16 286,PROT,PRIV +LMSW mem 286,PRIV +LMSW mem16 286,PRIV +LMSW reg16 286,PRIV +LOADALL 386,UNDOC +LOADALL286 286,UNDOC +LODSB 8086 +LODSD 386 +LODSQ X64 +LODSW 8086 +LOOP imm 8086 +LOOP imm,reg_cx 8086,NOLONG +LOOP imm,reg_ecx 386 +LOOP imm,reg_rcx X64 +LOOPE imm 8086 +LOOPE imm,reg_cx 8086,NOLONG +LOOPE imm,reg_ecx 386 +LOOPE imm,reg_rcx X64 +LOOPNE imm 8086 +LOOPNE imm,reg_cx 8086,NOLONG +LOOPNE imm,reg_ecx 386 +LOOPNE imm,reg_rcx X64 +LOOPNZ imm 8086 +LOOPNZ imm,reg_cx 8086,NOLONG +LOOPNZ imm,reg_ecx 386 +LOOPNZ imm,reg_rcx X64 +LOOPZ imm 8086 +LOOPZ imm,reg_cx 8086,NOLONG +LOOPZ imm,reg_ecx 386 +LOOPZ imm,reg_rcx X64 +LSL reg16,mem 286,PROT,SW +LSL reg16,reg16 286,PROT +LSL reg16,reg32 386,PROT +LSL reg16,reg64 X64,PROT,ND +LSL reg32,mem 386,PROT,SW +LSL reg32,reg16 386,PROT +LSL reg32,reg32 386,PROT +LSL reg32,reg64 X64,PROT,ND +LSL reg64,mem X64,PROT,SW +LSL reg64,reg16 X64,PROT +LSL reg64,reg32 X64,PROT +LSL reg64,reg64 X64,PROT +LSS reg16,mem 386 +LSS reg32,mem 386 +LTR mem 286,PROT,PRIV +LTR mem16 286,PROT,PRIV +LTR reg16 286,PROT,PRIV +MFENCE X64,AMD +MONITOR PRESCOTT +MONITOR reg_eax,reg_ecx,reg_edx PRESCOTT,ND +MONITOR reg_rax,reg_ecx,reg_edx X64,ND +MOV mem,reg_sreg 8086 +MOV reg16,reg_sreg 8086 +MOV reg32,reg_sreg 386 +MOV reg_sreg,mem 8086 +MOV reg_sreg,reg16 8086 +MOV reg_sreg,reg32 386 +MOV reg_al,mem_offs 8086 +MOV reg_ax,mem_offs 8086 +MOV reg_eax,mem_offs 386 +MOV reg_rax,mem_offs X64 +MOV mem_offs,reg_al 8086 +MOV mem_offs,reg_ax 8086 +MOV mem_offs,reg_eax 386 +MOV mem_offs,reg_rax X64 +MOV reg32,reg_creg 386,PRIV,NOLONG +MOV reg64,reg_creg X64,PRIV +MOV reg_creg,reg32 386,PRIV,NOLONG +MOV reg_creg,reg64 X64,PRIV +MOV reg32,reg_dreg 386,PRIV,NOLONG +MOV reg64,reg_dreg X64,PRIV +MOV reg_dreg,reg32 386,PRIV,NOLONG +MOV reg_dreg,reg64 X64,PRIV +MOV reg32,reg_treg 386,NOLONG,ND +MOV reg_treg,reg32 386,NOLONG,ND +MOV mem,reg8 8086 +MOV reg8,reg8 8086 +MOV mem,reg16 8086 +MOV reg16,reg16 8086 +MOV mem,reg32 386 +MOV reg32,reg32 386 +MOV mem,reg64 X64 +MOV reg64,reg64 X64 +MOV reg8,mem 8086 +MOV reg8,reg8 8086 +MOV reg16,mem 8086 +MOV reg16,reg16 8086 +MOV reg32,mem 386 +MOV reg32,reg32 386 +MOV reg64,mem X64 +MOV reg64,reg64 X64 +MOV reg8,imm 8086 +MOV reg16,imm 8086 +MOV reg32,imm 386 +MOV reg64,imm X64 +MOV reg64,imm32 X64 +MOV rm8,imm 8086 +MOV rm16,imm 8086 +MOV rm32,imm 386 +MOV rm64,imm X64 +MOV mem,imm8 8086 +MOV mem,imm16 8086 +MOV mem,imm32 386 +MOVD mmxreg,mem PENT,MMX,SD +MOVD mmxreg,reg32 PENT,MMX +MOVD mem,mmxreg PENT,MMX,SD +MOVD reg32,mmxreg PENT,MMX +MOVD xmmreg,mem X64,SD +MOVD xmmreg,reg32 X64 +MOVD mem,xmmreg X64,SD +MOVD reg32,xmmreg X64,SSE +MOVQ mmxreg,mmxrm PENT,MMX +MOVQ mmxrm,mmxreg PENT,MMX +MOVQ mmxreg,rm64 X64,MMX +MOVQ rm64,mmxreg X64,MMX +MOVSB 8086 +MOVSD 386 +MOVSQ X64 +MOVSW 8086 +MOVSX reg16,mem 386 +MOVSX reg16,reg8 386 +MOVSX reg32,rm8 386 +MOVSX reg32,rm16 386 +MOVSX reg64,rm8 X64 +MOVSX reg64,rm16 X64 +MOVSXD reg64,rm32 X64 +MOVSX reg64,rm32 X64,ND +MOVZX reg16,mem 386 +MOVZX reg16,reg8 386 +MOVZX reg32,rm8 386 +MOVZX reg32,rm16 386 +MOVZX reg64,rm8 X64 +MOVZX reg64,rm16 X64 +MUL rm8 8086 +MUL rm16 8086 +MUL rm32 386 +MUL rm64 X64 +MWAIT PRESCOTT +MWAIT reg_eax,reg_ecx PRESCOTT,ND +NEG rm8 8086 +NEG rm16 8086 +NEG rm32 386 +NEG rm64 X64 +NOP 8086 +NOP rm16 P6 +NOP rm32 P6 +NOP rm64 X64 +NOT rm8 8086 +NOT rm16 8086 +NOT rm32 386 +NOT rm64 X64 +OR mem,reg8 8086 +OR reg8,reg8 8086 +OR mem,reg16 8086 +OR reg16,reg16 8086 +OR mem,reg32 386 +OR reg32,reg32 386 +OR mem,reg64 X64 +OR reg64,reg64 X64 +OR reg8,mem 8086 +OR reg8,reg8 8086 +OR reg16,mem 8086 +OR reg16,reg16 8086 +OR reg32,mem 386 +OR reg32,reg32 386 +OR reg64,mem X64 +OR reg64,reg64 X64 +OR rm16,imm8 8086 +OR rm32,imm8 386 +OR rm64,imm8 X64 +OR reg_al,imm 8086 +OR reg_ax,sbyte16 8086 +OR reg_ax,imm 8086 +OR reg_eax,sbyte32 386 +OR reg_eax,imm 386 +OR reg_rax,sbyte64 X64 +OR reg_rax,imm X64 +OR rm8,imm 8086 +OR rm16,imm 8086 +OR rm32,imm 386 +OR rm64,imm X64 +OR mem,imm8 8086 +OR mem,imm16 8086 +OR mem,imm32 386 +OUT imm,reg_al 8086 +OUT imm,reg_ax 8086 +OUT imm,reg_eax 386 +OUT reg_dx,reg_al 8086 +OUT reg_dx,reg_ax 8086 +OUT reg_dx,reg_eax 386 +OUTSB 186 +OUTSD 386 +OUTSW 186 +PACKSSDW mmxreg,mmxrm PENT,MMX +PACKSSWB mmxreg,mmxrm PENT,MMX +PACKUSWB mmxreg,mmxrm PENT,MMX +PADDB mmxreg,mmxrm PENT,MMX +PADDD mmxreg,mmxrm PENT,MMX +PADDSB mmxreg,mmxrm PENT,MMX +PADDSIW mmxreg,mmxrm PENT,MMX,CYRIX +PADDSW mmxreg,mmxrm PENT,MMX +PADDUSB mmxreg,mmxrm PENT,MMX +PADDUSW mmxreg,mmxrm PENT,MMX +PADDW mmxreg,mmxrm PENT,MMX +PAND mmxreg,mmxrm PENT,MMX +PANDN mmxreg,mmxrm PENT,MMX +PAUSE 8086 +PAVEB mmxreg,mmxrm PENT,MMX,CYRIX +PAVGUSB mmxreg,mmxrm PENT,3DNOW +PCMPEQB mmxreg,mmxrm PENT,MMX +PCMPEQD mmxreg,mmxrm PENT,MMX +PCMPEQW mmxreg,mmxrm PENT,MMX +PCMPGTB mmxreg,mmxrm PENT,MMX +PCMPGTD mmxreg,mmxrm PENT,MMX +PCMPGTW mmxreg,mmxrm PENT,MMX +PDISTIB mmxreg,mem PENT,MMX,CYRIX +PF2ID mmxreg,mmxrm PENT,3DNOW +PFACC mmxreg,mmxrm PENT,3DNOW +PFADD mmxreg,mmxrm PENT,3DNOW +PFCMPEQ mmxreg,mmxrm PENT,3DNOW +PFCMPGE mmxreg,mmxrm PENT,3DNOW +PFCMPGT mmxreg,mmxrm PENT,3DNOW +PFMAX mmxreg,mmxrm PENT,3DNOW +PFMIN mmxreg,mmxrm PENT,3DNOW +PFMUL mmxreg,mmxrm PENT,3DNOW +PFRCP mmxreg,mmxrm PENT,3DNOW +PFRCPIT1 mmxreg,mmxrm PENT,3DNOW +PFRCPIT2 mmxreg,mmxrm PENT,3DNOW +PFRSQIT1 mmxreg,mmxrm PENT,3DNOW +PFRSQRT mmxreg,mmxrm PENT,3DNOW +PFSUB mmxreg,mmxrm PENT,3DNOW +PFSUBR mmxreg,mmxrm PENT,3DNOW +PI2FD mmxreg,mmxrm PENT,3DNOW +PMACHRIW mmxreg,mem PENT,MMX,CYRIX +PMADDWD mmxreg,mmxrm PENT,MMX +PMAGW mmxreg,mmxrm PENT,MMX,CYRIX +PMULHRIW mmxreg,mmxrm PENT,MMX,CYRIX +PMULHRWA mmxreg,mmxrm PENT,3DNOW +PMULHRWC mmxreg,mmxrm PENT,MMX,CYRIX +PMULHW mmxreg,mmxrm PENT,MMX +PMULLW mmxreg,mmxrm PENT,MMX +PMVGEZB mmxreg,mem PENT,MMX,CYRIX +PMVLZB mmxreg,mem PENT,MMX,CYRIX +PMVNZB mmxreg,mem PENT,MMX,CYRIX +PMVZB mmxreg,mem PENT,MMX,CYRIX +POP reg16 8086 +POP reg32 386,NOLONG +POP reg64 X64 +POP rm16 8086 +POP rm32 386,NOLONG +POP rm64 X64 +POP reg_cs 8086,UNDOC,ND +POP reg_dess 8086,NOLONG +POP reg_fsgs 386 +POPA 186,NOLONG +POPAD 386,NOLONG +POPAW 186,NOLONG +POPF 8086 +POPFD 386,NOLONG +POPFQ X64 +POPFW 8086 +POR mmxreg,mmxrm PENT,MMX +PREFETCH mem PENT,3DNOW +PREFETCHW mem PENT,3DNOW +PSLLD mmxreg,mmxrm PENT,MMX +PSLLD mmxreg,imm PENT,MMX +PSLLQ mmxreg,mmxrm PENT,MMX +PSLLQ mmxreg,imm PENT,MMX +PSLLW mmxreg,mmxrm PENT,MMX +PSLLW mmxreg,imm PENT,MMX +PSRAD mmxreg,mmxrm PENT,MMX +PSRAD mmxreg,imm PENT,MMX +PSRAW mmxreg,mmxrm PENT,MMX +PSRAW mmxreg,imm PENT,MMX +PSRLD mmxreg,mmxrm PENT,MMX +PSRLD mmxreg,imm PENT,MMX +PSRLQ mmxreg,mmxrm PENT,MMX +PSRLQ mmxreg,imm PENT,MMX +PSRLW mmxreg,mmxrm PENT,MMX +PSRLW mmxreg,imm PENT,MMX +PSUBB mmxreg,mmxrm PENT,MMX +PSUBD mmxreg,mmxrm PENT,MMX +PSUBSB mmxreg,mmxrm PENT,MMX +PSUBSIW mmxreg,mmxrm PENT,MMX,CYRIX +PSUBSW mmxreg,mmxrm PENT,MMX +PSUBUSB mmxreg,mmxrm PENT,MMX +PSUBUSW mmxreg,mmxrm PENT,MMX +PSUBW mmxreg,mmxrm PENT,MMX +PUNPCKHBW mmxreg,mmxrm PENT,MMX +PUNPCKHDQ mmxreg,mmxrm PENT,MMX +PUNPCKHWD mmxreg,mmxrm PENT,MMX +PUNPCKLBW mmxreg,mmxrm PENT,MMX +PUNPCKLDQ mmxreg,mmxrm PENT,MMX +PUNPCKLWD mmxreg,mmxrm PENT,MMX +PUSH reg16 8086 +PUSH reg32 386,NOLONG +PUSH reg64 X64 +PUSH rm16 8086 +PUSH rm32 386,NOLONG +PUSH rm64 X64 +PUSH reg_cs 8086,NOLONG +PUSH reg_dess 8086,NOLONG +PUSH reg_fsgs 386 +PUSH imm8 186 +PUSH imm16 186,AR0,SZ +PUSH imm32 386,NOLONG,AR0,SZ +PUSH imm32 386,NOLONG,SD +PUSH imm64 X64,AR0,SZ +PUSHA 186,NOLONG +PUSHAD 386,NOLONG +PUSHAW 186,NOLONG +PUSHF 8086 +PUSHFD 386,NOLONG +PUSHFQ X64 +PUSHFW 8086 +PXOR mmxreg,mmxrm PENT,MMX +RCL rm8,unity 8086 +RCL rm8,reg_cl 8086 +RCL rm8,imm 186 +RCL rm16,unity 8086 +RCL rm16,reg_cl 8086 +RCL rm16,imm 186 +RCL rm32,unity 386 +RCL rm32,reg_cl 386 +RCL rm32,imm 386 +RCL rm64,unity X64 +RCL rm64,reg_cl X64 +RCL rm64,imm X64 +RCR rm8,unity 8086 +RCR rm8,reg_cl 8086 +RCR rm8,imm 186 +RCR rm16,unity 8086 +RCR rm16,reg_cl 8086 +RCR rm16,imm 186 +RCR rm32,unity 386 +RCR rm32,reg_cl 386 +RCR rm32,imm 386 +RCR rm64,unity X64 +RCR rm64,reg_cl X64 +RCR rm64,imm X64 +RDSHR rm32 P6,CYRIXM +RDMSR PENT,PRIV +RDPMC P6 +RDTSC PENT +RDTSCP X86_64 +RET 8086 +RET imm 8086,SW +RETF 8086 +RETF imm 8086,SW +RETN 8086 +RETN imm 8086,SW +ROL rm8,unity 8086 +ROL rm8,reg_cl 8086 +ROL rm8,imm 186 +ROL rm16,unity 8086 +ROL rm16,reg_cl 8086 +ROL rm16,imm 186 +ROL rm32,unity 386 +ROL rm32,reg_cl 386 +ROL rm32,imm 386 +ROL rm64,unity X64 +ROL rm64,reg_cl X64 +ROL rm64,imm X64 +ROR rm8,unity 8086 +ROR rm8,reg_cl 8086 +ROR rm8,imm 186 +ROR rm16,unity 8086 +ROR rm16,reg_cl 8086 +ROR rm16,imm 186 +ROR rm32,unity 386 +ROR rm32,reg_cl 386 +ROR rm32,imm 386 +ROR rm64,unity X64 +ROR rm64,reg_cl X64 +ROR rm64,imm X64 +RDM P6,CYRIX,ND +RSDC reg_sreg,mem80 486,CYRIXM +RSLDT mem80 486,CYRIXM +RSM PENTM +RSTS mem80 486,CYRIXM +SAHF 8086 +SAL rm8,unity 8086,ND +SAL rm8,reg_cl 8086,ND +SAL rm8,imm 186,ND +SAL rm16,unity 8086,ND +SAL rm16,reg_cl 8086,ND +SAL rm16,imm 186,ND +SAL rm32,unity 386,ND +SAL rm32,reg_cl 386,ND +SAL rm32,imm 386,ND +SAL rm64,unity X64,ND +SAL rm64,reg_cl X64,ND +SAL rm64,imm X64,ND +SALC 8086,UNDOC +SAR rm8,unity 8086 +SAR rm8,reg_cl 8086 +SAR rm8,imm 186 +SAR rm16,unity 8086 +SAR rm16,reg_cl 8086 +SAR rm16,imm 186 +SAR rm32,unity 386 +SAR rm32,reg_cl 386 +SAR rm32,imm 386 +SAR rm64,unity X64 +SAR rm64,reg_cl X64 +SAR rm64,imm X64 +SBB mem,reg8 8086 +SBB reg8,reg8 8086 +SBB mem,reg16 8086 +SBB reg16,reg16 8086 +SBB mem,reg32 386 +SBB reg32,reg32 386 +SBB mem,reg64 X64 +SBB reg64,reg64 X64 +SBB reg8,mem 8086 +SBB reg8,reg8 8086 +SBB reg16,mem 8086 +SBB reg16,reg16 8086 +SBB reg32,mem 386 +SBB reg32,reg32 386 +SBB reg64,mem X64 +SBB reg64,reg64 X64 +SBB rm16,imm8 8086 +SBB rm32,imm8 386 +SBB rm64,imm8 X64 +SBB reg_al,imm 8086 +SBB reg_ax,sbyte16 8086 +SBB reg_ax,imm 8086 +SBB reg_eax,sbyte32 386 +SBB reg_eax,imm 386 +SBB reg_rax,sbyte64 X64 +SBB reg_rax,imm X64 +SBB rm8,imm 8086 +SBB rm16,imm 8086 +SBB rm32,imm 386 +SBB rm64,imm X64 +SBB mem,imm8 8086 +SBB mem,imm16 8086 +SBB mem,imm32 386 +SCASB 8086 +SCASD 386 +SCASQ X64 +SCASW 8086 +SFENCE X64,AMD +SGDT mem 286 +SHL rm8,unity 8086 +SHL rm8,reg_cl 8086 +SHL rm8,imm 186 +SHL rm16,unity 8086 +SHL rm16,reg_cl 8086 +SHL rm16,imm 186 +SHL rm32,unity 386 +SHL rm32,reg_cl 386 +SHL rm32,imm 386 +SHL rm64,unity X64 +SHL rm64,reg_cl X64 +SHL rm64,imm X64 +SHLD mem,reg16,imm 3862 +SHLD reg16,reg16,imm 3862 +SHLD mem,reg32,imm 3862 +SHLD reg32,reg32,imm 3862 +SHLD mem,reg64,imm X642 +SHLD reg64,reg64,imm X642 +SHLD mem,reg16,reg_cl 386 +SHLD reg16,reg16,reg_cl 386 +SHLD mem,reg32,reg_cl 386 +SHLD reg32,reg32,reg_cl 386 +SHLD mem,reg64,reg_cl X64 +SHLD reg64,reg64,reg_cl X64 +SHR rm8,unity 8086 +SHR rm8,reg_cl 8086 +SHR rm8,imm 186 +SHR rm16,unity 8086 +SHR rm16,reg_cl 8086 +SHR rm16,imm 186 +SHR rm32,unity 386 +SHR rm32,reg_cl 386 +SHR rm32,imm 386 +SHR rm64,unity X64 +SHR rm64,reg_cl X64 +SHR rm64,imm X64 +SHRD mem,reg16,imm 3862 +SHRD reg16,reg16,imm 3862 +SHRD mem,reg32,imm 3862 +SHRD reg32,reg32,imm 3862 +SHRD mem,reg64,imm X642 +SHRD reg64,reg64,imm X642 +SHRD mem,reg16,reg_cl 386 +SHRD reg16,reg16,reg_cl 386 +SHRD mem,reg32,reg_cl 386 +SHRD reg32,reg32,reg_cl 386 +SHRD mem,reg64,reg_cl X64 +SHRD reg64,reg64,reg_cl X64 +SIDT mem 286 +SLDT mem 286 +SLDT mem16 286 +SLDT reg16 286 +SLDT reg32 386 +SLDT reg64 X64,ND +SLDT reg64 X64 +SKINIT X64 +SMI 386,UNDOC +SMINT P6,CYRIX,ND +SMINTOLD 486,CYRIX,ND +SMSW mem 286 +SMSW mem16 286 +SMSW reg16 286 +SMSW reg32 386 +STC 8086 +STD 8086 +STGI X64 +STI 8086 +STOSB 8086 +STOSD 386 +STOSQ X64 +STOSW 8086 +STR mem 286,PROT +STR mem16 286,PROT +STR reg16 286,PROT +STR reg32 386,PROT +STR reg64 X64 +SUB mem,reg8 8086 +SUB reg8,reg8 8086 +SUB mem,reg16 8086 +SUB reg16,reg16 8086 +SUB mem,reg32 386 +SUB reg32,reg32 386 +SUB mem,reg64 X64 +SUB reg64,reg64 X64 +SUB reg8,mem 8086 +SUB reg8,reg8 8086 +SUB reg16,mem 8086 +SUB reg16,reg16 8086 +SUB reg32,mem 386 +SUB reg32,reg32 386 +SUB reg64,mem X64 +SUB reg64,reg64 X64 +SUB rm16,imm8 8086 +SUB rm32,imm8 386 +SUB rm64,imm8 X64 +SUB reg_al,imm 8086 +SUB reg_ax,sbyte16 8086 +SUB reg_ax,imm 8086 +SUB reg_eax,sbyte32 386 +SUB reg_eax,imm 386 +SUB reg_rax,sbyte64 X64 +SUB reg_rax,imm X64 +SUB rm8,imm 8086 +SUB rm16,imm 8086 +SUB rm32,imm 386 +SUB rm64,imm X64 +SUB mem,imm8 8086 +SUB mem,imm16 8086 +SUB mem,imm32 386 +SVDC mem80,reg_sreg 486,CYRIXM +SVLDT mem80 486,CYRIXM,ND +SVTS mem80 486,CYRIXM +SWAPGS X64 +SYSCALL P6,AMD +SYSENTER P6 +SYSEXIT P6,PRIV +SYSRET P6,PRIV,AMD +TEST mem,reg8 8086 +TEST reg8,reg8 8086 +TEST mem,reg16 8086 +TEST reg16,reg16 8086 +TEST mem,reg32 386 +TEST reg32,reg32 386 +TEST mem,reg64 X64 +TEST reg64,reg64 X64 +TEST reg8,mem 8086 +TEST reg16,mem 8086 +TEST reg32,mem 386 +TEST reg64,mem X64 +TEST reg_al,imm 8086 +TEST reg_ax,imm 8086 +TEST reg_eax,imm 386 +TEST reg_rax,imm X64 +TEST rm8,imm 8086 +TEST rm16,imm 8086 +TEST rm32,imm 386 +TEST rm64,imm X64 +TEST mem,imm8 8086 +TEST mem,imm16 8086 +TEST mem,imm32 386 +UD0 186,UNDOC +UD1 186,UNDOC +UD2B 186,UNDOC,ND +UD2 186 +UD2A 186,ND +UMOV mem,reg8 386,UNDOC,ND +UMOV reg8,reg8 386,UNDOC,ND +UMOV mem,reg16 386,UNDOC,ND +UMOV reg16,reg16 386,UNDOC,ND +UMOV mem,reg32 386,UNDOC,ND +UMOV reg32,reg32 386,UNDOC,ND +UMOV reg8,mem 386,UNDOC,ND +UMOV reg8,reg8 386,UNDOC,ND +UMOV reg16,mem 386,UNDOC,ND +UMOV reg16,reg16 386,UNDOC,ND +UMOV reg32,mem 386,UNDOC,ND +UMOV reg32,reg32 386,UNDOC,ND +VERR mem 286,PROT +VERR mem16 286,PROT +VERR reg16 286,PROT +VERW mem 286,PROT +VERW mem16 286,PROT +VERW reg16 286,PROT +FWAIT 8086 +WBINVD 486,PRIV +WRSHR rm32 P6,CYRIXM +WRMSR PENT,PRIV +XADD mem,reg8 486 +XADD reg8,reg8 486 +XADD mem,reg16 486 +XADD reg16,reg16 486 +XADD mem,reg32 486 +XADD reg32,reg32 486 +XADD mem,reg64 X64 +XADD reg64,reg64 X64 +XBTS reg16,mem 386,SW,UNDOC,ND +XBTS reg16,reg16 386,UNDOC,ND +XBTS reg32,mem 386,SD,UNDOC,ND +XBTS reg32,reg32 386,UNDOC,ND +XCHG reg_ax,reg16 8086 +XCHG reg_eax,reg32na 386 +XCHG reg_rax,reg64 X64 +XCHG reg16,reg_ax 8086 +XCHG reg32na,reg_eax 386 +XCHG reg64,reg_rax X64 +XCHG reg_eax,reg_eax 386,NOLONG +XCHG reg8,mem 8086 +XCHG reg8,reg8 8086 +XCHG reg16,mem 8086 +XCHG reg16,reg16 8086 +XCHG reg32,mem 386 +XCHG reg32,reg32 386 +XCHG reg64,mem X64 +XCHG reg64,reg64 X64 +XCHG mem,reg8 8086 +XCHG reg8,reg8 8086 +XCHG mem,reg16 8086 +XCHG reg16,reg16 8086 +XCHG mem,reg32 386 +XCHG reg32,reg32 386 +XCHG mem,reg64 X64 +XCHG reg64,reg64 X64 +XLATB 8086 +XLAT 8086 +XOR mem,reg8 8086 +XOR reg8,reg8 8086 +XOR mem,reg16 8086 +XOR reg16,reg16 8086 +XOR mem,reg32 386 +XOR reg32,reg32 386 +XOR mem,reg64 X64 +XOR reg64,reg64 X64 +XOR reg8,mem 8086 +XOR reg8,reg8 8086 +XOR reg16,mem 8086 +XOR reg16,reg16 8086 +XOR reg32,mem 386 +XOR reg32,reg32 386 +XOR reg64,mem X64 +XOR reg64,reg64 X64 +XOR rm16,imm8 8086 +XOR rm32,imm8 386 +XOR rm64,imm8 X64 +XOR reg_al,imm 8086 +XOR reg_ax,sbyte16 8086 +XOR reg_ax,imm 8086 +XOR reg_eax,sbyte32 386 +XOR reg_eax,imm 386 +XOR reg_rax,sbyte64 X64 +XOR reg_rax,imm X64 +XOR rm8,imm 8086 +XOR rm16,imm 8086 +XOR rm32,imm 386 +XOR rm64,imm X64 +XOR mem,imm8 8086 +XOR mem,imm16 8086 +XOR mem,imm32 386 +CMOVcc reg16,mem P6 +CMOVcc reg16,reg16 P6 +CMOVcc reg32,mem P6 +CMOVcc reg32,reg32 P6 +CMOVcc reg64,mem X64 +CMOVcc reg64,reg64 X64 +Jcc imm|near 386 +Jcc imm16|near 386 +Jcc imm32|near 386 +Jcc imm|short 8086,ND +Jcc imm 8086,ND +Jcc imm 386,ND +Jcc imm 8086,ND +Jcc imm 8086 +SETcc mem 386 +SETcc reg8 386 +</pre> +<h4><a name="section-B.1.3">B.1.3 Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)</a></h4> +<p><pre> +ADDPS xmmreg,xmmrm KATMAI,SSE +ADDSS xmmreg,xmmrm KATMAI,SSE,SD +ANDNPS xmmreg,xmmrm KATMAI,SSE +ANDPS xmmreg,xmmrm KATMAI,SSE +CMPEQPS xmmreg,xmmrm KATMAI,SSE +CMPEQSS xmmreg,xmmrm KATMAI,SSE +CMPLEPS xmmreg,xmmrm KATMAI,SSE +CMPLESS xmmreg,xmmrm KATMAI,SSE +CMPLTPS xmmreg,xmmrm KATMAI,SSE +CMPLTSS xmmreg,xmmrm KATMAI,SSE +CMPNEQPS xmmreg,xmmrm KATMAI,SSE +CMPNEQSS xmmreg,xmmrm KATMAI,SSE +CMPNLEPS xmmreg,xmmrm KATMAI,SSE +CMPNLESS xmmreg,xmmrm KATMAI,SSE +CMPNLTPS xmmreg,xmmrm KATMAI,SSE +CMPNLTSS xmmreg,xmmrm KATMAI,SSE +CMPORDPS xmmreg,xmmrm KATMAI,SSE +CMPORDSS xmmreg,xmmrm KATMAI,SSE +CMPUNORDPS xmmreg,xmmrm KATMAI,SSE +CMPUNORDSS xmmreg,xmmrm KATMAI,SSE +CMPPS xmmreg,mem,imm KATMAI,SSE +CMPPS xmmreg,xmmreg,imm KATMAI,SSE +CMPSS xmmreg,mem,imm KATMAI,SSE +CMPSS xmmreg,xmmreg,imm KATMAI,SSE +COMISS xmmreg,xmmrm KATMAI,SSE +CVTPI2PS xmmreg,mmxrm KATMAI,SSE,MMX +CVTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX +CVTSI2SS xmmreg,mem KATMAI,SSE,SD,AR1,ND +CVTSI2SS xmmreg,rm32 KATMAI,SSE,SD,AR1 +CVTSI2SS xmmreg,rm64 X64,SSE,AR1 +CVTSS2SI reg32,xmmreg KATMAI,SSE,SD,AR1 +CVTSS2SI reg32,mem KATMAI,SSE,SD,AR1 +CVTSS2SI reg64,xmmreg X64,SSE,SD,AR1 +CVTSS2SI reg64,mem X64,SSE,SD,AR1 +CVTTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX +CVTTSS2SI reg32,xmmrm KATMAI,SSE,SD,AR1 +CVTTSS2SI reg64,xmmrm X64,SSE,SD,AR1 +DIVPS xmmreg,xmmrm KATMAI,SSE +DIVSS xmmreg,xmmrm KATMAI,SSE +LDMXCSR mem KATMAI,SSE,SD +MAXPS xmmreg,xmmrm KATMAI,SSE +MAXSS xmmreg,xmmrm KATMAI,SSE +MINPS xmmreg,xmmrm KATMAI,SSE +MINSS xmmreg,xmmrm KATMAI,SSE +MOVAPS xmmreg,mem KATMAI,SSE +MOVAPS mem,xmmreg KATMAI,SSE +MOVAPS xmmreg,xmmreg KATMAI,SSE +MOVAPS xmmreg,xmmreg KATMAI,SSE +MOVHPS xmmreg,mem KATMAI,SSE +MOVHPS mem,xmmreg KATMAI,SSE +MOVLHPS xmmreg,xmmreg KATMAI,SSE +MOVLPS xmmreg,mem KATMAI,SSE +MOVLPS mem,xmmreg KATMAI,SSE +MOVHLPS xmmreg,xmmreg KATMAI,SSE +MOVMSKPS reg32,xmmreg KATMAI,SSE +MOVMSKPS reg64,xmmreg X64,SSE +MOVNTPS mem,xmmreg KATMAI,SSE +MOVSS xmmreg,mem KATMAI,SSE +MOVSS mem,xmmreg KATMAI,SSE +MOVSS xmmreg,xmmreg KATMAI,SSE +MOVSS xmmreg,xmmreg KATMAI,SSE +MOVUPS xmmreg,mem KATMAI,SSE +MOVUPS mem,xmmreg KATMAI,SSE +MOVUPS xmmreg,xmmreg KATMAI,SSE +MOVUPS xmmreg,xmmreg KATMAI,SSE +MULPS xmmreg,xmmrm KATMAI,SSE +MULSS xmmreg,xmmrm KATMAI,SSE +ORPS xmmreg,xmmrm KATMAI,SSE +RCPPS xmmreg,xmmrm KATMAI,SSE +RCPSS xmmreg,xmmrm KATMAI,SSE +RSQRTPS xmmreg,xmmrm KATMAI,SSE +RSQRTSS xmmreg,xmmrm KATMAI,SSE +SHUFPS xmmreg,mem,imm KATMAI,SSE +SHUFPS xmmreg,xmmreg,imm KATMAI,SSE +SQRTPS xmmreg,xmmrm KATMAI,SSE +SQRTSS xmmreg,xmmrm KATMAI,SSE +STMXCSR mem KATMAI,SSE,SD +SUBPS xmmreg,xmmrm KATMAI,SSE +SUBSS xmmreg,xmmrm KATMAI,SSE +UCOMISS xmmreg,xmmrm KATMAI,SSE +UNPCKHPS xmmreg,xmmrm KATMAI,SSE +UNPCKLPS xmmreg,xmmrm KATMAI,SSE +XORPS xmmreg,xmmrm KATMAI,SSE +</pre> +<h4><a name="section-B.1.4">B.1.4 Introduced in Deschutes but necessary for SSE support</a></h4> +<p><pre> +FXRSTOR mem P6,SSE,FPU +FXSAVE mem P6,SSE,FPU +</pre> +<h4><a name="section-B.1.5">B.1.5 XSAVE group (AVX and extended state)</a></h4> +<p><pre> +XGETBV NEHALEM +XSETBV NEHALEM,PRIV +XSAVE mem NEHALEM +XRSTOR mem NEHALEM +</pre> +<h4><a name="section-B.1.6">B.1.6 Generic memory operations</a></h4> +<p><pre> +PREFETCHNTA mem KATMAI +PREFETCHT0 mem KATMAI +PREFETCHT1 mem KATMAI +PREFETCHT2 mem KATMAI +SFENCE KATMAI +</pre> +<h4><a name="section-B.1.7">B.1.7 New MMX instructions introduced in Katmai</a></h4> +<p><pre> +MASKMOVQ mmxreg,mmxreg KATMAI,MMX +MOVNTQ mem,mmxreg KATMAI,MMX +PAVGB mmxreg,mmxrm KATMAI,MMX +PAVGW mmxreg,mmxrm KATMAI,MMX +PEXTRW reg32,mmxreg,imm KATMAI,MMX +PINSRW mmxreg,mem,imm KATMAI,MMX +PINSRW mmxreg,rm16,imm KATMAI,MMX +PINSRW mmxreg,reg32,imm KATMAI,MMX +PMAXSW mmxreg,mmxrm KATMAI,MMX +PMAXUB mmxreg,mmxrm KATMAI,MMX +PMINSW mmxreg,mmxrm KATMAI,MMX +PMINUB mmxreg,mmxrm KATMAI,MMX +PMOVMSKB reg32,mmxreg KATMAI,MMX +PMULHUW mmxreg,mmxrm KATMAI,MMX +PSADBW mmxreg,mmxrm KATMAI,MMX +PSHUFW mmxreg,mmxrm,imm KATMAI,MMX2 +</pre> +<h4><a name="section-B.1.8">B.1.8 AMD Enhanced 3DNow! (Athlon) instructions</a></h4> +<p><pre> +PF2IW mmxreg,mmxrm PENT,3DNOW +PFNACC mmxreg,mmxrm PENT,3DNOW +PFPNACC mmxreg,mmxrm PENT,3DNOW +PI2FW mmxreg,mmxrm PENT,3DNOW +PSWAPD mmxreg,mmxrm PENT,3DNOW +</pre> +<h4><a name="section-B.1.9">B.1.9 Willamette SSE2 Cacheability Instructions</a></h4> +<p><pre> +MASKMOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +CLFLUSH mem WILLAMETTE,SSE2 +MOVNTDQ mem,xmmreg WILLAMETTE,SSE2,SO +MOVNTI mem,reg32 WILLAMETTE,SD +MOVNTI mem,reg64 X64 +MOVNTPD mem,xmmreg WILLAMETTE,SSE2,SO +LFENCE WILLAMETTE,SSE2 +MFENCE WILLAMETTE,SSE2 +</pre> +<h4><a name="section-B.1.10">B.1.10 Willamette MMX instructions (SSE2 SIMD Integer Instructions)</a></h4> +<p><pre> +MOVD mem,xmmreg WILLAMETTE,SSE2,SD +MOVD xmmreg,mem WILLAMETTE,SSE2,SD +MOVD xmmreg,rm32 WILLAMETTE,SSE2 +MOVD rm32,xmmreg WILLAMETTE,SSE2 +MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 +MOVDQA mem,xmmreg WILLAMETTE,SSE2,SO +MOVDQA xmmreg,mem WILLAMETTE,SSE2,SO +MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 +MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +MOVDQU mem,xmmreg WILLAMETTE,SSE2,SO +MOVDQU xmmreg,mem WILLAMETTE,SSE2,SO +MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +MOVDQ2Q mmxreg,xmmreg WILLAMETTE,SSE2 +MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 +MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 +MOVQ mem,xmmreg WILLAMETTE,SSE2 +MOVQ xmmreg,mem WILLAMETTE,SSE2 +MOVQ xmmreg,rm64 X64,SSE2 +MOVQ rm64,xmmreg X64,SSE2 +MOVQ2DQ xmmreg,mmxreg WILLAMETTE,SSE2 +PACKSSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PACKSSDW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PACKUSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDQ mmxreg,mmxrm WILLAMETTE,MMX +PADDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PADDUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PAND xmmreg,xmmrm WILLAMETTE,SSE2,SO +PANDN xmmreg,xmmrm WILLAMETTE,SSE2,SO +PAVGB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PAVGW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPEQB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPEQW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPEQD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPGTB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPGTW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PCMPGTD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PEXTRW reg32,xmmreg,imm WILLAMETTE,SSE2 +PINSRW xmmreg,reg16,imm WILLAMETTE,SSE2 +PINSRW xmmreg,reg32,imm WILLAMETTE,SSE2,ND +PINSRW xmmreg,mem,imm WILLAMETTE,SSE2 +PINSRW xmmreg,mem16,imm WILLAMETTE,SSE2 +PMADDWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMAXSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMAXUB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMINSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMINUB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMOVMSKB reg32,xmmreg WILLAMETTE,SSE2 +PMULHUW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMULHW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMULLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PMULUDQ mmxreg,mmxrm WILLAMETTE,SSE2,SO +PMULUDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +POR xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSADBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSHUFD xmmreg,xmmreg,imm WILLAMETTE,SSE2 +PSHUFD xmmreg,mem,imm WILLAMETTE,SSE22 +PSHUFHW xmmreg,xmmreg,imm WILLAMETTE,SSE2 +PSHUFHW xmmreg,mem,imm WILLAMETTE,SSE22 +PSHUFLW xmmreg,xmmreg,imm WILLAMETTE,SSE2 +PSHUFLW xmmreg,mem,imm WILLAMETTE,SSE22 +PSLLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 +PSLLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSLLW xmmreg,imm WILLAMETTE,SSE2,AR1 +PSLLD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSLLD xmmreg,imm WILLAMETTE,SSE2,AR1 +PSLLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSLLQ xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRAW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSRAW xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRAD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSRAD xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSRLW xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRLD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSRLD xmmreg,imm WILLAMETTE,SSE2,AR1 +PSRLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSRLQ xmmreg,imm WILLAMETTE,SSE2,AR1 +PSUBB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBQ mmxreg,mmxrm WILLAMETTE,SSE2,SO +PSUBQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +PSUBUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKHBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKHWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKHDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKHQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKLBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKLWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKLDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PUNPCKLQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +PXOR xmmreg,xmmrm WILLAMETTE,SSE2,SO +</pre> +<h4><a name="section-B.1.11">B.1.11 Willamette Streaming SIMD instructions (SSE2)</a></h4> +<p><pre> +ADDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +ADDSD xmmreg,xmmrm WILLAMETTE,SSE2 +ANDNPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +ANDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPEQSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPLESD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPLTSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPNEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPNEQSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPNLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPNLESD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPNLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPNLTSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPORDSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPUNORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +CMPUNORDSD xmmreg,xmmrm WILLAMETTE,SSE2 +CMPPD xmmreg,xmmrm,imm WILLAMETTE,SSE22 +CMPSD xmmreg,xmmrm,imm WILLAMETTE,SSE2 +COMISD xmmreg,xmmrm WILLAMETTE,SSE2 +CVTDQ2PD xmmreg,xmmrm WILLAMETTE,SSE2 +CVTDQ2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO +CVTPD2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTPI2PD xmmreg,mmxrm WILLAMETTE,SSE2 +CVTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTPS2PD xmmreg,xmmrm WILLAMETTE,SSE2 +CVTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 +CVTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 +CVTSD2SI reg64,xmmreg X64,SSE2,AR1 +CVTSD2SI reg64,mem X64,SSE2,AR1 +CVTSD2SS xmmreg,xmmrm WILLAMETTE,SSE2 +CVTSI2SD xmmreg,mem WILLAMETTE,SSE2,SD,AR1,ND +CVTSI2SD xmmreg,rm32 WILLAMETTE,SSE2,SD,AR1 +CVTSI2SD xmmreg,rm64 X64,SSE2,AR1 +CVTSS2SD xmmreg,xmmrm WILLAMETTE,SSE2,SD +CVTTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO +CVTTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +CVTTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 +CVTTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 +CVTTSD2SI reg64,xmmreg X64,SSE2,AR1 +CVTTSD2SI reg64,mem X64,SSE2,AR1 +DIVPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +DIVSD xmmreg,xmmrm WILLAMETTE,SSE2 +MAXPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +MAXSD xmmreg,xmmrm WILLAMETTE,SSE2 +MINPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +MINSD xmmreg,xmmrm WILLAMETTE,SSE2 +MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVAPD mem,xmmreg WILLAMETTE,SSE2,SO +MOVAPD xmmreg,mem WILLAMETTE,SSE2,SO +MOVHPD mem,xmmreg WILLAMETTE,SSE2 +MOVHPD xmmreg,mem WILLAMETTE,SSE2 +MOVLPD mem,xmmreg WILLAMETTE,SSE2 +MOVLPD xmmreg,mem WILLAMETTE,SSE2 +MOVMSKPD reg32,xmmreg WILLAMETTE,SSE2 +MOVMSKPD reg64,xmmreg X64,SSE2 +MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVSD mem,xmmreg WILLAMETTE,SSE2 +MOVSD xmmreg,mem WILLAMETTE,SSE2 +MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 +MOVUPD mem,xmmreg WILLAMETTE,SSE2,SO +MOVUPD xmmreg,mem WILLAMETTE,SSE2,SO +MULPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +MULSD xmmreg,xmmrm WILLAMETTE,SSE2 +ORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +SHUFPD xmmreg,xmmreg,imm WILLAMETTE,SSE2 +SHUFPD xmmreg,mem,imm WILLAMETTE,SSE2 +SQRTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +SQRTSD xmmreg,xmmrm WILLAMETTE,SSE2 +SUBPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +SUBSD xmmreg,xmmrm WILLAMETTE,SSE2 +UCOMISD xmmreg,xmmrm WILLAMETTE,SSE2 +UNPCKHPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +UNPCKLPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +XORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +</pre> +<h4><a name="section-B.1.12">B.1.12 Prescott New Instructions (SSE3)</a></h4> +<p><pre> +ADDSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO +ADDSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO +HADDPD xmmreg,xmmrm PRESCOTT,SSE3,SO +HADDPS xmmreg,xmmrm PRESCOTT,SSE3,SO +HSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO +HSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO +LDDQU xmmreg,mem PRESCOTT,SSE3,SO +MOVDDUP xmmreg,xmmrm PRESCOTT,SSE3 +MOVSHDUP xmmreg,xmmrm PRESCOTT,SSE3 +MOVSLDUP xmmreg,xmmrm PRESCOTT,SSE3 +</pre> +<h4><a name="section-B.1.13">B.1.13 VMX Instructions</a></h4> +<p><pre> +VMCALL VMX +VMCLEAR mem VMX +VMLAUNCH VMX +VMLOAD X64,VMX +VMMCALL X64,VMX +VMPTRLD mem VMX +VMPTRST mem VMX +VMREAD rm32,reg32 VMX,NOLONG,SD +VMREAD rm64,reg64 X64,VMX +VMRESUME VMX +VMRUN X64,VMX +VMSAVE X64,VMX +VMWRITE reg32,rm32 VMX,NOLONG,SD +VMWRITE reg64,rm64 X64,VMX +VMXOFF VMX +VMXON mem VMX +</pre> +<h4><a name="section-B.1.14">B.1.14 Extended Page Tables VMX instructions</a></h4> +<p><pre> +INVEPT reg32,mem VMX,SO,NOLONG +INVEPT reg64,mem VMX,SO,LONG +INVVPID reg32,mem VMX,SO,NOLONG +INVVPID reg64,mem VMX,SO,LONG +</pre> +<h4><a name="section-B.1.15">B.1.15 Tejas New Instructions (SSSE3)</a></h4> +<p><pre> +PABSB mmxreg,mmxrm SSSE3,MMX +PABSB xmmreg,xmmrm SSSE3 +PABSW mmxreg,mmxrm SSSE3,MMX +PABSW xmmreg,xmmrm SSSE3 +PABSD mmxreg,mmxrm SSSE3,MMX +PABSD xmmreg,xmmrm SSSE3 +PALIGNR mmxreg,mmxrm,imm SSSE3,MMX +PALIGNR xmmreg,xmmrm,imm SSSE3 +PHADDW mmxreg,mmxrm SSSE3,MMX +PHADDW xmmreg,xmmrm SSSE3 +PHADDD mmxreg,mmxrm SSSE3,MMX +PHADDD xmmreg,xmmrm SSSE3 +PHADDSW mmxreg,mmxrm SSSE3,MMX +PHADDSW xmmreg,xmmrm SSSE3 +PHSUBW mmxreg,mmxrm SSSE3,MMX +PHSUBW xmmreg,xmmrm SSSE3 +PHSUBD mmxreg,mmxrm SSSE3,MMX +PHSUBD xmmreg,xmmrm SSSE3 +PHSUBSW mmxreg,mmxrm SSSE3,MMX +PHSUBSW xmmreg,xmmrm SSSE3 +PMADDUBSW mmxreg,mmxrm SSSE3,MMX +PMADDUBSW xmmreg,xmmrm SSSE3 +PMULHRSW mmxreg,mmxrm SSSE3,MMX +PMULHRSW xmmreg,xmmrm SSSE3 +PSHUFB mmxreg,mmxrm SSSE3,MMX +PSHUFB xmmreg,xmmrm SSSE3 +PSIGNB mmxreg,mmxrm SSSE3,MMX +PSIGNB xmmreg,xmmrm SSSE3 +PSIGNW mmxreg,mmxrm SSSE3,MMX +PSIGNW xmmreg,xmmrm SSSE3 +PSIGND mmxreg,mmxrm SSSE3,MMX +PSIGND xmmreg,xmmrm SSSE3 +</pre> +<h4><a name="section-B.1.16">B.1.16 AMD SSE4A</a></h4> +<p><pre> +EXTRQ xmmreg,imm,imm SSE4A,AMD +EXTRQ xmmreg,xmmreg SSE4A,AMD +INSERTQ xmmreg,xmmreg,imm,imm SSE4A,AMD +INSERTQ xmmreg,xmmreg SSE4A,AMD +MOVNTSD mem,xmmreg SSE4A,AMD +MOVNTSS mem,xmmreg SSE4A,AMD,SD +</pre> +<h4><a name="section-B.1.17">B.1.17 New instructions in Barcelona</a></h4> +<p><pre> +LZCNT reg16,rm16 P6,AMD +LZCNT reg32,rm32 P6,AMD +LZCNT reg64,rm64 X64,AMD +</pre> +<h4><a name="section-B.1.18">B.1.18 Penryn New Instructions (SSE4.1)</a></h4> +<p><pre> +BLENDPD xmmreg,xmmrm,imm SSE41 +BLENDPS xmmreg,xmmrm,imm SSE41 +BLENDVPD xmmreg,xmmrm,xmm0 SSE41 +BLENDVPS xmmreg,xmmrm,xmm0 SSE41 +DPPD xmmreg,xmmrm,imm SSE41 +DPPS xmmreg,xmmrm,imm SSE41 +EXTRACTPS rm32,xmmreg,imm SSE41 +EXTRACTPS reg64,xmmreg,imm SSE41,X64 +INSERTPS xmmreg,xmmrm,imm SSE41,SD +MOVNTDQA xmmreg,mem SSE41 +MPSADBW xmmreg,xmmrm,imm SSE41 +PACKUSDW xmmreg,xmmrm SSE41 +PBLENDVB xmmreg,xmmrm,xmm0 SSE41 +PBLENDW xmmreg,xmmrm,imm SSE41 +PCMPEQQ xmmreg,xmmrm SSE41 +PEXTRB reg32,xmmreg,imm SSE41 +PEXTRB mem8,xmmreg,imm SSE41 +PEXTRB reg64,xmmreg,imm SSE41,X64 +PEXTRD rm32,xmmreg,imm SSE41 +PEXTRQ rm64,xmmreg,imm SSE41,X64 +PEXTRW reg32,xmmreg,imm SSE41 +PEXTRW mem16,xmmreg,imm SSE41 +PEXTRW reg64,xmmreg,imm SSE41,X64 +PHMINPOSUW xmmreg,xmmrm SSE41 +PINSRB xmmreg,mem,imm SSE41 +PINSRB xmmreg,rm8,imm SSE41 +PINSRB xmmreg,reg32,imm SSE41 +PINSRD xmmreg,mem,imm SSE41 +PINSRD xmmreg,rm32,imm SSE41 +PINSRQ xmmreg,mem,imm SSE41,X64 +PINSRQ xmmreg,rm64,imm SSE41,X64 +PMAXSB xmmreg,xmmrm SSE41 +PMAXSD xmmreg,xmmrm SSE41 +PMAXUD xmmreg,xmmrm SSE41 +PMAXUW xmmreg,xmmrm SSE41 +PMINSB xmmreg,xmmrm SSE41 +PMINSD xmmreg,xmmrm SSE41 +PMINUD xmmreg,xmmrm SSE41 +PMINUW xmmreg,xmmrm SSE41 +PMOVSXBW xmmreg,xmmrm SSE41 +PMOVSXBD xmmreg,xmmrm SSE41,SD +PMOVSXBQ xmmreg,xmmrm SSE41,SW +PMOVSXWD xmmreg,xmmrm SSE41 +PMOVSXWQ xmmreg,xmmrm SSE41,SD +PMOVSXDQ xmmreg,xmmrm SSE41 +PMOVZXBW xmmreg,xmmrm SSE41 +PMOVZXBD xmmreg,xmmrm SSE41,SD +PMOVZXBQ xmmreg,xmmrm SSE41,SW +PMOVZXWD xmmreg,xmmrm SSE41 +PMOVZXWQ xmmreg,xmmrm SSE41,SD +PMOVZXDQ xmmreg,xmmrm SSE41 +PMULDQ xmmreg,xmmrm SSE41 +PMULLD xmmreg,xmmrm SSE41 +PTEST xmmreg,xmmrm SSE41 +ROUNDPD xmmreg,xmmrm,imm SSE41 +ROUNDPS xmmreg,xmmrm,imm SSE41 +ROUNDSD xmmreg,xmmrm,imm SSE41 +ROUNDSS xmmreg,xmmrm,imm SSE41 +</pre> +<h4><a name="section-B.1.19">B.1.19 Nehalem New Instructions (SSE4.2)</a></h4> +<p><pre> +CRC32 reg32,rm8 SSE42 +CRC32 reg32,rm16 SSE42 +CRC32 reg32,rm32 SSE42 +CRC32 reg64,rm8 SSE42,X64 +CRC32 reg64,rm64 SSE42,X64 +PCMPESTRI xmmreg,xmmrm,imm SSE42 +PCMPESTRM xmmreg,xmmrm,imm SSE42 +PCMPISTRI xmmreg,xmmrm,imm SSE42 +PCMPISTRM xmmreg,xmmrm,imm SSE42 +PCMPGTQ xmmreg,xmmrm SSE42 +POPCNT reg16,rm16 NEHALEM,SW +POPCNT reg32,rm32 NEHALEM,SD +POPCNT reg64,rm64 NEHALEM,X64 +</pre> +<h4><a name="section-B.1.20">B.1.20 Intel SMX</a></h4> +<p><pre> +GETSEC KATMAI +</pre> +<h4><a name="section-B.1.21">B.1.21 Geode (Cyrix) 3DNow! additions</a></h4> +<p><pre> +PFRCPV mmxreg,mmxrm PENT,3DNOW,CYRIX +PFRSQRTV mmxreg,mmxrm PENT,3DNOW,CYRIX +</pre> +<h4><a name="section-B.1.22">B.1.22 Intel new instructions in ???</a></h4> +<p><pre> +MOVBE reg16,mem16 NEHALEM +MOVBE reg32,mem32 NEHALEM +MOVBE reg64,mem64 NEHALEM +MOVBE mem16,reg16 NEHALEM +MOVBE mem32,reg32 NEHALEM +MOVBE mem64,reg64 NEHALEM +</pre> +<h4><a name="section-B.1.23">B.1.23 Intel AES instructions</a></h4> +<p><pre> +AESENC xmmreg,xmmrm128 SSE,WESTMERE +AESENCLAST xmmreg,xmmrm128 SSE,WESTMERE +AESDEC xmmreg,xmmrm128 SSE,WESTMERE +AESDECLAST xmmreg,xmmrm128 SSE,WESTMERE +AESIMC xmmreg,xmmrm128 SSE,WESTMERE +AESKEYGENASSIST xmmreg,xmmrm128,imm8 SSE,WESTMERE +</pre> +<h4><a name="section-B.1.24">B.1.24 Intel AVX AES instructions</a></h4> +<p><pre> +VAESENC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VAESENCLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VAESDEC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VAESDECLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VAESIMC xmmreg,xmmrm128 AVX,SANDYBRIDGE +VAESKEYGENASSIST xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +</pre> +<h4><a name="section-B.1.25">B.1.25 Intel AVX instructions</a></h4> +<p><pre> +VADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VADDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VADDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VADDSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VADDSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VADDSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VADDSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VANDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VANDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VANDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VANDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VANDNPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VANDNPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VANDNPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VANDNPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VBLENDVPD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VBLENDVPD xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE +VBLENDVPD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE +VBLENDVPS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VBLENDVPS xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE +VBLENDVPS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE +VBROADCASTSS xmmreg,mem32 AVX,SANDYBRIDGE +VBROADCASTSS ymmreg,mem32 AVX,SANDYBRIDGE +VBROADCASTSD ymmreg,mem64 AVX,SANDYBRIDGE +VBROADCASTF128 ymmreg,mem128 AVX,SANDYBRIDGE +VCMPEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VCMPEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VCMPEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPFALSESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPTRUESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE +VCMPEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPUNORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPFALSESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPTRUESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPLT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPLE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPGE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPGT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCMPSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +VCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE +VCVTDQ2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VCVTDQ2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE +VCVTDQ2PS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VCVTDQ2PS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VCVTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE +VCVTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO +VCVTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE +VCVTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY +VCVTPD2PS xmmreg,xmmreg AVX,SANDYBRIDGE +VCVTPD2PS xmmreg,mem128 AVX,SANDYBRIDGE,SO +VCVTPD2PS xmmreg,ymmreg AVX,SANDYBRIDGE +VCVTPD2PS xmmreg,mem256 AVX,SANDYBRIDGE,SY +VCVTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE +VCVTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE +VCVTPS2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VCVTPS2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE +VCVTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE +VCVTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG +VCVTSD2SS xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VCVTSI2SD xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD +VCVTSI2SD xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD +VCVTSI2SD xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG +VCVTSI2SS xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD +VCVTSI2SS xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD +VCVTSI2SS xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG +VCVTSS2SD xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VCVTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE +VCVTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG +VCVTTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE +VCVTTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO +VCVTTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE +VCVTTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY +VCVTTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE +VCVTTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE +VCVTTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE +VCVTTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG +VCVTTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE +VCVTTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG +VDIVPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VDIVPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VDIVPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VDIVPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VDIVSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VDIVSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VDPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VDPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VDPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VEXTRACTF128 xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +VEXTRACTPS rm32,xmmreg,imm8 AVX,SANDYBRIDGE +VHADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VHADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VHADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VHADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VHSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VHSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VHSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VHSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VINSERTF128 ymmreg,ymmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +VLDDQU xmmreg,mem128 AVX,SANDYBRIDGE +VLDQQU ymmreg,mem256 AVX,SANDYBRIDGE +VLDDQU ymmreg,mem256 AVX,SANDYBRIDGE +VLDMXCSR mem32 AVX,SANDYBRIDGE +VMASKMOVDQU xmmreg,xmmreg AVX,SANDYBRIDGE +VMASKMOVPS xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE +VMASKMOVPS ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE +VMASKMOVPS mem128,xmmreg,xmmreg AVX,SANDYBRIDGE,SO +VMASKMOVPS mem256,xmmreg,xmmreg AVX,SANDYBRIDGE,SY +VMASKMOVPD xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE +VMASKMOVPD ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE +VMASKMOVPD mem128,xmmreg,xmmreg AVX,SANDYBRIDGE +VMASKMOVPD mem256,ymmreg,ymmreg AVX,SANDYBRIDGE +VMAXPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMAXPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMAXPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMAXPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMAXSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VMAXSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VMINPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMINPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMINPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMINPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMINSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VMINSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VMOVAPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVAPD xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVAPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVAPD ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVAPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVAPS xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVAPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVAPS ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +VMOVQ xmmrm64,xmmreg AVX,SANDYBRIDGE +VMOVQ xmmreg,rm64 AVX,SANDYBRIDGE,LONG +VMOVQ rm64,xmmreg AVX,SANDYBRIDGE,LONG +VMOVD xmmreg,rm32 AVX,SANDYBRIDGE +VMOVD rm32,xmmreg AVX,SANDYBRIDGE +VMOVDDUP xmmreg,xmmrm64 AVX,SANDYBRIDGE +VMOVDDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVDQA xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVDQA xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVQQA ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVQQA ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVDQA ymmreg,ymmrm AVX,SANDYBRIDGE +VMOVDQA ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVDQU xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVDQU xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVQQU ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVQQU ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVDQU ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVDQU ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVHLPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVHPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +VMOVHPD mem64,xmmreg AVX,SANDYBRIDGE +VMOVHPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +VMOVHPS mem64,xmmreg AVX,SANDYBRIDGE +VMOVLHPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVLPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +VMOVLPD mem64,xmmreg AVX,SANDYBRIDGE +VMOVLPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +VMOVLPS mem64,xmmreg AVX,SANDYBRIDGE +VMOVMSKPD reg64,xmmreg AVX,SANDYBRIDGE,LONG +VMOVMSKPD reg32,xmmreg AVX,SANDYBRIDGE +VMOVMSKPD reg64,ymmreg AVX,SANDYBRIDGE,LONG +VMOVMSKPD reg32,ymmreg AVX,SANDYBRIDGE +VMOVMSKPS reg64,xmmreg AVX,SANDYBRIDGE,LONG +VMOVMSKPS reg32,xmmreg AVX,SANDYBRIDGE +VMOVMSKPS reg64,ymmreg AVX,SANDYBRIDGE,LONG +VMOVMSKPS reg32,ymmreg AVX,SANDYBRIDGE +VMOVNTDQ mem128,xmmreg AVX,SANDYBRIDGE +VMOVNTQQ mem256,ymmreg AVX,SANDYBRIDGE +VMOVNTDQ mem256,ymmreg AVX,SANDYBRIDGE +VMOVNTDQA xmmreg,mem128 AVX,SANDYBRIDGE +VMOVNTPD mem128,xmmreg AVX,SANDYBRIDGE +VMOVNTPD mem256,ymmreg AVX,SANDYBRIDGE +VMOVNTPS mem128,xmmreg AVX,SANDYBRIDGE +VMOVNTPS mem128,ymmreg AVX,SANDYBRIDGE +VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVSD xmmreg,mem64 AVX,SANDYBRIDGE +VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVSD mem64,xmmreg AVX,SANDYBRIDGE +VMOVSHDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVSHDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVSLDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVSLDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVSS xmmreg,mem64 AVX,SANDYBRIDGE +VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +VMOVSS mem64,xmmreg AVX,SANDYBRIDGE +VMOVUPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVUPD xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVUPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVUPD ymmrm256,ymmreg AVX,SANDYBRIDGE +VMOVUPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VMOVUPS xmmrm128,xmmreg AVX,SANDYBRIDGE +VMOVUPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VMOVUPS ymmrm256,ymmreg AVX,SANDYBRIDGE +VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VMULPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMULPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMULPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VMULPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VMULSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VMULSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VPABSB xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPABSW xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPABSD xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPACKSSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPACKSSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPACKUSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPACKUSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPADDUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VPAND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPANDN xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPAVGB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPAVGW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VPCMPESTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPCMPESTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPCMPISTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPCMPISTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPCMPEQB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPEQW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPEQD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPEQQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPGTB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPGTW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPGTD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCMPGTQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPERMILPD xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILPD ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPERMILPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VPERMILTD2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILTD2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILTD2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILTD2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILMO2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILMO2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILMO2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILMO2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILMZ2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILMZ2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILMZ2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILMZ2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMIL2PD xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +VPERMIL2PD xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPERMIL2PD ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE +VPERMIL2PD ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VPERMILPS xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILPS ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPERMILPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VPERMILTD2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILTD2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILTD2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILTD2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILMO2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILMO2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILMO2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILMO2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMILMZ2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +VPERMILMZ2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPERMILMZ2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +VPERMILMZ2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPERMIL2PS xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +VPERMIL2PS xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPERMIL2PS ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE +VPERMIL2PS ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VPERM2F128 ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VPEXTRB reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +VPEXTRB reg32,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRB mem8,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRD reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +VPEXTRD rm32,xmmreg,imm8 AVX,SANDYBRIDGE +VPEXTRQ rm64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +VPHADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPHADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPHADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPHMINPOSUW xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPHSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPHSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPHSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPINSRB xmmreg,xmmreg*,mem8,imm8 AVX,SANDYBRIDGE +VPINSRB xmmreg,xmmreg*,rm8,imm8 AVX,SANDYBRIDGE +VPINSRB xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE +VPINSRW xmmreg,xmmreg*,mem16,imm8 AVX,SANDYBRIDGE +VPINSRW xmmreg,xmmreg*,rm16,imm8 AVX,SANDYBRIDGE +VPINSRW xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE +VPINSRD xmmreg,xmmreg*,mem32,imm8 AVX,SANDYBRIDGE +VPINSRD xmmreg,xmmreg*,rm32,imm8 AVX,SANDYBRIDGE +VPINSRQ xmmreg,xmmreg*,mem64,imm8 AVX,SANDYBRIDGE,LONG +VPINSRQ xmmreg,xmmreg*,rm64,imm8 AVX,SANDYBRIDGE,LONG +VPMADDWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMADDUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMAXUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMINUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMOVMSKB reg64,xmmreg AVX,SANDYBRIDGE,LONG +VPMOVMSKB reg32,xmmreg AVX,SANDYBRIDGE +VPMOVSXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMOVSXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE +VPMOVSXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE +VPMOVSXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMOVSXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE +VPMOVSXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMOVZXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMOVZXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE +VPMOVZXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE +VPMOVZXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMOVZXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE +VPMOVZXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +VPMULHUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULHRSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULHW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULUDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPMULDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSADBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSHUFB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSHUFD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPSHUFHW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPSHUFLW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VPSIGNB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSIGNW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSIGND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSLLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSLLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSLLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSLLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSLLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSLLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSLLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRAW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSRAW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRAD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSRAD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSRLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSRLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPSRLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSRLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +VPTEST xmmreg,xmmrm128 AVX,SANDYBRIDGE +VPTEST ymmreg,ymmrm256 AVX,SANDYBRIDGE +VPSUBB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPSUBUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPXOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VRCPPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VRCPPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VRCPSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VRSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VRSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VRSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VROUNDPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VROUNDPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VROUNDPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +VROUNDPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE +VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +VSQRTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +VSQRTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +VSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VSQRTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VSTMXCSR mem32 AVX,SANDYBRIDGE +VSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VSUBSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +VSUBSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +VTESTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +VTESTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +VTESTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +VTESTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +VUCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE +VUCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE +VUNPCKHPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VUNPCKHPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VUNPCKHPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VUNPCKHPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VUNPCKLPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VUNPCKLPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VUNPCKLPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VUNPCKLPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VXORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VXORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VXORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VXORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +VZEROALL AVX,SANDYBRIDGE +VZEROUPPER AVX,SANDYBRIDGE +</pre> +<h4><a name="section-B.1.26">B.1.26 Intel Carry-Less Multiplication instructions (CLMUL)</a></h4> +<p><pre> +PCLMULLQLQDQ xmmreg,xmmrm128 SSE,WESTMERE +PCLMULHQLQDQ xmmreg,xmmrm128 SSE,WESTMERE +PCLMULLQHQDQ xmmreg,xmmrm128 SSE,WESTMERE +PCLMULHQHQDQ xmmreg,xmmrm128 SSE,WESTMERE +PCLMULQDQ xmmreg,xmmrm128,imm8 SSE,WESTMERE +</pre> +<h4><a name="section-B.1.27">B.1.27 Intel AVX Carry-Less Multiplication instructions (CLMUL)</a></h4> +<p><pre> +VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +</pre> +<h4><a name="section-B.1.28">B.1.28 Intel Fused Multiply-Add instructions (FMA)</a></h4> +<p><pre> +VFMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFNMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +VFNMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +VFMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +VFNMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +VFNMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +</pre> +<h4><a name="section-B.1.29">B.1.29 VIA (Centaur) security instructions</a></h4> +<p><pre> +XSTORE PENT,CYRIX +XCRYPTECB PENT,CYRIX +XCRYPTCBC PENT,CYRIX +XCRYPTCTR PENT,CYRIX +XCRYPTCFB PENT,CYRIX +XCRYPTOFB PENT,CYRIX +MONTMUL PENT,CYRIX +XSHA1 PENT,CYRIX +XSHA256 PENT,CYRIX +</pre> +<h4><a name="section-B.1.30">B.1.30 AMD Lightweight Profiling (LWP) instructions</a></h4> +<p><pre> +LLWPCB reg16 AMD +LLWPCB reg32 AMD,386 +LLWPCB reg64 AMD,X64 +SLWPCB reg16 AMD +SLWPCB reg32 AMD,386 +SLWPCB reg64 AMD,X64 +LWPVAL reg16,rm32,imm16 AMD,386 +LWPVAL reg32,rm32,imm32 AMD,386 +LWPVAL reg64,rm32,imm32 AMD,X64 +LWPINS reg16,rm32,imm16 AMD,386 +LWPINS reg32,rm32,imm32 AMD,386 +LWPINS reg64,rm32,imm32 AMD,X64 +</pre> +<h4><a name="section-B.1.31">B.1.31 AMD XOP, FMA4 and CVT16 instructions (SSE5)</a></h4> +<p><pre> +VCVTPH2PS xmmreg,xmmrm64*,imm8 AMD,SSE5 +VCVTPH2PS ymmreg,xmmrm128,imm8 AMD,SSE5 +VCVTPH2PS ymmreg,ymmrm128*,imm8 AMD,SSE5 +VCVTPS2PH xmmrm64,xmmreg*,imm8 AMD,SSE5 +VCVTPS2PH xmmrm128,ymmreg,imm8 AMD,SSE5 +VCVTPS2PH ymmrm128,ymmreg*,imm8 AMD,SSE5 +VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +VFRCZPD xmmreg,xmmrm128* AMD,SSE5 +VFRCZPD ymmreg,ymmrm256* AMD,SSE5 +VFRCZPS xmmreg,xmmrm128* AMD,SSE5 +VFRCZPS ymmreg,ymmrm256* AMD,SSE5 +VFRCZSD xmmreg,xmmrm64* AMD,SSE5 +VFRCZSS xmmreg,xmmrm32* AMD,SSE5 +VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +VPHADDBD xmmreg,xmmrm128* AMD,SSE5 +VPHADDBQ xmmreg,xmmrm128* AMD,SSE5 +VPHADDBW xmmreg,xmmrm128* AMD,SSE5 +VPHADDDQ xmmreg,xmmrm128* AMD,SSE5 +VPHADDUBD xmmreg,xmmrm128* AMD,SSE5 +VPHADDUBQ xmmreg,xmmrm128* AMD,SSE5 +VPHADDUBW xmmreg,xmmrm128* AMD,SSE5 +VPHADDUDQ xmmreg,xmmrm128* AMD,SSE5 +VPHADDUWD xmmreg,xmmrm128* AMD,SSE5 +VPHADDUWQ xmmreg,xmmrm128* AMD,SSE5 +VPHADDWD xmmreg,xmmrm128* AMD,SSE5 +VPHADDWQ xmmreg,xmmrm128* AMD,SSE5 +VPHSUBBW xmmreg,xmmrm128* AMD,SSE5 +VPHSUBDQ xmmreg,xmmrm128* AMD,SSE5 +VPHSUBWD xmmreg,xmmrm128* AMD,SSE5 +VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +VPROTB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPROTB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPROTB xmmreg,xmmrm128*,imm8 AMD,SSE5 +VPROTD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPROTD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPROTD xmmreg,xmmrm128*,imm8 AMD,SSE5 +VPROTQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPROTQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPROTQ xmmreg,xmmrm128*,imm8 AMD,SSE5 +VPROTW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPROTW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPROTW xmmreg,xmmrm128*,imm8 AMD,SSE5 +VPSHAB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHAB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHAD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHAD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHAQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHAQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHAW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHAW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHLB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHLB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHLD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHLD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHLQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHLQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +VPSHLW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +VPSHLW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +</pre> +<h4><a name="section-B.1.32">B.1.32 Systematic names for the hinting nop instructions</a></h4> +<p><pre> +HINT_NOP0 rm16 P6,UNDOC +HINT_NOP0 rm32 P6,UNDOC +HINT_NOP0 rm64 X64,UNDOC +HINT_NOP1 rm16 P6,UNDOC +HINT_NOP1 rm32 P6,UNDOC +HINT_NOP1 rm64 X64,UNDOC +HINT_NOP2 rm16 P6,UNDOC +HINT_NOP2 rm32 P6,UNDOC +HINT_NOP2 rm64 X64,UNDOC +HINT_NOP3 rm16 P6,UNDOC +HINT_NOP3 rm32 P6,UNDOC +HINT_NOP3 rm64 X64,UNDOC +HINT_NOP4 rm16 P6,UNDOC +HINT_NOP4 rm32 P6,UNDOC +HINT_NOP4 rm64 X64,UNDOC +HINT_NOP5 rm16 P6,UNDOC +HINT_NOP5 rm32 P6,UNDOC +HINT_NOP5 rm64 X64,UNDOC +HINT_NOP6 rm16 P6,UNDOC +HINT_NOP6 rm32 P6,UNDOC +HINT_NOP6 rm64 X64,UNDOC +HINT_NOP7 rm16 P6,UNDOC +HINT_NOP7 rm32 P6,UNDOC +HINT_NOP7 rm64 X64,UNDOC +HINT_NOP8 rm16 P6,UNDOC +HINT_NOP8 rm32 P6,UNDOC +HINT_NOP8 rm64 X64,UNDOC +HINT_NOP9 rm16 P6,UNDOC +HINT_NOP9 rm32 P6,UNDOC +HINT_NOP9 rm64 X64,UNDOC +HINT_NOP10 rm16 P6,UNDOC +HINT_NOP10 rm32 P6,UNDOC +HINT_NOP10 rm64 X64,UNDOC +HINT_NOP11 rm16 P6,UNDOC +HINT_NOP11 rm32 P6,UNDOC +HINT_NOP11 rm64 X64,UNDOC +HINT_NOP12 rm16 P6,UNDOC +HINT_NOP12 rm32 P6,UNDOC +HINT_NOP12 rm64 X64,UNDOC +HINT_NOP13 rm16 P6,UNDOC +HINT_NOP13 rm32 P6,UNDOC +HINT_NOP13 rm64 X64,UNDOC +HINT_NOP14 rm16 P6,UNDOC +HINT_NOP14 rm32 P6,UNDOC +HINT_NOP14 rm64 X64,UNDOC +HINT_NOP15 rm16 P6,UNDOC +HINT_NOP15 rm32 P6,UNDOC +HINT_NOP15 rm64 X64,UNDOC +HINT_NOP16 rm16 P6,UNDOC +HINT_NOP16 rm32 P6,UNDOC +HINT_NOP16 rm64 X64,UNDOC +HINT_NOP17 rm16 P6,UNDOC +HINT_NOP17 rm32 P6,UNDOC +HINT_NOP17 rm64 X64,UNDOC +HINT_NOP18 rm16 P6,UNDOC +HINT_NOP18 rm32 P6,UNDOC +HINT_NOP18 rm64 X64,UNDOC +HINT_NOP19 rm16 P6,UNDOC +HINT_NOP19 rm32 P6,UNDOC +HINT_NOP19 rm64 X64,UNDOC +HINT_NOP20 rm16 P6,UNDOC +HINT_NOP20 rm32 P6,UNDOC +HINT_NOP20 rm64 X64,UNDOC +HINT_NOP21 rm16 P6,UNDOC +HINT_NOP21 rm32 P6,UNDOC +HINT_NOP21 rm64 X64,UNDOC +HINT_NOP22 rm16 P6,UNDOC +HINT_NOP22 rm32 P6,UNDOC +HINT_NOP22 rm64 X64,UNDOC +HINT_NOP23 rm16 P6,UNDOC +HINT_NOP23 rm32 P6,UNDOC +HINT_NOP23 rm64 X64,UNDOC +HINT_NOP24 rm16 P6,UNDOC +HINT_NOP24 rm32 P6,UNDOC +HINT_NOP24 rm64 X64,UNDOC +HINT_NOP25 rm16 P6,UNDOC +HINT_NOP25 rm32 P6,UNDOC +HINT_NOP25 rm64 X64,UNDOC +HINT_NOP26 rm16 P6,UNDOC +HINT_NOP26 rm32 P6,UNDOC +HINT_NOP26 rm64 X64,UNDOC +HINT_NOP27 rm16 P6,UNDOC +HINT_NOP27 rm32 P6,UNDOC +HINT_NOP27 rm64 X64,UNDOC +HINT_NOP28 rm16 P6,UNDOC +HINT_NOP28 rm32 P6,UNDOC +HINT_NOP28 rm64 X64,UNDOC +HINT_NOP29 rm16 P6,UNDOC +HINT_NOP29 rm32 P6,UNDOC +HINT_NOP29 rm64 X64,UNDOC +HINT_NOP30 rm16 P6,UNDOC +HINT_NOP30 rm32 P6,UNDOC +HINT_NOP30 rm64 X64,UNDOC +HINT_NOP31 rm16 P6,UNDOC +HINT_NOP31 rm32 P6,UNDOC +HINT_NOP31 rm64 X64,UNDOC +HINT_NOP32 rm16 P6,UNDOC +HINT_NOP32 rm32 P6,UNDOC +HINT_NOP32 rm64 X64,UNDOC +HINT_NOP33 rm16 P6,UNDOC +HINT_NOP33 rm32 P6,UNDOC +HINT_NOP33 rm64 X64,UNDOC +HINT_NOP34 rm16 P6,UNDOC +HINT_NOP34 rm32 P6,UNDOC +HINT_NOP34 rm64 X64,UNDOC +HINT_NOP35 rm16 P6,UNDOC +HINT_NOP35 rm32 P6,UNDOC +HINT_NOP35 rm64 X64,UNDOC +HINT_NOP36 rm16 P6,UNDOC +HINT_NOP36 rm32 P6,UNDOC +HINT_NOP36 rm64 X64,UNDOC +HINT_NOP37 rm16 P6,UNDOC +HINT_NOP37 rm32 P6,UNDOC +HINT_NOP37 rm64 X64,UNDOC +HINT_NOP38 rm16 P6,UNDOC +HINT_NOP38 rm32 P6,UNDOC +HINT_NOP38 rm64 X64,UNDOC +HINT_NOP39 rm16 P6,UNDOC +HINT_NOP39 rm32 P6,UNDOC +HINT_NOP39 rm64 X64,UNDOC +HINT_NOP40 rm16 P6,UNDOC +HINT_NOP40 rm32 P6,UNDOC +HINT_NOP40 rm64 X64,UNDOC +HINT_NOP41 rm16 P6,UNDOC +HINT_NOP41 rm32 P6,UNDOC +HINT_NOP41 rm64 X64,UNDOC +HINT_NOP42 rm16 P6,UNDOC +HINT_NOP42 rm32 P6,UNDOC +HINT_NOP42 rm64 X64,UNDOC +HINT_NOP43 rm16 P6,UNDOC +HINT_NOP43 rm32 P6,UNDOC +HINT_NOP43 rm64 X64,UNDOC +HINT_NOP44 rm16 P6,UNDOC +HINT_NOP44 rm32 P6,UNDOC +HINT_NOP44 rm64 X64,UNDOC +HINT_NOP45 rm16 P6,UNDOC +HINT_NOP45 rm32 P6,UNDOC +HINT_NOP45 rm64 X64,UNDOC +HINT_NOP46 rm16 P6,UNDOC +HINT_NOP46 rm32 P6,UNDOC +HINT_NOP46 rm64 X64,UNDOC +HINT_NOP47 rm16 P6,UNDOC +HINT_NOP47 rm32 P6,UNDOC +HINT_NOP47 rm64 X64,UNDOC +HINT_NOP48 rm16 P6,UNDOC +HINT_NOP48 rm32 P6,UNDOC +HINT_NOP48 rm64 X64,UNDOC +HINT_NOP49 rm16 P6,UNDOC +HINT_NOP49 rm32 P6,UNDOC +HINT_NOP49 rm64 X64,UNDOC +HINT_NOP50 rm16 P6,UNDOC +HINT_NOP50 rm32 P6,UNDOC +HINT_NOP50 rm64 X64,UNDOC +HINT_NOP51 rm16 P6,UNDOC +HINT_NOP51 rm32 P6,UNDOC +HINT_NOP51 rm64 X64,UNDOC +HINT_NOP52 rm16 P6,UNDOC +HINT_NOP52 rm32 P6,UNDOC +HINT_NOP52 rm64 X64,UNDOC +HINT_NOP53 rm16 P6,UNDOC +HINT_NOP53 rm32 P6,UNDOC +HINT_NOP53 rm64 X64,UNDOC +HINT_NOP54 rm16 P6,UNDOC +HINT_NOP54 rm32 P6,UNDOC +HINT_NOP54 rm64 X64,UNDOC +HINT_NOP55 rm16 P6,UNDOC +HINT_NOP55 rm32 P6,UNDOC +HINT_NOP55 rm64 X64,UNDOC +HINT_NOP56 rm16 P6,UNDOC +HINT_NOP56 rm32 P6,UNDOC +HINT_NOP56 rm64 X64,UNDOC +HINT_NOP57 rm16 P6,UNDOC +HINT_NOP57 rm32 P6,UNDOC +HINT_NOP57 rm64 X64,UNDOC +HINT_NOP58 rm16 P6,UNDOC +HINT_NOP58 rm32 P6,UNDOC +HINT_NOP58 rm64 X64,UNDOC +HINT_NOP59 rm16 P6,UNDOC +HINT_NOP59 rm32 P6,UNDOC +HINT_NOP59 rm64 X64,UNDOC +HINT_NOP60 rm16 P6,UNDOC +HINT_NOP60 rm32 P6,UNDOC +HINT_NOP60 rm64 X64,UNDOC +HINT_NOP61 rm16 P6,UNDOC +HINT_NOP61 rm32 P6,UNDOC +HINT_NOP61 rm64 X64,UNDOC +HINT_NOP62 rm16 P6,UNDOC +HINT_NOP62 rm32 P6,UNDOC +HINT_NOP62 rm64 X64,UNDOC +HINT_NOP63 rm16 P6,UNDOC +HINT_NOP63 rm32 P6,UNDOC +HINT_NOP63 rm64 X64,UNDOC +</pre> +<p align=center><a href="nasmdocc.html">Next Chapter</a> | +<a href="nasmdoca.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdocc.html b/doc/html/nasmdocc.html new file mode 100644 index 0000000..b7ec3b2 --- /dev/null +++ b/doc/html/nasmdocc.html @@ -0,0 +1,1468 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdocb.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +<h2><a name="appendix-C">Appendix C: NASM Version History</a></h2> +<h3><a name="section-C.1">C.1 NASM 2 Series</a></h3> +<p>The NASM 2 series support x86-64, and is the production version of NASM +since 2007. +<h4><a name="section-C.1.1">C.1.1 Version 2.08</a></h4> +<ul> +<li>A number of enhancements/fixes in macros area. +<li>Support for arbitrarily terminating macro expansions +<code><nobr>%exitmacro</nobr></code>. See +<a href="nasmdoc4.html#section-4.3.12">section 4.3.12</a>. +<li>Support for recursive macro expansion +<code><nobr>%rmacro/irmacro</nobr></code>. See +<a href="nasmdoc4.html#section-4.3.1">section 4.3.1</a>. +<li>Support for converting strings to tokens. See +<a href="nasmdoc4.html#section-4.1.9">section 4.1.9</a>. +<li>Fuzzy operand size logic introduced. +<li>Fix COFF stack overrun on too long export identifiers. +<li>Fix Macho-O alignment bug. +<li>Fix crashes with -fwin32 on file with many exports. +<li>Fix stack overrun for too long [DEBUG id]. +<li>Fix incorrect sbyte usage in IMUL (hit only if optimization flag +passed). +<li>Append ending token for <code><nobr>.stabs</nobr></code> records in the +ELF output format. +<li>New NSIS script which uses ModernUI and MultiUser approach. +<li>Visual Studio 2008 NASM integration (rules file). +<li>Warn a user if a constant is too long (and as result will be stripped). +<li>The obsoleted pre-XOP AMD SSE5 instruction set which was never +actualized was removed. +<li>Fix stack overrun on too long error file name passed from the command +line. +<li>Bind symbols to the .text section by default (ie in case if SECTION +directive was omitted) in the ELF output format. +<li>Fix sync points array index wrapping. +<li>A few fixes for FMA4 and XOP instruction templates. +<li>Add AMD Lightweight Profiling (LWP) instructions. +</ul> +<h4><a name="section-C.1.2">C.1.2 Version 2.07</a></h4> +<ul> +<li>NASM is now under the 2-clause BSD license. See +<a href="nasmdoc1.html#section-1.1.2">section 1.1.2</a>. +<li>Fix the section type for the <code><nobr>.strtab</nobr></code> section +in the <code><nobr>elf64</nobr></code> output format. +<li>Fix the handling of <code><nobr>COMMON</nobr></code> directives in the +<code><nobr>obj</nobr></code> output format. +<li>New <code><nobr>ith</nobr></code> and <code><nobr>srec</nobr></code> +output formats; these are variants of the <code><nobr>bin</nobr></code> +output format which output Intel hex and Motorola S-records, respectively. +See <a href="nasmdoc7.html#section-7.2">section 7.2</a> and +<a href="nasmdoc7.html#section-7.3">section 7.3</a>. +<li><code><nobr>rdf2ihx</nobr></code> replaced with an enhanced +<code><nobr>rdf2bin</nobr></code>, which can output binary, COM, Intel hex +or Motorola S-records. +<li>The Windows installer now puts the NASM directory first in the +<code><nobr>PATH</nobr></code> of the "NASM Shell". +<li>Revert the early expansion behavior of <code><nobr>%+</nobr></code> to +pre-2.06 behavior: <code><nobr>%+</nobr></code> is only expanded late. +<li>Yet another Mach-O alignment fix. +<li>Don't delete the list file on errors. Also, include error and warning +information in the list file. +<li>Support for 64-bit Mach-O output, see +<a href="nasmdoc7.html#section-7.8">section 7.8</a>. +<li>Fix assert failure on certain operations that involve strings with +high-bit bytes. +</ul> +<h4><a name="section-C.1.3">C.1.3 Version 2.06</a></h4> +<ul> +<li>This release is dedicated to the memory of Charles A. Crayne, long time +NASM developer as well as moderator of +<code><nobr>comp.lang.asm.x86</nobr></code> and author of the book +<em>Serious Assembler</em>. We miss you, Chuck. +<li>Support for indirect macro expansion +(<code><nobr>%[...]</nobr></code>). See +<a href="nasmdoc4.html#section-4.1.3">section 4.1.3</a>. +<li><code><nobr>%pop</nobr></code> can now take an argument, see +<a href="nasmdoc4.html#section-4.7.1">section 4.7.1</a>. +<li>The argument to <code><nobr>%use</nobr></code> is no longer +macro-expanded. Use <code><nobr>%[...]</nobr></code> if macro expansion is +desired. +<li>Support for thread-local storage in ELF32 and ELF64. See +<a href="nasmdoc7.html#section-7.9.4">section 7.9.4</a>. +<li>Fix crash on <code><nobr>%ifmacro</nobr></code> without an argument. +<li>Correct the arguments to the <code><nobr>POPCNT</nobr></code> +instruction. +<li>Fix section alignment in the Mach-O format. +<li>Update AVX support to version 5 of the Intel specification. +<li>Fix the handling of accesses to context-local macros from higher levels +in the context stack. +<li>Treat <code><nobr>WAIT</nobr></code> as a prefix rather than as an +instruction, thereby allowing constructs like +<code><nobr>O16 FSAVE</nobr></code> to work correctly. +<li>Support for structures with a non-zero base offset. See +<a href="nasmdoc4.html#section-4.11.10">section 4.11.10</a>. +<li>Correctly handle preprocessor token concatenation (see +<a href="nasmdoc4.html#section-4.3.8">section 4.3.8</a>) involving +floating-point numbers. +<li>The <code><nobr>PINSR</nobr></code> series of instructions have been +corrected and rationalized. +<li>Removed AMD SSE5, replaced with the new XOP/FMA4/CVT16 (rev 3.03) spec. +<li>The ELF backends no longer automatically generate a +<code><nobr>.comment</nobr></code> section. +<li>Add additional "well-known" ELF sections with default attributes. See +<a href="nasmdoc7.html#section-7.9.2">section 7.9.2</a>. +</ul> +<h4><a name="section-C.1.4">C.1.4 Version 2.05.01</a></h4> +<ul> +<li>Fix the <code><nobr>-w</nobr></code>/<code><nobr>-W</nobr></code> +option parsing, which was broken in NASM 2.05. +</ul> +<h4><a name="section-C.1.5">C.1.5 Version 2.05</a></h4> +<ul> +<li>Fix redundant REX.W prefix on <code><nobr>JMP reg64</nobr></code>. +<li>Make the behaviour of <code><nobr>-O0</nobr></code> match NASM 0.98 +legacy behavior. See <a href="nasmdoc2.html#section-2.1.22">section +2.1.22</a>. +<li><code><nobr>-w-user</nobr></code> can be used to suppress the output of +<code><nobr>%warning</nobr></code> directives. See +<a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a>. +<li>Fix bug where <code><nobr>ALIGN</nobr></code> would issue a full +alignment datum instead of zero bytes. +<li>Fix offsets in list files. +<li>Fix <code><nobr>%include</nobr></code> inside multi-line macros or +loops. +<li>Fix error where NASM would generate a spurious warning on valid +optimizations of immediate values. +<li>Fix arguments to a number of the <code><nobr>CVT</nobr></code> SSE +instructions. +<li>Fix RIP-relative offsets when the instruction carries an immediate. +<li>Massive overhaul of the ELF64 backend for spec compliance. +<li>Fix the Geode <code><nobr>PFRCPV</nobr></code> and +<code><nobr>PFRSQRTV</nobr></code> instruction. +<li>Fix the SSE 4.2 <code><nobr>CRC32</nobr></code> instruction. +</ul> +<h4><a name="section-C.1.6">C.1.6 Version 2.04</a></h4> +<ul> +<li>Sanitize macro handing in the <code><nobr>%error</nobr></code> +directive. +<li>New <code><nobr>%warning</nobr></code> directive to issue +user-controlled warnings. +<li><code><nobr>%error</nobr></code> directives are now deferred to the +final assembly phase. +<li>New <code><nobr>%fatal</nobr></code> directive to immediately terminate +assembly. +<li>New <code><nobr>%strcat</nobr></code> directive to join quoted strings +together. +<li>New <code><nobr>%use</nobr></code> macro directive to support standard +macro directives. See <a href="nasmdoc4.html#section-4.6.4">section +4.6.4</a>. +<li>Excess default parameters to <code><nobr>%macro</nobr></code> now +issues a warning by default. See +<a href="nasmdoc4.html#section-4.3">section 4.3</a>. +<li>Fix <code><nobr>%ifn</nobr></code> and +<code><nobr>%elifn</nobr></code>. +<li>Fix nested <code><nobr>%else</nobr></code> clauses. +<li>Correct the handling of nested <code><nobr>%rep</nobr></code>s. +<li>New <code><nobr>%unmacro</nobr></code> directive to undeclare a +multi-line macro. See <a href="nasmdoc4.html#section-4.3.11">section +4.3.11</a>. +<li>Builtin macro <code><nobr>__PASS__</nobr></code> which expands to the +current assembly pass. See <a href="nasmdoc4.html#section-4.11.9">section +4.11.9</a>. +<li><code><nobr>__utf16__</nobr></code> and +<code><nobr>__utf32__</nobr></code> operators to generate UTF-16 and UTF-32 +strings. See <a href="nasmdoc3.html#section-3.4.5">section 3.4.5</a>. +<li>Fix bug in case-insensitive matching when compiled on platforms that +don't use the <code><nobr>configure</nobr></code> script. Of the official +release binaries, that only affected the OS/2 binary. +<li>Support for x87 packed BCD constants. See +<a href="nasmdoc3.html#section-3.4.7">section 3.4.7</a>. +<li>Correct the <code><nobr>LTR</nobr></code> and +<code><nobr>SLDT</nobr></code> instructions in 64-bit mode. +<li>Fix unnecessary REX.W prefix on indirect jumps in 64-bit mode. +<li>Add AVX versions of the AES instructions +(<code><nobr>VAES</nobr></code>...). +<li>Fix the 256-bit FMA instructions. +<li>Add 256-bit AVX stores per the latest AVX spec. +<li>VIA XCRYPT instructions can now be written either with or without +<code><nobr>REP</nobr></code>, apparently different versions of the VIA +spec wrote them differently. +<li>Add missing 64-bit <code><nobr>MOVNTI</nobr></code> instruction. +<li>Fix the operand size of <code><nobr>VMREAD</nobr></code> and +<code><nobr>VMWRITE</nobr></code>. +<li>Numerous bug fixes, especially to the AES, AVX and VTX instructions. +<li>The optimizer now always runs until it converges. It also runs even +when disabled, but doesn't optimize. This allows most forward references to +be resolved properly. +<li><code><nobr>%push</nobr></code> no longer needs a context identifier; +omitting the context identifier results in an anonymous context. +</ul> +<h4><a name="section-C.1.7">C.1.7 Version 2.03.01</a></h4> +<ul> +<li>Fix buffer overflow in the listing module. +<li>Fix the handling of hexadecimal escape codes in `...` strings. +<li>The Postscript/PDF documentation has been reformatted. +<li>The <code><nobr>-F</nobr></code> option now implies +<code><nobr>-g</nobr></code>. +</ul> +<h4><a name="section-C.1.8">C.1.8 Version 2.03</a></h4> +<ul> +<li>Add support for Intel AVX, CLMUL and FMA instructions, including YMM +registers. +<li><code><nobr>dy</nobr></code>, <code><nobr>resy</nobr></code> and +<code><nobr>yword</nobr></code> for 32-byte operands. +<li>Fix some SSE5 instructions. +<li>Intel <code><nobr>INVEPT</nobr></code>, +<code><nobr>INVVPID</nobr></code> and <code><nobr>MOVBE</nobr></code> +instructions. +<li>Fix checking for critical expressions when the optimizer is enabled. +<li>Support the DWARF debugging format for ELF targets. +<li>Fix optimizations of signed bytes. +<li>Fix operation on bigendian machines. +<li>Fix buffer overflow in the preprocessor. +<li><code><nobr>SAFESEH</nobr></code> support for Win32, +<code><nobr>IMAGEREL</nobr></code> for Win64 (SEH). +<li><code><nobr>%?</nobr></code> and <code><nobr>%??</nobr></code> to refer +to the name of a macro itself. In particular, +<code><nobr>%idefine keyword $%?</nobr></code> can be used to make a +keyword "disappear". +<li>New options for dependency generation: <code><nobr>-MD</nobr></code>, +<code><nobr>-MF</nobr></code>, <code><nobr>-MP</nobr></code>, +<code><nobr>-MT</nobr></code>, <code><nobr>-MQ</nobr></code>. +<li>New preprocessor directives <code><nobr>%pathsearch</nobr></code> and +<code><nobr>%depend</nobr></code>; INCBIN reimplemented as a macro. +<li><code><nobr>%include</nobr></code> now resolves macros in a sane +manner. +<li><code><nobr>%substr</nobr></code> can now be used to get other than +one-character substrings. +<li>New type of character/string constants, using backquotes +(<code><nobr>`...`</nobr></code>), which support C-style escape sequences. +<li><code><nobr>%defstr</nobr></code> and +<code><nobr>%idefstr</nobr></code> to stringize macro definitions before +creation. +<li>Fix forward references used in <code><nobr>EQU</nobr></code> +statements. +</ul> +<h4><a name="section-C.1.9">C.1.9 Version 2.02</a></h4> +<ul> +<li>Additional fixes for MMX operands with explicit +<code><nobr>qword</nobr></code>, as well as (hopefully) SSE operands with +<code><nobr>oword</nobr></code>. +<li>Fix handling of truncated strings with <code><nobr>DO</nobr></code>. +<li>Fix segfaults due to memory overwrites when floating-point constants +were used. +<li>Fix segfaults due to missing include files. +<li>Fix OpenWatcom Makefiles for DOS and OS/2. +<li>Add autogenerated instruction list back into the documentation. +<li>ELF: Fix segfault when generating stabs, and no symbols have been +defined. +<li>ELF: Experimental support for DWARF debugging information. +<li>New compile date and time standard macros. +<li><code><nobr>%ifnum</nobr></code> now returns true for negative numbers. +<li>New <code><nobr>%iftoken</nobr></code> test for a single token. +<li>New <code><nobr>%ifempty</nobr></code> test for empty expansion. +<li>Add support for the <code><nobr>XSAVE</nobr></code> instruction group. +<li>Makefile for Netware/gcc. +<li>Fix issue with some warnings getting emitted way too many times. +<li>Autogenerated instruction list added to the documentation. +</ul> +<h4><a name="section-C.1.10">C.1.10 Version 2.01</a></h4> +<ul> +<li>Fix the handling of MMX registers with explicit +<code><nobr>qword</nobr></code> tags on memory (broken in 2.00 due to +64-bit changes.) +<li>Fix the PREFETCH instructions. +<li>Fix the documentation. +<li>Fix debugging info when using <code><nobr>-f elf</nobr></code> +(backwards compatibility alias for <code><nobr>-f elf32</nobr></code>). +<li>Man pages for rdoff tools (from the Debian project.) +<li>ELF: handle large numbers of sections. +<li>Fix corrupt output when the optimizer runs out of passes. +</ul> +<h4><a name="section-C.1.11">C.1.11 Version 2.00</a></h4> +<ul> +<li>Added c99 data-type compliance. +<li>Added general x86-64 support. +<li>Added win64 (x86-64 COFF) output format. +<li>Added <code><nobr>__BITS__</nobr></code> standard macro. +<li>Renamed the <code><nobr>elf</nobr></code> output format to +<code><nobr>elf32</nobr></code> for clarity. +<li>Added <code><nobr>elf64</nobr></code> and +<code><nobr>macho</nobr></code> (MacOS X) output formats. +<li>Added Numeric constants in <code><nobr>dq</nobr></code> directive. +<li>Added <code><nobr>oword</nobr></code>, <code><nobr>do</nobr></code> and +<code><nobr>reso</nobr></code> pseudo operands. +<li>Allow underscores in numbers. +<li>Added 8-, 16- and 128-bit floating-point formats. +<li>Added binary, octal and hexadecimal floating-point. +<li>Correct the generation of floating-point constants. +<li>Added floating-point option control. +<li>Added Infinity and NaN floating point support. +<li>Added ELF Symbol Visibility support. +<li>Added setting OSABI value in ELF header directive. +<li>Added Generate Makefile Dependencies option. +<li>Added Unlimited Optimization Passes option. +<li>Added <code><nobr>%IFN</nobr></code> and +<code><nobr>%ELIFN</nobr></code> support. +<li>Added Logical Negation Operator. +<li>Enhanced Stack Relative Preprocessor Directives. +<li>Enhanced ELF Debug Formats. +<li>Enhanced Send Errors to a File option. +<li>Added SSSE3, SSE4.1, SSE4.2, SSE5 support. +<li>Added a large number of additional instructions. +<li>Significant performance improvements. +<li><code><nobr>-w+warning</nobr></code> and +<code><nobr>-w-warning</nobr></code> can now be written as -Wwarning and +-Wno-warning, respectively. See +<a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a>. +<li>Add <code><nobr>-w+error</nobr></code> to treat warnings as errors. See +<a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a>. +<li>Add <code><nobr>-w+all</nobr></code> and +<code><nobr>-w-all</nobr></code> to enable or disable all suppressible +warnings. See <a href="nasmdoc2.html#section-2.1.24">section 2.1.24</a>. +</ul> +<h3><a name="section-C.2">C.2 NASM 0.98 Series</a></h3> +<p>The 0.98 series was the production versions of NASM from 1999 to 2007. +<h4><a name="section-C.2.1">C.2.1 Version 0.98.39</a></h4> +<ul> +<li>fix buffer overflow +<li>fix outas86's <code><nobr>.bss</nobr></code> handling +<li>"make spotless" no longer deletes config.h.in. +<li><code><nobr>%(el)if(n)idn</nobr></code> insensitivity to string quotes +difference (#809300). +<li>(nasm.c)<code><nobr>__OUTPUT_FORMAT__</nobr></code> changed to string +value instead of symbol. +</ul> +<h4><a name="section-C.2.2">C.2.2 Version 0.98.38</a></h4> +<ul> +<li>Add Makefile for 16-bit DOS binaries under OpenWatcom, and modify +<code><nobr>mkdep.pl</nobr></code> to be able to generate completely +pathless dependencies, as required by OpenWatcom wmake (it supports path +searches, but not explicit paths.) +<li>Fix the <code><nobr>STR</nobr></code> instruction. +<li>Fix the ELF output format, which was broken under certain circumstances +due to the addition of stabs support. +<li>Quick-fix Borland format debug-info for +<code><nobr>-f obj</nobr></code> +<li>Fix for <code><nobr>%rep</nobr></code> with no arguments (#560568) +<li>Fix concatenation of preprocessor function call (#794686) +<li>Fix long label causes coredump (#677841) +<li>Use autoheader as well as autoconf to keep configure from generating +ridiculously long command lines. +<li>Make sure that all of the formats which support debugging output +actually will suppress debugging output when <code><nobr>-g</nobr></code> +not specified. +</ul> +<h4><a name="section-C.2.3">C.2.3 Version 0.98.37</a></h4> +<ul> +<li>Paths given in <code><nobr>-I</nobr></code> switch searched for +<code><nobr>incbin</nobr></code>-ed as well as +<code><nobr>%include</nobr></code>-ed files. +<li>Added stabs debugging for the ELF output format, patch from Martin +Wawro. +<li>Fix <code><nobr>output/outbin.c</nobr></code> to allow origin > +80000000h. +<li>Make <code><nobr>-U</nobr></code> switch work. +<li>Fix the use of relative offsets with explicit prefixes, e.g. +<code><nobr>a32 loop foo</nobr></code>. +<li>Remove <code><nobr>backslash()</nobr></code>. +<li>Fix the <code><nobr>SMSW</nobr></code> and +<code><nobr>SLDT</nobr></code> instructions. +<li><code><nobr>-O2</nobr></code> and <code><nobr>-O3</nobr></code> are no +longer aliases for <code><nobr>-O10</nobr></code> and +<code><nobr>-O15</nobr></code>. If you mean the latter, please say so! :) +</ul> +<h4><a name="section-C.2.4">C.2.4 Version 0.98.36</a></h4> +<ul> +<li>Update rdoff - librarian/archiver - common rec - docs! +<li>Fix signed/unsigned problems. +<li>Fix <code><nobr>JMP FAR label</nobr></code> and +<code><nobr>CALL FAR label</nobr></code>. +<li>Add new multisection support - map files - fix align bug +<li>Fix sysexit, movhps/movlps reg,reg bugs in insns.dat +<li><code><nobr>Q</nobr></code> or <code><nobr>O</nobr></code> suffixes +indicate octal +<li>Support Prescott new instructions (PNI). +<li>Cyrix <code><nobr>XSTORE</nobr></code> instruction. +</ul> +<h4><a name="section-C.2.5">C.2.5 Version 0.98.35</a></h4> +<ul> +<li>Fix build failure on 16-bit DOS (Makefile.bc3 workaround for compiler +bug.) +<li>Fix dependencies and compiler warnings. +<li>Add "const" in a number of places. +<li>Add -X option to specify error reporting format (use -Xvc to integrate +with Microsoft Visual Studio.) +<li>Minor changes for code legibility. +<li>Drop use of tmpnam() in rdoff (security fix.) +</ul> +<h4><a name="section-C.2.6">C.2.6 Version 0.98.34</a></h4> +<ul> +<li>Correct additional address-size vs. operand-size confusions. +<li>Generate dependencies for all Makefiles automatically. +<li>Add support for unimplemented (but theoretically available) registers +such as tr0 and cr5. Segment registers 6 and 7 are called segr6 and segr7 +for the operations which they can be represented. +<li>Correct some disassembler bugs related to redundant address-size +prefixes. Some work still remains in this area. +<li>Correctly generate an error for things like "SEG eax". +<li>Add the JMPE instruction, enabled by "CPU IA64". +<li>Correct compilation on newer gcc/glibc platforms. +<li>Issue an error on things like "jmp far eax". +</ul> +<h4><a name="section-C.2.7">C.2.7 Version 0.98.33</a></h4> +<ul> +<li>New __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ standard macros to +round out the version-query macros. version.pl now understands X.YYplWW or +X.YY.ZZplWW as a version number, equivalent to X.YY.ZZ.WW (or X.YY.0.WW, as +appropriate). +<li>New keyword "strict" to disable the optimization of specific operands. +<li>Fix the handing of size overrides with JMP instructions (instructions +such as "jmp dword foo".) +<li>Fix the handling of "ABSOLUTE label", where "label" points into a +relocatable segment. +<li>Fix OBJ output format with lots of externs. +<li>More documentation updates. +<li>Add -Ov option to get verbose information about optimizations. +<li>Undo a braindead change which broke <code><nobr>%elif</nobr></code> +directives. +<li>Makefile updates. +</ul> +<h4><a name="section-C.2.8">C.2.8 Version 0.98.32</a></h4> +<ul> +<li>Fix NASM crashing when <code><nobr>%macro</nobr></code> directives were +left unterminated. +<li>Lots of documentation updates. +<li>Complete rewrite of the PostScript/PDF documentation generator. +<li>The MS Visual C++ Makefile was updated and corrected. +<li>Recognize .rodata as a standard section name in ELF. +<li>Fix some obsolete Perl4-isms in Perl scripts. +<li>Fix configure.in to work with autoconf 2.5x. +<li>Fix a couple of "make cleaner" misses. +<li>Make the normal "./configure && make" work with Cygwin. +</ul> +<h4><a name="section-C.2.9">C.2.9 Version 0.98.31</a></h4> +<ul> +<li>Correctly build in a separate object directory again. +<li>Derive all references to the version number from the version file. +<li>New standard macros __NASM_SUBMINOR__ and __NASM_VER__ macros. +<li>Lots of Makefile updates and bug fixes. +<li>New <code><nobr>%ifmacro</nobr></code> directive to test for multiline +macros. +<li>Documentation updates. +<li>Fixes for 16-bit OBJ format output. +<li>Changed the NASM environment variable to NASMENV. +</ul> +<h4><a name="section-C.2.10">C.2.10 Version 0.98.30</a></h4> +<ul> +<li>Changed doc files a lot: completely removed old READMExx and Wishlist +files, incorporating all information in CHANGES and TODO. +<li>I waited a long time to rename zoutieee.c to (original) outieee.c +<li>moved all output modules to output/ subdirectory. +<li>Added 'make strip' target to strip debug info from nasm & ndisasm. +<li>Added INSTALL file with installation instructions. +<li>Added -v option description to nasm man. +<li>Added dist makefile target to produce source distributions. +<li>16-bit support for ELF output format (GNU extension, but useful.) +</ul> +<h4><a name="section-C.2.11">C.2.11 Version 0.98.28</a></h4> +<ul> +<li>Fastcooked this for Debian's Woody release: Frank applied the INCBIN +bug patch to 0.98.25alt and called it 0.98.28 to not confuse poor little +apt-get. +</ul> +<h4><a name="section-C.2.12">C.2.12 Version 0.98.26</a></h4> +<ul> +<li>Reorganised files even better from 0.98.25alt +</ul> +<h4><a name="section-C.2.13">C.2.13 Version 0.98.25alt</a></h4> +<ul> +<li>Prettified the source tree. Moved files to more reasonable places. +<li>Added findleak.pl script to misc/ directory. +<li>Attempted to fix doc. +</ul> +<h4><a name="section-C.2.14">C.2.14 Version 0.98.25</a></h4> +<ul> +<li>Line continuation character <code><nobr>\</nobr></code>. +<li>Docs inadvertantly reverted - "dos packaging". +</ul> +<h4><a name="section-C.2.15">C.2.15 Version 0.98.24p1</a></h4> +<ul> +<li>FIXME: Someone, document this please. +</ul> +<h4><a name="section-C.2.16">C.2.16 Version 0.98.24</a></h4> +<ul> +<li>Documentation - Ndisasm doc added to Nasm.doc. +</ul> +<h4><a name="section-C.2.17">C.2.17 Version 0.98.23</a></h4> +<ul> +<li>Attempted to remove rdoff version1 +<li>Lino Mastrodomenico's patches to preproc.c (%$$ bug?). +</ul> +<h4><a name="section-C.2.18">C.2.18 Version 0.98.22</a></h4> +<ul> +<li>Update rdoff2 - attempt to remove v1. +</ul> +<h4><a name="section-C.2.19">C.2.19 Version 0.98.21</a></h4> +<ul> +<li>Optimization fixes. +</ul> +<h4><a name="section-C.2.20">C.2.20 Version 0.98.20</a></h4> +<ul> +<li>Optimization fixes. +</ul> +<h4><a name="section-C.2.21">C.2.21 Version 0.98.19</a></h4> +<ul> +<li>H. J. Lu's patch back out. +</ul> +<h4><a name="section-C.2.22">C.2.22 Version 0.98.18</a></h4> +<ul> +<li>Added ".rdata" to "-f win32". +</ul> +<h4><a name="section-C.2.23">C.2.23 Version 0.98.17</a></h4> +<ul> +<li>H. J. Lu's "bogus elf" patch. (Red Hat problem?) +</ul> +<h4><a name="section-C.2.24">C.2.24 Version 0.98.16</a></h4> +<ul> +<li>Fix whitespace before "[section ..." bug. +</ul> +<h4><a name="section-C.2.25">C.2.25 Version 0.98.15</a></h4> +<ul> +<li>Rdoff changes (?). +<li>Fix fixes to memory leaks. +</ul> +<h4><a name="section-C.2.26">C.2.26 Version 0.98.14</a></h4> +<ul> +<li>Fix memory leaks. +</ul> +<h4><a name="section-C.2.27">C.2.27 Version 0.98.13</a></h4> +<ul> +<li>There was no 0.98.13 +</ul> +<h4><a name="section-C.2.28">C.2.28 Version 0.98.12</a></h4> +<ul> +<li>Update optimization (new function of "-O1") +<li>Changes to test/bintest.asm (?). +</ul> +<h4><a name="section-C.2.29">C.2.29 Version 0.98.11</a></h4> +<ul> +<li>Optimization changes. +<li>Ndisasm fixed. +</ul> +<h4><a name="section-C.2.30">C.2.30 Version 0.98.10</a></h4> +<ul> +<li>There was no 0.98.10 +</ul> +<h4><a name="section-C.2.31">C.2.31 Version 0.98.09</a></h4> +<ul> +<li>Add multiple sections support to "-f bin". +<li>Changed GLOBAL_TEMP_BASE in outelf.c from 6 to 15. +<li>Add "-v" as an alias to the "-r" switch. +<li>Remove "#ifdef" from Tasm compatibility options. +<li>Remove redundant size-overrides on "mov ds, ex", etc. +<li>Fixes to SSE2, other insns.dat (?). +<li>Enable uppercase "I" and "P" switches. +<li>Case insinsitive "seg" and "wrt". +<li>Update install.sh (?). +<li>Allocate tokens in blocks. +<li>Improve "invalid effective address" messages. +</ul> +<h4><a name="section-C.2.32">C.2.32 Version 0.98.08</a></h4> +<ul> +<li>Add "<code><nobr>%strlen</nobr></code>" and +"<code><nobr>%substr</nobr></code>" macro operators +<li>Fixed broken c16.mac. +<li>Unterminated string error reported. +<li>Fixed bugs as per 0.98bf +</ul> +<h4><a name="section-C.2.33">C.2.33 Version 0.98.09b with John Coffman patches released 28-Oct-2001</a></h4> +<p>Changes from 0.98.07 release to 98.09b as of 28-Oct-2001 +<ul> +<li>More closely compatible with 0.98 when -O0 is implied or specified. Not +strictly identical, since backward branches in range of short offsets are +recognized, and signed byte values with no explicit size specification will +be assembled as a single byte. +<li>More forgiving with the PUSH instruction. 0.98 requires a size to be +specified always. 0.98.09b will imply the size from the current BITS +setting (16 or 32). +<li>Changed definition of the optimization flag: +</ul> +<p>-O0 strict two-pass assembly, JMP and Jcc are handled more like 0.98, +except that back- ward JMPs are short, if possible. +<p>-O1 strict two-pass assembly, but forward branches are assembled with +code guaranteed to reach; may produce larger code than -O0, but will +produce successful assembly more often if branch offset sizes are not +specified. +<p>-O2 multi-pass optimization, minimize branch offsets; also will minimize +signed immed- iate bytes, overriding size specification. +<p>-O3 like -O2, but more passes taken, if needed +<h4><a name="section-C.2.34">C.2.34 Version 0.98.07 released 01/28/01</a></h4> +<ul> +<li>Added Stepane Denis' SSE2 instructions to a *working* version of the +code - some earlier versions were based on broken code - sorry 'bout that. +version "0.98.07" +</ul> +<p>01/28/01 +<ul> +<li>Cosmetic modifications to nasm.c, nasm.h, AUTHORS, MODIFIED +</ul> +<h4><a name="section-C.2.35">C.2.35 Version 0.98.06f released 01/18/01</a></h4> +<ul> +<li>- Add "metalbrain"s jecxz bug fix in insns.dat - alter nasmdoc.src to +match - version "0.98.06f" +</ul> +<h4><a name="section-C.2.36">C.2.36 Version 0.98.06e released 01/09/01</a></h4> +<ul> +<li>Removed the "outforms.h" file - it appears to be someone's old backup +of "outform.h". version "0.98.06e" +</ul> +<p>01/09/01 +<ul> +<li>fbk - finally added the fix for the "multiple %includes bug", known +since 7/27/99 - reported originally (?) and sent to us by Austin Lunnen - +he reports that John Fine had a fix within the day. Here it is... +<li>Nelson Rush resigns from the group. Big thanks to Nelson for his +leadership and enthusiasm in getting these changes incorporated into Nasm! +<li>fbk - [list +], [list -] directives - ineptly implemented, should be +re-written or removed, perhaps. +<li>Brian Raiter / fbk - "elfso bug" fix - applied to aoutb format as well +- testing might be desirable... +</ul> +<p>08/07/00 +<ul> +<li>James Seter - -postfix, -prefix command line switches. +<li>Yuri Zaporogets - rdoff utility changes. +</ul> +<h4><a name="section-C.2.37">C.2.37 Version 0.98p1</a></h4> +<ul> +<li>GAS-like palign (Panos Minos) +<li>FIXME: Someone, fill this in with details +</ul> +<h4><a name="section-C.2.38">C.2.38 Version 0.98bf (bug-fixed)</a></h4> +<ul> +<li>Fixed - elf and aoutb bug - shared libraries - multiple "%include" bug +in "-f obj" - jcxz, jecxz bug - unrecognized option bug in ndisasm +</ul> +<h4><a name="section-C.2.39">C.2.39 Version 0.98.03 with John Coffman's changes released 27-Jul-2000</a></h4> +<ul> +<li>Added signed byte optimizations for the 0x81/0x83 class of +instructions: ADC, ADD, AND, CMP, OR, SBB, SUB, XOR: when used as 'ADD +reg16,imm' or 'ADD reg32,imm.' Also optimization of signed byte form of +'PUSH imm' and 'IMUL reg,imm'/'IMUL reg,reg,imm.' No size specification is +needed. +<li>Added multi-pass JMP and Jcc offset optimization. Offsets on forward +references will preferentially use the short form, without the need to code +a specific size (short or near) for the branch. Added instructions for 'Jcc +label' to use the form 'Jnotcc $+3/JMP label', in cases where a short +offset is out of bounds. If compiling for a 386 or higher CPU, then the 386 +form of Jcc will be used instead. +</ul> +<p>This feature is controlled by a new command-line switch: "O", (upper +case letter O). "-O0" reverts the assembler to no extra optimization +passes, "-O1" allows up to 5 extra passes, and "-O2"(default), allows up to +10 extra optimization passes. +<ul> +<li>Added a new directive: 'cpu XXX', where XXX is any of: 8086, 186, 286, +386, 486, 586, pentium, 686, PPro, P2, P3 or Katmai. All are case +insensitive. All instructions will be selected only if they apply to the +selected cpu or lower. Corrected a couple of bugs in cpu-dependence in +'insns.dat'. +<li>Added to 'standard.mac', the "use16" and "use32" forms of the "bits +16/32" directive. This is nothing new, just conforms to a lot of other +assemblers. (minor) +<li>Changed label allocation from 320/32 (10000 labels @ 200K+) to 32/37 +(1000 labels); makes running under DOS much easier. Since additional label +space is allocated dynamically, this should have no effect on large +programs with lots of labels. The 37 is a prime, believed to be better for +hashing. (minor) +</ul> +<h4><a name="section-C.2.40">C.2.40 Version 0.98.03</a></h4> +<p>"Integrated patchfile 0.98-0.98.01. I call this version 0.98.03 for +historical reasons: 0.98.02 was trashed." --John Coffman +<johninsd@san.rr.com>, 27-Jul-2000 +<ul> +<li>Kendall Bennett's SciTech MGL changes +<li>Note that you must define "TASM_COMPAT" at compile-time to get the Tasm +Ideal Mode compatibility. +<li>All changes can be compiled in and out using the TASM_COMPAT macros, +and when compiled without TASM_COMPAT defined we get the exact same binary +as the unmodified 0.98 sources. +<li>standard.mac, macros.c: Added macros to ignore TASM directives before +first include +<li>nasm.h: Added extern declaration for tasm_compatible_mode +<li>nasm.c: Added global variable tasm_compatible_mode +<li>Added command line switch for TASM compatible mode (-t) +<li>Changed version command line to reflect when compiled with TASM +additions +<li>Added response file processing to allow all arguments on a single line +(response file is @resp rather than -@resp for NASM format). +<li>labels.c: Changes islocal() macro to support TASM style @@local labels. +<li>Added islocalchar() macro to support TASM style @@local labels. +<li>parser.c: Added support for TASM style memory references (ie: mov +[DWORD eax],10 rather than the NASM style mov DWORD [eax],10). +<li>preproc.c: Added new directives, <code><nobr>%arg</nobr></code>, +<code><nobr>%local</nobr></code>, <code><nobr>%stacksize</nobr></code> to +directives table +<li>Added support for TASM style directives without a leading % symbol. +<li>Integrated a block of changes from Andrew Zabolotny +<bit@eltech.ru>: +<li>A new keyword <code><nobr>%xdefine</nobr></code> and its +case-insensitive counterpart <code><nobr>%ixdefine</nobr></code>. They work +almost the same way as <code><nobr>%define</nobr></code> and +<code><nobr>%idefine</nobr></code> but expand the definition immediately, +not on the invocation. Something like a cross between +<code><nobr>%define</nobr></code> and <code><nobr>%assign</nobr></code>. +The "x" suffix stands for "eXpand", so "xdefine" can be deciphered as +"expand-and-define". Thus you can do things like this: +</ul> +<p><pre> + %assign ofs 0 + + %macro arg 1 + %xdefine %1 dword [esp+ofs] + %assign ofs ofs+4 + %endmacro +</pre> +<ul> +<li>Changed the place where the expansion of %$name macros are expanded. +Now they are converted into ..@ctxnum.name form when detokenizing, so there +are no quirks as before when using %$name arguments to macros, in macros +etc. For example: +</ul> +<p><pre> + %macro abc 1 + %define %1 hello + %endm + + abc %$here + %$here +</pre> +<p>Now last line will be expanded into "hello" as expected. This also +allows for lots of goodies, a good example are extended "proc" macros +included in this archive. +<ul> +<li>Added a check for "cstk" in smacro_defined() before calling get_ctx() - +this allows for things like: +</ul> +<p><pre> + %ifdef %$abc + %endif +</pre> +<p>to work without warnings even in no context. +<ul> +<li>Added a check for "cstk" in %if*ctx and %elif*ctx directives - this +allows to use <code><nobr>%ifctx</nobr></code> without excessive warnings. +If there is no active context, <code><nobr>%ifctx</nobr></code> goes +through "false" branch. +<li>Removed "user error: " prefix with <code><nobr>%error</nobr></code> +directive: it just clobbers the output and has absolutely no functionality. +Besides, this allows to write macros that does not differ from built-in +functions in any way. +<li>Added expansion of string that is output by +<code><nobr>%error</nobr></code> directive. Now you can do things like: +</ul> +<p><pre> + %define hello(x) Hello, x! + + %define %$name andy + %error "hello(%$name)" +</pre> +<p>Same happened with <code><nobr>%include</nobr></code> directive. +<ul> +<li>Now all directives that expect an identifier will try to expand and +concatenate everything without whitespaces in between before usage. For +example, with "unfixed" nasm the commands +</ul> +<p><pre> + %define %$abc hello + %define __%$abc goodbye + __%$abc +</pre> +<p>would produce "incorrect" output: last line will expand to +<p><pre> + hello goodbyehello +</pre> +<p>Not quite what you expected, eh? :-) The answer is that preprocessor +treats the <code><nobr>%define</nobr></code> construct as if it would be +<p><pre> + %define __ %$abc goodbye +</pre> +<p>(note the white space between __ and %$abc). After my "fix" it will +"correctly" expand into +<p><pre> + goodbye +</pre> +<p>as expected. Note that I use quotes around words "correct", "incorrect" +etc because this is rather a feature not a bug; however current behaviour +is more logical (and allows more advanced macro usage :-). +<p>Same change was applied to: +<code><nobr>%push</nobr></code>,<code><nobr>%macro</nobr></code>,<code><nobr>%imacro</nobr></code>,<code><nobr>%define</nobr></code>,<code><nobr>%idefine</nobr></code>,<code><nobr>%xdefine</nobr></code>,<code><nobr>%ixdefine</nobr></code>, +<code><nobr>%assign</nobr></code>,<code><nobr>%iassign</nobr></code>,<code><nobr>%undef</nobr></code> +<ul> +<li>A new directive [WARNING {+|-}warning-id] have been added. It works +only if the assembly phase is enabled (i.e. it doesn't work with nasm -e). +<li>A new warning type: macro-selfref. By default this warning is disabled; +when enabled NASM warns when a macro self-references itself; for example +the following source: +</ul> +<p><pre> + [WARNING macro-selfref] + + %macro push 1-* + %rep %0 + push %1 + %rotate 1 + %endrep + %endmacro + + push eax,ebx,ecx +</pre> +<p>will produce a warning, but if we remove the first line we won't see it +anymore (which is The Right Thing To Do {tm} IMHO since C preprocessor eats +such constructs without warnings at all). +<ul> +<li>Added a "error" routine to preprocessor which always will set ERR_PASS1 +bit in severity_code. This removes annoying repeated errors on first and +second passes from preprocessor. +<li>Added the %+ operator in single-line macros for concatenating two +identifiers. Usage example: +</ul> +<p><pre> + %define _myfunc _otherfunc + %define cextern(x) _ %+ x + cextern (myfunc) +</pre> +<p>After first expansion, third line will become "_myfunc". After this +expansion is performed again so it becomes "_otherunc". +<ul> +<li>Now if preprocessor is in a non-emitting state, no warning or error +will be emitted. Example: +</ul> +<p><pre> + %if 1 + mov eax,ebx + %else + put anything you want between these two brackets, + even macro-parameter references %1 or local + labels %$zz or macro-local labels %%zz - no + warning will be emitted. + %endif +</pre> +<ul> +<li>Context-local variables on expansion as a last resort are looked up in +outer contexts. For example, the following piece: +</ul> +<p><pre> + %push outer + %define %$a [esp] + + %push inner + %$a + %pop + %pop +</pre> +<p>will expand correctly the fourth line to [esp]; if we'll define another +%$a inside the "inner" context, it will take precedence over outer +definition. However, this modification has been applied only to +expand_smacro and not to smacro_define: as a consequence expansion looks in +outer contexts, but <code><nobr>%ifdef</nobr></code> won't look in outer +contexts. +<p>This behaviour is needed because we don't want nested contexts to act on +already defined local macros. Example: +<p><pre> + %define %$arg1 [esp+4] + test eax,eax + if nz + mov eax,%$arg1 + endif +</pre> +<p>In this example the "if" mmacro enters into the "if" context, so %$arg1 +is not valid anymore inside "if". Of course it could be worked around by +using explicitely %$$arg1 but this is ugly IMHO. +<ul> +<li>Fixed memory leak in <code><nobr>%undef</nobr></code>. The origline +wasn't freed before exiting on success. +<li>Fixed trap in preprocessor when line expanded to empty set of tokens. +This happens, for example, in the following case: +</ul> +<p><pre> + #define SOMETHING + SOMETHING +</pre> +<h4><a name="section-C.2.41">C.2.41 Version 0.98</a></h4> +<p>All changes since NASM 0.98p3 have been produced by H. Peter Anvin +<hpa@zytor.com>. +<ul> +<li>The documentation comment delimiter is +<li>Allow EQU definitions to refer to external labels; reported by Pedro +Gimeno. +<li>Re-enable support for RDOFF v1; reported by Pedro Gimeno. +<li>Updated License file per OK from Simon and Julian. +</ul> +<h4><a name="section-C.2.42">C.2.42 Version 0.98p9</a></h4> +<ul> +<li>Update documentation (although the instruction set reference will have +to wait; I don't want to hold up the 0.98 release for it.) +<li>Verified that the NASM implementation of the PEXTRW and PMOVMSKB +instructions is correct. The encoding differs from what the Intel manuals +document, but the Pentium III behaviour matches NASM, not the Intel +manuals. +<li>Fix handling of implicit sizes in PSHUFW and PINSRW, reported by Stefan +Hoffmeister. +<li>Resurrect the -s option, which was removed when changing the diagnostic +output to stdout. +</ul> +<h4><a name="section-C.2.43">C.2.43 Version 0.98p8</a></h4> +<ul> +<li>Fix for "DB" when NASM is running on a bigendian machine. +<li>Invoke insns.pl once for each output script, making Makefile.in legal +for "make -j". +<li>Improve the Unix configure-based makefiles to make package creation +easier. +<li>Included an RPM .spec file for building RPM (RedHat Package Manager) +packages on Linux or Unix systems. +<li>Fix Makefile dependency problems. +<li>Change src/rdsrc.pl to include sectioning information in info output; +required for install-info to work. +<li>Updated the RDOFF distribution to version 2 from Jules; minor massaging +to make it compile in my environment. +<li>Split doc files that can be built by anyone with a Perl interpreter off +into a separate archive. +<li>"Dress rehearsal" release! +</ul> +<h4><a name="section-C.2.44">C.2.44 Version 0.98p7</a></h4> +<ul> +<li>Fixed opcodes with a third byte-sized immediate argument to not +complain if given "byte" on the immediate. +<li>Allow <code><nobr>%undef</nobr></code> to remove single-line macros +with arguments. This matches the behaviour of #undef in the C preprocessor. +<li>Allow -d, -u, -i and -p to be specified as -D, -U, -I and -P for +compatibility with most C compilers and preprocessors. This allows Makefile +options to be shared between cc and nasm, for example. +<li>Minor cleanups. +<li>Went through the list of Katmai instructions and hopefully fixed the +(rather few) mistakes in it. +<li>(Hopefully) fixed a number of disassembler bugs related to ambiguous +instructions (disambiguated by -p) and SSE instructions with REP. +<li>Fix for bug reported by Mark Junger: "call dword 0x12345678" should +work and may add an OSP (affected CALL, JMP, Jcc). +<li>Fix for environments when "stderr" isn't a compile-time constant. +</ul> +<h4><a name="section-C.2.45">C.2.45 Version 0.98p6</a></h4> +<ul> +<li>Took officially over coordination of the 0.98 release; so drop the p3.x +notation. Skipped p4 and p5 to avoid confusion with John Fine's J4 and J5 +releases. +<li>Update the documentation; however, it still doesn't include +documentation for the various new instructions. I somehow wonder if it +makes sense to have an instruction set reference in the assembler manual +when Intel et al have PDF versions of their manuals online. +<li>Recognize "idt" or "centaur" for the -p option to ndisasm. +<li>Changed error messages back to stderr where they belong, but add an -E +option to redirect them elsewhere (the DOS shell cannot redirect stderr.) +<li>-M option to generate Makefile dependencies (based on code from Alex +Verstak.) +<li><code><nobr>%undef</nobr></code> preprocessor directive, and -u option, +that undefines a single-line macro. +<li>OS/2 Makefile (Mkfiles/Makefile.os2) for Borland under OS/2; from Chuck +Crayne. +<li>Various minor bugfixes (reported by): - Dangling +<code><nobr>%s</nobr></code> in preproc.c (Martin Junker) +<li>THERE ARE KNOWN BUGS IN SSE AND THE OTHER KATMAI INSTRUCTIONS. I am on +a trip and didn't bring the Katmai instruction reference, so I can't work +on them right now. +<li>Updated the License file per agreement with Simon and Jules to include +a GPL distribution clause. +</ul> +<h4><a name="section-C.2.46">C.2.46 Version 0.98p3.7</a></h4> +<ul> +<li>(Hopefully) fixed the canned Makefiles to include the outrdf2 and +zoutieee modules. +<li>Renamed changes.asm to changed.asm. +</ul> +<h4><a name="section-C.2.47">C.2.47 Version 0.98p3.6</a></h4> +<ul> +<li>Fixed a bunch of instructions that were added in 0.98p3.5 which had +memory operands, and the address-size prefix was missing from the +instruction pattern. +</ul> +<h4><a name="section-C.2.48">C.2.48 Version 0.98p3.5</a></h4> +<ul> +<li>Merged in changes from John S. Fine's 0.98-J5 release. John's based +0.98-J5 on my 0.98p3.3 release; this merges the changes. +<li>Expanded the instructions flag field to a long so we can fit more +flags; mark SSE (KNI) and AMD or Katmai-specific instructions as such. +<li>Fix the "PRIV" flag on a bunch of instructions, and create new "PROT" +flag for protected-mode-only instructions (orthogonal to if the instruction +is privileged!) and new "SMM" flag for SMM-only instructions. +<li>Added AMD-only SYSCALL and SYSRET instructions. +<li>Make SSE actually work, and add new Katmai MMX instructions. +<li>Added a -p (preferred vendor) option to ndisasm so that it can +distinguish e.g. Cyrix opcodes also used in SSE. For example: +</ul> +<p><pre> + ndisasm -p cyrix aliased.bin + 00000000 670F514310 paddsiw mm0,[ebx+0x10] + 00000005 670F514320 paddsiw mm0,[ebx+0x20] + ndisasm -p intel aliased.bin + 00000000 670F514310 sqrtps xmm0,[ebx+0x10] + 00000005 670F514320 sqrtps xmm0,[ebx+0x20] +</pre> +<ul> +<li>Added a bunch of Cyrix-specific instructions. +</ul> +<h4><a name="section-C.2.49">C.2.49 Version 0.98p3.4</a></h4> +<ul> +<li>Made at least an attempt to modify all the additional Makefiles (in the +Mkfiles directory). I can't test it, but this was the best I could do. +<li>DOS DJGPP+"Opus Make" Makefile from John S. Fine. +<li>changes.asm changes from John S. Fine. +</ul> +<h4><a name="section-C.2.50">C.2.50 Version 0.98p3.3</a></h4> +<ul> +<li>Patch from Conan Brink to allow nesting of +<code><nobr>%rep</nobr></code> directives. +<li>If we're going to allow INT01 as an alias for INT1/ICEBP (one of Jules +0.98p3 changes), then we should allow INT03 as an alias for INT3 as well. +<li>Updated changes.asm to include the latest changes. +<li>Tried to clean up the <CR>s that had snuck in from a DOS/Windows +environment into my Unix environment, and try to make sure than DOS/Windows +users get them back. +<li>We would silently generate broken tools if insns.dat wasn't sorted +properly. Change insns.pl so that the order doesn't matter. +<li>Fix bug in insns.pl (introduced by me) which would cause conditional +instructions to have an extra "cc" in disassembly, e.g. "jnz" disassembled +as "jccnz". +</ul> +<h4><a name="section-C.2.51">C.2.51 Version 0.98p3.2</a></h4> +<ul> +<li>Merged in John S. Fine's changes from his 0.98-J4 prerelease; see +http://www.csoft.net/cz/johnfine/ +<li>Changed previous "spotless" Makefile target (appropriate for +distribution) to "distclean", and added "cleaner" target which is same as +"clean" except deletes files generated by Perl scripts; "spotless" is +union. +<li>Removed BASIC programs from distribution. Get a Perl interpreter +instead (see below.) +<li>Calling this "pre-release 3.2" rather than "p3-hpa2" because of John's +contributions. +<li>Actually link in the IEEE output format (zoutieee.c); fix a bunch of +compiler warnings in that file. Note I don't know what IEEE output is +supposed to look like, so these changes were made "blind". +</ul> +<h4><a name="section-C.2.52">C.2.52 Version 0.98p3-hpa</a></h4> +<ul> +<li>Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully buildable +version for Unix systems (Makefile.in updates, etc.) +<li>Changed insns.pl to create the instruction tables in nasm.h and +names.c, so that a new instruction can be added by adding it *only* to +insns.dat. +<li>Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE, +FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel guarantee will +never be used; one of them is documented as UD2 in Intel documentation, the +other one just as "Undefined Opcode" -- calling it UD1 seemed to make +sense.) +<li>MAX_SYMBOL was defined to be 9, but LOADALL286 and LOADALL386 are 10 +characters long. Now MAX_SYMBOL is derived from insns.dat. +<li>A note on the BASIC programs included: forget them. insns.bas is +already out of date. Get yourself a Perl interpreter for your platform of +choice at +<a href="http://www.cpan.org/ports/index.html">http://www.cpan.org/ports/index.html</a>. +</ul> +<h4><a name="section-C.2.53">C.2.53 Version 0.98 pre-release 3</a></h4> +<ul> +<li>added response file support, improved command line handling, new layout +help screen +<li>fixed limit checking bug, 'OUT byte nn, reg' bug, and a couple of rdoff +related bugs, updated Wishlist; 0.98 Prerelease 3. +</ul> +<h4><a name="section-C.2.54">C.2.54 Version 0.98 pre-release 2</a></h4> +<ul> +<li>fixed bug in outcoff.c to do with truncating section names longer than +8 characters, referencing beyond end of string; 0.98 pre-release 2 +</ul> +<h4><a name="section-C.2.55">C.2.55 Version 0.98 pre-release 1</a></h4> +<ul> +<li>Fixed a bug whereby STRUC didn't work at all in RDF. +<li>Fixed a problem with group specification in PUBDEFs in OBJ. +<li>Improved ease of adding new output formats. Contribution due to Fox +Cutter. +<li>Fixed a bug in relocations in the `bin' format: was showing up when a +relocatable reference crossed an 8192-byte boundary in any output section. +<li>Fixed a bug in local labels: local-label lookups were inconsistent +between passes one and two if an EQU occurred between the definition of a +global label and the subsequent use of a local label local to that global. +<li>Fixed a seg-fault in the preprocessor (again) which happened when you +use a blank line as the first line of a multi-line macro definition and +then defined a label on the same line as a call to that macro. +<li>Fixed a stale-pointer bug in the handling of the NASM environment +variable. Thanks to Thomas McWilliams. +<li>ELF had a hard limit on the number of sections which caused segfaults +when transgressed. Fixed. +<li>Added ability for ndisasm to read from stdin by using `-' as the +filename. +<li>ndisasm wasn't outputting the TO keyword. Fixed. +<li>Fixed error cascade on bogus expression in +<code><nobr>%if</nobr></code> - an error in evaluation was causing the +entire <code><nobr>%if</nobr></code> to be discarded, thus creating trouble +later when the <code><nobr>%else</nobr></code> or +<code><nobr>%endif</nobr></code> was encountered. +<li>Forward reference tracking was instruction-granular not operand- +granular, which was causing 286-specific code to be generated needlessly on +code of the form `shr word [forwardref],1'. Thanks to Jim Hague for sending +a patch. +<li>All messages now appear on stdout, as sending them to stderr serves no +useful purpose other than to make redirection difficult. +<li>Fixed the problem with EQUs pointing to an external symbol - this now +generates an error message. +<li>Allowed multiple size prefixes to an operand, of which only the first +is taken into account. +<li>Incorporated John Fine's changes, including fixes of a large number of +preprocessor bugs, some small problems in OBJ, and a reworking of label +handling to define labels before their line is assembled, rather than +after. +<li>Reformatted a lot of the source code to be more readable. Included +'coding.txt' as a guideline for how to format code for contributors. +<li>Stopped nested <code><nobr>%reps</nobr></code> causing a panic - they +now cause a slightly more friendly error message instead. +<li>Fixed floating point constant problems (patch by Pedro Gimeno) +<li>Fixed the return value of insn_size() not being checked for -1, +indicating an error. +<li>Incorporated 3Dnow! instructions. +<li>Fixed the 'mov eax, eax + ebx' bug. +<li>Fixed the GLOBAL EQU bug in ELF. Released developers release 3. +<li>Incorporated John Fine's command line parsing changes +<li>Incorporated David Lindauer's OMF debug support +<li>Made changes for LCC 4.0 support +(<code><nobr>__NASM_CDecl__</nobr></code>, removed register size +specification warning when sizes agree). +</ul> +<h3><a name="section-C.3">C.3 NASM 0.9 Series</a></h3> +<p>Revisions before 0.98. +<h4><a name="section-C.3.1">C.3.1 Version 0.97 released December 1997</a></h4> +<ul> +<li>This was entirely a bug-fix release to 0.96, which seems to have got +cursed. Silly me. +<li>Fixed stupid mistake in OBJ which caused `MOV EAX,<constant>' to +fail. Caused by an error in the `MOV EAX,<segment>' support. +<li>ndisasm hung at EOF when compiled with lcc on Linux because lcc on +Linux somehow breaks feof(). ndisasm now does not rely on feof(). +<li>A heading in the documentation was missing due to a markup error in the +indexing. Fixed. +<li>Fixed failure to update all pointers on realloc() within extended- +operand code in parser.c. Was causing wrong behaviour and seg faults on +lines such as `dd 0.0,0.0,0.0,0.0,...' +<li>Fixed a subtle preprocessor bug whereby invoking one multi-line macro +on the first line of the expansion of another, when the second had been +invoked with a label defined before it, didn't expand the inner macro. +<li>Added internal.doc back in to the distribution archives - it was +missing in 0.96 *blush* +<li>Fixed bug causing 0.96 to be unable to assemble its own test files, +specifically objtest.asm. *blush again* +<li>Fixed seg-faults and bogus error messages caused by mismatching +<code><nobr>%rep</nobr></code> and <code><nobr>%endrep</nobr></code> within +multi-line macro definitions. +<li>Fixed a problem with buffer overrun in OBJ, which was causing +corruption at ends of long PUBDEF records. +<li>Separated DOS archives into main-program and documentation to reduce +download size. +</ul> +<h4><a name="section-C.3.2">C.3.2 Version 0.96 released November 1997</a></h4> +<ul> +<li>Fixed a bug whereby, if `nasm sourcefile' would cause a filename +collision warning and put output into `nasm.out', then `nasm sourcefile -o +outputfile' still gave the warning even though the `-o' was honoured. Fixed +name pollution under Digital UNIX: one of its header files defined R_SP, +which broke the enum in nasm.h. +<li>Fixed minor instruction table problems: FUCOM and FUCOMP didn't have +two-operand forms; NDISASM didn't recognise the longer register forms of +PUSH and POP (eg FF F3 for PUSH BX); TEST mem,imm32 was flagged as +undocumented; the 32-bit forms of CMOV had 16-bit operand size prefixes; +`AAD imm' and `AAM imm' are no longer flagged as undocumented because the +Intel Architecture reference documents them. +<li>Fixed a problem with the local-label mechanism, whereby strange types +of symbol (EQUs, auto-defined OBJ segment base symbols) interfered with the +`previous global label' value and screwed up local labels. +<li>Fixed a bug whereby the stub preprocessor didn't communicate with the +listing file generator, so that the -a and -l options in conjunction would +produce a useless listing file. +<li>Merged `os2' object file format back into `obj', after discovering that +`obj' _also_ shouldn't have a link pass separator in a module containing a +non-trivial MODEND. Flat segments are now declared using the FLAT +attribute. `os2' is no longer a valid object format name: use `obj'. +<li>Removed the fixed-size temporary storage in the evaluator. Very very +long expressions (like `mov ax,1+1+1+1+...' for two hundred 1s or so) +should now no longer crash NASM. +<li>Fixed a bug involving segfaults on disassembly of MMX instructions, by +changing the meaning of one of the operand-type flags in nasm.h. This may +cause other apparently unrelated MMX problems; it needs to be tested +thoroughly. +<li>Fixed some buffer overrun problems with large OBJ output files. Thanks +to DJ Delorie for the bug report and fix. +<li>Made preprocess-only mode actually listen to the +<code><nobr>%line</nobr></code> markers as it prints them, so that it can +report errors more sanely. +<li>Re-designed the evaluator to keep more sensible track of expressions +involving forward references: can now cope with previously-nightmare +situations such as: +</ul> +<p><pre> + mov ax,foo | bar + foo equ 1 + bar equ 2 +</pre> +<ul> +<li>Added the ALIGN and ALIGNB standard macros. +<li>Added PIC support in ELF: use of WRT to obtain the four extra +relocation types needed. +<li>Added the ability for output file formats to define their own +extensions to the GLOBAL, COMMON and EXTERN directives. +<li>Implemented common-variable alignment, and global-symbol type and size +declarations, in ELF. +<li>Implemented NEAR and FAR keywords for common variables, plus far-common +element size specification, in OBJ. +<li>Added a feature whereby EXTERNs and COMMONs in OBJ can be given a +default WRT specification (either a segment or a group). +<li>Transformed the Unix NASM archive into an auto-configuring package. +<li>Added a sanity-check for people applying SEG to things which are +already segment bases: this previously went unnoticed by the SEG processing +and caused OBJ-driver panics later. +<li>Added the ability, in OBJ format, to deal with `MOV +EAX,<segment>' type references: OBJ doesn't directly support +dword-size segment base fixups, but as long as the low two bytes of the +constant term are zero, a word-size fixup can be generated instead and it +will work. +<li>Added the ability to specify sections' alignment requirements in Win32 +object files and pure binary files. +<li>Added preprocess-time expression evaluation: the +<code><nobr>%assign</nobr></code> (and <code><nobr>%iassign</nobr></code>) +directive and the bare <code><nobr>%if</nobr></code> (and +<code><nobr>%elif</nobr></code>) conditional. Added relational operators to +the evaluator, for use only in <code><nobr>%if</nobr></code> constructs: +the standard relationals = < > <= >= <> (and C-like +synonyms == and !=) plus low-precedence logical operators &&, ^^ +and ||. +<li>Added a preprocessor repeat construct: <code><nobr>%rep</nobr></code> / +<code><nobr>%exitrep</nobr></code> / <code><nobr>%endrep</nobr></code>. +<li>Added the __FILE__ and __LINE__ standard macros. +<li>Added a sanity check for number constants being greater than +0xFFFFFFFF. The warning can be disabled. +<li>Added the %0 token whereby a variadic multi-line macro can tell how +many parameters it's been given in a specific invocation. +<li>Added <code><nobr>%rotate</nobr></code>, allowing multi-line macro +parameters to be cycled. +<li>Added the `*' option for the maximum parameter count on multi-line +macros, allowing them to take arbitrarily many parameters. +<li>Added the ability for the user-level forms of EXTERN, GLOBAL and COMMON +to take more than one argument. +<li>Added the IMPORT and EXPORT directives in OBJ format, to deal with +Windows DLLs. +<li>Added some more preprocessor <code><nobr>%if</nobr></code> constructs: +<code><nobr>%ifidn</nobr></code> / <code><nobr>%ifidni</nobr></code> (exact +textual identity), and <code><nobr>%ifid</nobr></code> / +<code><nobr>%ifnum</nobr></code> / <code><nobr>%ifstr</nobr></code> (token +type testing). +<li>Added the ability to distinguish SHL AX,1 (the 8086 version) from SHL +AX,BYTE 1 (the 286-and-upwards version whose constant happens to be 1). +<li>Added NetBSD/FreeBSD/OpenBSD's variant of a.out format, complete with +PIC shared library features. +<li>Changed NASM's idiosyncratic handling of FCLEX, FDISI, FENI, FINIT, +FSAVE, FSTCW, FSTENV, and FSTSW to bring it into line with the otherwise +accepted standard. The previous behaviour, though it was a deliberate +feature, was a deliberate feature based on a misunderstanding. Apologies +for the inconvenience. +<li>Improved the flexibility of ABSOLUTE: you can now give it an expression +rather than being restricted to a constant, and it can take relocatable +arguments as well. +<li>Added the ability for a variable to be declared as EXTERN multiple +times, and the subsequent definitions are just ignored. +<li>We now allow instruction prefixes (CS, DS, LOCK, REPZ etc) to be alone +on a line (without a following instruction). +<li>Improved sanity checks on whether the arguments to EXTERN, GLOBAL and +COMMON are valid identifiers. +<li>Added misc/exebin.mac to allow direct generation of .EXE files by +hacking up an EXE header using DB and DW; also added test/binexe.asm to +demonstrate the use of this. Thanks to Yann Guidon for contributing the EXE +header code. +<li>ndisasm forgot to check whether the input file had been successfully +opened. Now it does. Doh! +<li>Added the Cyrix extensions to the MMX instruction set. +<li>Added a hinting mechanism to allow [EAX+EBX] and [EBX+EAX] to be +assembled differently. This is important since [ESI+EBP] and [EBP+ESI] have +different default base segment registers. +<li>Added support for the PharLap OMF extension for 4096-byte segment +alignment. +</ul> +<h4><a name="section-C.3.3">C.3.3 Version 0.95 released July 1997</a></h4> +<ul> +<li>Fixed yet another ELF bug. This one manifested if the user relied on +the default segment, and attempted to define global symbols without first +explicitly declaring the target segment. +<li>Added makefiles (for NASM and the RDF tools) to build Win32 console +apps under Symantec C++. Donated by Mark Junker. +<li>Added `macros.bas' and `insns.bas', QBasic versions of the Perl scripts +that convert `standard.mac' to `macros.c' and convert `insns.dat' to +`insnsa.c' and `insnsd.c'. Also thanks to Mark Junker. +<li>Changed the diassembled forms of the conditional instructions so that +JB is now emitted as JC, and other similar changes. Suggested list by +Ulrich Doewich. +<li>Added `@' to the list of valid characters to begin an identifier with. +<li>Documentary changes, notably the addition of the `Common Problems' +section in nasm.doc. +<li>Fixed a bug relating to 32-bit PC-relative fixups in OBJ. +<li>Fixed a bug in perm_copy() in labels.c which was causing exceptions in +cleanup_labels() on some systems. +<li>Positivity sanity check in TIMES argument changed from a warning to an +error following a further complaint. +<li>Changed the acceptable limits on byte and word operands to allow things +like `~10111001b' to work. +<li>Fixed a major problem in the preprocessor which caused seg-faults if +macro definitions contained blank lines or comment-only lines. +<li>Fixed inadequate error checking on the commas separating the arguments +to `db', `dw' etc. +<li>Fixed a crippling bug in the handling of macros with operand counts +defined with a `+' modifier. +<li>Fixed a bug whereby object file formats which stored the input file +name in the output file (such as OBJ and COFF) weren't doing so correctly +when the output file name was specified on the command line. +<li>Removed [INC] and [INCLUDE] support for good, since they were obsolete +anyway. +<li>Fixed a bug in OBJ which caused all fixups to be output in 16-bit +(old-format) FIXUPP records, rather than putting the 32-bit ones in +FIXUPP32 (new-format) records. +<li>Added, tentatively, OS/2 object file support (as a minor variant on +OBJ). +<li>Updates to Fox Cutter's Borland C makefile, Makefile.bc2. +<li>Removed a spurious second fclose() on the output file. +<li>Added the `-s' command line option to redirect all messages which would +go to stderr (errors, help text) to stdout instead. +<li>Added the `-w' command line option to selectively suppress some classes +of assembly warning messages. +<li>Added the `-p' pre-include and `-d' pre-define command-line options. +<li>Added an include file search path: the `-i' command line option. +<li>Fixed a silly little preprocessor bug whereby starting a line with a +`%!' environment-variable reference caused an `unknown directive' error. +<li>Added the long-awaited listing file support: the `-l' command line +option. +<li>Fixed a problem with OBJ format whereby, in the absence of any explicit +segment definition, non-global symbols declared in the implicit default +segment generated spurious EXTDEF records in the output. +<li>Added the NASM environment variable. +<li>From this version forward, Win32 console-mode binaries will be included +in the DOS distribution in addition to the 16-bit binaries. Added +Makefile.vc for this purpose. +<li>Added `return 0;' to test/objlink.c to prevent compiler warnings. +<li>Added the __NASM_MAJOR__ and __NASM_MINOR__ standard defines. +<li>Added an alternative memory-reference syntax in which prefixing an +operand with `&' is equivalent to enclosing it in square brackets, at +the request of Fox Cutter. +<li>Errors in pass two now cause the program to return a non-zero error +code, which they didn't before. +<li>Fixed the single-line macro cycle detection, which didn't work at all +on macros with no parameters (caused an infinite loop). Also changed the +behaviour of single-line macro cycle detection to work like cpp, so that +macros like `extrn' as given in the documentation can be implemented. +<li>Fixed the implementation of WRT, which was too restrictive in that you +couldn't do `mov ax,[di+abc wrt dgroup]' because (di+abc) wasn't a +relocatable reference. +</ul> +<h4><a name="section-C.3.4">C.3.4 Version 0.94 released April 1997</a></h4> +<ul> +<li>Major item: added the macro processor. +<li>Added undocumented instructions SMI, IBTS, XBTS and LOADALL286. Also +reorganised CMPXCHG instruction into early-486 and Pentium forms. Thanks to +Thobias Jones for the information. +<li>Fixed two more stupid bugs in ELF, which were causing `ld' to continue +to seg-fault in a lot of non-trivial cases. +<li>Fixed a seg-fault in the label manager. +<li>Stopped FBLD and FBSTP from _requiring_ the TWORD keyword, which is the +only option for BCD loads/stores in any case. +<li>Ensured FLDCW, FSTCW and FSTSW can cope with the WORD keyword, if +anyone bothers to provide it. Previously they complained unless no keyword +at all was present. +<li>Some forms of FDIV/FDIVR and FSUB/FSUBR were still inverted: a vestige +of a bug that I thought had been fixed in 0.92. This was fixed, hopefully +for good this time... +<li>Another minor phase error (insofar as a phase error can _ever_ be +minor) fixed, this one occurring in code of the form +</ul> +<p><pre> + rol ax,forward_reference + forward_reference equ 1 +</pre> +<ul> +<li>The number supplied to TIMES is now sanity-checked for positivity, and +also may be greater than 64K (which previously didn't work on 16-bit +systems). +<li>Added Watcom C makefiles, and misc/pmw.bat, donated by Dominik Behr. +<li>Added the INCBIN pseudo-opcode. +<li>Due to the advent of the preprocessor, the [INCLUDE] and [INC] +directives have become obsolete. They are still supported in this version, +with a warning, but won't be in the next. +<li>Fixed a bug in OBJ format, which caused incorrect object records to be +output when absolute labels were made global. +<li>Updates to RDOFF subdirectory, and changes to outrdf.c. +</ul> +<h4><a name="section-C.3.5">C.3.5 Version 0.93 released January 1997</a></h4> +<p>This release went out in a great hurry after semi-crippling bugs were +found in 0.92. +<ul> +<li>Really <em>did</em> fix the stack overflows this time. *blush* +<li>Had problems with EA instruction sizes changing between passes, when an +offset contained a forward reference and so 4 bytes were allocated for the +offset in pass one; by pass two the symbol had been defined and happened to +be a small absolute value, so only 1 byte got allocated, causing +instruction size mismatch between passes and hence incorrect address +calculations. Fixed. +<li>Stupid bug in the revised ELF section generation fixed (associated +string-table section for .symtab was hard-coded as 7, even when this didn't +fit with the real section table). Was causing `ld' to seg-fault under +Linux. +<li>Included a new Borland C makefile, Makefile.bc2, donated by Fox Cutter +<lmb@comtch.iea.com>. +</ul> +<h4><a name="section-C.3.6">C.3.6 Version 0.92 released January 1997</a></h4> +<ul> +<li>The FDIVP/FDIVRP and FSUBP/FSUBRP pairs had been inverted: this was +fixed. This also affected the LCC driver. +<li>Fixed a bug regarding 32-bit effective addresses of the form +<code><nobr>[other_register+ESP]</nobr></code>. +<li>Documentary changes, notably documentation of the fact that Borland +Win32 compilers use `obj' rather than `win32' object format. +<li>Fixed the COMENT record in OBJ files, which was formatted incorrectly. +<li>Fixed a bug causing segfaults in large RDF files. +<li>OBJ format now strips initial periods from segment and group +definitions, in order to avoid complications with the local label syntax. +<li>Fixed a bug in disassembling far calls and jumps in NDISASM. +<li>Added support for user-defined sections in COFF and ELF files. +<li>Compiled the DOS binaries with a sensible amount of stack, to prevent +stack overflows on any arithmetic expression containing parentheses. +<li>Fixed a bug in handling of files that do not terminate in a newline. +</ul> +<h4><a name="section-C.3.7">C.3.7 Version 0.91 released November 1996</a></h4> +<ul> +<li>Loads of bug fixes. +<li>Support for RDF added. +<li>Support for DBG debugging format added. +<li>Support for 32-bit extensions to Microsoft OBJ format added. +<li>Revised for Borland C: some variable names changed, makefile added. +<li>LCC support revised to actually work. +<li>JMP/CALL NEAR/FAR notation added. +<li>`a16', `o16', `a32' and `o32' prefixes added. +<li>Range checking on short jumps implemented. +<li>MMX instruction support added. +<li>Negative floating point constant support added. +<li>Memory handling improved to bypass 64K barrier under DOS. +<li><code><nobr>$</nobr></code> prefix to force treatment of reserved words +as identifiers added. +<li>Default-size mechanism for object formats added. +<li>Compile-time configurability added. +<li><code><nobr>#</nobr></code>, <code><nobr>@</nobr></code>, +<code><nobr>~</nobr></code> and c{?} are now valid characters in labels. +<li><code><nobr>-e</nobr></code> and <code><nobr>-k</nobr></code> options +in NDISASM added. +</ul> +<h4><a name="section-C.3.8">C.3.8 Version 0.90 released October 1996</a></h4> +<p>First release version. First support for object file output. Other +changes from previous version (0.3x) too numerous to document. +<p align=center><a href="nasmdocb.html">Previous Chapter</a> | +<a href="nasmdoc0.html">Contents</a> | +<a href="nasmdoci.html">Index</a> +</body></html> diff --git a/doc/html/nasmdoci.html b/doc/html/nasmdoci.html new file mode 100644 index 0000000..54eb6a6 --- /dev/null +++ b/doc/html/nasmdoci.html @@ -0,0 +1,2345 @@ +<html><head><title>NASM Manual</title></head> +<body><h1 align=center>The Netwide Assembler: NASM</h1> + +<p align=center><a href="nasmdoc0.html">Contents</a> +<p><code><nobr>!</nobr></code> operator, unary: +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +<code><nobr>!=</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>$$</nobr></code> token: +<a href="nasmdoc3.html#section-3.5">Section 3.5</a>, +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>$</nobr></code>, Here token: +<a href="nasmdoc3.html#section-3.5">Section 3.5</a> +<br> +<code><nobr>$</nobr></code>, prefix: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a>, +<a href="nasmdoc3.html#section-3.4.1">Section 3.4.1</a>, +<a href="nasmdoc7.html#section-7.13.2">Section 7.13.2</a> +<br> +<code><nobr>%</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr>%!</nobr></code>: +<a href="nasmdoc4.html#section-4.10.2">Section 4.10.2</a> +<br> +<code><nobr>%$</nobr></code> and <code><nobr>%$$</nobr></code> prefixes: +<a href="nasmdoc4.html#section-4.7.2">Section 4.7.2</a> +<br> +<code><nobr>%%</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a>, +<a href="nasmdoc4.html#section-4.3.3">Section 4.3.3</a> +<br> +<code><nobr>%+</nobr></code>: +<a href="nasmdoc4.html#section-4.1.4">Section 4.1.4</a> +<br> +<code><nobr>%?</nobr></code>: +<a href="nasmdoc4.html#section-4.1.5">Section 4.1.5</a> +<br> +<code><nobr>%??</nobr></code>: +<a href="nasmdoc4.html#section-4.1.5">Section 4.1.5</a> +<br> +<code><nobr>%[</nobr></code>: +<a href="nasmdoc4.html#section-4.1.3">Section 4.1.3</a> +<br> +<code><nobr>&</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.3">Section 3.5.3</a> +<br> +<code><nobr>&&</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>*</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr>+</nobr></code> modifier: +<a href="nasmdoc4.html#section-4.3.4">Section 4.3.4</a> +<br> +<code><nobr>+</nobr></code> operator, binary: +<a href="nasmdoc3.html#section-3.5.5">Section 3.5.5</a> +<br> +<code><nobr>+</nobr></code> operator, unary: +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +<code><nobr>-</nobr></code> operator, binary: +<a href="nasmdoc3.html#section-3.5.5">Section 3.5.5</a> +<br> +<code><nobr>-</nobr></code> operator, unary: +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +<code><nobr>..@</nobr></code> symbol prefix: +<a href="nasmdoc3.html#section-3.9">Section 3.9</a>, +<a href="nasmdoc4.html#section-4.3.3">Section 4.3.3</a> +<br> +<code><nobr>/</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr>//</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr><</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr><<</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.4">Section 3.5.4</a> +<br> +<code><nobr><=</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr><></nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>=</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>==</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>></nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>>=</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>>></nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.4">Section 3.5.4</a> +<br> +<code><nobr>?</nobr></code> MASM syntax: +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>^</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.2">Section 3.5.2</a> +<br> +<code><nobr>^^</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>|</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.1">Section 3.5.1</a> +<br> +<code><nobr>||</nobr></code> operator: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>~</nobr></code> operator: +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +<code><nobr>%0</nobr></code> parameter count: +<a href="nasmdoc4.html#section-4.3.5">Section 4.3.5</a>, +<a href="nasmdoc4.html#section-4.3.6">Section 4.3.6</a> +<br> +<code><nobr>%+1</nobr></code> and <code><nobr>%-1</nobr></code> syntax: +<a href="nasmdoc4.html#section-4.3.9">Section 4.3.9</a> +<br> +16-bit mode, versus 32-bit mode: +<a href="nasmdoc6.html#section-6.1">Section 6.1</a> +<br> +64-bit displacement: <a href="nasmdo11.html#section-11.2">Section 11.2</a> +<br> +64-bit immediate: <a href="nasmdo11.html#section-11.2">Section 11.2</a> +<br> +<code><nobr>-a</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.21">Section 2.1.21</a>, +<a href="nasmdoca.html#section-A.3.3">Section A.3.3</a> +<br> +<code><nobr>A16</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>a16</nobr></code>: +<a href="nasmdo10.html#section-10.3">Section 10.3</a> +<br> +<code><nobr>A32</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>a32</nobr></code>: +<a href="nasmdo10.html#section-10.3">Section 10.3</a> +<br> +<code><nobr>A64</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>a64</nobr></code>: +<a href="nasmdo10.html#section-10.3">Section 10.3</a> +<br> +<code><nobr>a86</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a>, +<a href="nasmdoc2.html#section-2.2">Section 2.2</a>, +<a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a>, +<a href="nasmdoc2.html#section-2.2.6">Section 2.2.6</a> +<br> +<code><nobr>ABS</nobr></code>: +<a href="nasmdoc3.html#section-3.3">Section 3.3</a> +<br> +<code><nobr>ABSOLUTE</nobr></code>: +<a href="nasmdoc6.html#section-6.4">Section 6.4</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +addition: <a href="nasmdoc3.html#section-3.5.5">Section 3.5.5</a> +<br> +addressing, mixed-size: +<a href="nasmdo10.html#section-10.2">Section 10.2</a> +<br> +address-size prefixes: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +algebra: <a href="nasmdoc3.html#section-3.3">Section 3.3</a> +<br> +<code><nobr>ALIGN</nobr></code>: +<a href="nasmdoc4.html#section-4.11.12">Section 4.11.12</a>, +<a href="nasmdoc5.html#section-5.2">Section 5.2</a>, +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>ALIGN</nobr></code>, smart: +<a href="nasmdoc5.html#section-5.2">Section 5.2</a> +<br> +<code><nobr>ALIGNB</nobr></code>: +<a href="nasmdoc4.html#section-4.11.12">Section 4.11.12</a> +<br> +alignment, in <code><nobr>bin</nobr></code> sections: +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2</a> +<br> +alignment, in <code><nobr>elf</nobr></code> sections: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +alignment, in <code><nobr>obj</nobr></code> sections: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +alignment, in <code><nobr>win32</nobr></code> sections: +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a> +<br> +alignment, of <code><nobr>elf</nobr></code> common variables: +<a href="nasmdoc7.html#section-7.9.6">Section 7.9.6</a> +<br> +<code><nobr>ALIGNMODE</nobr></code>: +<a href="nasmdoc5.html#section-5.2">Section 5.2</a> +<br> +<code><nobr>__ALIGNMODE__</nobr></code>: +<a href="nasmdoc5.html#section-5.2">Section 5.2</a> +<br> +<code><nobr>ALINK</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>alink.sourceforge.net</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>all</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>alloc</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +alternate register names: +<a href="nasmdoc5.html#section-5.1">Section 5.1</a> +<br> +<code><nobr>alt.lang.asm</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a> +<br> +<code><nobr>altreg</nobr></code>: +<a href="nasmdoc5.html#section-5.1">Section 5.1</a> +<br> +ambiguity: <a href="nasmdoc2.html#section-2.2.3">Section 2.2.3</a> +<br> +<code><nobr>a.out</nobr></code>, BSD version: +<a href="nasmdoc7.html#section-7.11">Section 7.11</a> +<br> +<code><nobr>a.out</nobr></code>, Linux version: +<a href="nasmdoc7.html#section-7.10">Section 7.10</a> +<br> +<code><nobr>aout</nobr></code>: +<a href="nasmdoc7.html#section-7.10">Section 7.10</a> +<br> +<code><nobr>aoutb</nobr></code>: +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>%arg</nobr></code>: +<a href="nasmdoc4.html#section-4.8.1">Section 4.8.1</a> +<br> +<code><nobr>arg</nobr></code>: +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4</a> +<br> +<code><nobr>as86</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a>, +<a href="nasmdoc7.html#section-7.12">Section 7.12</a> +<br> +assembler directives: <a href="nasmdoc6.html">Chapter 6</a> +<br> +assembly-time options: +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18</a> +<br> +<code><nobr>%assign</nobr></code>: +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7</a> +<br> +<code><nobr>ASSUME</nobr></code>: +<a href="nasmdoc2.html#section-2.2.4">Section 2.2.4</a> +<br> +<code><nobr>AT</nobr></code>: +<a href="nasmdoc4.html#section-4.11.11">Section 4.11.11</a> +<br> +Autoconf: <a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +<code><nobr>autoexec.bat</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>auto-sync</nobr></code>: +<a href="nasmdoca.html#section-A.3.3">Section A.3.3</a> +<br> +<code><nobr>-b</nobr></code>: +<a href="nasmdoca.html#section-A.3">Section A.3</a> +<br> +bin: <a href="nasmdoc2.html#section-2.1.2">Section 2.1.2</a>, +<a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +bin, multisection: <a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +binary: <a href="nasmdoc3.html#section-3.4.1">Section 3.4.1</a> +<br> +binary files: <a href="nasmdoc3.html#section-3.2.3">Section 3.2.3</a> +<br> +bit shift: <a href="nasmdoc3.html#section-3.5.4">Section 3.5.4</a> +<br> +<code><nobr>BITS</nobr></code>: +<a href="nasmdoc6.html#section-6.1">Section 6.1</a>, +<a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +<code><nobr>__BITS__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.5">Section 4.11.5</a> +<br> +bitwise AND: <a href="nasmdoc3.html#section-3.5.3">Section 3.5.3</a> +<br> +bitwise OR: <a href="nasmdoc3.html#section-3.5.1">Section 3.5.1</a> +<br> +bitwise XOR: <a href="nasmdoc3.html#section-3.5.2">Section 3.5.2</a> +<br> +block IFs: <a href="nasmdoc4.html#section-4.7.5">Section 4.7.5</a> +<br> +boot loader: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +boot sector: <a href="nasmdo12.html#section-12.1.3">Section 12.1.3</a> +<br> +Borland, Pascal: <a href="nasmdoc8.html#section-8.5">Section 8.5</a> +<br> +Borland, Win32 compilers: +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +braces, after <code><nobr>%</nobr></code> sign: +<a href="nasmdoc4.html#section-4.3.8">Section 4.3.8</a> +<br> +braces, around macro parameters: +<a href="nasmdoc4.html#section-4.3">Section 4.3</a> +<br> +BSD: <a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>.bss</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a>, +<a href="nasmdoc7.html#section-7.10">Section 7.10</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc7.html#section-7.12">Section 7.12</a>, +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +bugs: <a href="nasmdo12.html#section-12.2">Section 12.2</a> +<br> +<code><nobr>bugtracker</nobr></code>: +<a href="nasmdo12.html#section-12.2">Section 12.2</a> +<br> +<code><nobr>BYTE</nobr></code>: +<a href="nasmdo12.html#section-12.1.1">Section 12.1.1</a> +<br> +C calling convention: +<a href="nasmdoc8.html#section-8.4.3">Section 8.4.3</a>, +<a href="nasmdoc9.html#section-9.1.2">Section 9.1.2</a> +<br> +C symbol names: <a href="nasmdoc8.html#section-8.4.1">Section 8.4.1</a> +<br> +<code><nobr>c16.mac</nobr></code>: +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc8.html#section-8.5.3">Section 8.5.3</a> +<br> +<code><nobr>c32.mac</nobr></code>: +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4</a> +<br> +<code><nobr>CALL FAR</nobr></code>: +<a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +case sensitivity: <a href="nasmdoc2.html#section-2.2.1">Section 2.2.1</a>, +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a>, +<a href="nasmdoc4.html#section-4.1.2">Section 4.1.2</a>, +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7</a>, +<a href="nasmdoc4.html#section-4.3">Section 4.3</a>, +<a href="nasmdoc4.html#section-4.3.1">Section 4.3.1</a>, +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a>, +<a href="nasmdoc7.html#section-7.4.3">Section 7.4.3</a> +<br> +changing sections: <a href="nasmdoc6.html#section-6.3">Section 6.3</a> +<br> +character constant: +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.3">Section 3.4.3</a> +<br> +character strings: <a href="nasmdoc3.html#section-3.4.2">Section 3.4.2</a> +<br> +circular references: +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a> +<br> +<code><nobr>CLASS</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>%clear</nobr></code>: +<a href="nasmdoc4.html#section-4.11">Section 4.11</a> +<br> +<code><nobr>coff</nobr></code>: +<a href="nasmdoc7.html#section-7.7">Section 7.7</a> +<br> +colon: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>.COM</nobr></code>: +<a href="nasmdoc7.html#section-7.1">Section 7.1</a>, +<a href="nasmdoc8.html#section-8.2">Section 8.2</a> +<br> +command-line: <a href="nasmdoc2.html#section-2.1">Section 2.1</a>, +<a href="nasmdoc7.html">Chapter 7</a> +<br> +commas in macro parameters: +<a href="nasmdoc4.html#section-4.3.4">Section 4.3.4</a> +<br> +<code><nobr>.comment</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>COMMON</nobr></code>: +<a href="nasmdoc6.html#section-6.7">Section 6.7</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>COMMON</nobr></code>, <code><nobr>elf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.9.6">Section 7.9.6</a> +<br> +<code><nobr>COMMON</nobr></code>, <code><nobr>obj</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.4.8">Section 7.4.8</a> +<br> +Common Object File Format: +<a href="nasmdoc7.html#section-7.7">Section 7.7</a> +<br> +common variables: <a href="nasmdoc6.html#section-6.7">Section 6.7</a> +<br> +common variables, alignment in <code><nobr>elf</nobr></code>: +<a href="nasmdoc7.html#section-7.9.6">Section 7.9.6</a> +<br> +common variables, element size: +<a href="nasmdoc7.html#section-7.4.8">Section 7.4.8</a> +<br> +<code><nobr>comp.lang.asm.x86</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a>, +<a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +<code><nobr>comp.os.msdos.programmer</nobr></code>: +<a href="nasmdoc8.html#section-8.3">Section 8.3</a> +<br> +concatenating macro parameters: +<a href="nasmdoc4.html#section-4.3.8">Section 4.3.8</a> +<br> +concatenating strings: +<a href="nasmdoc4.html#section-4.2.1">Section 4.2.1</a> +<br> +condition codes as macro parameters: +<a href="nasmdoc4.html#section-4.3.9">Section 4.3.9</a> +<br> +conditional assembly: <a href="nasmdoc4.html#section-4.4">Section 4.4</a> +<br> +conditional jumps: +<a href="nasmdo12.html#section-12.1.2">Section 12.1.2</a> +<br> +conditional-return macro: +<a href="nasmdoc4.html#section-4.3.9">Section 4.3.9</a> +<br> +<code><nobr>configure</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +constants: <a href="nasmdoc3.html#section-3.4">Section 3.4</a> +<br> +context stack: <a href="nasmdoc4.html#section-4.7">Section 4.7</a>, +<a href="nasmdoc4.html#section-4.7.5">Section 4.7.5</a> +<br> +context-local labels: +<a href="nasmdoc4.html#section-4.7.2">Section 4.7.2</a> +<br> +context-local single-line macros: +<a href="nasmdoc4.html#section-4.7.3">Section 4.7.3</a> +<br> +counting macro parameters: +<a href="nasmdoc4.html#section-4.3.6">Section 4.3.6</a> +<br> +<code><nobr>CPU</nobr></code>: +<a href="nasmdoc6.html#section-6.8">Section 6.8</a> +<br> +<code><nobr>CPUID</nobr></code>: +<a href="nasmdoc3.html#section-3.4.3">Section 3.4.3</a> +<br> +creating contexts: <a href="nasmdoc4.html#section-4.7.1">Section 4.7.1</a> +<br> +critical expression: +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a>, +<a href="nasmdoc3.html#section-3.8">Section 3.8</a>, +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7</a>, +<a href="nasmdoc6.html#section-6.4">Section 6.4</a> +<br> +<code><nobr>-D</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18</a> +<br> +<code><nobr>-d</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18</a> +<br> +daily development snapshots: +<a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +<code><nobr>.data</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a>, +<a href="nasmdoc7.html#section-7.10">Section 7.10</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc7.html#section-7.12">Section 7.12</a>, +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +<code><nobr>_DATA</nobr></code>: +<a href="nasmdoc8.html#section-8.4.2">Section 8.4.2</a> +<br> +<code><nobr>data</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a>, +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a> +<br> +data structure: <a href="nasmdoc8.html#section-8.4.4">Section 8.4.4</a>, +<a href="nasmdoc9.html#section-9.1.3">Section 9.1.3</a> +<br> +<code><nobr>__DATE__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>__DATE_NUM__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>DB</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>dbg</nobr></code>: +<a href="nasmdoc7.html#section-7.14">Section 7.14</a> +<br> +<code><nobr>DD</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +debug information: +<a href="nasmdoc2.html#section-2.1.12">Section 2.1.12</a> +<br> +debug information format: +<a href="nasmdoc2.html#section-2.1.11">Section 2.1.11</a> +<br> +declaring structures: +<a href="nasmdoc4.html#section-4.11.10">Section 4.11.10</a> +<br> +<code><nobr>DEFAULT</nobr></code>: +<a href="nasmdoc6.html#section-6.2">Section 6.2</a> +<br> +<code><nobr>default</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +default macro parameters: +<a href="nasmdoc4.html#section-4.3.5">Section 4.3.5</a> +<br> +default name: <a href="nasmdoc7.html">Chapter 7</a> +<br> +default-<code><nobr>WRT</nobr></code> mechanism: +<a href="nasmdoc7.html#section-7.4.7">Section 7.4.7</a> +<br> +<code><nobr>%define</nobr></code>: +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18</a>, +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a> +<br> +defining sections: <a href="nasmdoc6.html#section-6.3">Section 6.3</a> +<br> +<code><nobr>%defstr</nobr></code>: +<a href="nasmdoc4.html#section-4.1.8">Section 4.1.8</a> +<br> +<code><nobr>%deftok</nobr></code>: +<a href="nasmdoc4.html#section-4.1.9">Section 4.1.9</a> +<br> +<code><nobr>%depend</nobr></code>: +<a href="nasmdoc4.html#section-4.6.3">Section 4.6.3</a> +<br> +design goals: <a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a> +<br> +DevPac: <a href="nasmdoc3.html#section-3.2.3">Section 3.2.3</a>, +<a href="nasmdoc3.html#section-3.9">Section 3.9</a> +<br> +disabling listing expansion: +<a href="nasmdoc4.html#section-4.3.10">Section 4.3.10</a> +<br> +division: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +DJGPP: <a href="nasmdoc7.html#section-7.7">Section 7.7</a>, +<a href="nasmdoc9.html">Chapter 9</a> +<br> +<code><nobr>djlink</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +DLL symbols, exporting: +<a href="nasmdoc7.html#section-7.4.5">Section 7.4.5</a> +<br> +DLL symbols, importing: +<a href="nasmdoc7.html#section-7.4.4">Section 7.4.4</a> +<br> +<code><nobr>DO</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +DOS: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a>, +<a href="nasmdoc2.html#section-2.1.14">Section 2.1.14</a>, +<a href="nasmdoc2.html#section-2.1.15">Section 2.1.15</a> +<br> +DOS archive: +<br> +DOS source archive: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>DQ</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>.drectve</nobr></code>: +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a> +<br> +<code><nobr>DT</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>DUP</nobr></code>: +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7</a>, +<a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a> +<br> +<code><nobr>DW</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>DWORD</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>DY</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a> +<br> +<code><nobr>-E</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a> +<br> +<code><nobr>-e</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a>, +<a href="nasmdoca.html#section-A.3.4">Section A.3.4</a> +<br> +effective addresses: <a href="nasmdoc3.html#section-3.1">Section 3.1</a>, +<a href="nasmdoc3.html#section-3.3">Section 3.3</a> +<br> +element size, in common variables: +<a href="nasmdoc7.html#section-7.4.8">Section 7.4.8</a> +<br> +ELF: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +ELF, shared libraries: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +ELF, 16-bit code and: +<a href="nasmdoc7.html#section-7.9.7">Section 7.9.7</a> +<br> +elf, debug formats and: +<a href="nasmdoc7.html#section-7.9.8">Section 7.9.8</a> +<br> +<code><nobr>elf32</nobr></code>: +<a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +<code><nobr>elf64</nobr></code>: +<a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +<code><nobr>%elif</nobr></code>: +<a href="nasmdoc4.html#section-4.4">Section 4.4</a>, +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>%elifctx</nobr></code>: +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3</a> +<br> +<code><nobr>%elifdef</nobr></code>: +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1</a> +<br> +<code><nobr>%elifempty</nobr></code>: +<a href="nasmdoc4.html#section-4.4.8">Section 4.4.8</a> +<br> +<code><nobr>%elifid</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%elifidn</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%elifidni</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%elifmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2</a> +<br> +<code><nobr>%elifn</nobr></code>: +<a href="nasmdoc4.html#section-4.4">Section 4.4</a>, +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>%elifnctx</nobr></code>: +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3</a> +<br> +<code><nobr>%elifndef</nobr></code>: +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1</a> +<br> +<code><nobr>%elifnempty</nobr></code>: +<a href="nasmdoc4.html#section-4.4.8">Section 4.4.8</a> +<br> +<code><nobr>%elifnid</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%elifnidn</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%elifnidni</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%elifnmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2</a> +<br> +<code><nobr>%elifnnum</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%elifnstr</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%elifntoken</nobr></code>: +<a href="nasmdoc4.html#section-4.4.7">Section 4.4.7</a> +<br> +<code><nobr>%elifnum</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%elifstr</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%eliftoken</nobr></code>: +<a href="nasmdoc4.html#section-4.4.7">Section 4.4.7</a> +<br> +<code><nobr>%else</nobr></code>: +<a href="nasmdoc4.html#section-4.4">Section 4.4</a> +<br> +<code><nobr>endproc</nobr></code>: +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4</a> +<br> +<code><nobr>%endrep</nobr></code>: +<a href="nasmdoc4.html#section-4.5">Section 4.5</a> +<br> +<code><nobr>ENDSTRUC</nobr></code>: +<a href="nasmdoc4.html#section-4.11.10">Section 4.11.10</a>, +<a href="nasmdoc6.html#section-6.4">Section 6.4</a> +<br> +environment: <a href="nasmdoc2.html#section-2.1.28">Section 2.1.28</a> +<br> +<code><nobr>EQU</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.4">Section 3.2.4</a> +<br> +<code><nobr>%error</nobr></code>: +<a href="nasmdoc4.html#section-4.9">Section 4.9</a> +<br> +<code><nobr>error</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +error messages: <a href="nasmdoc2.html#section-2.1.14">Section 2.1.14</a>, +<a href="nasmdoc2.html#section-2.1.15">Section 2.1.15</a> +<br> +error reporting format: +<a href="nasmdoc2.html#section-2.1.13">Section 2.1.13</a> +<br> +escape sequences: <a href="nasmdoc3.html#section-3.4.2">Section 3.4.2</a> +<br> +<code><nobr>EVEN</nobr></code>: +<a href="nasmdoc4.html#section-4.11.12">Section 4.11.12</a> +<br> +exact matches: <a href="nasmdoc4.html#section-4.3.11">Section 4.3.11</a> +<br> +<code><nobr>.EXE</nobr></code>: +<a href="nasmdoc7.html#section-7.4">Section 7.4</a>, +<a href="nasmdoc8.html#section-8.1">Section 8.1</a> +<br> +<code><nobr>EXE2BIN</nobr></code>: +<a href="nasmdoc8.html#section-8.2.2">Section 8.2.2</a> +<br> +<code><nobr>EXE_begin</nobr></code>: +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2</a> +<br> +<code><nobr>exebin.mac</nobr></code>: +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2</a> +<br> +<code><nobr>exec</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +Executable and Linkable Format: +<a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +<code><nobr>EXE_end</nobr></code>: +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2</a> +<br> +<code><nobr>EXE_stack</nobr></code>: +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2</a> +<br> +<code><nobr>%exitmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.3.12">Section 4.3.12</a> +<br> +<code><nobr>%exitrep</nobr></code>: +<a href="nasmdoc4.html#section-4.5">Section 4.5</a> +<br> +<code><nobr>EXPORT</nobr></code>: +<a href="nasmdoc7.html#section-7.4.5">Section 7.4.5</a> +<br> +<code><nobr>export</nobr></code>: +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a> +<br> +exporting symbols: <a href="nasmdoc6.html#section-6.6">Section 6.6</a> +<br> +expressions: <a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a>, +<a href="nasmdoc3.html#section-3.5">Section 3.5</a> +<br> +extension: <a href="nasmdoc2.html#section-2.1.1">Section 2.1.1</a>, +<a href="nasmdoc7.html">Chapter 7</a> +<br> +<code><nobr>EXTERN</nobr></code>: +<a href="nasmdoc6.html#section-6.5">Section 6.5</a> +<br> +<code><nobr>EXTERN</nobr></code>, <code><nobr>obj</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.4.7">Section 7.4.7</a> +<br> +<code><nobr>EXTERN</nobr></code>, <code><nobr>rdf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.13.4">Section 7.13.4</a> +<br> +extracting substrings: +<a href="nasmdoc4.html#section-4.2.3">Section 4.2.3</a> +<br> +<code><nobr>-F</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.11">Section 2.1.11</a> +<br> +<code><nobr>-f</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.2">Section 2.1.2</a>, +<a href="nasmdoc7.html">Chapter 7</a> +<br> +far call: <a href="nasmdoc2.html#section-2.2.5">Section 2.2.5</a> +<br> +far common variables: +<a href="nasmdoc7.html#section-7.4.8">Section 7.4.8</a> +<br> +far pointer: <a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +<code><nobr>FARCODE</nobr></code>: +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc8.html#section-8.5.3">Section 8.5.3</a> +<br> +<code><nobr>%fatal</nobr></code>: +<a href="nasmdoc4.html#section-4.9">Section 4.9</a> +<br> +<code><nobr>__FILE__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.4">Section 4.11.4</a> +<br> +<code><nobr>FLAT</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +flat memory model: <a href="nasmdoc9.html">Chapter 9</a> +<br> +flat-form binary: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +<code><nobr>FLOAT</nobr></code>: +<a href="nasmdoc6.html#section-6.9">Section 6.9</a> +<br> +<code><nobr>__FLOAT__</nobr></code>: +<a href="nasmdoc6.html#section-6.9">Section 6.9</a> +<br> +<code><nobr>__float128h__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float128l__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float16__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float32__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float64__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float8__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float80e__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__float80m__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>__FLOAT_DAZ__</nobr></code>: +<a href="nasmdoc6.html#section-6.9">Section 6.9</a> +<br> +<code><nobr>float-denorm</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +floating-point, constants: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a>, +<a href="nasmdoc6.html#section-6.9">Section 6.9</a> +<br> +floating-point, packed BCD constants: +<a href="nasmdoc3.html#section-3.4.7">Section 3.4.7</a> +<br> +floating-point: <a href="nasmdoc2.html#section-2.2.6">Section 2.2.6</a>, +<a href="nasmdoc3.html#section-3.1">Section 3.1</a>, +<a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>float-overflow</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>__FLOAT_ROUND__</nobr></code>: +<a href="nasmdoc6.html#section-6.9">Section 6.9</a> +<br> +<code><nobr>float-toolong</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>float-underflow</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>follows=</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +format-specific directives: <a href="nasmdoc6.html">Chapter 6</a> +<br> +frame pointer: <a href="nasmdoc8.html#section-8.4.3">Section 8.4.3</a>, +<a href="nasmdoc8.html#section-8.5.1">Section 8.5.1</a>, +<a href="nasmdoc9.html#section-9.1.2">Section 9.1.2</a> +<br> +FreeBSD: <a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +FreeLink: <a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>ftp.simtel.net</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>function</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a>, +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a> +<br> +functions, C calling convention: +<a href="nasmdoc8.html#section-8.4.3">Section 8.4.3</a>, +<a href="nasmdoc9.html#section-9.1.2">Section 9.1.2</a> +<br> +functions, Pascal calling convention: +<a href="nasmdoc8.html#section-8.5.1">Section 8.5.1</a> +<br> +<code><nobr>-g</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.12">Section 2.1.12</a> +<br> +<code><nobr>gas</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a> +<br> +<code><nobr>gcc</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a> +<br> +<code><nobr>GLOBAL</nobr></code>: +<a href="nasmdoc6.html#section-6.6">Section 6.6</a> +<br> +<code><nobr>GLOBAL</nobr></code>, <code><nobr>aoutb</nobr></code> +extensions to: <a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>GLOBAL</nobr></code>, <code><nobr>elf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>GLOBAL</nobr></code>, <code><nobr>rdf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a> +<br> +global offset table: <a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>_GLOBAL_OFFSET_TABLE_</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>gnu-elf-extensions</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>..got</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>GOT</nobr></code> relocations: +<a href="nasmdoc9.html#section-9.2.3">Section 9.2.3</a> +<br> +GOT: <a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>..gotoff</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>GOTOFF</nobr></code> relocations: +<a href="nasmdoc9.html#section-9.2.2">Section 9.2.2</a> +<br> +<code><nobr>..gotpc</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>GOTPC</nobr></code> relocations: +<a href="nasmdoc9.html#section-9.2.1">Section 9.2.1</a> +<br> +<code><nobr>..gottpoff</nobr></code>: +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4</a> +<br> +graphics: <a href="nasmdoc3.html#section-3.2.3">Section 3.2.3</a> +<br> +greedy macro parameters: +<a href="nasmdoc4.html#section-4.3.4">Section 4.3.4</a> +<br> +<code><nobr>GROUP</nobr></code>: +<a href="nasmdoc7.html#section-7.4.2">Section 7.4.2</a> +<br> +groups: <a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +<code><nobr>-h</nobr></code>: +<a href="nasmdoca.html#section-A.3">Section A.3</a> +<br> +hexadecimal: <a href="nasmdoc3.html#section-3.4.1">Section 3.4.1</a> +<br> +<code><nobr>hidden</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +hybrid syntaxes: <a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a> +<br> +<code><nobr>-I</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a> +<br> +<code><nobr>-i</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a>, +<a href="nasmdoca.html#section-A.3.3">Section A.3.3</a> +<br> +<code><nobr>%iassign</nobr></code>: +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7</a> +<br> +<code><nobr>%idefine</nobr></code>: +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a> +<br> +<code><nobr>%idefstr</nobr></code>: +<a href="nasmdoc4.html#section-4.1.8">Section 4.1.8</a> +<br> +<code><nobr>%ideftok</nobr></code>: +<a href="nasmdoc4.html#section-4.1.9">Section 4.1.9</a> +<br> +<code><nobr>IEND</nobr></code>: +<a href="nasmdoc4.html#section-4.11.11">Section 4.11.11</a> +<br> +<code><nobr>%if</nobr></code>: +<a href="nasmdoc4.html#section-4.4">Section 4.4</a>, +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>%ifctx</nobr></code>: +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3</a>, +<a href="nasmdoc4.html#section-4.7.5">Section 4.7.5</a> +<br> +<code><nobr>%ifdef</nobr></code>: +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1</a> +<br> +<code><nobr>%ifempty</nobr></code>: +<a href="nasmdoc4.html#section-4.4.8">Section 4.4.8</a> +<br> +<code><nobr>%ifid</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%ifidn</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%ifidni</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%ifmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2</a> +<br> +<code><nobr>%ifn</nobr></code>: +<a href="nasmdoc4.html#section-4.4">Section 4.4</a>, +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>%ifnctx</nobr></code>: +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3</a> +<br> +<code><nobr>%ifndef</nobr></code>: +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1</a> +<br> +<code><nobr>%ifnempty</nobr></code>: +<a href="nasmdoc4.html#section-4.4.8">Section 4.4.8</a> +<br> +<code><nobr>%ifnid</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%ifnidn</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%ifnidni</nobr></code>: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +<code><nobr>%ifnmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2</a> +<br> +<code><nobr>%ifnnum</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%ifnstr</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%ifntoken</nobr></code>: +<a href="nasmdoc4.html#section-4.4.7">Section 4.4.7</a> +<br> +<code><nobr>%ifnum</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%ifstr</nobr></code>: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>%iftoken</nobr></code>: +<a href="nasmdoc4.html#section-4.4.7">Section 4.4.7</a> +<br> +<code><nobr>%imacro</nobr></code>: +<a href="nasmdoc4.html#section-4.3">Section 4.3</a> +<br> +<code><nobr>IMPORT</nobr></code>: +<a href="nasmdoc7.html#section-7.4.4">Section 7.4.4</a> +<br> +import library: <a href="nasmdoc7.html#section-7.4.4">Section 7.4.4</a> +<br> +importing symbols: <a href="nasmdoc6.html#section-6.5">Section 6.5</a> +<br> +<code><nobr>INCBIN</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.3">Section 3.2.3</a>, +<a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a> +<br> +<code><nobr>%include</nobr></code>: +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a>, +<a href="nasmdoc2.html#section-2.1.17">Section 2.1.17</a>, +<a href="nasmdoc4.html#section-4.6.1">Section 4.6.1</a> +<br> +include search path: +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a> +<br> +including other files: +<a href="nasmdoc4.html#section-4.6.1">Section 4.6.1</a> +<br> +inefficient code: <a href="nasmdo12.html#section-12.1.1">Section 12.1.1</a> +<br> +infinite loop: <a href="nasmdoc3.html#section-3.5">Section 3.5</a> +<br> +<code><nobr>__Infinity__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +infinity: <a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +informational section: +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a> +<br> +<code><nobr>INSTALL</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +installing: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +instances of structures: +<a href="nasmdoc4.html#section-4.11.11">Section 4.11.11</a> +<br> +instruction list: <a href="nasmdocb.html">Appendix B</a> +<br> +intel hex: <a href="nasmdoc7.html#section-7.2">Section 7.2</a> +<br> +Intel number formats: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +<code><nobr>internal</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>%irmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.3.1">Section 4.3.1</a> +<br> +<code><nobr>ISTRUC</nobr></code>: +<a href="nasmdoc4.html#section-4.11.11">Section 4.11.11</a> +<br> +iterating over macro parameters: +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7</a> +<br> +<code><nobr>ith</nobr></code>: +<a href="nasmdoc7.html#section-7.2">Section 7.2</a> +<br> +<code><nobr>%ixdefine</nobr></code>: +<a href="nasmdoc4.html#section-4.1.2">Section 4.1.2</a> +<br> +<code><nobr>Jcc NEAR</nobr></code>: +<a href="nasmdo12.html#section-12.1.2">Section 12.1.2</a> +<br> +<code><nobr>JMP DWORD</nobr></code>: +<a href="nasmdo10.html#section-10.1">Section 10.1</a> +<br> +jumps, mixed-size: <a href="nasmdo10.html#section-10.1">Section 10.1</a> +<br> +<code><nobr>-k</nobr></code>: +<a href="nasmdoca.html#section-A.3.4">Section A.3.4</a> +<br> +<code><nobr>-l</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.3">Section 2.1.3</a> +<br> +label prefix: <a href="nasmdoc3.html#section-3.9">Section 3.9</a> +<br> +<code><nobr>.lbss</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>ld86</nobr></code>: +<a href="nasmdoc7.html#section-7.12">Section 7.12</a> +<br> +<code><nobr>.ldata</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>LIBRARY</nobr></code>: +<a href="nasmdoc7.html#section-7.13.1">Section 7.13.1</a> +<br> +license: <a href="nasmdoc1.html#section-1.1.2">Section 1.1.2</a> +<br> +<code><nobr>%line</nobr></code>: +<a href="nasmdoc4.html#section-4.10.1">Section 4.10.1</a> +<br> +<code><nobr>__LINE__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.4">Section 4.11.4</a> +<br> +linker, free: <a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +Linux, <code><nobr>a.out</nobr></code>: +<a href="nasmdoc7.html#section-7.10">Section 7.10</a> +<br> +Linux, <code><nobr>as86</nobr></code>: +<a href="nasmdoc7.html#section-7.12">Section 7.12</a> +<br> +Linux, ELF: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +listing file: <a href="nasmdoc2.html#section-2.1.3">Section 2.1.3</a> +<br> +little-endian: <a href="nasmdoc3.html#section-3.4.3">Section 3.4.3</a> +<br> +<code><nobr>%local</nobr></code>: +<a href="nasmdoc4.html#section-4.8.3">Section 4.8.3</a> +<br> +local labels: <a href="nasmdoc3.html#section-3.9">Section 3.9</a> +<br> +logical AND: <a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +logical negation: <a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +logical OR: <a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +logical XOR: <a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +<code><nobr>.lrodata</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>-M</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.4">Section 2.1.4</a> +<br> +Mach, object file format: +<a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +Mach-O: <a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +<code><nobr>macho</nobr></code>: +<a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +<code><nobr>macho32</nobr></code>: +<a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +<code><nobr>macho64</nobr></code>: +<a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +MacOS X: <a href="nasmdoc7.html#section-7.8">Section 7.8</a> +<br> +<code><nobr>%macro</nobr></code>: +<a href="nasmdoc4.html#section-4.3">Section 4.3</a> +<br> +macro indirection: <a href="nasmdoc4.html#section-4.1.3">Section 4.1.3</a> +<br> +macro library: <a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a> +<br> +macro processor: <a href="nasmdoc4.html">Chapter 4</a> +<br> +<code><nobr>macro-defaults</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +macro-local labels: <a href="nasmdoc4.html#section-4.3.3">Section 4.3.3</a> +<br> +<code><nobr>macro-params</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +macros: <a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a> +<br> +<code><nobr>macro-selfref</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>make</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +makefile dependencies: +<a href="nasmdoc2.html#section-2.1.4">Section 2.1.4</a>, +<a href="nasmdoc2.html#section-2.1.5">Section 2.1.5</a> +<br> +makefiles: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a>, +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +man pages: <a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +map files: <a href="nasmdoc7.html#section-7.1.4">Section 7.1.4</a> +<br> +<code><nobr>MASM</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a> +<br> +MASM: <a href="nasmdoc2.html#section-2.2">Section 2.2</a>, +<a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a>, +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +<code><nobr>-MD</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.7">Section 2.1.7</a> +<br> +memory models: <a href="nasmdoc2.html#section-2.2.5">Section 2.2.5</a>, +<a href="nasmdoc8.html#section-8.4.2">Section 8.4.2</a> +<br> +memory operand: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +memory references: <a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a>, +<a href="nasmdoc3.html#section-3.3">Section 3.3</a> +<br> +<code><nobr>-MF</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.6">Section 2.1.6</a> +<br> +<code><nobr>-MG</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.5">Section 2.1.5</a> +<br> +Microsoft OMF: <a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +minifloat: <a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +Minix: <a href="nasmdoc7.html#section-7.12">Section 7.12</a> +<br> +<code><nobr>misc</nobr></code> subdirectory: +<a href="nasmdoc8.html#section-8.1.2">Section 8.1.2</a>, +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4</a> +<br> +mixed-language program: <a href="nasmdoc8.html#section-8.4">Section 8.4</a> +<br> +mixed-size addressing: +<a href="nasmdo10.html#section-10.2">Section 10.2</a> +<br> +mixed-size instruction: +<a href="nasmdo10.html#section-10.1">Section 10.1</a> +<br> +MMX registers: +<br> +ModR/M byte: +<br> +<code><nobr>MODULE</nobr></code>: +<a href="nasmdoc7.html#section-7.13.2">Section 7.13.2</a> +<br> +modulo operators: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +motorola s-records: <a href="nasmdoc7.html#section-7.3">Section 7.3</a> +<br> +<code><nobr>-MP</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.10">Section 2.1.10</a> +<br> +<code><nobr>-MQ</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.9">Section 2.1.9</a> +<br> +MS-DOS: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +MS-DOS device drivers: <a href="nasmdoc8.html#section-8.3">Section 8.3</a> +<br> +<code><nobr>-MT</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.8">Section 2.1.8</a> +<br> +multi-line macros: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a>, +<a href="nasmdoc4.html#section-4.3">Section 4.3</a> +<br> +multipass optimization: +<a href="nasmdoc2.html#section-2.1.22">Section 2.1.22</a> +<br> +multiple section names: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +multiplication: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr>multipush</nobr></code> macro: +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7</a> +<br> +multisection: <a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +<code><nobr>__NaN__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +NaN: <a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +NASM version: <a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +nasm version history: <a href="nasmdocc.html">Appendix C</a> +<br> +nasm version id: <a href="nasmdoc4.html#section-4.11.2">Section 4.11.2</a> +<br> +nasm version string: +<a href="nasmdoc4.html#section-4.11.3">Section 4.11.3</a> +<br> +<code><nobr>nasm.1</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +<code><nobr>__NASMDEFSEG</nobr></code>: +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +<code><nobr>nasm-devel</nobr></code>: +<a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +<code><nobr>NASMENV</nobr></code>: +<a href="nasmdoc2.html#section-2.1.28">Section 2.1.28</a> +<br> +<code><nobr>nasm.exe</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>nasm -hf</nobr></code>: +<a href="nasmdoc2.html#section-2.1.2">Section 2.1.2</a> +<br> +<code><nobr>__NASM_MAJOR__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>__NASM_MINOR__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>nasm.out</nobr></code>: +<a href="nasmdoc2.html#section-2.1.1">Section 2.1.1</a> +<br> +<code><nobr>___NASM_PATCHLEVEL__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>__NASM_SNAPSHOT__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>__NASM_SUBMINOR__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>__NASM_VER__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.3">Section 4.11.3</a> +<br> +<code><nobr>__NASM_VERSION_ID__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.2">Section 4.11.2</a> +<br> +<code><nobr>nasm-XXX-dos.zip</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>nasm-XXX.tar.gz</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +<code><nobr>nasm-XXX-win32.zip</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>nasm-XXX.zip</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +ndisasm: <a href="nasmdoca.html">Appendix A</a> +<br> +<code><nobr>ndisasm.1</nobr></code>: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +<code><nobr>ndisasm.exe</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +near call: <a href="nasmdoc2.html#section-2.2.5">Section 2.2.5</a> +<br> +near common variables: +<a href="nasmdoc7.html#section-7.4.8">Section 7.4.8</a> +<br> +NetBSD: <a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +new releases: <a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +<code><nobr>noalloc</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>nobits</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a>, +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>noexec</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>.nolist</nobr></code>: +<a href="nasmdoc4.html#section-4.3.10">Section 4.3.10</a> +<br> +`nowait': <a href="nasmdoc2.html#section-2.2.6">Section 2.2.6</a> +<br> +<code><nobr>nowrite</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>number-overflow</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +numeric constants: <a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a>, +<a href="nasmdoc3.html#section-3.4.1">Section 3.4.1</a> +<br> +<code><nobr>-O</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.22">Section 2.1.22</a> +<br> +<code><nobr>-o</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.1">Section 2.1.1</a>, +<a href="nasmdoca.html#section-A.3.1">Section A.3.1</a> +<br> +<code><nobr>O16</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>o16</nobr></code>: +<a href="nasmdo10.html#section-10.3">Section 10.3</a> +<br> +<code><nobr>O32</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>o32</nobr></code>: +<a href="nasmdo10.html#section-10.3">Section 10.3</a> +<br> +<code><nobr>O64</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>.OBJ</nobr></code>: +<a href="nasmdoc8.html#section-8.1">Section 8.1</a> +<br> +<code><nobr>obj</nobr></code>: +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +<code><nobr>object</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a>, +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a> +<br> +octal: <a href="nasmdoc3.html#section-3.4.1">Section 3.4.1</a> +<br> +<code><nobr>OF_DBG</nobr></code>: +<a href="nasmdoc7.html#section-7.14">Section 7.14</a> +<br> +<code><nobr>OF_DEFAULT</nobr></code>: +<a href="nasmdoc2.html#section-2.1.2">Section 2.1.2</a> +<br> +<code><nobr>OFFSET</nobr></code>: +<a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a> +<br> +OMF: <a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +omitted parameters: <a href="nasmdoc4.html#section-4.3.5">Section 4.3.5</a> +<br> +one's complement: <a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +OpenBSD: <a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +operands: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +operand-size prefixes: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +operating system: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +operating system, writing: +<a href="nasmdo10.html#section-10.1">Section 10.1</a> +<br> +operators: <a href="nasmdoc3.html#section-3.5">Section 3.5</a> +<br> +<code><nobr>ORG</nobr></code>: +<a href="nasmdoc7.html#section-7.1.1">Section 7.1.1</a>, +<a href="nasmdoc8.html#section-8.2.1">Section 8.2.1</a>, +<a href="nasmdoc8.html#section-8.2.2">Section 8.2.2</a>, +<a href="nasmdo12.html#section-12.1.3">Section 12.1.3</a> +<br> +<code><nobr>orphan-labels</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a>, +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +OS/2: <a href="nasmdoc7.html#section-7.4">Section 7.4</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>osabi</nobr></code>: +<a href="nasmdoc7.html#section-7.9.1">Section 7.9.1</a> +<br> +other preprocessor directives: +<a href="nasmdoc4.html#section-4.10">Section 4.10</a> +<br> +out of range, jumps: +<a href="nasmdo12.html#section-12.1.2">Section 12.1.2</a> +<br> +output file format: <a href="nasmdoc2.html#section-2.1.2">Section 2.1.2</a> +<br> +output formats: <a href="nasmdoc7.html">Chapter 7</a> +<br> +<code><nobr>__OUTPUT_FORMAT__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.6">Section 4.11.6</a> +<br> +overlapping segments: <a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +<code><nobr>OVERLAY</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +overloading, multi-line macros: +<a href="nasmdoc4.html#section-4.3.2">Section 4.3.2</a> +<br> +overloading, single-line macros: +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a> +<br> +<code><nobr>-P</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.17">Section 2.1.17</a> +<br> +<code><nobr>-p</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.17">Section 2.1.17</a>, +<a href="nasmdoc4.html#section-4.6.1">Section 4.6.1</a> +<br> +paradox: <a href="nasmdoc3.html#section-3.8">Section 3.8</a> +<br> +<code><nobr>PASCAL</nobr></code>: +<a href="nasmdoc8.html#section-8.5.3">Section 8.5.3</a> +<br> +Pascal calling convention: +<a href="nasmdoc8.html#section-8.5.1">Section 8.5.1</a> +<br> +<code><nobr>__PASS__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.9">Section 4.11.9</a> +<br> +passes, assembly: +<br> +<code><nobr>PATH</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>%pathsearch</nobr></code>: +<a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a>, +<a href="nasmdoc4.html#section-4.6.2">Section 4.6.2</a> +<br> +period: <a href="nasmdoc3.html#section-3.9">Section 3.9</a> +<br> +Perl: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +perverse: <a href="nasmdoc2.html#section-2.1.16">Section 2.1.16</a> +<br> +PharLap: <a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +PIC: <a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>..plt</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +<code><nobr>PLT</nobr></code> relocations: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc9.html#section-9.2.4">Section 9.2.4</a>, +<a href="nasmdoc9.html#section-9.2.5">Section 9.2.5</a> +<br> +plt relocations: <a href="nasmdoc9.html#section-9.2.5">Section 9.2.5</a> +<br> +<code><nobr>%pop</nobr></code>: +<a href="nasmdoc4.html#section-4.7">Section 4.7</a>, +<a href="nasmdoc4.html#section-4.7.1">Section 4.7.1</a> +<br> +position-independent code: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +<code><nobr>--postfix</nobr></code>: +<a href="nasmdoc2.html#section-2.1.27">Section 2.1.27</a> +<br> +precedence: <a href="nasmdoc3.html#section-3.5">Section 3.5</a> +<br> +pre-defining macros: +<a href="nasmdoc2.html#section-2.1.18">Section 2.1.18</a>, +<a href="nasmdoc4.html#section-4.1.1">Section 4.1.1</a> +<br> +preferred: <a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +<code><nobr>--prefix</nobr></code>: +<a href="nasmdoc2.html#section-2.1.27">Section 2.1.27</a> +<br> +pre-including files: +<a href="nasmdoc2.html#section-2.1.17">Section 2.1.17</a> +<br> +preprocess-only mode: +<a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a> +<br> +preprocessor: <a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a>, +<a href="nasmdoc2.html#section-2.1.21">Section 2.1.21</a>, +<a href="nasmdoc3.html#section-3.2.4">Section 3.2.4</a>, +<a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a>, +<a href="nasmdoc4.html">Chapter 4</a> +<br> +preprocessor expressions: +<a href="nasmdoc2.html#section-2.1.20">Section 2.1.20</a> +<br> +preprocessor loops: <a href="nasmdoc4.html#section-4.5">Section 4.5</a> +<br> +preprocessor variables: +<a href="nasmdoc4.html#section-4.1.7">Section 4.1.7</a> +<br> +primitive directives: <a href="nasmdoc6.html">Chapter 6</a> +<br> +<code><nobr>PRIVATE</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>proc</nobr></code>: +<a href="nasmdoc7.html#section-7.13.3">Section 7.13.3</a>, +<a href="nasmdoc8.html#section-8.4.5">Section 8.4.5</a>, +<a href="nasmdoc9.html#section-9.1.4">Section 9.1.4</a> +<br> +procedure linkage table: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc9.html#section-9.2.4">Section 9.2.4</a>, +<a href="nasmdoc9.html#section-9.2.5">Section 9.2.5</a> +<br> +processor mode: <a href="nasmdoc6.html#section-6.1">Section 6.1</a> +<br> +<code><nobr>progbits</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a>, +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +program entry point: +<a href="nasmdoc7.html#section-7.4.6">Section 7.4.6</a>, +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +program origin: <a href="nasmdoc7.html#section-7.1.1">Section 7.1.1</a> +<br> +<code><nobr>protected</nobr></code>: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +pseudo-instructions: <a href="nasmdoc3.html#section-3.2">Section 3.2</a> +<br> +<code><nobr>PUBLIC</nobr></code>: +<a href="nasmdoc6.html#section-6.6">Section 6.6</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +pure binary: <a href="nasmdoc7.html#section-7.1">Section 7.1</a> +<br> +<code><nobr>%push</nobr></code>: +<a href="nasmdoc4.html#section-4.7">Section 4.7</a>, +<a href="nasmdoc4.html#section-4.7.1">Section 4.7.1</a> +<br> +<code><nobr>__QNaN__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +quick start: <a href="nasmdoc2.html#section-2.2">Section 2.2</a> +<br> +<code><nobr>QWORD</nobr></code>: +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>-r</nobr></code>: +<a href="nasmdoca.html#section-A.3">Section A.3</a> +<br> +<code><nobr>rdf</nobr></code>: +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +<code><nobr>rdoff</nobr></code> subdirectory: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a>, +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +recursive multi-line macros: +<a href="nasmdoc4.html#section-4.3.1">Section 4.3.1</a> +<br> +redirecting errors: +<a href="nasmdoc2.html#section-2.1.14">Section 2.1.14</a> +<br> +<code><nobr>REL</nobr></code>: +<a href="nasmdoc3.html#section-3.3">Section 3.3</a>, +<a href="nasmdoc6.html#section-6.2">Section 6.2</a> +<br> +relational operators: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +release candidates: <a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +Relocatable Dynamic Object File Format: +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +relocations, PIC-specific: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +removing contexts: <a href="nasmdoc4.html#section-4.7.1">Section 4.7.1</a> +<br> +renaming contexts: <a href="nasmdoc4.html#section-4.7.4">Section 4.7.4</a> +<br> +<code><nobr>%rep</nobr></code>: +<a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a>, +<a href="nasmdoc4.html#section-4.5">Section 4.5</a> +<br> +repeating: <a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a>, +<a href="nasmdoc4.html#section-4.5">Section 4.5</a> +<br> +<code><nobr>%repl</nobr></code>: +<a href="nasmdoc4.html#section-4.7.4">Section 4.7.4</a> +<br> +reporting bugs: <a href="nasmdo12.html#section-12.2">Section 12.2</a> +<br> +<code><nobr>RESB</nobr></code>: +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7</a>, +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>RESD</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>RESO</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>RESQ</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>REST</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>RESW</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>RESY</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +<code><nobr>%rmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.3.1">Section 4.3.1</a> +<br> +<code><nobr>.rodata</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>%rotate</nobr></code>: +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7</a> +<br> +rotating macro parameters: +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7</a> +<br> +<code><nobr>-s</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.15">Section 2.1.15</a>, +<a href="nasmdoca.html#section-A.3.2">Section A.3.2</a> +<br> +searching for include files: +<a href="nasmdoc4.html#section-4.6.1">Section 4.6.1</a> +<br> +<code><nobr>__SECT__</nobr></code>: +<a href="nasmdoc6.html#section-6.3.1">Section 6.3.1</a>, +<a href="nasmdoc6.html#section-6.4">Section 6.4</a> +<br> +<code><nobr>SECTION</nobr></code>: +<a href="nasmdoc6.html#section-6.3">Section 6.3</a> +<br> +<code><nobr>SECTION</nobr></code>, <code><nobr>elf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>SECTION</nobr></code>, <code><nobr>win32</nobr></code> +extensions to: <a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a> +<br> +section alignment, in <code><nobr>bin</nobr></code>: +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2</a> +<br> +section alignment, in <code><nobr>elf</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +section alignment, in <code><nobr>obj</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +section alignment, in <code><nobr>win32</nobr></code>: +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a> +<br> +section, bin extensions to: +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2</a> +<br> +<code><nobr>SEG</nobr></code>: +<a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a>, +<a href="nasmdoc3.html#section-3.6">Section 3.6</a>, +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +<code><nobr>SEGMENT</nobr></code>: +<a href="nasmdoc6.html#section-6.3">Section 6.3</a> +<br> +<code><nobr>SEGMENT</nobr></code>, <code><nobr>elf</nobr></code> extensions +to: <a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +segment address: <a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a>, +<a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +segment alignment, in <code><nobr>bin</nobr></code>: +<a href="nasmdoc7.html#section-7.1.2">Section 7.1.2</a> +<br> +segment alignment, in <code><nobr>obj</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +segment names, Borland Pascal: +<a href="nasmdoc8.html#section-8.5.2">Section 8.5.2</a> +<br> +segment override: <a href="nasmdoc2.html#section-2.2.4">Section 2.2.4</a>, +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +segments: <a href="nasmdoc3.html#section-3.6">Section 3.6</a> +<br> +segments, groups of: +<a href="nasmdoc7.html#section-7.4.2">Section 7.4.2</a> +<br> +separator character: +<a href="nasmdoc2.html#section-2.1.28">Section 2.1.28</a> +<br> +shared libraries: <a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc9.html#section-9.2">Section 9.2</a> +<br> +shared library: <a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>shift</nobr></code> command: +<a href="nasmdoc4.html#section-4.3.7">Section 4.3.7</a> +<br> +SIB byte: +<br> +signed division: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +signed modulo: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +single-line macros: <a href="nasmdoc4.html#section-4.1">Section 4.1</a> +<br> +size, of symbols: <a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>smartalign</nobr></code>: +<a href="nasmdoc5.html#section-5.2">Section 5.2</a> +<br> +<code><nobr>__SNaN__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.6">Section 3.4.6</a> +<br> +snapshots, daily development: +<a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +Solaris x86: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +<code><nobr>-soname</nobr></code>: +<a href="nasmdoc9.html#section-9.2.6">Section 9.2.6</a> +<br> +sound: <a href="nasmdoc3.html#section-3.2.3">Section 3.2.3</a> +<br> +source code: <a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +source-listing file: +<a href="nasmdoc2.html#section-2.1.3">Section 2.1.3</a> +<br> +square brackets: <a href="nasmdoc2.html#section-2.2.2">Section 2.2.2</a>, +<a href="nasmdoc3.html#section-3.3">Section 3.3</a> +<br> +<code><nobr>srec</nobr></code>: +<a href="nasmdoc7.html#section-7.3">Section 7.3</a> +<br> +<code><nobr>STACK</nobr></code>: +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +stack relative preprocessor directives: +<a href="nasmdoc4.html#section-4.8">Section 4.8</a> +<br> +<code><nobr>%stacksize</nobr></code>: +<a href="nasmdoc4.html#section-4.8.2">Section 4.8.2</a> +<br> +standard macro packages: <a href="nasmdoc5.html">Chapter 5</a> +<br> +standard macros: <a href="nasmdoc4.html#section-4.11">Section 4.11</a> +<br> +standardized section names: +<a href="nasmdoc6.html#section-6.3">Section 6.3</a>, +<a href="nasmdoc7.html#section-7.5.1">Section 7.5.1</a>, +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a>, +<a href="nasmdoc7.html#section-7.10">Section 7.10</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc7.html#section-7.12">Section 7.12</a>, +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +<code><nobr>..start</nobr></code>: +<a href="nasmdoc7.html#section-7.4.6">Section 7.4.6</a>, +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>start=</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +<code><nobr>stderr</nobr></code>: +<a href="nasmdoc2.html#section-2.1.14">Section 2.1.14</a> +<br> +<code><nobr>stdout</nobr></code>: +<a href="nasmdoc2.html#section-2.1.15">Section 2.1.15</a> +<br> +<code><nobr>%strcat</nobr></code>: +<a href="nasmdoc4.html#section-4.2.1">Section 4.2.1</a> +<br> +<code><nobr>STRICT</nobr></code>: +<a href="nasmdoc3.html#section-3.7">Section 3.7</a> +<br> +string constant: <a href="nasmdoc3.html#section-3.2.1">Section 3.2.1</a> +<br> +string constants: <a href="nasmdoc3.html#section-3.4.4">Section 3.4.4</a> +<br> +string length: <a href="nasmdoc4.html#section-4.2.2">Section 4.2.2</a> +<br> +string manipulation in macros: +<a href="nasmdoc4.html#section-4.2">Section 4.2</a> +<br> +strings: <a href="nasmdoc3.html#section-3.4.2">Section 3.4.2</a> +<br> +<code><nobr>%strlen</nobr></code>: +<a href="nasmdoc4.html#section-4.2.2">Section 4.2.2</a> +<br> +<code><nobr>STRUC</nobr></code>: +<a href="nasmdoc4.html#section-4.11.10">Section 4.11.10</a>, +<a href="nasmdoc6.html#section-6.4">Section 6.4</a>, +<a href="nasmdoc8.html#section-8.4.4">Section 8.4.4</a>, +<a href="nasmdoc9.html#section-9.1.3">Section 9.1.3</a> +<br> +stub preprocessor: +<a href="nasmdoc2.html#section-2.1.21">Section 2.1.21</a> +<br> +<code><nobr>%substr</nobr></code>: +<a href="nasmdoc4.html#section-4.2.3">Section 4.2.3</a> +<br> +subtraction: <a href="nasmdoc3.html#section-3.5.5">Section 3.5.5</a> +<br> +suppressible warning: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +suppressing preprocessing: +<a href="nasmdoc2.html#section-2.1.21">Section 2.1.21</a> +<br> +switching between sections: +<a href="nasmdoc6.html#section-6.3">Section 6.3</a> +<br> +<code><nobr>..sym</nobr></code>: +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a> +<br> +symbol sizes, specifying: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +symbol types, specifying: +<a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +symbols, exporting from DLLs: +<a href="nasmdoc7.html#section-7.4.5">Section 7.4.5</a> +<br> +symbols, importing from DLLs: +<a href="nasmdoc7.html#section-7.4.4">Section 7.4.4</a> +<br> +<code><nobr>synchronisation</nobr></code>: +<a href="nasmdoca.html#section-A.3.2">Section A.3.2</a> +<br> +<code><nobr>.SYS</nobr></code>: +<a href="nasmdoc7.html#section-7.1">Section 7.1</a>, +<a href="nasmdoc8.html#section-8.3">Section 8.3</a> +<br> +<code><nobr>-t</nobr></code>: +<a href="nasmdoc2.html#section-2.1.23">Section 2.1.23</a> +<br> +<code><nobr>TASM</nobr></code>: +<a href="nasmdoc1.html#section-1.1.1">Section 1.1.1</a>, +<a href="nasmdoc2.html#section-2.1.23">Section 2.1.23</a> +<br> +tasm: <a href="nasmdoc2.html#section-2.2">Section 2.2</a>, +<a href="nasmdoc7.html#section-7.4">Section 7.4</a> +<br> +<code><nobr>.tbss</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>TBYTE</nobr></code>: +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7</a> +<br> +<code><nobr>.tdata</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +<code><nobr>test</nobr></code> subdirectory: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +testing, arbitrary numeric expressions: +<a href="nasmdoc4.html#section-4.4.4">Section 4.4.4</a> +<br> +testing, context stack: +<a href="nasmdoc4.html#section-4.4.3">Section 4.4.3</a> +<br> +testing, exact text identity: +<a href="nasmdoc4.html#section-4.4.5">Section 4.4.5</a> +<br> +testing, multi-line macro existence: +<a href="nasmdoc4.html#section-4.4.2">Section 4.4.2</a> +<br> +testing, single-line macro existence: +<a href="nasmdoc4.html#section-4.4.1">Section 4.4.1</a> +<br> +testing, token types: +<a href="nasmdoc4.html#section-4.4.6">Section 4.4.6</a> +<br> +<code><nobr>.text</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a>, +<a href="nasmdoc7.html#section-7.10">Section 7.10</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a>, +<a href="nasmdoc7.html#section-7.12">Section 7.12</a>, +<a href="nasmdoc7.html#section-7.13">Section 7.13</a> +<br> +<code><nobr>_TEXT</nobr></code>: +<a href="nasmdoc8.html#section-8.4.2">Section 8.4.2</a> +<br> +thread local storage: +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4</a> +<br> +<code><nobr>__TIME__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>__TIME_NUM__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>TIMES</nobr></code>: +<a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a>, +<a href="nasmdoc3.html#section-3.8">Section 3.8</a>, +<a href="nasmdo12.html#section-12.1.3">Section 12.1.3</a>, +<a href="nasmdo12.html#section-12.1.4">Section 12.1.4</a> +<br> +<code><nobr>TLINK</nobr></code>: +<a href="nasmdoc8.html#section-8.2.2">Section 8.2.2</a> +<br> +<code><nobr>tls</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a>, +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4</a> +<br> +<code><nobr>..tlsie</nobr></code>: +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4</a> +<br> +trailing colon: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +<code><nobr>TWORD</nobr></code>: +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7</a>, +<a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +type, of symbols: <a href="nasmdoc7.html#section-7.9.5">Section 7.9.5</a> +<br> +<code><nobr>-U</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.19">Section 2.1.19</a> +<br> +<code><nobr>-u</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.19">Section 2.1.19</a>, +<a href="nasmdoca.html#section-A.3">Section A.3</a> +<br> +unary operators: <a href="nasmdoc3.html#section-3.5.7">Section 3.5.7</a> +<br> +<code><nobr>%undef</nobr></code>: +<a href="nasmdoc2.html#section-2.1.19">Section 2.1.19</a>, +<a href="nasmdoc4.html#section-4.1.6">Section 4.1.6</a> +<br> +undefining macros: +<a href="nasmdoc2.html#section-2.1.19">Section 2.1.19</a> +<br> +underscore, in C symbols: +<a href="nasmdoc8.html#section-8.4.1">Section 8.4.1</a> +<br> +Unicode: <a href="nasmdoc3.html#section-3.4.2">Section 3.4.2</a>, +<a href="nasmdoc3.html#section-3.4.5">Section 3.4.5</a> +<br> +uninitialized: <a href="nasmdoc3.html#section-3.2">Section 3.2</a>, +<a href="nasmdoc3.html#section-3.2.2">Section 3.2.2</a> +<br> +uninitialized storage: +<a href="nasmdoc2.html#section-2.2.7">Section 2.2.7</a> +<br> +Unix: <a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +Unix, SCO: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +Unix, source archive: +<a href="nasmdoc1.html#section-1.3.2">Section 1.3.2</a> +<br> +Unix, System V: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +UnixWare: <a href="nasmdoc7.html#section-7.9">Section 7.9</a> +<br> +<code><nobr>%unmacro</nobr></code>: +<a href="nasmdoc4.html#section-4.3.11">Section 4.3.11</a> +<br> +unrolled loops: <a href="nasmdoc3.html#section-3.2.5">Section 3.2.5</a> +<br> +unsigned division: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +unsigned modulo: <a href="nasmdoc3.html#section-3.5.6">Section 3.5.6</a> +<br> +<code><nobr>UPPERCASE</nobr></code>: +<a href="nasmdoc2.html#section-2.2.1">Section 2.2.1</a>, +<a href="nasmdoc7.html#section-7.4.3">Section 7.4.3</a> +<br> +<code><nobr>%use</nobr></code>: +<a href="nasmdoc4.html#section-4.6.4">Section 4.6.4</a>, +<a href="nasmdoc5.html">Chapter 5</a> +<br> +<code><nobr>__USE_*__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.8">Section 4.11.8</a> +<br> +<code><nobr>USE16</nobr></code>: +<a href="nasmdoc6.html#section-6.1.1">Section 6.1.1</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>USE32</nobr></code>: +<a href="nasmdoc6.html#section-6.1.1">Section 6.1.1</a>, +<a href="nasmdoc7.html#section-7.4.1">Section 7.4.1</a> +<br> +<code><nobr>user</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +user-defined errors: <a href="nasmdoc4.html#section-4.9">Section 4.9</a> +<br> +user-level assembler directives: +<a href="nasmdoc4.html#section-4.11">Section 4.11</a> +<br> +user-level directives: <a href="nasmdoc6.html">Chapter 6</a> +<br> +<code><nobr>__UTC_DATE__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>__UTC_DATE_NUM__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>__UTC_TIME__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +<code><nobr>__UTC_TIME_NUM__</nobr></code>: +<a href="nasmdoc4.html#section-4.11.7">Section 4.11.7</a> +<br> +UTF-16: <a href="nasmdoc3.html#section-3.4.5">Section 3.4.5</a> +<br> +UTF-32: <a href="nasmdoc3.html#section-3.4.5">Section 3.4.5</a> +<br> +UTF-8: <a href="nasmdoc3.html#section-3.4.2">Section 3.4.2</a> +<br> +<code><nobr>__utf16__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.5">Section 3.4.5</a> +<br> +<code><nobr>__utf32__</nobr></code>: +<a href="nasmdoc3.html#section-3.4.5">Section 3.4.5</a> +<br> +<code><nobr>-v</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.25">Section 2.1.25</a> +<br> +VAL: <a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +valid characters: <a href="nasmdoc3.html#section-3.1">Section 3.1</a> +<br> +variable types: <a href="nasmdoc2.html#section-2.2.3">Section 2.2.3</a> +<br> +version: <a href="nasmdoc2.html#section-2.1.25">Section 2.1.25</a> +<br> +version number of NASM: +<a href="nasmdoc4.html#section-4.11.1">Section 4.11.1</a> +<br> +<code><nobr>vfollows=</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +Visual C++: <a href="nasmdoc7.html#section-7.5">Section 7.5</a> +<br> +<code><nobr>vstart=</nobr></code>: +<a href="nasmdoc7.html#section-7.1.3">Section 7.1.3</a> +<br> +<code><nobr>-W</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>-w</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>%warning</nobr></code>: +<a href="nasmdoc4.html#section-4.9">Section 4.9</a> +<br> +warnings: <a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>[warning *warning-name]</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>[warning +warning-name]</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +<code><nobr>[warning -warning-name]</nobr></code>: +<a href="nasmdoc2.html#section-2.1.24">Section 2.1.24</a> +<br> +website: <a href="nasmdoc1.html#section-1.2">Section 1.2</a> +<br> +<code><nobr>win64</nobr></code>: +<a href="nasmdoc7.html#section-7.6">Section 7.6</a>, +<a href="nasmdo11.html">Chapter 11</a> +<br> +Win64: <a href="nasmdoc7.html#section-7.4">Section 7.4</a>, +<a href="nasmdoc7.html#section-7.5">Section 7.5</a>, +<a href="nasmdoc9.html">Chapter 9</a> +<br> +Windows: <a href="nasmdoc8.html#section-8.1">Section 8.1</a> +<br> +Windows 95: +<br> +Windows NT: +<br> +<code><nobr>write</nobr></code>: +<a href="nasmdoc7.html#section-7.9.2">Section 7.9.2</a> +<br> +writing operating systems: +<a href="nasmdo10.html#section-10.1">Section 10.1</a> +<br> +<code><nobr>WRT</nobr></code>: +<a href="nasmdoc3.html#section-3.6">Section 3.6</a>, +<a href="nasmdoc7.html#section-7.4">Section 7.4</a>, +<a href="nasmdoc7.html#section-7.9.3">Section 7.9.3</a>, +<a href="nasmdoc7.html#section-7.9.4">Section 7.9.4</a>, +<a href="nasmdoc7.html#section-7.11">Section 7.11</a> +<br> +<code><nobr>WRT ..got</nobr></code>: +<a href="nasmdoc9.html#section-9.2.3">Section 9.2.3</a> +<br> +<code><nobr>WRT ..gotoff</nobr></code>: +<a href="nasmdoc9.html#section-9.2.2">Section 9.2.2</a> +<br> +<code><nobr>WRT ..gotpc</nobr></code>: +<a href="nasmdoc9.html#section-9.2.1">Section 9.2.1</a> +<br> +<code><nobr>WRT ..plt</nobr></code>: +<a href="nasmdoc9.html#section-9.2.5">Section 9.2.5</a> +<br> +<code><nobr>WRT ..sym</nobr></code>: +<a href="nasmdoc9.html#section-9.2.4">Section 9.2.4</a> +<br> +WWW page: +<br> +<code><nobr>www.cpan.org</nobr></code>: +<a href="nasmdoc1.html#section-1.3.1">Section 1.3.1</a> +<br> +<code><nobr>www.delorie.com</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>www.pcorner.com</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>-X</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.13">Section 2.1.13</a> +<br> +<code><nobr>x2ftp.oulu.fi</nobr></code>: +<a href="nasmdoc8.html#section-8.1.1">Section 8.1.1</a> +<br> +<code><nobr>%xdefine</nobr></code>: +<a href="nasmdoc4.html#section-4.1.2">Section 4.1.2</a> +<br> +<code><nobr>-y</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.26">Section 2.1.26</a> +<br> +<code><nobr>-Z</nobr></code> option: +<a href="nasmdoc2.html#section-2.1.14">Section 2.1.14</a> +<br> +<p align=center><a href="nasmdoc0.html">Contents</a> +</body></html> diff --git a/doc/info/nasm.info b/doc/info/nasm.info new file mode 100644 index 0000000..64ae230 --- /dev/null +++ b/doc/info/nasm.info @@ -0,0 +1,398 @@ +This is nasm.info, produced by makeinfo version 4.13 from nasmdoc.texi. + +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* NASM: (nasm). The Netwide Assembler for x86. +END-INFO-DIR-ENTRY + + This file documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. + + Copyright 1996-2009 The NASM Development Team + + This document is redistributable under the license given in the file +"COPYING" distributed in the NASM archive. + + +Indirect: +nasm.info-1: 506 +nasm.info-2: 299030 +nasm.info-3: 597272 + +Tag Table: +(Indirect) +Node: Top506 +Node: Chapter 11340 +Node: Section 1.11573 +Node: Section 1.1.12288 +Node: Section 1.1.24165 +Node: Section 1.25885 +Node: Section 1.36714 +Node: Section 1.3.16961 +Node: Section 1.3.28939 +Node: Chapter 210269 +Node: Section 2.110501 +Node: Section 2.1.113922 +Node: Section 2.1.215572 +Node: Section 2.1.316326 +Node: Section 2.1.417278 +Node: Section 2.1.517670 +Node: Section 2.1.618127 +Node: Section 2.1.718501 +Node: Section 2.1.819097 +Node: Section 2.1.919462 +Node: Section 2.1.1019895 +Node: Section 2.1.1120315 +Node: Section 2.1.1221351 +Node: Section 2.1.1321902 +Node: Section 2.1.1423151 +Node: Section 2.1.1524104 +Node: Section 2.1.1624609 +Node: Section 2.1.1726221 +Node: Section 2.1.1826794 +Node: Section 2.1.1927652 +Node: Section 2.1.2028346 +Node: Section 2.1.2129324 +Node: Section 2.1.2229870 +Node: Section 2.1.2331394 +Node: Section 2.1.2432358 +Node: Section 2.1.2535726 +Node: Section 2.1.2636094 +Node: Section 2.1.2736730 +Node: Section 2.1.2837190 +Node: Section 2.238528 +Node: Section 2.2.139321 +Node: Section 2.2.239931 +Node: Section 2.2.342292 +Node: Section 2.2.443155 +Node: Section 2.2.543559 +Node: Section 2.2.644319 +Node: Section 2.2.744947 +Node: Chapter 345799 +Node: Section 3.146276 +Node: Section 3.250446 +Node: Section 3.2.151310 +Node: Section 3.2.252567 +Node: Section 3.2.353598 +Node: Section 3.2.454561 +Node: Section 3.2.555471 +Node: Section 3.356970 +Node: Section 3.460459 +Node: Section 3.4.160957 +Node: Section 3.4.262817 +Node: Section 3.4.364681 +Node: Section 3.4.465383 +Node: Section 3.4.566694 +Node: Section 3.4.667390 +Node: Section 3.4.771120 +Node: Section 3.571682 +Node: Section 3.5.172876 +Node: Section 3.5.273207 +Node: Section 3.5.373418 +Node: Section 3.5.473629 +Node: Section 3.5.574128 +Node: Section 3.5.674417 +Node: Section 3.5.775167 +Node: Section 3.675754 +Node: Section 3.777833 +Node: Section 3.878736 +Node: Section 3.980161 +Node: Chapter 482743 +Node: Section 4.183935 +Node: Section 4.1.184549 +Node: Section 4.1.287390 +Node: Section 4.1.388934 +Node: Section 4.1.489843 +Node: Section 4.1.591349 +Node: Section 4.1.692319 +Node: Section 4.1.792959 +Node: Section 4.1.894230 +Node: Section 4.1.994874 +Node: Section 4.295336 +Node: Section 4.2.196105 +Node: Section 4.2.296681 +Node: Section 4.2.397368 +Node: Section 4.398741 +Node: Section 4.3.1100959 +Node: Section 4.3.2101752 +Node: Section 4.3.3103123 +Node: Section 4.3.4104286 +Node: Section 4.3.5106612 +Node: Section 4.3.6109310 +Node: Section 4.3.7109896 +Node: Section 4.3.8112639 +Node: Section 4.3.9114996 +Node: Section 4.3.10116387 +Node: Section 4.3.11117234 +Node: Section 4.3.12117992 +Node: Section 4.4118457 +Node: Section 4.4.1119961 +Node: Section 4.4.2121062 +Node: Section 4.4.3122377 +Node: Section 4.4.4123000 +Node: Section 4.4.5124560 +Node: Section 4.4.6125561 +Node: Section 4.4.7127864 +Node: Section 4.4.8128682 +Node: Section 4.5129130 +Node: Section 4.6130826 +Node: Section 4.6.1131288 +Node: Section 4.6.2132695 +Node: Section 4.6.3133293 +Node: Section 4.6.4134133 +Node: Section 4.7135063 +Node: Section 4.7.1136233 +Node: Section 4.7.2137224 +Node: Section 4.7.3138261 +Node: Section 4.7.4138778 +Node: Section 4.7.5139538 +Node: Section 4.8142039 +Node: Section 4.8.1142600 +Node: Section 4.8.2143809 +Node: Section 4.8.3145438 +Node: Section 4.9147193 +Node: Section 4.10149062 +Node: Section 4.10.1149732 +Node: Section 4.10.2151046 +Node: Section 4.11151773 +Node: Section 4.11.1153179 +Node: Section 4.11.2153878 +Node: Section 4.11.3154703 +Node: Section 4.11.4155133 +Node: Section 4.11.5156498 +Node: Section 4.11.6157004 +Node: Section 4.11.7157505 +Node: Section 4.11.8159693 +Node: Section 4.11.9160294 +Node: Section 4.11.10160911 +Node: Section 4.11.11163932 +Node: Section 4.11.12165536 +Node: Chapter 5168133 +Node: Section 5.1168785 +Node: Section 5.2169475 +Node: Chapter 6171420 +Node: Section 6.1173000 +Node: Section 6.1.1175976 +Node: Section 6.2176296 +Node: Section 6.3177453 +Node: Section 6.3.1178524 +Node: Section 6.4180364 +Node: Section 6.5182293 +Node: Section 6.6183787 +Node: Section 6.7184971 +Node: Section 6.8186170 +Node: Section 6.9187418 +Node: Chapter 7188427 +Node: Section 7.1190123 +Node: Section 7.1.1191429 +Node: Section 7.1.2192457 +Node: Section 7.1.3193198 +Node: Section 7.1.4194959 +Node: Section 7.2195436 +Node: Section 7.3195980 +Node: Section 7.4196548 +Node: Section 7.4.1199011 +Node: Section 7.4.2201987 +Node: Section 7.4.3203656 +Node: Section 7.4.4204379 +Node: Section 7.4.5205355 +Node: Section 7.4.6207319 +Node: Section 7.4.7207871 +Node: Section 7.4.8209425 +Node: Section 7.5211274 +Node: Section 7.5.1212425 +Node: Section 7.5.2214883 +Node: Section 7.6219189 +Node: Section 7.6.1219880 +Node: Section 7.6.2222750 +Node: Section 7.7231628 +Node: Section 7.8232143 +Node: Section 7.9232570 +Node: Section 7.9.1233574 +Node: Section 7.9.2234090 +Node: Section 7.9.3236574 +Node: Section 7.9.4239580 +Node: Section 7.9.5240492 +Node: Section 7.9.6242295 +Node: Section 7.9.7242944 +Node: Section 7.9.8243460 +Node: Section 7.10243838 +Node: Section 7.11244741 +Node: Section 7.12245917 +Node: Section 7.13246833 +Node: Section 7.13.1248187 +Node: Section 7.13.2248663 +Node: Section 7.13.3249368 +Node: Section 7.13.4250315 +Node: Section 7.14251192 +Node: Chapter 8253473 +Node: Section 8.1254227 +Node: Section 8.1.1255319 +Node: Section 8.1.2258921 +Node: Section 8.2261299 +Node: Section 8.2.1261805 +Node: Section 8.2.2263314 +Node: Section 8.3264893 +Node: Section 8.4265899 +Node: Section 8.4.1266570 +Node: Section 8.4.2268084 +Node: Section 8.4.3271540 +Node: Section 8.4.4278288 +Node: Section 8.4.5280465 +Node: Section 8.5283090 +Node: Section 8.5.1284827 +Node: Section 8.5.2289081 +Node: Section 8.5.3290107 +Node: Chapter 9291435 +Node: Section 9.1292896 +Node: Section 9.1.1293491 +Node: Section 9.1.2294359 +Node: Section 9.1.3299030 +Node: Section 9.1.4301283 +Node: Section 9.2302862 +Node: Section 9.2.1305149 +Node: Section 9.2.2307928 +Node: Section 9.2.3309212 +Node: Section 9.2.4310327 +Node: Section 9.2.5312918 +Node: Section 9.2.6313825 +Node: Chapter 10314685 +Node: Section 10.1315390 +Node: Section 10.2317375 +Node: Section 10.3319959 +Node: Chapter 11322252 +Node: Section 11.1324207 +Node: Section 11.2325177 +Node: Section 11.3327200 +Node: Section 11.4328551 +Node: Chapter 12329634 +Node: Section 12.1330070 +Node: Section 12.1.1330398 +Node: Section 12.1.2331166 +Node: Section 12.1.3332323 +Node: Section 12.1.4333493 +Node: Section 12.2334851 +Node: Appendix A339510 +Node: Section A.1339830 +Node: Section A.2340543 +Node: Section A.3340876 +Node: Section A.3.1341789 +Node: Section A.3.2342678 +Node: Section A.3.3344784 +Node: Section A.3.4347578 +Node: Section A.4348326 +Node: Appendix B348762 +Node: Section B.1348948 +Node: Section B.1.1351150 +Node: Section B.1.2351483 +Node: Section B.1.3424168 +Node: Section B.1.4429304 +Node: Section B.1.5429647 +Node: Section B.1.6430065 +Node: Section B.1.7430506 +Node: Section B.1.8431638 +Node: Section B.1.9432131 +Node: Section B.1.10432831 +Node: Section B.1.11439728 +Node: Section B.1.12445350 +Node: Section B.1.13446171 +Node: Section B.1.14447189 +Node: Section B.1.15447629 +Node: Section B.1.16449575 +Node: Section B.1.17450064 +Node: Section B.1.18450411 +Node: Section B.1.19453720 +Node: Section B.1.20454625 +Node: Section B.1.21454823 +Node: Section B.1.22455137 +Node: Section B.1.23455651 +Node: Section B.1.24456181 +Node: Section B.1.25456737 +Node: Section B.1.26497504 +Node: Section B.1.27498034 +Node: Section B.1.28498591 +Node: Section B.1.29509939 +Node: Section B.1.30510657 +Node: Section B.1.31511523 +Node: Section B.1.32520363 +Node: Appendix C531399 +Node: Section C.1531662 +Node: Section C.1.1532242 +Node: Section C.1.2533796 +Node: Section C.1.3535031 +Node: Section C.1.4536766 +Node: Section C.1.5536987 +Node: Section C.1.6537982 +Node: Section C.1.7540282 +Node: Section C.1.8540651 +Node: Section C.1.9542095 +Node: Section C.1.10543237 +Node: Section C.1.11543839 +Node: Section C.2545564 +Node: Section C.2.1547911 +Node: Section C.2.2548336 +Node: Section C.2.3549349 +Node: Section C.2.4550042 +Node: Section C.2.5550581 +Node: Section C.2.6551111 +Node: Section C.2.7551952 +Node: Section C.2.8552881 +Node: Section C.2.9553540 +Node: Section C.2.10554127 +Node: Section C.2.11554863 +Node: Section C.2.12555186 +Node: Section C.2.13555393 +Node: Section C.2.14555706 +Node: Section C.2.15555953 +Node: Section C.2.16556156 +Node: Section C.2.17556364 +Node: Section C.2.18556621 +Node: Section C.2.19556820 +Node: Section C.2.20557001 +Node: Section C.2.21557182 +Node: Section C.2.22557370 +Node: Section C.2.23557561 +Node: Section C.2.24557771 +Node: Section C.2.25557974 +Node: Section C.2.26558187 +Node: Section C.2.27558366 +Node: Section C.2.28558548 +Node: Section C.2.29558792 +Node: Section C.2.30558996 +Node: Section C.2.31559178 +Node: Section C.2.32559842 +Node: Section C.2.33560152 +Node: Section C.2.34561495 +Node: Section C.2.35561944 +Node: Section C.2.36562245 +Node: Section C.2.37563300 +Node: Section C.2.38563537 +Node: Section C.2.39563868 +Node: Section C.2.40565946 +Node: Section C.2.41573822 +Node: Section C.2.42574310 +Node: Section C.2.43575038 +Node: Section C.2.44575971 +Node: Section C.2.45577069 +Node: Section C.2.46578569 +Node: Section C.2.47578863 +Node: Section C.2.48579191 +Node: Section C.2.49580498 +Node: Section C.2.50580915 +Node: Section C.2.51581846 +Node: Section C.2.52582760 +Node: Section C.2.53583882 +Node: Section C.2.54584288 +Node: Section C.2.55584619 +Node: Section C.3587873 +Node: Section C.3.1588473 +Node: Section C.3.2590132 +Node: Section C.3.3597272 +Node: Section C.3.4601832 +Node: Section C.3.5603782 +Node: Section C.3.6604873 +Node: Section C.3.7606084 +Node: Section C.3.8607145 +Node: Index607442 + +End Tag Table diff --git a/doc/info/nasm.info-1 b/doc/info/nasm.info-1 new file mode 100644 index 0000000..d1896f8 --- /dev/null +++ b/doc/info/nasm.info-1 @@ -0,0 +1,7484 @@ +This is nasm.info, produced by makeinfo version 4.13 from nasmdoc.texi. + +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* NASM: (nasm). The Netwide Assembler for x86. +END-INFO-DIR-ENTRY + + This file documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. + + Copyright 1996-2009 The NASM Development Team + + This document is redistributable under the license given in the file +"COPYING" distributed in the NASM archive. + + +File: nasm.info, Node: Top, Next: Chapter 1, Prev: (dir), Up: (dir) + +The Netwide Assembler for x86 +***************************** + +This file documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. + +* Menu: + +* Chapter 1:: Introduction +* Chapter 2:: Running NASM +* Chapter 3:: The NASM Language +* Chapter 4:: The NASM Preprocessor +* Chapter 5:: Standard Macro Packages +* Chapter 6:: Assembler Directives +* Chapter 7:: Output Formats +* Chapter 8:: Writing 16-bit Code (DOS, Windows 3/3.1) +* Chapter 9:: Writing 32-bit Code (Unix, Win32, DJGPP) +* Chapter 10:: Mixing 16 and 32 Bit Code +* Chapter 11:: Writing 64-bit Code (Unix, Win64) +* Chapter 12:: Troubleshooting +* Appendix A:: Ndisasm +* Appendix B:: Instruction List +* Appendix C:: NASM Version History +* Index:: + + +File: nasm.info, Node: Chapter 1, Next: Section 1.1, Prev: Top, Up: Top + +Chapter 1: Introduction +*********************** + +* Menu: + +* Section 1.1:: What Is NASM? +* Section 1.2:: Contact Information +* Section 1.3:: Installation + + +File: nasm.info, Node: Section 1.1, Next: Section 1.1.1, Prev: Chapter 1, Up: Chapter 1 + +1.1. What Is NASM? +================== + +The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler designed +for portability and modularity. It supports a range of object file +formats, including Linux and `*BSD' `a.out', `ELF', `COFF', `Mach-O', +Microsoft 16-bit `OBJ', `Win32' and `Win64'. It will also output plain +binary files. Its syntax is designed to be simple and easy to +understand, similar to Intel's but less complex. It supports all +currently known x86 architectural extensions, and has strong support +for macros. + +* Menu: + +* Section 1.1.1:: Why Yet Another Assembler? +* Section 1.1.2:: License Conditions + + +File: nasm.info, Node: Section 1.1.1, Next: Section 1.1.2, Prev: Section 1.1, Up: Section 1.1 + +1.1.1. Why Yet Another Assembler? +--------------------------------- + +The Netwide Assembler grew out of an idea on `comp.lang.asm.x86' (or +possibly `alt.lang.asm' - I forget which), which was essentially that +there didn't seem to be a good _free_ x86-series assembler around, and +that maybe someone ought to write one. + + * `a86' is good, but not free, and in particular you don't get any + 32- bit capability until you pay. It's DOS only, too. + + * `gas' is free, and ports over to DOS and Unix, but it's not very + good, since it's designed to be a back end to `gcc', which always + feeds it correct code. So its error checking is minimal. Also, its + syntax is horrible, from the point of view of anyone trying to + actually _write_ anything in it. Plus you can't write 16-bit code + in it (properly.) + + * `as86' is specific to Minix and Linux, and (my version at least) + doesn't seem to have much (or any) documentation. + + * `MASM' isn't very good, and it's (was) expensive, and it runs only + under DOS. + + * `TASM' is better, but still strives for MASM compatibility, which + means millions of directives and tons of red tape. And its syntax + is essentially MASM's, with the contradictions and quirks that + entails (although it sorts out some of those by means of Ideal + mode.) It's expensive too. And it's DOS-only. + + So here, for your coding pleasure, is NASM. At present it's still in +prototype stage - we don't promise that it can outperform any of these +assemblers. But please, _please_ send us bug reports, fixes, helpful +information, and anything else you can get your hands on (and thanks to +the many people who've done this already! You all know who you are), +and we'll improve it out of all recognition. Again. + + +File: nasm.info, Node: Section 1.1.2, Next: Section 1.2, Prev: Section 1.1.1, Up: Section 1.1 + +1.1.2. License Conditions +------------------------- + +Please see the file `LICENSE', supplied as part of any NASM +distribution archive, for the license conditions under which you may use +NASM. NASM is now under the so-called 2-clause BSD license, also known +as the simplified BSD license. + + Copyright 1996-2009 the NASM Authors - All rights reserved. + + Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +File: nasm.info, Node: Section 1.2, Next: Section 1.3, Prev: Section 1.1.2, Up: Chapter 1 + +1.2. Contact Information +======================== + +The current version of NASM (since about 0.98.08) is maintained by a +team of developers, accessible through the `nasm-devel' mailing list +(see below for the link). If you want to report a bug, please read +*note Section 12.2:: first. + + NASM has a website at `http://www.nasm.us/'. If it's not there, +google for us! + + New releases, release candidates, and daily development snapshots of +NASM are available from the official web site. + + Announcements are posted to `comp.lang.asm.x86', and to the web site +`http://www.freshmeat.net/'. + + If you want information about the current development status, please +subscribe to the `nasm-devel' email list; see link from the website. + + +File: nasm.info, Node: Section 1.3, Next: Section 1.3.1, Prev: Section 1.2, Up: Chapter 1 + +1.3. Installation +================= + +* Menu: + +* Section 1.3.1:: Installing NASM under MS-DOS or Windows +* Section 1.3.2:: Installing NASM under Unix + + +File: nasm.info, Node: Section 1.3.1, Next: Section 1.3.2, Prev: Section 1.3, Up: Section 1.3 + +1.3.1. Installing NASM under MS-DOS or Windows +---------------------------------------------- + +Once you've obtained the appropriate archive for NASM, +`nasm-XXX-dos.zip' or `nasm-XXX-win32.zip' (where `XXX' denotes the +version number of NASM contained in the archive), unpack it into its +own directory (for example `c:\nasm'). + + The archive will contain a set of executable files: the NASM +executable file `nasm.exe', the NDISASM executable file `ndisasm.exe', +and possibly additional utilities to handle the RDOFF file format. + + The only file NASM needs to run is its own executable, so copy +`nasm.exe' to a directory on your PATH, or alternatively edit +`autoexec.bat' to add the `nasm' directory to your `PATH' (to do that +under Windows XP, go to Start > Control Panel > System > Advanced > +Environment Variables; these instructions may work under other versions +of Windows as well.) + + That's it - NASM is installed. You don't need the nasm directory to +be present to run NASM (unless you've added it to your `PATH'), so you +can delete it if you need to save space; however, you may want to keep +the documentation or test programs. + + If you've downloaded the DOS source archive, `nasm-XXX.zip', the +`nasm' directory will also contain the full NASM source code, and a +selection of Makefiles you can (hopefully) use to rebuild your copy of +NASM from scratch. See the file `INSTALL' in the source archive. + + Note that a number of files are generated from other files by Perl +scripts. Although the NASM source distribution includes these +generated files, you will need to rebuild them (and hence, will need a +Perl interpreter) if you change insns.dat, standard.mac or the +documentation. It is possible future source distributions may not +include these files at all. Ports of Perl for a variety of platforms, +including DOS and Windows, are available from www.cpan.org. + + +File: nasm.info, Node: Section 1.3.2, Next: Chapter 2, Prev: Section 1.3.1, Up: Section 1.3 + +1.3.2. Installing NASM under Unix +--------------------------------- + +Once you've obtained the Unix source archive for NASM, +`nasm-XXX.tar.gz' (where `XXX' denotes the version number of NASM +contained in the archive), unpack it into a directory such as +`/usr/local/src'. The archive, when unpacked, will create its own +subdirectory `nasm-XXX'. + + NASM is an auto-configuring package: once you've unpacked it, `cd' to +the directory it's been unpacked into and type `./configure'. This +shell script will find the best C compiler to use for building NASM and +set up Makefiles accordingly. + + Once NASM has auto-configured, you can type `make' to build the +`nasm' and `ndisasm' binaries, and then `make install' to install them +in `/usr/local/bin' and install the man pages `nasm.1' and `ndisasm.1' +in `/usr/local/man/man1'. Alternatively, you can give options such as +`--prefix' to the configure script (see the file `INSTALL' for more +details), or install the programs yourself. + + NASM also comes with a set of utilities for handling the `RDOFF' +custom object-file format, which are in the `rdoff' subdirectory of the +NASM archive. You can build these with `make rdf' and install them with +`make rdf_install', if you want them. + + +File: nasm.info, Node: Chapter 2, Next: Section 2.1, Prev: Section 1.3.2, Up: Top + +Chapter 2: Running NASM +*********************** + +* Menu: + +* Section 2.1:: NASM Command-Line Syntax +* Section 2.2:: Quick Start for MASM Users + + +File: nasm.info, Node: Section 2.1, Next: Section 2.1.1, Prev: Chapter 2, Up: Chapter 2 + +2.1. NASM Command-Line Syntax +============================= + +To assemble a file, you issue a command of the form + + nasm -f <format> <filename> [-o <output>] + + For example, + + nasm -f elf myfile.asm + + will assemble `myfile.asm' into an `ELF' object file `myfile.o'. And + + nasm -f bin myfile.asm -o myfile.com + + will assemble `myfile.asm' into a raw binary file `myfile.com'. + + To produce a listing file, with the hex codes output from NASM +displayed on the left of the original sources, use the `-l' option to +give a listing file name, for example: + + nasm -f coff myfile.asm -l myfile.lst + + To get further usage instructions from NASM, try typing + + nasm -h + + As `-hf', this will also list the available output file formats, and +what they are. + + If you use Linux but aren't sure whether your system is `a.out' or +`ELF', type + + file nasm + + (in the directory in which you put the NASM binary when you +installed it). If it says something like + + nasm: ELF 32-bit LSB executable i386 (386 and up) Version 1 + + then your system is `ELF', and you should use the option `-f elf' +when you want NASM to produce Linux object files. If it says + + nasm: Linux/i386 demand-paged executable (QMAGIC) + + or something similar, your system is `a.out', and you should use `-f +aout' instead (Linux `a.out' systems have long been obsolete, and are +rare these days.) + + Like Unix compilers and assemblers, NASM is silent unless it goes +wrong: you won't see any output at all, unless it gives error messages. + +* Menu: + +* Section 2.1.1:: The `-o' Option: Specifying the Output File Name +* Section 2.1.2:: The `-f' Option: Specifying the Output File Format +* Section 2.1.3:: The `-l' Option: Generating a Listing File +* Section 2.1.4:: The `-M' Option: Generate Makefile Dependencies +* Section 2.1.5:: The `-MG' Option: Generate Makefile Dependencies +* Section 2.1.6:: The `-MF' Option: Set Makefile Dependency File +* Section 2.1.7:: The `-MD' Option: Assemble and Generate Dependencies +* Section 2.1.8:: The `-MT' Option: Dependency Target Name +* Section 2.1.9:: The `-MQ' Option: Dependency Target Name (Quoted) +* Section 2.1.10:: The `-MP' Option: Emit phony targets +* Section 2.1.11:: The `-F' Option: Selecting a Debug Information Format +* Section 2.1.12:: The `-g' Option: Enabling Debug Information. +* Section 2.1.13:: The `-X' Option: Selecting an Error Reporting Format +* Section 2.1.14:: The `-Z' Option: Send Errors to a File +* Section 2.1.15:: The `-s' Option: Send Errors to `stdout' +* Section 2.1.16:: The `-i' Option: Include File Search Directories +* Section 2.1.17:: The `-p' Option: Pre-Include a File +* Section 2.1.18:: The `-d' Option: Pre-Define a Macro +* Section 2.1.19:: The `-u' Option: Undefine a Macro +* Section 2.1.20:: The `-E' Option: Preprocess Only +* Section 2.1.21:: The `-a' Option: Don't Preprocess At All +* Section 2.1.22:: The `-O' Option: Specifying Multipass Optimization +* Section 2.1.23:: The `-t' Option: Enable TASM Compatibility Mode +* Section 2.1.24:: The `-w' and `-W' Options: Enable or Disable Assembly Warnings +* Section 2.1.25:: The `-v' Option: Display Version Info +* Section 2.1.26:: The `-y' Option: Display Available Debug Info Formats +* Section 2.1.27:: The `--prefix' and `--postfix' Options. +* Section 2.1.28:: The `NASMENV' Environment Variable + + +File: nasm.info, Node: Section 2.1.1, Next: Section 2.1.2, Prev: Section 2.1, Up: Section 2.1 + +2.1.1. The `-o' Option: Specifying the Output File Name +------------------------------------------------------- + +NASM will normally choose the name of your output file for you; +precisely how it does this is dependent on the object file format. For +Microsoft object file formats (`obj', `win32' and `win64'), it will +remove the `.asm' extension (or whatever extension you like to use - +NASM doesn't care) from your source file name and substitute `.obj'. +For Unix object file formats (`aout', `as86', `coff', `elf32', `elf64', +`ieee', `macho32' and `macho64') it will substitute `.o'. For `dbg', +`rdf', `ith' and `srec', it will use `.dbg', `.rdf', `.ith' and +`.srec', respectively, and for the `bin' format it will simply remove +the extension, so that `myfile.asm' produces the output file `myfile'. + + If the output file already exists, NASM will overwrite it, unless it +has the same name as the input file, in which case it will give a +warning and use `nasm.out' as the output file name instead. + + For situations in which this behaviour is unacceptable, NASM +provides the `-o' command-line option, which allows you to specify your +desired output file name. You invoke `-o' by following it with the name +you wish for the output file, either with or without an intervening +space. For example: + + nasm -f bin program.asm -o program.com + nasm -f bin driver.asm -odriver.sys + + Note that this is a small o, and is different from a capital O , +which is used to specify the number of optimisation passes required. See +*note Section 2.1.22::. + + +File: nasm.info, Node: Section 2.1.2, Next: Section 2.1.3, Prev: Section 2.1.1, Up: Section 2.1 + +2.1.2. The `-f' Option: Specifying the Output File Format +--------------------------------------------------------- + +If you do not supply the `-f' option to NASM, it will choose an output +file format for you itself. In the distribution versions of NASM, the +default is always `bin'; if you've compiled your own copy of NASM, you +can redefine `OF_DEFAULT' at compile time and choose what you want the +default to be. + + Like `-o', the intervening space between `-f' and the output file +format is optional; so `-f elf' and `-felf' are both valid. + + A complete list of the available output file formats can be given by +issuing the command `nasm -hf'. + + +File: nasm.info, Node: Section 2.1.3, Next: Section 2.1.4, Prev: Section 2.1.2, Up: Section 2.1 + +2.1.3. The `-l' Option: Generating a Listing File +------------------------------------------------- + +If you supply the `-l' option to NASM, followed (with the usual +optional space) by a file name, NASM will generate a source-listing file +for you, in which addresses and generated code are listed on the left, +and the actual source code, with expansions of multi-line macros +(except those which specifically request no expansion in source +listings: see *note Section 4.3.10::) on the right. For example: + + nasm -f elf myfile.asm -l myfile.lst + + If a list file is selected, you may turn off listing for a section +of your source with `[list -]', and turn it back on with `[list +]', +(the default, obviously). There is no "user form" (without the +brackets). This can be used to list only sections of interest, avoiding +excessively long listings. + + +File: nasm.info, Node: Section 2.1.4, Next: Section 2.1.5, Prev: Section 2.1.3, Up: Section 2.1 + +2.1.4. The `-M' Option: Generate Makefile Dependencies +------------------------------------------------------ + +This option can be used to generate makefile dependencies on stdout. +This can be redirected to a file for further processing. For example: + + nasm -M myfile.asm > myfile.dep + + +File: nasm.info, Node: Section 2.1.5, Next: Section 2.1.6, Prev: Section 2.1.4, Up: Section 2.1 + +2.1.5. The `-MG' Option: Generate Makefile Dependencies +------------------------------------------------------- + +This option can be used to generate makefile dependencies on stdout. +This differs from the `-M' option in that if a nonexisting file is +encountered, it is assumed to be a generated file and is added to the +dependency list without a prefix. + + +File: nasm.info, Node: Section 2.1.6, Next: Section 2.1.7, Prev: Section 2.1.5, Up: Section 2.1 + +2.1.6. The `-MF' Option: Set Makefile Dependency File +----------------------------------------------------- + +This option can be used with the `-M' or `-MG' options to send the +output to a file, rather than to stdout. For example: + + nasm -M -MF myfile.dep myfile.asm + + +File: nasm.info, Node: Section 2.1.7, Next: Section 2.1.8, Prev: Section 2.1.6, Up: Section 2.1 + +2.1.7. The `-MD' Option: Assemble and Generate Dependencies +----------------------------------------------------------- + +The `-MD' option acts as the combination of the `-M' and `-MF' options +(i.e. a filename has to be specified.) However, unlike the `-M' or +`-MG' options, `-MD' does _not_ inhibit the normal operation of the +assembler. Use this to automatically generate updated dependencies with +every assembly session. For example: + + nasm -f elf -o myfile.o -MD myfile.dep myfile.asm + + +File: nasm.info, Node: Section 2.1.8, Next: Section 2.1.9, Prev: Section 2.1.7, Up: Section 2.1 + +2.1.8. The `-MT' Option: Dependency Target Name +----------------------------------------------- + +The `-MT' option can be used to override the default name of the +dependency target. This is normally the same as the output filename, +specified by the `-o' option. + + +File: nasm.info, Node: Section 2.1.9, Next: Section 2.1.10, Prev: Section 2.1.8, Up: Section 2.1 + +2.1.9. The `-MQ' Option: Dependency Target Name (Quoted) +-------------------------------------------------------- + +The `-MQ' option acts as the `-MT' option, except it tries to quote +characters that have special meaning in Makefile syntax. This is not +foolproof, as not all characters with special meaning are quotable in +Make. + + +File: nasm.info, Node: Section 2.1.10, Next: Section 2.1.11, Prev: Section 2.1.9, Up: Section 2.1 + +2.1.10. The `-MP' Option: Emit phony targets +-------------------------------------------- + +When used with any of the dependency generation options, the `-MP' +option causes NASM to emit a phony target without dependencies for each +header file. This prevents Make from complaining if a header file has +been removed. + + +File: nasm.info, Node: Section 2.1.11, Next: Section 2.1.12, Prev: Section 2.1.10, Up: Section 2.1 + +2.1.11. The `-F' Option: Selecting a Debug Information Format +------------------------------------------------------------- + +This option is used to select the format of the debug information +emitted into the output file, to be used by a debugger (or _will_ be). +Prior to version 2.03.01, the use of this switch did _not_ enable +output of the selected debug info format. Use `-g', see *note Section +2.1.12::, to enable output. Versions 2.03.01 and later automatically +enable `-g' if `-F' is specified. + + A complete list of the available debug file formats for an output +format can be seen by issuing the command `nasm -f <format> -y'. Not all +output formats currently support debugging output. See *note Section +2.1.26::. + + This should not be confused with the `-f dbg' output format option +which is not built into NASM by default. For information on how to +enable it when building from the sources, see *note Section 7.14::. + + +File: nasm.info, Node: Section 2.1.12, Next: Section 2.1.13, Prev: Section 2.1.11, Up: Section 2.1 + +2.1.12. The `-g' Option: Enabling Debug Information. +---------------------------------------------------- + +This option can be used to generate debugging information in the +specified format. See *note Section 2.1.11::. Using `-g' without `-F' +results in emitting debug info in the default format, if any, for the +selected output format. If no debug information is currently +implemented in the selected output format, `-g' is _silently ignored_. + + +File: nasm.info, Node: Section 2.1.13, Next: Section 2.1.14, Prev: Section 2.1.12, Up: Section 2.1 + +2.1.13. The `-X' Option: Selecting an Error Reporting Format +------------------------------------------------------------ + +This option can be used to select an error reporting format for any +error messages that might be produced by NASM. + + Currently, two error reporting formats may be selected. They are the +`-Xvc' option and the `-Xgnu' option. The GNU format is the default and +looks like this: + + filename.asm:65: error: specific error message + + where `filename.asm' is the name of the source file in which the +error was detected, `65' is the source file line number on which the +error was detected, `error' is the severity of the error (this could be +`warning'), and `specific error message' is a more detailed text +message which should help pinpoint the exact problem. + + The other format, specified by `-Xvc' is the style used by Microsoft +Visual C++ and some other programs. It looks like this: + + filename.asm(65) : error: specific error message + + where the only difference is that the line number is in parentheses +instead of being delimited by colons. + + See also the `Visual C++' output format, *note Section 7.5::. + + +File: nasm.info, Node: Section 2.1.14, Next: Section 2.1.15, Prev: Section 2.1.13, Up: Section 2.1 + +2.1.14. The `-Z' Option: Send Errors to a File +---------------------------------------------- + +Under `MS-DOS' it can be difficult (though there are ways) to redirect +the standard-error output of a program to a file. Since NASM usually +produces its warning and error messages on `stderr', this can make it +hard to capture the errors if (for example) you want to load them into +an editor. + + NASM therefore provides the `-Z' option, taking a filename argument +which causes errors to be sent to the specified files rather than +standard error. Therefore you can redirect the errors into a file by +typing + + nasm -Z myfile.err -f obj myfile.asm + + In earlier versions of NASM, this option was called `-E', but it was +changed since `-E' is an option conventionally used for preprocessing +only, with disastrous results. See *note Section 2.1.20::. + + +File: nasm.info, Node: Section 2.1.15, Next: Section 2.1.16, Prev: Section 2.1.14, Up: Section 2.1 + +2.1.15. The `-s' Option: Send Errors to `stdout' +------------------------------------------------ + +The `-s' option redirects error messages to `stdout' rather than +`stderr', so it can be redirected under `MS-DOS'. To assemble the file +`myfile.asm' and pipe its output to the `more' program, you can type: + + nasm -s -f obj myfile.asm | more + + See also the `-Z' option, *note Section 2.1.14::. + + +File: nasm.info, Node: Section 2.1.16, Next: Section 2.1.17, Prev: Section 2.1.15, Up: Section 2.1 + +2.1.16. The `-i' Option: Include File Search Directories +-------------------------------------------------------- + +When NASM sees the `%include' or `%pathsearch' directive in a source +file (see *note Section 4.6.1::, *note Section 4.6.2:: or *note Section +3.2.3::), it will search for the given file not only in the current +directory, but also in any directories specified on the command line by +the use of the `-i' option. Therefore you can include files from a macro +library, for example, by typing + + nasm -ic:\macrolib\ -f obj myfile.asm + + (As usual, a space between `-i' and the path name is allowed, and +optional). + + NASM, in the interests of complete source-code portability, does not +understand the file naming conventions of the OS it is running on; the +string you provide as an argument to the `-i' option will be prepended +exactly as written to the name of the include file. Therefore the +trailing backslash in the above example is necessary. Under Unix, a +trailing forward slash is similarly necessary. + + (You can use this to your advantage, if you're really perverse, by +noting that the option `-ifoo' will cause `%include "bar.i"' to search +for the file `foobar.i'...) + + If you want to define a _standard_ include search path, similar to +`/usr/include' on Unix systems, you should place one or more `-i' +directives in the `NASMENV' environment variable (see *note Section +2.1.28::). + + For Makefile compatibility with many C compilers, this option can +also be specified as `-I'. + + +File: nasm.info, Node: Section 2.1.17, Next: Section 2.1.18, Prev: Section 2.1.16, Up: Section 2.1 + +2.1.17. The `-p' Option: Pre-Include a File +------------------------------------------- + +NASM allows you to specify files to be _pre-included_ into your source +file, by the use of the `-p' option. So running + + nasm myfile.asm -p myinc.inc + + is equivalent to running `nasm myfile.asm' and placing the directive +`%include "myinc.inc"' at the start of the file. + + For consistency with the `-I', `-D' and `-U' options, this option +can also be specified as `-P'. + + +File: nasm.info, Node: Section 2.1.18, Next: Section 2.1.19, Prev: Section 2.1.17, Up: Section 2.1 + +2.1.18. The `-d' Option: Pre-Define a Macro +------------------------------------------- + +Just as the `-p' option gives an alternative to placing `%include' +directives at the start of a source file, the `-d' option gives an +alternative to placing a `%define' directive. You could code + + nasm myfile.asm -dFOO=100 + + as an alternative to placing the directive + + %define FOO 100 + + at the start of the file. You can miss off the macro value, as well: +the option `-dFOO' is equivalent to coding `%define FOO'. This form of +the directive may be useful for selecting assembly-time options which +are then tested using `%ifdef', for example `-dDEBUG'. + + For Makefile compatibility with many C compilers, this option can +also be specified as `-D'. + + +File: nasm.info, Node: Section 2.1.19, Next: Section 2.1.20, Prev: Section 2.1.18, Up: Section 2.1 + +2.1.19. The `-u' Option: Undefine a Macro +----------------------------------------- + +The `-u' option undefines a macro that would otherwise have been pre- +defined, either automatically or by a `-p' or `-d' option specified +earlier on the command lines. + + For example, the following command line: + + nasm myfile.asm -dFOO=100 -uFOO + + would result in `FOO' _not_ being a predefined macro in the program. +This is useful to override options specified at a different point in a +Makefile. + + For Makefile compatibility with many C compilers, this option can +also be specified as `-U'. + + +File: nasm.info, Node: Section 2.1.20, Next: Section 2.1.21, Prev: Section 2.1.19, Up: Section 2.1 + +2.1.20. The `-E' Option: Preprocess Only +---------------------------------------- + +NASM allows the preprocessor to be run on its own, up to a point. Using +the `-E' option (which requires no arguments) will cause NASM to +preprocess its input file, expand all the macro references, remove all +the comments and preprocessor directives, and print the resulting file +on standard output (or save it to a file, if the `-o' option is also +used). + + This option cannot be applied to programs which require the +preprocessor to evaluate expressions which depend on the values of +symbols: so code such as + + %assign tablesize ($-tablestart) + + will cause an error in preprocess-only mode. + + For compatiblity with older version of NASM, this option can also be +written `-e'. `-E' in older versions of NASM was the equivalent of the +current `-Z' option, *note Section 2.1.14::. + + +File: nasm.info, Node: Section 2.1.21, Next: Section 2.1.22, Prev: Section 2.1.20, Up: Section 2.1 + +2.1.21. The `-a' Option: Don't Preprocess At All +------------------------------------------------ + +If NASM is being used as the back end to a compiler, it might be +desirable to suppress preprocessing completely and assume the compiler +has already done it, to save time and increase compilation speeds. The +`-a' option, requiring no argument, instructs NASM to replace its +powerful preprocessor with a stub preprocessor which does nothing. + + +File: nasm.info, Node: Section 2.1.22, Next: Section 2.1.23, Prev: Section 2.1.21, Up: Section 2.1 + +2.1.22. The `-O' Option: Specifying Multipass Optimization +---------------------------------------------------------- + +NASM defaults to not optimizing operands which can fit into a signed +byte. This means that if you want the shortest possible object code, +you have to enable optimization. + + Using the `-O' option, you can tell NASM to carry out different +levels of optimization. The syntax is: + + * `-O0': No optimization. All operands take their long forms, if a + short form is not specified, except conditional jumps. This is + intended to match NASM 0.98 behavior. + + * `-O1': Minimal optimization. As above, but immediate operands which + will fit in a signed byte are optimized, unless the long form is + specified. Conditional jumps default to the long form unless + otherwise specified. + + * `-Ox' (where `x' is the actual letter `x'): Multipass + optimization. Minimize branch offsets and signed immediate bytes, + overriding size specification unless the `strict' keyword has been + used (see *note Section 3.7::). For compatability with earlier + releases, the letter `x' may also be any number greater than one. + This number has no effect on the actual number of passes. + + The `-Ox' mode is recommended for most uses. + + Note that this is a capital `O', and is different from a small `o', +which is used to specify the output file name. See *note Section +2.1.1::. + + +File: nasm.info, Node: Section 2.1.23, Next: Section 2.1.24, Prev: Section 2.1.22, Up: Section 2.1 + +2.1.23. The `-t' Option: Enable TASM Compatibility Mode +------------------------------------------------------- + +NASM includes a limited form of compatibility with Borland's `TASM'. +When NASM's `-t' option is used, the following changes are made: + + * local labels may be prefixed with `@@' instead of `.' + + * size override is supported within brackets. In TASM compatible + mode, a size override inside square brackets changes the size of + the operand, and not the address type of the operand as it does in + NASM syntax. E.g. `mov eax,[DWORD val]' is valid syntax in TASM + compatibility mode. Note that you lose the ability to override the + default address type for the instruction. + + * unprefixed forms of some directives supported (`arg', `elif', + `else', `endif', `if', `ifdef', `ifdifi', `ifndef', `include', + `local') + + +File: nasm.info, Node: Section 2.1.24, Next: Section 2.1.25, Prev: Section 2.1.23, Up: Section 2.1 + +2.1.24. The `-w' and `-W' Options: Enable or Disable Assembly Warnings +---------------------------------------------------------------------- + +NASM can observe many conditions during the course of assembly which are +worth mentioning to the user, but not a sufficiently severe error to +justify NASM refusing to generate an output file. These conditions are +reported like errors, but come up with the word `warning' before the +message. Warnings do not prevent NASM from generating an output file and +returning a success status to the operating system. + + Some conditions are even less severe than that: they are only +sometimes worth mentioning to the user. Therefore NASM supports the `-w' +command-line option, which enables or disables certain classes of +assembly warning. Such warning classes are described by a name, for +example `orphan-labels'; you can enable warnings of this class by the +command- line option `-w+orphan-labels' and disable it by +`-w-orphan-labels'. + + The suppressible warning classes are: + + * `macro-params' covers warnings about multi-line macros being + invoked with the wrong number of parameters. This warning class is + enabled by default; see *note Section 4.3.2:: for an example of + why you might want to disable it. + + * `macro-selfref' warns if a macro references itself. This warning + class is disabled by default. + + * `macro-defaults' warns when a macro has more default parameters + than optional parameters. This warning class is enabled by + default; see *note Section 4.3.5:: for why you might want to + disable it. + + * `orphan-labels' covers warnings about source lines which contain no + instruction but define a label without a trailing colon. NASM + warns about this somewhat obscure condition by default; see *note + Section 3.1:: for more information. + + * `number-overflow' covers warnings about numeric constants which + don't fit in 64 bits. This warning class is enabled by default. + + * `gnu-elf-extensions' warns if 8-bit or 16-bit relocations are used + in `-f elf' format. The GNU extensions allow this. This warning + class is disabled by default. + + * `float-overflow' warns about floating point overflow. Enabled by + default. + + * `float-denorm' warns about floating point denormals. Disabled by + default. + + * `float-underflow' warns about floating point underflow. Disabled by + default. + + * `float-toolong' warns about too many digits in floating-point + numbers. Enabled by default. + + * `user' controls `%warning' directives (see *note Section 4.9::). + Enabled by default. + + * `error' causes warnings to be treated as errors. Disabled by + default. + + * `all' is an alias for _all_ suppressible warning classes (not + including `error'). Thus, `-w+all' enables all available warnings. + + In addition, you can set warning classes across sections. Warning +classes may be enabled with `[warning +warning-name]', disabled with +`[warning -warning-name]' or reset to their original value with +`[warning *warning-name]'. No "user form" (without the brackets) exists. + + Since version 2.00, NASM has also supported the gcc-like syntax +`-Wwarning' and `-Wno-warning' instead of `-w+warning' and +`-w-warning', respectively. + + +File: nasm.info, Node: Section 2.1.25, Next: Section 2.1.26, Prev: Section 2.1.24, Up: Section 2.1 + +2.1.25. The `-v' Option: Display Version Info +--------------------------------------------- + +Typing `NASM -v' will display the version of NASM which you are using, +and the date on which it was compiled. + + You will need the version number if you report a bug. + + +File: nasm.info, Node: Section 2.1.26, Next: Section 2.1.27, Prev: Section 2.1.25, Up: Section 2.1 + +2.1.26. The `-y' Option: Display Available Debug Info Formats +------------------------------------------------------------- + +Typing `nasm -f <option> -y' will display a list of the available debug +info formats for the given output format. The default format is +indicated by an asterisk. For example: + + nasm -f elf -y + + valid debug formats for 'elf32' output format are + ('*' denotes default): + * stabs ELF32 (i386) stabs debug format for Linux + dwarf elf32 (i386) dwarf debug format for Linux + + +File: nasm.info, Node: Section 2.1.27, Next: Section 2.1.28, Prev: Section 2.1.26, Up: Section 2.1 + +2.1.27. The `--prefix' and `--postfix' Options. +----------------------------------------------- + +The `--prefix' and `--postfix' options prepend or append (respectively) +the given argument to all `global' or `extern' variables. E.g. +`--prefix _' will prepend the underscore to all global and external +variables, as C sometimes (but not always) likes it. + + +File: nasm.info, Node: Section 2.1.28, Next: Section 2.2, Prev: Section 2.1.27, Up: Section 2.1 + +2.1.28. The `NASMENV' Environment Variable +------------------------------------------ + +If you define an environment variable called `NASMENV', the program +will interpret it as a list of extra command-line options, which are +processed before the real command line. You can use this to define +standard search directories for include files, by putting `-i' options +in the `NASMENV' variable. + + The value of the variable is split up at white space, so that the +value `-s -ic:\nasmlib\' will be treated as two separate options. +However, that means that the value `-dNAME="my name"' won't do what you +might want, because it will be split at the space and the NASM +command-line processing will get confused by the two nonsensical words +`-dNAME="my' and `name"'. + + To get round this, NASM provides a feature whereby, if you begin the +`NASMENV' environment variable with some character that isn't a minus +sign, then NASM will treat this character as the separator character for +options. So setting the `NASMENV' variable to the value +`!-s!-ic:\nasmlib\' is equivalent to setting it to `-s -ic:\nasmlib\', +but `!-dNAME="my name"' will work. + + This environment variable was previously called `NASM'. This was +changed with version 0.98.31. + + +File: nasm.info, Node: Section 2.2, Next: Section 2.2.1, Prev: Section 2.1.28, Up: Chapter 2 + +2.2. Quick Start for MASM Users +=============================== + +If you're used to writing programs with MASM, or with TASM in MASM- +compatible (non-Ideal) mode, or with `a86', this section attempts to +outline the major differences between MASM's syntax and NASM's. If +you're not already used to MASM, it's probably worth skipping this +section. + +* Menu: + +* Section 2.2.1:: NASM Is Case-Sensitive +* Section 2.2.2:: NASM Requires Square Brackets For Memory References +* Section 2.2.3:: NASM Doesn't Store Variable Types +* Section 2.2.4:: NASM Doesn't `ASSUME' +* Section 2.2.5:: NASM Doesn't Support Memory Models +* Section 2.2.6:: Floating-Point Differences +* Section 2.2.7:: Other Differences + + +File: nasm.info, Node: Section 2.2.1, Next: Section 2.2.2, Prev: Section 2.2, Up: Section 2.2 + +2.2.1. NASM Is Case-Sensitive +----------------------------- + +One simple difference is that NASM is case-sensitive. It makes a +difference whether you call your label `foo', `Foo' or `FOO'. If you're +assembling to `DOS' or `OS/2' `.OBJ' files, you can invoke the +`UPPERCASE' directive (documented in *note Section 7.4::) to ensure +that all symbols exported to other code modules are forced to be upper +case; but even then, _within_ a single module, NASM will distinguish +between labels differing only in case. + + +File: nasm.info, Node: Section 2.2.2, Next: Section 2.2.3, Prev: Section 2.2.1, Up: Section 2.2 + +2.2.2. NASM Requires Square Brackets For Memory References +---------------------------------------------------------- + +NASM was designed with simplicity of syntax in mind. One of the design +goals of NASM is that it should be possible, as far as is practical, for +the user to look at a single line of NASM code and tell what opcode is +generated by it. You can't do this in MASM: if you declare, for example, + + foo equ 1 + bar dw 2 + + then the two lines of code + + mov ax,foo + mov ax,bar + + generate completely different opcodes, despite having +identical-looking syntaxes. + + NASM avoids this undesirable situation by having a much simpler +syntax for memory references. The rule is simply that any access to the +_contents_ of a memory location requires square brackets around the +address, and any access to the _address_ of a variable doesn't. So an +instruction of the form `mov ax,foo' will _always_ refer to a +compile-time constant, whether it's an `EQU' or the address of a +variable; and to access the _contents_ of the variable `bar', you must +code `mov ax,[bar]'. + + This also means that NASM has no need for MASM's `OFFSET' keyword, +since the MASM code `mov ax,offset bar' means exactly the same thing as +NASM's `mov ax,bar'. If you're trying to get large amounts of MASM code +to assemble sensibly under NASM, you can always code `%idefine offset' +to make the preprocessor treat the `OFFSET' keyword as a no-op. + + This issue is even more confusing in `a86', where declaring a label +with a trailing colon defines it to be a `label' as opposed to a +`variable' and causes `a86' to adopt NASM-style semantics; so in `a86', +`mov ax,var' has different behaviour depending on whether `var' was +declared as `var: dw 0' (a label) or `var dw 0' (a word-size variable). +NASM is very simple by comparison: _everything_ is a label. + + NASM, in the interests of simplicity, also does not support the +hybrid syntaxes supported by MASM and its clones, such as `mov +ax,table[bx]', where a memory reference is denoted by one portion +outside square brackets and another portion inside. The correct syntax +for the above is `mov ax,[table+bx]'. Likewise, `mov ax,es:[di]' is +wrong and `mov ax,[es:di]' is right. + + +File: nasm.info, Node: Section 2.2.3, Next: Section 2.2.4, Prev: Section 2.2.2, Up: Section 2.2 + +2.2.3. NASM Doesn't Store Variable Types +---------------------------------------- + +NASM, by design, chooses not to remember the types of variables you +declare. Whereas MASM will remember, on seeing `var dw 0', that you +declared `var' as a word-size variable, and will then be able to fill +in the ambiguity in the size of the instruction `mov var,2', NASM will +deliberately remember nothing about the symbol `var' except where it +begins, and so you must explicitly code `mov word [var],2'. + + For this reason, NASM doesn't support the `LODS', `MOVS', `STOS', +`SCAS', `CMPS', `INS', or `OUTS' instructions, but only supports the +forms such as `LODSB', `MOVSW', and `SCASD', which explicitly specify +the size of the components of the strings being manipulated. + + +File: nasm.info, Node: Section 2.2.4, Next: Section 2.2.5, Prev: Section 2.2.3, Up: Section 2.2 + +2.2.4. NASM Doesn't `ASSUME' +---------------------------- + +As part of NASM's drive for simplicity, it also does not support the +`ASSUME' directive. NASM will not keep track of what values you choose +to put in your segment registers, and will never _automatically_ +generate a segment override prefix. + + +File: nasm.info, Node: Section 2.2.5, Next: Section 2.2.6, Prev: Section 2.2.4, Up: Section 2.2 + +2.2.5. NASM Doesn't Support Memory Models +----------------------------------------- + +NASM also does not have any directives to support different 16-bit +memory models. The programmer has to keep track of which functions are +supposed to be called with a far call and which with a near call, and +is responsible for putting the correct form of `RET' instruction +(`RETN' or `RETF'; NASM accepts `RET' itself as an alternate form for +`RETN'); in addition, the programmer is responsible for coding CALL FAR +instructions where necessary when calling _external_ functions, and +must also keep track of which external variable definitions are far and +which are near. + + +File: nasm.info, Node: Section 2.2.6, Next: Section 2.2.7, Prev: Section 2.2.5, Up: Section 2.2 + +2.2.6. Floating-Point Differences +--------------------------------- + +NASM uses different names to refer to floating-point registers from +MASM: where MASM would call them `ST(0)', `ST(1)' and so on, and `a86' +would call them simply `0', `1' and so on, NASM chooses to call them +`st0', `st1' etc. + + As of version 0.96, NASM now treats the instructions with `nowait' +forms in the same way as MASM-compatible assemblers. The idiosyncratic +treatment employed by 0.95 and earlier was based on a misunderstanding +by the authors. + + +File: nasm.info, Node: Section 2.2.7, Next: Chapter 3, Prev: Section 2.2.6, Up: Section 2.2 + +2.2.7. Other Differences +------------------------ + +For historical reasons, NASM uses the keyword `TWORD' where MASM and +compatible assemblers use `TBYTE'. + + NASM does not declare uninitialized storage in the same way as MASM: +where a MASM programmer might use `stack db 64 dup (?)', NASM requires +`stack resb 64', intended to be read as `reserve 64 bytes'. For a +limited amount of compatibility, since NASM treats `?' as a valid +character in symbol names, you can code `? equ 0' and then writing `dw +?' will at least do something vaguely useful. `DUP' is still not a +supported syntax, however. + + In addition to all of this, macros and directives work completely +differently to MASM. See *note Chapter 4:: and *note Chapter 6:: for +further details. + + +File: nasm.info, Node: Chapter 3, Next: Section 3.1, Prev: Section 2.2.7, Up: Top + +Chapter 3: The NASM Language +**************************** + +* Menu: + +* Section 3.1:: Layout of a NASM Source Line +* Section 3.2:: Pseudo-Instructions +* Section 3.3:: Effective Addresses +* Section 3.4:: Constants +* Section 3.5:: Expressions +* Section 3.6:: `SEG' and `WRT' +* Section 3.7:: `STRICT': Inhibiting Optimization +* Section 3.8:: Critical Expressions +* Section 3.9:: Local Labels + + +File: nasm.info, Node: Section 3.1, Next: Section 3.2, Prev: Chapter 3, Up: Chapter 3 + +3.1. Layout of a NASM Source Line +================================= + +Like most assemblers, each NASM source line contains (unless it is a +macro, a preprocessor directive or an assembler directive: see *note +Chapter 4:: and *note Chapter 6::) some combination of the four fields + + label: instruction operands ; comment + + As usual, most of these fields are optional; the presence or absence +of any combination of a label, an instruction and a comment is allowed. +Of course, the operand field is either required or forbidden by the +presence and nature of the instruction field. + + NASM uses backslash (\) as the line continuation character; if a +line ends with backslash, the next line is considered to be a part of +the backslash- ended line. + + NASM places no restrictions on white space within a line: labels may +have white space before them, or instructions may have no space before +them, or anything. The colon after a label is also optional. (Note that +this means that if you intend to code `lodsb' alone on a line, and type +`lodab' by accident, then that's still a valid source line which does +nothing but define a label. Running NASM with the command-line option +`-w+orphan-labels' will cause it to warn you if you define a label +alone on a line without a trailing colon.) + + Valid characters in labels are letters, numbers, `_', `$', `#', `@', +`~', `.', and `?'. The only characters which may be used as the _first_ +character of an identifier are letters, `.' (with special meaning: see +*note Section 3.9::), `_' and `?'. An identifier may also be prefixed +with a `$' to indicate that it is intended to be read as an identifier +and not a reserved word; thus, if some other module you are linking +with defines a symbol called `eax', you can refer to `$eax' in NASM +code to distinguish the symbol from the register. Maximum length of an +identifier is 4095 characters. + + The instruction field may contain any machine instruction: Pentium +and P6 instructions, FPU instructions, MMX instructions and even +undocumented instructions are all supported. The instruction may be +prefixed by `LOCK', `REP', `REPE'/`REPZ' or `REPNE'/`REPNZ', in the +usual way. Explicit address-size and operand-size prefixes `A16', +`A32', `A64', `O16' and `O32', `O64' are provided - one example of +their use is given in *note Chapter 10::. You can also use the name of +a segment register as an instruction prefix: coding `es mov [bx],ax' is +equivalent to coding `mov [es:bx],ax'. We recommend the latter syntax, +since it is consistent with other syntactic features of the language, +but for instructions such as `LODSB', which has no operands and yet can +require a segment override, there is no clean syntactic way to proceed +apart from `es lodsb'. + + An instruction is not required to use a prefix: prefixes such as +`CS', `A32', `LOCK' or `REPE' can appear on a line by themselves, and +NASM will just generate the prefix bytes. + + In addition to actual machine instructions, NASM also supports a +number of pseudo-instructions, described in *note Section 3.2::. + + Instruction operands may take a number of forms: they can be +registers, described simply by the register name (e.g. `ax', `bp', +`ebx', `cr0': NASM does not use the `gas'-style syntax in which +register names must be prefixed by a `%' sign), or they can be +effective addresses (see *note Section 3.3::), constants (*note Section +3.4::) or expressions (*note Section 3.5::). + + For x87 floating-point instructions, NASM accepts a wide range of +syntaxes: you can use two-operand forms like MASM supports, or you can +use NASM's native single-operand forms in most cases. For example, you +can code: + + fadd st1 ; this sets st0 := st0 + st1 + fadd st0,st1 ; so does this + + fadd st1,st0 ; this sets st1 := st1 + st0 + fadd to st1 ; so does this + + Almost any x87 floating-point instruction that references memory +must use one of the prefixes `DWORD', `QWORD' or `TWORD' to indicate +what size of memory operand it refers to. + + +File: nasm.info, Node: Section 3.2, Next: Section 3.2.1, Prev: Section 3.1, Up: Chapter 3 + +3.2. Pseudo-Instructions +======================== + +Pseudo-instructions are things which, though not real x86 machine +instructions, are used in the instruction field anyway because that's +the most convenient place to put them. The current pseudo-instructions +are `DB', `DW', `DD', `DQ', `DT', `DO' and `DY'; their uninitialized +counterparts `RESB', `RESW', `RESD', `RESQ', `REST', `RESO' and `RESY'; +the `INCBIN' command, the `EQU' command, and the `TIMES' prefix. + +* Menu: + +* Section 3.2.1:: `DB' and Friends: Declaring Initialized Data +* Section 3.2.2:: `RESB' and Friends: Declaring Uninitialized Data +* Section 3.2.3:: `INCBIN': Including External Binary Files +* Section 3.2.4:: `EQU': Defining Constants +* Section 3.2.5:: `TIMES': Repeating Instructions or Data + + +File: nasm.info, Node: Section 3.2.1, Next: Section 3.2.2, Prev: Section 3.2, Up: Section 3.2 + +3.2.1. `DB' and Friends: Declaring Initialized Data +--------------------------------------------------- + +`DB', `DW', `DD', `DQ', `DT', `DO' and `DY' are used, much as in MASM, +to declare initialized data in the output file. They can be invoked in +a wide range of ways: + + db 0x55 ; just the byte 0x55 + db 0x55,0x56,0x57 ; three bytes in succession + db 'a',0x55 ; character constants are OK + db 'hello',13,10,'$' ; so are string constants + dw 0x1234 ; 0x34 0x12 + dw 'a' ; 0x61 0x00 (it's just a number) + dw 'ab' ; 0x61 0x62 (character constant) + dw 'abc' ; 0x61 0x62 0x63 0x00 (string) + dd 0x12345678 ; 0x78 0x56 0x34 0x12 + dd 1.234567e20 ; floating-point constant + dq 0x123456789abcdef0 ; eight byte constant + dq 1.234567e20 ; double-precision float + dt 1.234567e20 ; extended-precision float + + `DT', `DO' and `DY' do not accept numeric constants as operands. + + +File: nasm.info, Node: Section 3.2.2, Next: Section 3.2.3, Prev: Section 3.2.1, Up: Section 3.2 + +3.2.2. `RESB' and Friends: Declaring Uninitialized Data +------------------------------------------------------- + +`RESB', `RESW', `RESD', `RESQ', `REST', `RESO' and `RESY' are designed +to be used in the BSS section of a module: they declare _uninitialized_ +storage space. Each takes a single operand, which is the number of +bytes, words, doublewords or whatever to reserve. As stated in *note +Section 2.2.7::, NASM does not support the MASM/TASM syntax of +reserving uninitialized space by writing `DW ?' or similar things: this +is what it does instead. The operand to a `RESB'-type +pseudo-instruction is a _critical expression_: see *note Section 3.8::. + + For example: + + buffer: resb 64 ; reserve 64 bytes + wordvar: resw 1 ; reserve a word + realarray resq 10 ; array of ten reals + ymmval: resy 1 ; one YMM register + + +File: nasm.info, Node: Section 3.2.3, Next: Section 3.2.4, Prev: Section 3.2.2, Up: Section 3.2 + +3.2.3. `INCBIN': Including External Binary Files +------------------------------------------------ + +`INCBIN' is borrowed from the old Amiga assembler DevPac: it includes a +binary file verbatim into the output file. This can be handy for (for +example) including graphics and sound data directly into a game +executable file. It can be called in one of these three ways: + + incbin "file.dat" ; include the whole file + incbin "file.dat",1024 ; skip the first 1024 bytes + incbin "file.dat",1024,512 ; skip the first 1024, and + ; actually include at most 512 + + `INCBIN' is both a directive and a standard macro; the standard macro +version searches for the file in the include file search path and adds +the file to the dependency lists. This macro can be overridden if +desired. + + +File: nasm.info, Node: Section 3.2.4, Next: Section 3.2.5, Prev: Section 3.2.3, Up: Section 3.2 + +3.2.4. `EQU': Defining Constants +-------------------------------- + +`EQU' defines a symbol to a given constant value: when `EQU' is used, +the source line must contain a label. The action of `EQU' is to define +the given label name to the value of its (only) operand. This +definition is absolute, and cannot change later. So, for example, + + message db 'hello, world' + msglen equ $-message + + defines `msglen' to be the constant 12. `msglen' may not then be +redefined later. This is not a preprocessor definition either: the +value of `msglen' is evaluated _once_, using the value of `$' (see +*note Section 3.5:: for an explanation of `$') at the point of +definition, rather than being evaluated wherever it is referenced and +using the value of `$' at the point of reference. + + +File: nasm.info, Node: Section 3.2.5, Next: Section 3.3, Prev: Section 3.2.4, Up: Section 3.2 + +3.2.5. `TIMES': Repeating Instructions or Data +---------------------------------------------- + +The `TIMES' prefix causes the instruction to be assembled multiple +times. This is partly present as NASM's equivalent of the `DUP' syntax +supported by MASM-compatible assemblers, in that you can code + + zerobuf: times 64 db 0 + + or similar things; but `TIMES' is more versatile than that. The +argument to `TIMES' is not just a numeric constant, but a numeric +_expression_, so you can do things like + + buffer: db 'hello, world' + times 64-$+buffer db ' ' + + which will store exactly enough spaces to make the total length of +`buffer' up to 64. Finally, `TIMES' can be applied to ordinary +instructions, so you can code trivial unrolled loops in it: + + times 100 movsb + + Note that there is no effective difference between `times 100 resb 1' +and `resb 100', except that the latter will be assembled about 100 +times faster due to the internal structure of the assembler. + + The operand to `TIMES' is a critical expression (*note Section +3.8::). + + Note also that `TIMES' can't be applied to macros: the reason for +this is that `TIMES' is processed after the macro phase, which allows +the argument to `TIMES' to contain expressions such as `64-$+buffer' as +above. To repeat more than one line of code, or a complex macro, use the +preprocessor `%rep' directive. + + +File: nasm.info, Node: Section 3.3, Next: Section 3.4, Prev: Section 3.2.5, Up: Chapter 3 + +3.3. Effective Addresses +======================== + +An effective address is any operand to an instruction which references +memory. Effective addresses, in NASM, have a very simple syntax: they +consist of an expression evaluating to the desired address, enclosed in +square brackets. For example: + + wordvar dw 123 + mov ax,[wordvar] + mov ax,[wordvar+1] + mov ax,[es:wordvar+bx] + + Anything not conforming to this simple system is not a valid memory +reference in NASM, for example `es:wordvar[bx]'. + + More complicated effective addresses, such as those involving more +than one register, work in exactly the same way: + + mov eax,[ebx*2+ecx+offset] + mov ax,[bp+di+8] + + NASM is capable of doing algebra on these effective addresses, so +that things which don't necessarily _look_ legal are perfectly all +right: + + mov eax,[ebx*5] ; assembles as [ebx*4+ebx] + mov eax,[label1*2-label2] ; ie [label1+(label1-label2)] + + Some forms of effective address have more than one assembled form; +in most such cases NASM will generate the smallest form it can. For +example, there are distinct assembled forms for the 32-bit effective +addresses `[eax*2+0]' and `[eax+eax]', and NASM will generally generate +the latter on the grounds that the former requires four bytes to store +a zero offset. + + NASM has a hinting mechanism which will cause `[eax+ebx]' and +`[ebx+eax]' to generate different opcodes; this is occasionally useful +because `[esi+ebp]' and `[ebp+esi]' have different default segment +registers. + + However, you can force NASM to generate an effective address in a +particular form by the use of the keywords `BYTE', `WORD', `DWORD' and +`NOSPLIT'. If you need `[eax+3]' to be assembled using a double-word +offset field instead of the one byte NASM will normally generate, you +can code `[dword eax+3]'. Similarly, you can force NASM to use a byte +offset for a small value which it hasn't seen on the first pass (see +*note Section 3.8:: for an example of such a code fragment) by using +`[byte eax+offset]'. As special cases, `[byte eax]' will code `[eax+0]' +with a byte offset of zero, and `[dword eax]' will code it with a +double-word offset of zero. The normal form, `[eax]', will be coded +with no offset field. + + The form described in the previous paragraph is also useful if you +are trying to access data in a 32-bit segment from within 16 bit code. +For more information on this see the section on mixed-size addressing +(*note Section 10.2::). In particular, if you need to access data with +a known offset that is larger than will fit in a 16-bit value, if you +don't specify that it is a dword offset, nasm will cause the high word +of the offset to be lost. + + Similarly, NASM will split `[eax*2]' into `[eax+eax]' because that +allows the offset field to be absent and space to be saved; in fact, it +will also split `[eax*2+offset]' into `[eax+eax+offset]'. You can +combat this behaviour by the use of the `NOSPLIT' keyword: `[nosplit +eax*2]' will force `[eax*2+0]' to be generated literally. + + In 64-bit mode, NASM will by default generate absolute addresses. The +`REL' keyword makes it produce `RIP'-relative addresses. Since this is +frequently the normally desired behaviour, see the `DEFAULT' directive +(*note Section 6.2::). The keyword `ABS' overrides `REL'. + + +File: nasm.info, Node: Section 3.4, Next: Section 3.4.1, Prev: Section 3.3, Up: Chapter 3 + +3.4. Constants +============== + +NASM understands four different types of constant: numeric, character, +string and floating-point. + +* Menu: + +* Section 3.4.1:: Numeric Constants +* Section 3.4.2:: Character Strings +* Section 3.4.3:: Character Constants +* Section 3.4.4:: String Constants +* Section 3.4.5:: Unicode Strings +* Section 3.4.6:: Floating-Point Constants +* Section 3.4.7:: Packed BCD Constants + + +File: nasm.info, Node: Section 3.4.1, Next: Section 3.4.2, Prev: Section 3.4, Up: Section 3.4 + +3.4.1. Numeric Constants +------------------------ + +A numeric constant is simply a number. NASM allows you to specify +numbers in a variety of number bases, in a variety of ways: you can +suffix `H' or `X', `Q' or `O', and `B' for hexadecimal, octal and +binary respectively, or you can prefix `0x' for hexadecimal in the +style of C, or you can prefix `$' for hexadecimal in the style of +Borland Pascal. Note, though, that the `$' prefix does double duty as a +prefix on identifiers (see *note Section 3.1::), so a hex number +prefixed with a `$' sign must have a digit after the `$' rather than a +letter. In addition, current versions of NASM accept the prefix `0h' +for hexadecimal, `0o' or `0q' for octal, and `0b' for binary. Please +note that unlike C, a `0' prefix by itself does _not_ imply an octal +constant! + + Numeric constants can have underscores (`_') interspersed to break up +long strings. + + Some examples (all producing exactly the same code): + + mov ax,200 ; decimal + mov ax,0200 ; still decimal + mov ax,0200d ; explicitly decimal + mov ax,0d200 ; also decimal + mov ax,0c8h ; hex + mov ax,$0c8 ; hex again: the 0 is required + mov ax,0xc8 ; hex yet again + mov ax,0hc8 ; still hex + mov ax,310q ; octal + mov ax,310o ; octal again + mov ax,0o310 ; octal yet again + mov ax,0q310 ; hex yet again + mov ax,11001000b ; binary + mov ax,1100_1000b ; same binary constant + mov ax,0b1100_1000 ; same binary constant yet again + + +File: nasm.info, Node: Section 3.4.2, Next: Section 3.4.3, Prev: Section 3.4.1, Up: Section 3.4 + +3.4.2. Character Strings +------------------------ + +A character string consists of up to eight characters enclosed in either +single quotes (`'...''), double quotes (`"..."') or backquotes +(``...`'). Single or double quotes are equivalent to NASM (except of +course that surrounding the constant with single quotes allows double +quotes to appear within it and vice versa); the contents of those are +represented verbatim. Strings enclosed in backquotes support C-style +`\'-escapes for special characters. + + The following escape sequences are recognized by backquoted strings: + + \' single quote (') + \" double quote (") + \` backquote (`) + \\ backslash (\) + \? question mark (?) + \a BEL (ASCII 7) + \b BS (ASCII 8) + \t TAB (ASCII 9) + \n LF (ASCII 10) + \v VT (ASCII 11) + \f FF (ASCII 12) + \r CR (ASCII 13) + \e ESC (ASCII 27) + \377 Up to 3 octal digits - literal byte + \xFF Up to 2 hexadecimal digits - literal byte + \u1234 4 hexadecimal digits - Unicode character + \U12345678 8 hexadecimal digits - Unicode character + + All other escape sequences are reserved. Note that `\0', meaning a +`NUL' character (ASCII 0), is a special case of the octal escape +sequence. + + Unicode characters specified with `\u' or `\U' are converted to +UTF-8. For example, the following lines are all equivalent: + + db `\u263a` ; UTF-8 smiley face + db `\xe2\x98\xba` ; UTF-8 smiley face + db 0E2h, 098h, 0BAh ; UTF-8 smiley face + + +File: nasm.info, Node: Section 3.4.3, Next: Section 3.4.4, Prev: Section 3.4.2, Up: Section 3.4 + +3.4.3. Character Constants +-------------------------- + +A character constant consists of a string up to eight bytes long, used +in an expression context. It is treated as if it was an integer. + + A character constant with more than one byte will be arranged with +little-endian order in mind: if you code + + mov eax,'abcd' + + then the constant generated is not `0x61626364', but `0x64636261', +so that if you were then to store the value into memory, it would read +`abcd' rather than `dcba'. This is also the sense of character +constants understood by the Pentium's `CPUID' instruction. + + +File: nasm.info, Node: Section 3.4.4, Next: Section 3.4.5, Prev: Section 3.4.3, Up: Section 3.4 + +3.4.4. String Constants +----------------------- + +String constants are character strings used in the context of some +pseudo- instructions, namely the `DB' family and `INCBIN' (where it +represents a filename.) They are also used in certain preprocessor +directives. + + A string constant looks like a character constant, only longer. It is +treated as a concatenation of maximum-size character constants for the +conditions. So the following are equivalent: + + db 'hello' ; string constant + db 'h','e','l','l','o' ; equivalent character constants + + And the following are also equivalent: + + dd 'ninechars' ; doubleword string constant + dd 'nine','char','s' ; becomes three doublewords + db 'ninechars',0,0,0 ; and really looks like this + + Note that when used in a string-supporting context, quoted strings +are treated as a string constants even if they are short enough to be a +character constant, because otherwise `db 'ab'' would have the same +effect as `db 'a'', which would be silly. Similarly, three-character or +four-character constants are treated as strings when they are operands +to `DW', and so forth. + + +File: nasm.info, Node: Section 3.4.5, Next: Section 3.4.6, Prev: Section 3.4.4, Up: Section 3.4 + +3.4.5. Unicode Strings +---------------------- + +The special operators `__utf16__' and `__utf32__' allows definition of +Unicode strings. They take a string in UTF-8 format and converts it to +(littleendian) UTF-16 or UTF-32, respectively. + + For example: + + %define u(x) __utf16__(x) + %define w(x) __utf32__(x) + + dw u('C:\WINDOWS'), 0 ; Pathname in UTF-16 + dd w(`A + B = \u206a`), 0 ; String in UTF-32 + + `__utf16__' and `__utf32__' can be applied either to strings passed +to the `DB' family instructions, or to character constants in an +expression context. + + +File: nasm.info, Node: Section 3.4.6, Next: Section 3.4.7, Prev: Section 3.4.5, Up: Section 3.4 + +3.4.6. Floating-Point Constants +------------------------------- + +Floating-point constants are acceptable only as arguments to `DB', +`DW', `DD', `DQ', `DT', and `DO', or as arguments to the special +operators `__float8__', `__float16__', `__float32__', `__float64__', +`__float80m__', `__float80e__', `__float128l__', and `__float128h__'. + + Floating-point constants are expressed in the traditional form: +digits, then a period, then optionally more digits, then optionally an +`E' followed by an exponent. The period is mandatory, so that NASM can +distinguish between `dd 1', which declares an integer constant, and `dd +1.0' which declares a floating-point constant. NASM also support +C99-style hexadecimal floating-point: `0x', hexadecimal digits, period, +optionally more hexadeximal digits, then optionally a `P' followed by a +_binary_ (not hexadecimal) exponent in decimal notation. + + Underscores to break up groups of digits are permitted in +floating-point constants as well. + + Some examples: + + db -0.2 ; "Quarter precision" + dw -0.5 ; IEEE 754r/SSE5 half precision + dd 1.2 ; an easy one + dd 1.222_222_222 ; underscores are permitted + dd 0x1p+2 ; 1.0x2^2 = 4.0 + dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0 + dq 1.e10 ; 10 000 000 000.0 + dq 1.e+10 ; synonymous with 1.e10 + dq 1.e-10 ; 0.000 000 000 1 + dt 3.141592653589793238462 ; pi + do 1.e+4000 ; IEEE 754r quad precision + + The 8-bit "quarter-precision" floating-point format is +sign:exponent:mantissa = 1:4:3 with an exponent bias of 7. This appears +to be the most frequently used 8-bit floating-point format, although it +is not covered by any formal standard. This is sometimes called a +"minifloat." + + The special operators are used to produce floating-point numbers in +other contexts. They produce the binary representation of a specific +floating- point number as an integer, and can use anywhere integer +constants are used in an expression. `__float80m__' and `__float80e__' +produce the 64-bit mantissa and 16-bit exponent of an 80-bit +floating-point number, and `__float128l__' and `__float128h__' produce +the lower and upper 64-bit halves of a 128-bit floating-point number, +respectively. + + For example: + + mov rax,__float64__(3.141592653589793238462) + + ... would assign the binary representation of pi as a 64-bit +floating point number into `RAX'. This is exactly equivalent to: + + mov rax,0x400921fb54442d18 + + NASM cannot do compile-time arithmetic on floating-point constants. +This is because NASM is designed to be portable - although it always +generates code to run on x86 processors, the assembler itself can run +on any system with an ANSI C compiler. Therefore, the assembler cannot +guarantee the presence of a floating-point unit capable of handling the +Intel number formats, and so for NASM to be able to do floating +arithmetic it would have to include its own complete set of +floating-point routines, which would significantly increase the size of +the assembler for very little benefit. + + The special tokens `__Infinity__', `__QNaN__' (or `__NaN__') and +`__SNaN__' can be used to generate infinities, quiet NaNs, and +signalling NaNs, respectively. These are normally used as macros: + + %define Inf __Infinity__ + %define NaN __QNaN__ + + dq +1.5, -Inf, NaN ; Double-precision constants + + +File: nasm.info, Node: Section 3.4.7, Next: Section 3.5, Prev: Section 3.4.6, Up: Section 3.4 + +3.4.7. Packed BCD Constants +--------------------------- + +x87-style packed BCD constants can be used in the same contexts as +80-bit floating-point numbers. They are suffixed with `p' or prefixed +with `0p', and can include up to 18 decimal digits. + + As with other numeric constants, underscores can be used to separate +digits. + + For example: + + dt 12_345_678_901_245_678p + dt -12_345_678_901_245_678p + dt +0p33 + dt 33p + + +File: nasm.info, Node: Section 3.5, Next: Section 3.5.1, Prev: Section 3.4.7, Up: Chapter 3 + +3.5. Expressions +================ + +Expressions in NASM are similar in syntax to those in C. Expressions are +evaluated as 64-bit integers which are then adjusted to the appropriate +size. + + NASM supports two special tokens in expressions, allowing +calculations to involve the current assembly position: the `$' and `$$' +tokens. `$' evaluates to the assembly position at the beginning of the +line containing the expression; so you can code an infinite loop using +`JMP $'. `$$' evaluates to the beginning of the current section; so you +can tell how far into the section you are by using `($-$$)'. + + The arithmetic operators provided by NASM are listed here, in +increasing order of precedence. + +* Menu: + +* Section 3.5.1:: `|': Bitwise OR Operator +* Section 3.5.2:: `^': Bitwise XOR Operator +* Section 3.5.3:: `&': Bitwise AND Operator +* Section 3.5.4:: `<<' and `>>': Bit Shift Operators +* Section 3.5.5:: `+' and `-': Addition and Subtraction Operators +* Section 3.5.6:: `*', `/', `//', `%' and `%%': Multiplication and Division +* Section 3.5.7:: Unary Operators: `+', `-', `~', `!' and `SEG' + + +File: nasm.info, Node: Section 3.5.1, Next: Section 3.5.2, Prev: Section 3.5, Up: Section 3.5 + +3.5.1. `|': Bitwise OR Operator +------------------------------- + +The `|' operator gives a bitwise OR, exactly as performed by the `OR' +machine instruction. Bitwise OR is the lowest-priority arithmetic +operator supported by NASM. + + +File: nasm.info, Node: Section 3.5.2, Next: Section 3.5.3, Prev: Section 3.5.1, Up: Section 3.5 + +3.5.2. `^': Bitwise XOR Operator +-------------------------------- + +`^' provides the bitwise XOR operation. + + +File: nasm.info, Node: Section 3.5.3, Next: Section 3.5.4, Prev: Section 3.5.2, Up: Section 3.5 + +3.5.3. `&': Bitwise AND Operator +-------------------------------- + +`&' provides the bitwise AND operation. + + +File: nasm.info, Node: Section 3.5.4, Next: Section 3.5.5, Prev: Section 3.5.3, Up: Section 3.5 + +3.5.4. `<<' and `>>': Bit Shift Operators +----------------------------------------- + +`<<' gives a bit-shift to the left, just as it does in C. So `5<<3' +evaluates to 5 times 8, or 40. `>>' gives a bit-shift to the right; in +NASM, such a shift is _always_ unsigned, so that the bits shifted in +from the left-hand end are filled with zero rather than a +sign-extension of the previous highest bit. + + +File: nasm.info, Node: Section 3.5.5, Next: Section 3.5.6, Prev: Section 3.5.4, Up: Section 3.5 + +3.5.5. `+' and `-': Addition and Subtraction Operators +------------------------------------------------------ + +The `+' and `-' operators do perfectly ordinary addition and +subtraction. + + +File: nasm.info, Node: Section 3.5.6, Next: Section 3.5.7, Prev: Section 3.5.5, Up: Section 3.5 + +3.5.6. `*', `/', `//', `%' and `%%': Multiplication and Division +---------------------------------------------------------------- + +`*' is the multiplication operator. `/' and `//' are both division +operators: `/' is unsigned division and `//' is signed division. +Similarly, `%' and `%%' provide unsigned and signed modulo operators +respectively. + + NASM, like ANSI C, provides no guarantees about the sensible +operation of the signed modulo operator. + + Since the `%' character is used extensively by the macro +preprocessor, you should ensure that both the signed and unsigned +modulo operators are followed by white space wherever they appear. + + +File: nasm.info, Node: Section 3.5.7, Next: Section 3.6, Prev: Section 3.5.6, Up: Section 3.5 + +3.5.7. Unary Operators: `+', `-', `~', `!' and `SEG' +---------------------------------------------------- + +The highest-priority operators in NASM's expression grammar are those +which only apply to one argument. `-' negates its operand, `+' does +nothing (it's provided for symmetry with `-'), `~' computes the one's +complement of its operand, `!' is the logical negation operator, and +`SEG' provides the segment address of its operand (explained in more +detail in *note Section 3.6::). + + +File: nasm.info, Node: Section 3.6, Next: Section 3.7, Prev: Section 3.5.7, Up: Chapter 3 + +3.6. `SEG' and `WRT' +==================== + +When writing large 16-bit programs, which must be split into multiple +segments, it is often necessary to be able to refer to the segment part +of the address of a symbol. NASM supports the `SEG' operator to perform +this function. + + The `SEG' operator returns the _preferred_ segment base of a symbol, +defined as the segment base relative to which the offset of the symbol +makes sense. So the code + + mov ax,seg symbol + mov es,ax + mov bx,symbol + + will load `ES:BX' with a valid pointer to the symbol `symbol'. + + Things can be more complex than this: since 16-bit segments and +groups may overlap, you might occasionally want to refer to some symbol +using a different segment base from the preferred one. NASM lets you do +this, by the use of the `WRT' (With Reference To) keyword. So you can +do things like + + mov ax,weird_seg ; weird_seg is a segment base + mov es,ax + mov bx,symbol wrt weird_seg + + to load `ES:BX' with a different, but functionally equivalent, +pointer to the symbol `symbol'. + + NASM supports far (inter-segment) calls and jumps by means of the +syntax `call segment:offset', where `segment' and `offset' both +represent immediate values. So to call a far procedure, you could code +either of + + call (seg procedure):procedure + call weird_seg:(procedure wrt weird_seg) + + (The parentheses are included for clarity, to show the intended +parsing of the above instructions. They are not necessary in practice.) + + NASM supports the syntax `call far procedure' as a synonym for the +first of the above usages. `JMP' works identically to `CALL' in these +examples. + + To declare a far pointer to a data item in a data segment, you must +code + + dw symbol, seg symbol + + NASM supports no convenient synonym for this, though you can always +invent one using the macro processor. + + +File: nasm.info, Node: Section 3.7, Next: Section 3.8, Prev: Section 3.6, Up: Chapter 3 + +3.7. `STRICT': Inhibiting Optimization +====================================== + +When assembling with the optimizer set to level 2 or higher (see *note +Section 2.1.22::), NASM will use size specifiers (`BYTE', `WORD', +`DWORD', `QWORD', `TWORD', `OWORD' or `YWORD'), but will give them the +smallest possible size. The keyword `STRICT' can be used to inhibit +optimization and force a particular operand to be emitted in the +specified size. For example, with the optimizer on, and in `BITS 16' +mode, + + push dword 33 + + is encoded in three bytes `66 6A 21', whereas + + push strict dword 33 + + is encoded in six bytes, with a full dword immediate operand `66 68 +21 00 00 00'. + + With the optimizer off, the same code (six bytes) is generated +whether the `STRICT' keyword was used or not. + + +File: nasm.info, Node: Section 3.8, Next: Section 3.9, Prev: Section 3.7, Up: Chapter 3 + +3.8. Critical Expressions +========================= + +Although NASM has an optional multi-pass optimizer, there are some +expressions which must be resolvable on the first pass. These are called +_Critical Expressions_. + + The first pass is used to determine the size of all the assembled +code and data, so that the second pass, when generating all the code, +knows all the symbol addresses the code refers to. So one thing NASM +can't handle is code whose size depends on the value of a symbol +declared after the code in question. For example, + + times (label-$) db 0 + label: db 'Where am I?' + + The argument to `TIMES' in this case could equally legally evaluate +to anything at all; NASM will reject this example because it cannot +tell the size of the `TIMES' line when it first sees it. It will just +as firmly reject the slightly paradoxical code + + times (label-$+1) db 0 + label: db 'NOW where am I?' + + in which _any_ value for the `TIMES' argument is by definition wrong! + + NASM rejects these examples by means of a concept called a _critical +expression_, which is defined to be an expression whose value is +required to be computable in the first pass, and which must therefore +depend only on symbols defined before it. The argument to the `TIMES' +prefix is a critical expression. + + +File: nasm.info, Node: Section 3.9, Next: Chapter 4, Prev: Section 3.8, Up: Chapter 3 + +3.9. Local Labels +================= + +NASM gives special treatment to symbols beginning with a period. A label +beginning with a single period is treated as a _local_ label, which +means that it is associated with the previous non-local label. So, for +example: + + label1 ; some code + + .loop + ; some more code + + jne .loop + ret + + label2 ; some code + + .loop + ; some more code + + jne .loop + ret + + In the above code fragment, each `JNE' instruction jumps to the line +immediately before it, because the two definitions of `.loop' are kept +separate by virtue of each being associated with the previous non-local +label. + + This form of local label handling is borrowed from the old Amiga +assembler DevPac; however, NASM goes one step further, in allowing +access to local labels from other parts of the code. This is achieved +by means of _defining_ a local label in terms of the previous non-local +label: the first definition of `.loop' above is really defining a +symbol called `label1.loop', and the second defines a symbol called +`label2.loop'. So, if you really needed to, you could write + + label3 ; some more code + ; and some more + + jmp label1.loop + + Sometimes it is useful - in a macro, for instance - to be able to +define a label which can be referenced from anywhere but which doesn't +interfere with the normal local-label mechanism. Such a label can't be +non-local because it would interfere with subsequent definitions of, +and references to, local labels; and it can't be local because the +macro that defined it wouldn't know the label's full name. NASM +therefore introduces a third type of label, which is probably only +useful in macro definitions: if a label begins with the special prefix +`..@', then it does nothing to the local label mechanism. So you could +code + + label1: ; a non-local label + .local: ; this is really label1.local + ..@foo: ; this is a special symbol + label2: ; another non-local label + .local: ; this is really label2.local + + jmp ..@foo ; this will jump three lines up + + NASM has the capacity to define other special symbols beginning with +a double period: for example, `..start' is used to specify the entry +point in the `obj' output format (see *note Section 7.4.6::). + + +File: nasm.info, Node: Chapter 4, Next: Section 4.1, Prev: Section 3.9, Up: Top + +Chapter 4: The NASM Preprocessor +******************************** + +NASM contains a powerful macro processor, which supports conditional +assembly, multi-level file inclusion, two forms of macro (single-line +and multi-line), and a `context stack' mechanism for extra macro power. +Preprocessor directives all begin with a `%' sign. + + The preprocessor collapses all lines which end with a backslash (\) +character into a single line. Thus: + + %define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \ + THIS_VALUE + + will work like a single-line macro without the backslash-newline +sequence. + +* Menu: + +* Section 4.1:: Single-Line Macros +* Section 4.2:: String Manipulation in Macros +* Section 4.3:: Multi-Line Macros: `%macro' +* Section 4.4:: Conditional Assembly +* Section 4.5:: Preprocessor Loops: `%rep' +* Section 4.6:: Source Files and Dependencies +* Section 4.7:: The Context Stack +* Section 4.8:: Stack Relative Preprocessor Directives +* Section 4.9:: Reporting User-Defined Errors: `%error', `%warning', `%fatal' +* Section 4.10:: Other Preprocessor Directives +* Section 4.11:: Standard Macros + + +File: nasm.info, Node: Section 4.1, Next: Section 4.1.1, Prev: Chapter 4, Up: Chapter 4 + +4.1. Single-Line Macros +======================= + +* Menu: + +* Section 4.1.1:: The Normal Way: `%define' +* Section 4.1.2:: Resolving `%define': `%xdefine' +* Section 4.1.3:: Macro Indirection: `%[...]' +* Section 4.1.4:: Concatenating Single Line Macro Tokens: `%+' +* Section 4.1.5:: The Macro Name Itself: `%?' and `%??' +* Section 4.1.6:: Undefining Single-Line Macros: `%undef' +* Section 4.1.7:: Preprocessor Variables: `%assign' +* Section 4.1.8:: Defining Strings: `%defstr' +* Section 4.1.9:: Defining Tokens: `%deftok' + + +File: nasm.info, Node: Section 4.1.1, Next: Section 4.1.2, Prev: Section 4.1, Up: Section 4.1 + +4.1.1. The Normal Way: `%define' +-------------------------------- + +Single-line macros are defined using the `%define' preprocessor +directive. The definitions work in a similar way to C; so you can do +things like + + %define ctrl 0x1F & + %define param(a,b) ((a)+(a)*(b)) + + mov byte [param(2,ebx)], ctrl 'D' + + which will expand to + + mov byte [(2)+(2)*(ebx)], 0x1F & 'D' + + When the expansion of a single-line macro contains tokens which +invoke another macro, the expansion is performed at invocation time, +not at definition time. Thus the code + + %define a(x) 1+b(x) + %define b(x) 2*x + + mov ax,a(8) + + will evaluate in the expected way to `mov ax,1+2*8', even though the +macro `b' wasn't defined at the time of definition of `a'. + + Macros defined with `%define' are case sensitive: after `%define foo +bar', only `foo' will expand to `bar': `Foo' or `FOO' will not. By +using `%idefine' instead of `%define' (the `i' stands for +`insensitive') you can define all the case variants of a macro at once, +so that `%idefine foo bar' would cause `foo', `Foo', `FOO', `fOO' and +so on all to expand to `bar'. + + There is a mechanism which detects when a macro call has occurred as +a result of a previous expansion of the same macro, to guard against +circular references and infinite loops. If this happens, the +preprocessor will only expand the first occurrence of the macro. Hence, +if you code + + %define a(x) 1+a(x) + + mov ax,a(3) + + the macro `a(3)' will expand once, becoming `1+a(3)', and will then +expand no further. This behaviour can be useful: see *note Section 9.1:: +for an example of its use. + + You can overload single-line macros: if you write + + %define foo(x) 1+x + %define foo(x,y) 1+x*y + + the preprocessor will be able to handle both types of macro call, by +counting the parameters you pass; so `foo(3)' will become `1+3' whereas +`foo(ebx,2)' will become `1+ebx*2'. However, if you define + + %define foo bar + + then no other definition of `foo' will be accepted: a macro with no +parameters prohibits the definition of the same name as a macro _with_ +parameters, and vice versa. + + This doesn't prevent single-line macros being _redefined_: you can +perfectly well define a macro with + + %define foo bar + + and then re-define it later in the same source file with + + %define foo baz + + Then everywhere the macro `foo' is invoked, it will be expanded +according to the most recent definition. This is particularly useful +when defining single-line macros with `%assign' (see *note Section +4.1.7::). + + You can pre-define single-line macros using the `-d' option on the +NASM command line: see *note Section 2.1.18::. + + +File: nasm.info, Node: Section 4.1.2, Next: Section 4.1.3, Prev: Section 4.1.1, Up: Section 4.1 + +4.1.2. Resolving `%define': `%xdefine' +-------------------------------------- + +To have a reference to an embedded single-line macro resolved at the +time that the embedding macro is _defined_, as opposed to when the +embedding macro is _expanded_, you need a different mechanism to the +one offered by `%define'. The solution is to use `%xdefine', or it's +case-insensitive counterpart `%ixdefine'. + + Suppose you have the following code: + + %define isTrue 1 + %define isFalse isTrue + %define isTrue 0 + + val1: db isFalse + + %define isTrue 1 + + val2: db isFalse + + In this case, `val1' is equal to 0, and `val2' is equal to 1. This +is because, when a single-line macro is defined using `%define', it is +expanded only when it is called. As `isFalse' expands to `isTrue', the +expansion will be the current value of `isTrue'. The first time it is +called that is 0, and the second time it is 1. + + If you wanted `isFalse' to expand to the value assigned to the +embedded macro `isTrue' at the time that `isFalse' was defined, you +need to change the above code to use `%xdefine'. + + %xdefine isTrue 1 + %xdefine isFalse isTrue + %xdefine isTrue 0 + + val1: db isFalse + + %xdefine isTrue 1 + + val2: db isFalse + + Now, each time that `isFalse' is called, it expands to 1, as that is +what the embedded macro `isTrue' expanded to at the time that `isFalse' +was defined. + + +File: nasm.info, Node: Section 4.1.3, Next: Section 4.1.4, Prev: Section 4.1.2, Up: Section 4.1 + +4.1.3. Macro Indirection: `%[...]' +---------------------------------- + +The `%[...]' construct can be used to expand macros in contexts where +macro expansion would otherwise not occur, including in the names other +macros. For example, if you have a set of macros named `Foo16', `Foo32' +and `Foo64', you could write: + + mov ax,Foo%[__BITS__] ; The Foo value + + to use the builtin macro `__BITS__' (see *note Section 4.11.5::) to +automatically select between them. Similarly, the two statements: + + %xdefine Bar Quux ; Expands due to %xdefine + %define Bar %[Quux] ; Expands due to %[...] + + have, in fact, exactly the same effect. + + `%[...]' concatenates to adjacent tokens in the same way that multi- +line macro parameters do, see *note Section 4.3.8:: for details. + + +File: nasm.info, Node: Section 4.1.4, Next: Section 4.1.5, Prev: Section 4.1.3, Up: Section 4.1 + +4.1.4. Concatenating Single Line Macro Tokens: `%+' +--------------------------------------------------- + +Individual tokens in single line macros can be concatenated, to produce +longer tokens for later processing. This can be useful if there are +several similar macros that perform similar functions. + + Please note that a space is required after `%+', in order to +disambiguate it from the syntax `%+1' used in multiline macros. + + As an example, consider the following: + + %define BDASTART 400h ; Start of BIOS data area + + struc tBIOSDA ; its structure + .COM1addr RESW 1 + .COM2addr RESW 1 + ; ..and so on + endstruc + + Now, if we need to access the elements of tBIOSDA in different +places, we can end up with: + + mov ax,BDASTART + tBIOSDA.COM1addr + mov bx,BDASTART + tBIOSDA.COM2addr + + This will become pretty ugly (and tedious) if used in many places, +and can be reduced in size significantly by using the following macro: + + ; Macro to access BIOS variables by their names (from tBDA): + + %define BDA(x) BDASTART + tBIOSDA. %+ x + + Now the above code can be written as: + + mov ax,BDA(COM1addr) + mov bx,BDA(COM2addr) + + Using this feature, we can simplify references to a lot of macros +(and, in turn, reduce typing errors). + + +File: nasm.info, Node: Section 4.1.5, Next: Section 4.1.6, Prev: Section 4.1.4, Up: Section 4.1 + +4.1.5. The Macro Name Itself: `%?' and `%??' +-------------------------------------------- + +The special symbols `%?' and `%??' can be used to reference the macro +name itself inside a macro expansion, this is supported for both +single-and multi-line macros. `%?' refers to the macro name as +_invoked_, whereas `%??' refers to the macro name as _declared_. The +two are always the same for case-sensitive macros, but for +case-insensitive macros, they can differ. + + For example: + + %idefine Foo mov %?,%?? + + foo + FOO + + will expand to: + + mov foo,Foo + mov FOO,Foo + + The sequence: + + %idefine keyword $%? + + can be used to make a keyword "disappear", for example in case a new +instruction has been used as a label in older code. For example: + + %idefine pause $%? ; Hide the PAUSE instruction + + +File: nasm.info, Node: Section 4.1.6, Next: Section 4.1.7, Prev: Section 4.1.5, Up: Section 4.1 + +4.1.6. Undefining Single-Line Macros: `%undef' +---------------------------------------------- + +Single-line macros can be removed with the `%undef' directive. For +example, the following sequence: + + %define foo bar + %undef foo + + mov eax, foo + + will expand to the instruction `mov eax, foo', since after `%undef' +the macro `foo' is no longer defined. + + Macros that would otherwise be pre-defined can be undefined on the +command- line using the `-u' option on the NASM command line: see *note +Section 2.1.19::. + + +File: nasm.info, Node: Section 4.1.7, Next: Section 4.1.8, Prev: Section 4.1.6, Up: Section 4.1 + +4.1.7. Preprocessor Variables: `%assign' +---------------------------------------- + +An alternative way to define single-line macros is by means of the +`%assign' command (and its case-insensitive counterpart `%iassign', +which differs from `%assign' in exactly the same way that `%idefine' +differs from `%define'). + + `%assign' is used to define single-line macros which take no +parameters and have a numeric value. This value can be specified in the +form of an expression, and it will be evaluated once, when the +`%assign' directive is processed. + + Like `%define', macros defined using `%assign' can be re-defined +later, so you can do things like + + %assign i i+1 + + to increment the numeric value of a macro. + + `%assign' is useful for controlling the termination of `%rep' +preprocessor loops: see *note Section 4.5:: for an example of this. +Another use for `%assign' is given in *note Section 8.4:: and *note +Section 9.1::. + + The expression passed to `%assign' is a critical expression (see +*note Section 3.8::), and must also evaluate to a pure number (rather +than a relocatable reference such as a code or data address, or +anything involving a register). + + +File: nasm.info, Node: Section 4.1.8, Next: Section 4.1.9, Prev: Section 4.1.7, Up: Section 4.1 + +4.1.8. Defining Strings: `%defstr' +---------------------------------- + +`%defstr', and its case-insensitive counterpart `%idefstr', define or +redefine a single-line macro without parameters but converts the entire +right-hand side, after macro expansion, to a quoted string before +definition. + + For example: + + %defstr test TEST + + is equivalent to + + %define test 'TEST' + + This can be used, for example, with the `%!' construct (see *note +Section 4.10.2::): + + %defstr PATH %!PATH ; The operating system PATH variable + + +File: nasm.info, Node: Section 4.1.9, Next: Section 4.2, Prev: Section 4.1.8, Up: Section 4.1 + +4.1.9. Defining Tokens: `%deftok' +--------------------------------- + +`%deftok', and its case-insensitive counterpart `%ideftok', define or +redefine a single-line macro without parameters but converts the second +parameter, after string conversion, to a sequence of tokens. + + For example: + + %deftok test 'TEST' + + is equivalent to + + %define test TEST + + +File: nasm.info, Node: Section 4.2, Next: Section 4.2.1, Prev: Section 4.1.9, Up: Chapter 4 + +4.2. String Manipulation in Macros +================================== + +It's often useful to be able to handle strings in macros. NASM supports +a few simple string handling macro operators from which more complex +operations can be constructed. + + All the string operators define or redefine a value (either a string +or a numeric value) to a single-line macro. When producing a string +value, it may change the style of quoting of the input string or +strings, and possibly use `\'-escapes inside ``'-quoted strings. + +* Menu: + +* Section 4.2.1:: Concatenating Strings: `%strcat' +* Section 4.2.2:: String Length: `%strlen' +* Section 4.2.3:: Extracting Substrings: `%substr' + + +File: nasm.info, Node: Section 4.2.1, Next: Section 4.2.2, Prev: Section 4.2, Up: Section 4.2 + +4.2.1. Concatenating Strings: `%strcat' +--------------------------------------- + +The `%strcat' operator concatenates quoted strings and assign them to a +single-line macro. + + For example: + + %strcat alpha "Alpha: ", '12" screen' + + ... would assign the value `'Alpha: 12" screen'' to `alpha'. +Similarly: + + %strcat beta '"foo"\', "'bar'" + + ... would assign the value ``"foo"\\'bar'`' to `beta'. + + The use of commas to separate strings is permitted but optional. + + +File: nasm.info, Node: Section 4.2.2, Next: Section 4.2.3, Prev: Section 4.2.1, Up: Section 4.2 + +4.2.2. String Length: `%strlen' +------------------------------- + +The `%strlen' operator assigns the length of a string to a macro. For +example: + + %strlen charcnt 'my string' + + In this example, `charcnt' would receive the value 9, just as if an +`%assign' had been used. In this example, `'my string'' was a literal +string but it could also have been a single-line macro that expands to +a string, as in the following example: + + %define sometext 'my string' + %strlen charcnt sometext + + As in the first case, this would result in `charcnt' being assigned +the value of 9. + + +File: nasm.info, Node: Section 4.2.3, Next: Section 4.3, Prev: Section 4.2.2, Up: Section 4.2 + +4.2.3. Extracting Substrings: `%substr' +--------------------------------------- + +Individual letters or substrings in strings can be extracted using the +`%substr' operator. An example of its use is probably more useful than +the description: + + %substr mychar 'xyzw' 1 ; equivalent to %define mychar 'x' + %substr mychar 'xyzw' 2 ; equivalent to %define mychar 'y' + %substr mychar 'xyzw' 3 ; equivalent to %define mychar 'z' + %substr mychar 'xyzw' 2,2 ; equivalent to %define mychar 'yz' + %substr mychar 'xyzw' 2,-1 ; equivalent to %define mychar 'yzw' + %substr mychar 'xyzw' 2,-2 ; equivalent to %define mychar 'yz' + + As with `%strlen' (see *note Section 4.2.2::), the first parameter is +the single-line macro to be created and the second is the string. The +third parameter specifies the first character to be selected, and the +optional fourth parameter preceeded by comma) is the length. Note that +the first index is 1, not 0 and the last index is equal to the value +that `%strlen' would assign given the same string. Index values out of +range result in an empty string. A negative length means "until N-1 +characters before the end of string", i.e. `-1' means until end of +string, `-2' until one character before, etc. + + +File: nasm.info, Node: Section 4.3, Next: Section 4.3.1, Prev: Section 4.2.3, Up: Chapter 4 + +4.3. Multi-Line Macros: `%macro' +================================ + +Multi-line macros are much more like the type of macro seen in MASM and +TASM: a multi-line macro definition in NASM looks something like this. + + %macro prologue 1 + + push ebp + mov ebp,esp + sub esp,%1 + + %endmacro + + This defines a C-like function prologue as a macro: so you would +invoke the macro with a call such as + + myfunc: prologue 12 + + which would expand to the three lines of code + + myfunc: push ebp + mov ebp,esp + sub esp,12 + + The number `1' after the macro name in the `%macro' line defines the +number of parameters the macro `prologue' expects to receive. The use +of `%1' inside the macro definition refers to the first parameter to +the macro call. With a macro taking more than one parameter, subsequent +parameters would be referred to as `%2', `%3' and so on. + + Multi-line macros, like single-line macros, are case-sensitive, +unless you define them using the alternative directive `%imacro'. + + If you need to pass a comma as _part_ of a parameter to a multi-line +macro, you can do that by enclosing the entire parameter in braces. So +you could code things like + + %macro silly 2 + + %2: db %1 + + %endmacro + + silly 'a', letter_a ; letter_a: db 'a' + silly 'ab', string_ab ; string_ab: db 'ab' + silly {13,10}, crlf ; crlf: db 13,10 + +* Menu: + +* Section 4.3.1:: Recursive Multi-Line Macros: `%rmacro' +* Section 4.3.2:: Overloading Multi-Line Macros +* Section 4.3.3:: Macro-Local Labels +* Section 4.3.4:: Greedy Macro Parameters +* Section 4.3.5:: Default Macro Parameters +* Section 4.3.6:: `%0': Macro Parameter Counter +* Section 4.3.7:: `%rotate': Rotating Macro Parameters +* Section 4.3.8:: Concatenating Macro Parameters +* Section 4.3.9:: Condition Codes as Macro Parameters +* Section 4.3.10:: Disabling Listing Expansion +* Section 4.3.11:: Undefining Multi-Line Macros: `%unmacro' +* Section 4.3.12:: Exiting Multi-Line Macros: `%exitmacro' + + +File: nasm.info, Node: Section 4.3.1, Next: Section 4.3.2, Prev: Section 4.3, Up: Section 4.3 + +4.3.1. Recursive Multi-Line Macros: `%rmacro' +--------------------------------------------- + +A multi-line macro cannot be referenced within itself, in order to +prevent accidental infinite recursion. + + Recursive multi-line macros allow for self-referencing, with the +caveat that the user is aware of the existence, use and purpose of +recursive multi-line macros. There is also a generous, but sane, upper +limit to the number of recursions, in order to prevent run-away memory +consumption in case of accidental infinite recursion. + + As with non-recursive multi-line macros, recursive multi-line macros +are case-sensitive, unless you define them using the alternative +directive `%irmacro'. + + +File: nasm.info, Node: Section 4.3.2, Next: Section 4.3.3, Prev: Section 4.3.1, Up: Section 4.3 + +4.3.2. Overloading Multi-Line Macros +------------------------------------ + +As with single-line macros, multi-line macros can be overloaded by +defining the same macro name several times with different numbers of +parameters. This time, no exception is made for macros with no +parameters at all. So you could define + + %macro prologue 0 + + push ebp + mov ebp,esp + + %endmacro + + to define an alternative form of the function prologue which +allocates no local stack space. + + Sometimes, however, you might want to `overload' a machine +instruction; for example, you might want to define + + %macro push 2 + + push %1 + push %2 + + %endmacro + + so that you could code + + push ebx ; this line is not a macro call + push eax,ecx ; but this one is + + Ordinarily, NASM will give a warning for the first of the above two +lines, since `push' is now defined to be a macro, and is being invoked +with a number of parameters for which no definition has been given. The +correct code will still be generated, but the assembler will give a +warning. This warning can be disabled by the use of the +`-w-macro-params' command- line option (see *note Section 2.1.24::). + + +File: nasm.info, Node: Section 4.3.3, Next: Section 4.3.4, Prev: Section 4.3.2, Up: Section 4.3 + +4.3.3. Macro-Local Labels +------------------------- + +NASM allows you to define labels within a multi-line macro definition in +such a way as to make them local to the macro call: so calling the same +macro multiple times will use a different label each time. You do this +by prefixing `%%' to the label name. So you can invent an instruction +which executes a `RET' if the `Z' flag is set by doing this: + + %macro retz 0 + + jnz %%skip + ret + %%skip: + + %endmacro + + You can call this macro as many times as you want, and every time +you call it NASM will make up a different `real' name to substitute for +the label `%%skip'. The names NASM invents are of the form +`..@2345.skip', where the number 2345 changes with every macro call. +The `..@' prefix prevents macro-local labels from interfering with the +local label mechanism, as described in *note Section 3.9::. You should +avoid defining your own labels in this form (the `..@' prefix, then a +number, then another period) in case they interfere with macro-local +labels. + + +File: nasm.info, Node: Section 4.3.4, Next: Section 4.3.5, Prev: Section 4.3.3, Up: Section 4.3 + +4.3.4. Greedy Macro Parameters +------------------------------ + +Occasionally it is useful to define a macro which lumps its entire +command line into one parameter definition, possibly after extracting +one or two smaller parameters from the front. An example might be a +macro to write a text string to a file in MS-DOS, where you might want +to be able to write + + writefile [filehandle],"hello, world",13,10 + + NASM allows you to define the last parameter of a macro to be +_greedy_, meaning that if you invoke the macro with more parameters +than it expects, all the spare parameters get lumped into the last +defined one along with the separating commas. So if you code: + + %macro writefile 2+ + + jmp %%endstr + %%str: db %2 + %%endstr: + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + then the example call to `writefile' above will work as expected: the +text before the first comma, `[filehandle]', is used as the first macro +parameter and expanded when `%1' is referred to, and all the subsequent +text is lumped into `%2' and placed after the `db'. + + The greedy nature of the macro is indicated to NASM by the use of the +`+' sign after the parameter count on the `%macro' line. + + If you define a greedy macro, you are effectively telling NASM how it +should expand the macro given _any_ number of parameters from the +actual number specified up to infinity; in this case, for example, NASM +now knows what to do when it sees a call to `writefile' with 2, 3, 4 or +more parameters. NASM will take this into account when overloading +macros, and will not allow you to define another form of `writefile' +taking 4 parameters (for example). + + Of course, the above macro could have been implemented as a +non-greedy macro, in which case the call to it would have had to look +like + + writefile [filehandle], {"hello, world",13,10} + + NASM provides both mechanisms for putting commas in macro +parameters, and you choose which one you prefer for each macro +definition. + + See *note Section 6.3.1:: for a better way to write the above macro. + + +File: nasm.info, Node: Section 4.3.5, Next: Section 4.3.6, Prev: Section 4.3.4, Up: Section 4.3 + +4.3.5. Default Macro Parameters +------------------------------- + +NASM also allows you to define a multi-line macro with a _range_ of +allowable parameter counts. If you do this, you can specify defaults for +omitted parameters. So, for example: + + %macro die 0-1 "Painful program death has occurred." + + writefile 2,%1 + mov ax,0x4c01 + int 0x21 + + %endmacro + + This macro (which makes use of the `writefile' macro defined in +*note Section 4.3.4::) can be called with an explicit error message, +which it will display on the error output stream before exiting, or it +can be called with no parameters, in which case it will use the default +error message supplied in the macro definition. + + In general, you supply a minimum and maximum number of parameters +for a macro of this type; the minimum number of parameters are then +required in the macro call, and then you provide defaults for the +optional ones. So if a macro definition began with the line + + %macro foobar 1-3 eax,[ebx+2] + + then it could be called with between one and three parameters, and +`%1' would always be taken from the macro call. `%2', if not specified +by the macro call, would default to `eax', and `%3' if not specified +would default to `[ebx+2]'. + + You can provide extra information to a macro by providing too many +default parameters: + + %macro quux 1 something + + This will trigger a warning by default; see *note Section 2.1.24:: +for more information. When `quux' is invoked, it receives not one but +two parameters. `something' can be referred to as `%2'. The difference +between passing `something' this way and writing `something' in the +macro body is that with this way `something' is evaluated when the +macro is defined, not when it is expanded. + + You may omit parameter defaults from the macro definition, in which +case the parameter default is taken to be blank. This can be useful for +macros which can take a variable number of parameters, since the `%0' +token (see *note Section 4.3.6::) allows you to determine how many +parameters were really passed to the macro call. + + This defaulting mechanism can be combined with the greedy-parameter +mechanism; so the `die' macro above could be made more powerful, and +more useful, by changing the first line of the definition to + + %macro die 0-1+ "Painful program death has occurred.",13,10 + + The maximum parameter count can be infinite, denoted by `*'. In this +case, of course, it is impossible to provide a _full_ set of default +parameters. Examples of this usage are shown in *note Section 4.3.7::. + + +File: nasm.info, Node: Section 4.3.6, Next: Section 4.3.7, Prev: Section 4.3.5, Up: Section 4.3 + +4.3.6. `%0': Macro Parameter Counter +------------------------------------ + +The parameter reference `%0' will return a numeric constant giving the +number of parameters received, that is, if `%0' is n then `%'n is the +last parameter. `%0' is mostly useful for macros that can take a +variable number of parameters. It can be used as an argument to `%rep' +(see *note Section 4.5::) in order to iterate through all the +parameters of a macro. Examples are given in *note Section 4.3.7::. + + +File: nasm.info, Node: Section 4.3.7, Next: Section 4.3.8, Prev: Section 4.3.6, Up: Section 4.3 + +4.3.7. `%rotate': Rotating Macro Parameters +------------------------------------------- + +Unix shell programmers will be familiar with the `shift' shell command, +which allows the arguments passed to a shell script (referenced as +`$1', `$2' and so on) to be moved left by one place, so that the +argument previously referenced as `$2' becomes available as `$1', and +the argument previously referenced as `$1' is no longer available at +all. + + NASM provides a similar mechanism, in the form of `%rotate'. As its +name suggests, it differs from the Unix `shift' in that no parameters +are lost: parameters rotated off the left end of the argument list +reappear on the right, and vice versa. + + `%rotate' is invoked with a single numeric argument (which may be an +expression). The macro parameters are rotated to the left by that many +places. If the argument to `%rotate' is negative, the macro parameters +are rotated to the right. + + So a pair of macros to save and restore a set of registers might +work as follows: + + %macro multipush 1-* + + %rep %0 + push %1 + %rotate 1 + %endrep + + %endmacro + + This macro invokes the `PUSH' instruction on each of its arguments in +turn, from left to right. It begins by pushing its first argument, +`%1', then invokes `%rotate' to move all the arguments one place to the +left, so that the original second argument is now available as `%1'. +Repeating this procedure as many times as there were arguments +(achieved by supplying `%0' as the argument to `%rep') causes each +argument in turn to be pushed. + + Note also the use of `*' as the maximum parameter count, indicating +that there is no upper limit on the number of parameters you may supply +to the `multipush' macro. + + It would be convenient, when using this macro, to have a `POP' +equivalent, which _didn't_ require the arguments to be given in reverse +order. Ideally, you would write the `multipush' macro call, then +cut-and-paste the line to where the pop needed to be done, and change +the name of the called macro to `multipop', and the macro would take +care of popping the registers in the opposite order from the one in +which they were pushed. + + This can be done by the following definition: + + %macro multipop 1-* + + %rep %0 + %rotate -1 + pop %1 + %endrep + + %endmacro + + This macro begins by rotating its arguments one place to the _right_, +so that the original _last_ argument appears as `%1'. This is then +popped, and the arguments are rotated right again, so the second-to- +last argument becomes `%1'. Thus the arguments are iterated through in +reverse order. + + +File: nasm.info, Node: Section 4.3.8, Next: Section 4.3.9, Prev: Section 4.3.7, Up: Section 4.3 + +4.3.8. Concatenating Macro Parameters +------------------------------------- + +NASM can concatenate macro parameters and macro indirection constructs +on to other text surrounding them. This allows you to declare a family +of symbols, for example, in a macro definition. If, for example, you +wanted to generate a table of key codes along with offsets into the +table, you could code something like + + %macro keytab_entry 2 + + keypos%1 equ $-keytab + db %2 + + %endmacro + + keytab: + keytab_entry F1,128+1 + keytab_entry F2,128+2 + keytab_entry Return,13 + + which would expand to + + keytab: + keyposF1 equ $-keytab + db 128+1 + keyposF2 equ $-keytab + db 128+2 + keyposReturn equ $-keytab + db 13 + + You can just as easily concatenate text on to the other end of a +macro parameter, by writing `%1foo'. + + If you need to append a _digit_ to a macro parameter, for example +defining labels `foo1' and `foo2' when passed the parameter `foo', you +can't code `%11' because that would be taken as the eleventh macro +parameter. Instead, you must code `%{1}1', which will separate the +first `1' (giving the number of the macro parameter) from the second +(literal text to be concatenated to the parameter). + + This concatenation can also be applied to other preprocessor in-line +objects, such as macro-local labels (*note Section 4.3.3::) and +context-local labels (*note Section 4.7.2::). In all cases, ambiguities +in syntax can be resolved by enclosing everything after the `%' sign +and before the literal text in braces: so `%{%foo}bar' concatenates the +text `bar' to the end of the real name of the macro-local label +`%%foo'. (This is unnecessary, since the form NASM uses for the real +names of macro-local labels means that the two usages `%{%foo}bar' and +`%%foobar' would both expand to the same thing anyway; nevertheless, +the capability is there.) + + The single-line macro indirection construct, `%[...]' (*note Section +4.1.3::), behaves the same way as macro parameters for the purpose of +concatenation. + + See also the `%+' operator, *note Section 4.1.4::. + + +File: nasm.info, Node: Section 4.3.9, Next: Section 4.3.10, Prev: Section 4.3.8, Up: Section 4.3 + +4.3.9. Condition Codes as Macro Parameters +------------------------------------------ + +NASM can give special treatment to a macro parameter which contains a +condition code. For a start, you can refer to the macro parameter `%1' +by means of the alternative syntax `%+1', which informs NASM that this +macro parameter is supposed to contain a condition code, and will cause +the preprocessor to report an error message if the macro is called with +a parameter which is _not_ a valid condition code. + + Far more usefully, though, you can refer to the macro parameter by +means of `%-1', which NASM will expand as the _inverse_ condition code. +So the `retz' macro defined in *note Section 4.3.3:: can be replaced by +a general conditional-return macro like this: + + %macro retc 1 + + j%-1 %%skip + ret + %%skip: + + %endmacro + + This macro can now be invoked using calls like `retc ne', which will +cause the conditional-jump instruction in the macro expansion to come +out as `JE', or `retc po' which will make the jump a `JPE'. + + The `%+1' macro-parameter reference is quite happy to interpret the +arguments `CXZ' and `ECXZ' as valid condition codes; however, `%-1' +will report an error if passed either of these, because no inverse +condition code exists. + + +File: nasm.info, Node: Section 4.3.10, Next: Section 4.3.11, Prev: Section 4.3.9, Up: Section 4.3 + +4.3.10. Disabling Listing Expansion +----------------------------------- + +When NASM is generating a listing file from your program, it will +generally expand multi-line macros by means of writing the macro call +and then listing each line of the expansion. This allows you to see +which instructions in the macro expansion are generating what code; +however, for some macros this clutters the listing up unnecessarily. + + NASM therefore provides the `.nolist' qualifier, which you can +include in a macro definition to inhibit the expansion of the macro in +the listing file. The `.nolist' qualifier comes directly after the +number of parameters, like this: + + %macro foo 1.nolist + + Or like this: + + %macro bar 1-5+.nolist a,b,c,d,e,f,g,h + + +File: nasm.info, Node: Section 4.3.11, Next: Section 4.3.12, Prev: Section 4.3.10, Up: Section 4.3 + +4.3.11. Undefining Multi-Line Macros: `%unmacro' +------------------------------------------------ + +Multi-line macros can be removed with the `%unmacro' directive. Unlike +the `%undef' directive, however, `%unmacro' takes an argument +specification, and will only remove exact matches with that argument +specification. + + For example: + + %macro foo 1-3 + ; Do something + %endmacro + %unmacro foo 1-3 + + removes the previously defined macro `foo', but + + %macro bar 1-3 + ; Do something + %endmacro + %unmacro bar 1 + + does _not_ remove the macro `bar', since the argument specification +does not match exactly. + + +File: nasm.info, Node: Section 4.3.12, Next: Section 4.4, Prev: Section 4.3.11, Up: Section 4.3 + +4.3.12. Exiting Multi-Line Macros: `%exitmacro' +----------------------------------------------- + +Multi-line macro expansions can be arbitrarily terminated with the +`%exitmacro' directive. + + For example: + + %macro foo 1-3 + ; Do something + %if<condition> + %exitmacro + %endif + ; Do something + %endmacro + + +File: nasm.info, Node: Section 4.4, Next: Section 4.4.1, Prev: Section 4.3.12, Up: Chapter 4 + +4.4. Conditional Assembly +========================= + +Similarly to the C preprocessor, NASM allows sections of a source file +to be assembled only if certain conditions are met. The general syntax +of this feature looks like this: + + %if<condition> + ; some code which only appears if <condition> is met + %elif<condition2> + ; only appears if <condition> is not met but <condition2> is + %else + ; this appears if neither <condition> nor <condition2> was met + %endif + + The inverse forms `%ifn' and `%elifn' are also supported. + + The `%else' clause is optional, as is the `%elif' clause. You can +have more than one `%elif' clause as well. + + There are a number of variants of the `%if' directive. Each has its +corresponding `%elif', `%ifn', and `%elifn' directives; for example, +the equivalents to the `%ifdef' directive are `%elifdef', `%ifndef', +and `%elifndef'. + +* Menu: + +* Section 4.4.1:: `%ifdef': Testing Single-Line Macro Existence +* Section 4.4.2:: `%ifmacro': Testing Multi-Line Macro Existence +* Section 4.4.3:: `%ifctx': Testing the Context Stack +* Section 4.4.4:: `%if': Testing Arbitrary Numeric Expressions +* Section 4.4.5:: `%ifidn' and `%ifidni': Testing Exact Text Identity +* Section 4.4.6:: `%ifid', `%ifnum', `%ifstr': Testing Token Types +* Section 4.4.7:: `%iftoken': Test for a Single Token +* Section 4.4.8:: `%ifempty': Test for Empty Expansion + + +File: nasm.info, Node: Section 4.4.1, Next: Section 4.4.2, Prev: Section 4.4, Up: Section 4.4 + +4.4.1. `%ifdef': Testing Single-Line Macro Existence +---------------------------------------------------- + +Beginning a conditional-assembly block with the line `%ifdef MACRO' +will assemble the subsequent code if, and only if, a single-line macro +called `MACRO' is defined. If not, then the `%elif' and `%else' blocks +(if any) will be processed instead. + + For example, when debugging a program, you might want to write code +such as + + ; perform some function + %ifdef DEBUG + writefile 2,"Function performed successfully",13,10 + %endif + ; go and do something else + + Then you could use the command-line option `-dDEBUG' to create a +version of the program which produced debugging messages, and remove the +option to generate the final release version of the program. + + You can test for a macro _not_ being defined by using `%ifndef' +instead of `%ifdef'. You can also test for macro definitions in `%elif' +blocks by using `%elifdef' and `%elifndef'. + + +File: nasm.info, Node: Section 4.4.2, Next: Section 4.4.3, Prev: Section 4.4.1, Up: Section 4.4 + +4.4.2. `%ifmacro': Testing Multi-Line Macro Existence +----------------------------------------------------- + +The `%ifmacro' directive operates in the same way as the `%ifdef' +directive, except that it checks for the existence of a multi-line +macro. + + For example, you may be working with a large project and not have +control over the macros in a library. You may want to create a macro +with one name if it doesn't already exist, and another name if one with +that name does exist. + + The `%ifmacro' is considered true if defining a macro with the given +name and number of arguments would cause a definitions conflict. For +example: + + %ifmacro MyMacro 1-3 + + %error "MyMacro 1-3" causes a conflict with an existing macro. + + %else + + %macro MyMacro 1-3 + + ; insert code to define the macro + + %endmacro + + %endif + + This will create the macro "MyMacro 1-3" if no macro already exists +which would conflict with it, and emits a warning if there would be a +definition conflict. + + You can test for the macro not existing by using the `%ifnmacro' +instead of `%ifmacro'. Additional tests can be performed in `%elif' +blocks by using `%elifmacro' and `%elifnmacro'. + + +File: nasm.info, Node: Section 4.4.3, Next: Section 4.4.4, Prev: Section 4.4.2, Up: Section 4.4 + +4.4.3. `%ifctx': Testing the Context Stack +------------------------------------------ + +The conditional-assembly construct `%ifctx' will cause the subsequent +code to be assembled if and only if the top context on the +preprocessor's context stack has the same name as one of the arguments. +As with `%ifdef', the inverse and `%elif' forms `%ifnctx', `%elifctx' +and `%elifnctx' are also supported. + + For more details of the context stack, see *note Section 4.7::. For +a sample use of `%ifctx', see *note Section 4.7.5::. + + +File: nasm.info, Node: Section 4.4.4, Next: Section 4.4.5, Prev: Section 4.4.3, Up: Section 4.4 + +4.4.4. `%if': Testing Arbitrary Numeric Expressions +--------------------------------------------------- + +The conditional-assembly construct `%if expr' will cause the subsequent +code to be assembled if and only if the value of the numeric expression +`expr' is non-zero. An example of the use of this feature is in +deciding when to break out of a `%rep' preprocessor loop: see *note +Section 4.5:: for a detailed example. + + The expression given to `%if', and its counterpart `%elif', is a +critical expression (see *note Section 3.8::). + + `%if' extends the normal NASM expression syntax, by providing a set +of relational operators which are not normally available in +expressions. The operators `=', `<', `>', `<=', `>=' and `<>' test +equality, less-than, greater-than, less-or-equal, greater-or-equal and +not-equal respectively. The C-like forms `==' and `!=' are supported as +alternative forms of `=' and `<>'. In addition, low- priority logical +operators `&&', `^^' and `||' are provided, supplying logical AND, +logical XOR and logical OR. These work like the C logical operators +(although C has no logical XOR), in that they always return either 0 or +1, and treat any non-zero input as 1 (so that `^^', for example, +returns 1 if exactly one of its inputs is zero, and 0 otherwise). The +relational operators also return 1 for true and 0 for false. + + Like other `%if' constructs, `%if' has a counterpart `%elif', and +negative forms `%ifn' and `%elifn'. + + +File: nasm.info, Node: Section 4.4.5, Next: Section 4.4.6, Prev: Section 4.4.4, Up: Section 4.4 + +4.4.5. `%ifidn' and `%ifidni': Testing Exact Text Identity +---------------------------------------------------------- + +The construct `%ifidn text1,text2' will cause the subsequent code to be +assembled if and only if `text1' and `text2', after expanding +single-line macros, are identical pieces of text. Differences in white +space are not counted. + + `%ifidni' is similar to `%ifidn', but is case-insensitive. + + For example, the following macro pushes a register or number on the +stack, and allows you to treat `IP' as a real register: + + %macro pushparam 1 + + %ifidni %1,ip + call %%label + %%label: + %else + push %1 + %endif + + %endmacro + + Like other `%if' constructs, `%ifidn' has a counterpart `%elifidn', +and negative forms `%ifnidn' and `%elifnidn'. Similarly, `%ifidni' has +counterparts `%elifidni', `%ifnidni' and `%elifnidni'. + + +File: nasm.info, Node: Section 4.4.6, Next: Section 4.4.7, Prev: Section 4.4.5, Up: Section 4.4 + +4.4.6. `%ifid', `%ifnum', `%ifstr': Testing Token Types +------------------------------------------------------- + +Some macros will want to perform different tasks depending on whether +they are passed a number, a string, or an identifier. For example, a +string output macro might want to be able to cope with being passed +either a string constant or a pointer to an existing string. + + The conditional assembly construct `%ifid', taking one parameter +(which may be blank), assembles the subsequent code if and only if the +first token in the parameter exists and is an identifier. `%ifnum' +works similarly, but tests for the token being a numeric constant; +`%ifstr' tests for it being a string. + + For example, the `writefile' macro defined in *note Section 4.3.4:: +can be extended to take advantage of `%ifstr' in the following fashion: + + %macro writefile 2-3+ + + %ifstr %2 + jmp %%endstr + %if %0 = 3 + %%str: db %2,%3 + %else + %%str: db %2 + %endif + %%endstr: mov dx,%%str + mov cx,%%endstr-%%str + %else + mov dx,%2 + mov cx,%3 + %endif + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + Then the `writefile' macro can cope with being called in either of +the following two ways: + + writefile [file], strpointer, length + writefile [file], "hello", 13, 10 + + In the first, `strpointer' is used as the address of an already- +declared string, and `length' is used as its length; in the second, a +string is given to the macro, which therefore declares it itself and +works out the address and length for itself. + + Note the use of `%if' inside the `%ifstr': this is to detect whether +the macro was passed two arguments (so the string would be a single +string constant, and `db %2' would be adequate) or more (in which case, +all but the first two would be lumped together into `%3', and `db +%2,%3' would be required). + + The usual `%elif'..., `%ifn'..., and `%elifn'... versions exist for +each of `%ifid', `%ifnum' and `%ifstr'. + + +File: nasm.info, Node: Section 4.4.7, Next: Section 4.4.8, Prev: Section 4.4.6, Up: Section 4.4 + +4.4.7. `%iftoken': Test for a Single Token +------------------------------------------ + +Some macros will want to do different things depending on if it is +passed a single token (e.g. paste it to something else using `%+') +versus a multi-token sequence. + + The conditional assembly construct `%iftoken' assembles the +subsequent code if and only if the expanded parameters consist of +exactly one token, possibly surrounded by whitespace. + + For example: + + %iftoken 1 + + will assemble the subsequent code, but + + %iftoken -1 + + will not, since `-1' contains two tokens: the unary minus operator +`-', and the number `1'. + + The usual `%eliftoken', `%ifntoken', and `%elifntoken' variants are +also provided. + + +File: nasm.info, Node: Section 4.4.8, Next: Section 4.5, Prev: Section 4.4.7, Up: Section 4.4 + +4.4.8. `%ifempty': Test for Empty Expansion +------------------------------------------- + +The conditional assembly construct `%ifempty' assembles the subsequent +code if and only if the expanded parameters do not contain any tokens at +all, whitespace excepted. + + The usual `%elifempty', `%ifnempty', and `%elifnempty' variants are +also provided. + + +File: nasm.info, Node: Section 4.5, Next: Section 4.6, Prev: Section 4.4.8, Up: Chapter 4 + +4.5. Preprocessor Loops: `%rep' +=============================== + +NASM's `TIMES' prefix, though useful, cannot be used to invoke a +multi-line macro multiple times, because it is processed by NASM after +macros have already been expanded. Therefore NASM provides another form +of loop, this time at the preprocessor level: `%rep'. + + The directives `%rep' and `%endrep' (`%rep' takes a numeric +argument, which can be an expression; `%endrep' takes no arguments) can +be used to enclose a chunk of code, which is then replicated as many +times as specified by the preprocessor: + + %assign i 0 + %rep 64 + inc word [table+2*i] + %assign i i+1 + %endrep + + This will generate a sequence of 64 `INC' instructions, incrementing +every word of memory from `[table]' to `[table+126]'. + + For more complex termination conditions, or to break out of a repeat +loop part way along, you can use the `%exitrep' directive to terminate +the loop, like this: + + fibonacci: + %assign i 0 + %assign j 1 + %rep 100 + %if j > 65535 + %exitrep + %endif + dw j + %assign k j+i + %assign i j + %assign j k + %endrep + + fib_number equ ($-fibonacci)/2 + + This produces a list of all the Fibonacci numbers that will fit in +16 bits. Note that a maximum repeat count must still be given to +`%rep'. This is to prevent the possibility of NASM getting into an +infinite loop in the preprocessor, which (on multitasking or multi-user +systems) would typically cause all the system memory to be gradually +used up and other applications to start crashing. + + +File: nasm.info, Node: Section 4.6, Next: Section 4.6.1, Prev: Section 4.5, Up: Chapter 4 + +4.6. Source Files and Dependencies +================================== + +These commands allow you to split your sources into multiple files. + +* Menu: + +* Section 4.6.1:: `%include': Including Other Files +* Section 4.6.2:: `%pathsearch': Search the Include Path +* Section 4.6.3:: `%depend': Add Dependent Files +* Section 4.6.4:: `%use': Include Standard Macro Package + + +File: nasm.info, Node: Section 4.6.1, Next: Section 4.6.2, Prev: Section 4.6, Up: Section 4.6 + +4.6.1. `%include': Including Other Files +---------------------------------------- + +Using, once again, a very similar syntax to the C preprocessor, NASM's +preprocessor lets you include other source files into your code. This is +done by the use of the `%include' directive: + + %include "macros.mac" + + will include the contents of the file `macros.mac' into the source +file containing the `%include' directive. + + Include files are searched for in the current directory (the +directory you're in when you run NASM, as opposed to the location of +the NASM executable or the location of the source file), plus any +directories specified on the NASM command line using the `-i' option. + + The standard C idiom for preventing a file being included more than +once is just as applicable in NASM: if the file `macros.mac' has the +form + + %ifndef MACROS_MAC + %define MACROS_MAC + ; now define some macros + %endif + + then including the file more than once will not cause errors, +because the second time the file is included nothing will happen +because the macro `MACROS_MAC' will already be defined. + + You can force a file to be included even if there is no `%include' +directive that explicitly includes it, by using the `-p' option on the +NASM command line (see *note Section 2.1.17::). + + +File: nasm.info, Node: Section 4.6.2, Next: Section 4.6.3, Prev: Section 4.6.1, Up: Section 4.6 + +4.6.2. `%pathsearch': Search the Include Path +--------------------------------------------- + +The `%pathsearch' directive takes a single-line macro name and a +filename, and declare or redefines the specified single-line macro to be +the include-path-resolved version of the filename, if the file exists +(otherwise, it is passed unchanged.) + + For example, + + %pathsearch MyFoo "foo.bin" + + ... with `-Ibins/' in the include path may end up defining the macro +`MyFoo' to be `"bins/foo.bin"'. + + +File: nasm.info, Node: Section 4.6.3, Next: Section 4.6.4, Prev: Section 4.6.2, Up: Section 4.6 + +4.6.3. `%depend': Add Dependent Files +------------------------------------- + +The `%depend' directive takes a filename and adds it to the list of +files to be emitted as dependency generation when the `-M' options and +its relatives (see *note Section 2.1.4::) are used. It produces no +output. + + This is generally used in conjunction with `%pathsearch'. For +example, a simplified version of the standard macro wrapper for the +`INCBIN' directive looks like: + + %imacro incbin 1-2+ 0 + %pathsearch dep %1 + %depend dep + incbin dep,%2 + %endmacro + + This first resolves the location of the file into the macro `dep', +then adds it to the dependency lists, and finally issues the assembler- +level `INCBIN' directive. + + +File: nasm.info, Node: Section 4.6.4, Next: Section 4.7, Prev: Section 4.6.3, Up: Section 4.6 + +4.6.4. `%use': Include Standard Macro Package +--------------------------------------------- + +The `%use' directive is similar to `%include', but rather than +including the contents of a file, it includes a named standard macro +package. The standard macro packages are part of NASM, and are +described in *note Chapter 5::. + + Unlike the `%include' directive, package names for the `%use' +directive do not require quotes, but quotes are permitted. In NASM 2.04 +and 2.05 the unquoted form would be macro-expanded; this is no longer +true. Thus, the following lines are equivalent: + + %use altreg + %use 'altreg' + + Standard macro packages are protected from multiple inclusion. When a +standard macro package is used, a testable single-line macro of the form +`__USE_'_package_`__' is also defined, see *note Section 4.11.8::. + + +File: nasm.info, Node: Section 4.7, Next: Section 4.7.1, Prev: Section 4.6.4, Up: Chapter 4 + +4.7. The Context Stack +====================== + +Having labels that are local to a macro definition is sometimes not +quite powerful enough: sometimes you want to be able to share labels +between several macro calls. An example might be a `REPEAT' ... `UNTIL' +loop, in which the expansion of the `REPEAT' macro would need to be +able to refer to a label which the `UNTIL' macro had defined. However, +for such a macro you would also want to be able to nest these loops. + + NASM provides this level of power by means of a _context stack_. The +preprocessor maintains a stack of _contexts_, each of which is +characterized by a name. You add a new context to the stack using the +`%push' directive, and remove one using `%pop'. You can define labels +that are local to a particular context on the stack. + +* Menu: + +* Section 4.7.1:: `%push' and `%pop': Creating and Removing Contexts +* Section 4.7.2:: Context-Local Labels +* Section 4.7.3:: Context-Local Single-Line Macros +* Section 4.7.4:: `%repl': Renaming a Context +* Section 4.7.5:: Example Use of the Context Stack: Block IFs + + +File: nasm.info, Node: Section 4.7.1, Next: Section 4.7.2, Prev: Section 4.7, Up: Section 4.7 + +4.7.1. `%push' and `%pop': Creating and Removing Contexts +--------------------------------------------------------- + +The `%push' directive is used to create a new context and place it on +the top of the context stack. `%push' takes an optional argument, which +is the name of the context. For example: + + %push foobar + + This pushes a new context called `foobar' on the stack. You can have +several contexts on the stack with the same name: they can still be +distinguished. If no name is given, the context is unnamed (this is +normally used when both the `%push' and the `%pop' are inside a single +macro definition.) + + The directive `%pop', taking one optional argument, removes the top +context from the context stack and destroys it, along with any labels +associated with it. If an argument is given, it must match the name of +the current context, otherwise it will issue an error. + + +File: nasm.info, Node: Section 4.7.2, Next: Section 4.7.3, Prev: Section 4.7.1, Up: Section 4.7 + +4.7.2. Context-Local Labels +--------------------------- + +Just as the usage `%%foo' defines a label which is local to the +particular macro call in which it is used, the usage `%$foo' is used to +define a label which is local to the context on the top of the context +stack. So the `REPEAT' and `UNTIL' example given above could be +implemented by means of: + + %macro repeat 0 + + %push repeat + %$begin: + + %endmacro + + %macro until 1 + + j%-1 %$begin + %pop + + %endmacro + + and invoked by means of, for example, + + mov cx,string + repeat + add cx,3 + scasb + until e + + which would scan every fourth byte of a string in search of the byte +in `AL'. + + If you need to define, or access, labels local to the context _below_ +the top one on the stack, you can use `%$$foo', or `%$$$foo' for the +context below that, and so on. + + +File: nasm.info, Node: Section 4.7.3, Next: Section 4.7.4, Prev: Section 4.7.2, Up: Section 4.7 + +4.7.3. Context-Local Single-Line Macros +--------------------------------------- + +NASM also allows you to define single-line macros which are local to a +particular context, in just the same way: + + %define %$localmac 3 + + will define the single-line macro `%$localmac' to be local to the top +context on the stack. Of course, after a subsequent `%push', it can +then still be accessed by the name `%$$localmac'. + + +File: nasm.info, Node: Section 4.7.4, Next: Section 4.7.5, Prev: Section 4.7.3, Up: Section 4.7 + +4.7.4. `%repl': Renaming a Context +---------------------------------- + +If you need to change the name of the top context on the stack (in +order, for example, to have it respond differently to `%ifctx'), you can +execute a `%pop' followed by a `%push'; but this will have the side +effect of destroying all context-local labels and macros associated +with the context that was just popped. + + NASM provides the directive `%repl', which _replaces_ a context with +a different name, without touching the associated macros and labels. +So you could replace the destructive code + + %pop + %push newname + + with the non-destructive version `%repl newname'. + + +File: nasm.info, Node: Section 4.7.5, Next: Section 4.8, Prev: Section 4.7.4, Up: Section 4.7 + +4.7.5. Example Use of the Context Stack: Block IFs +-------------------------------------------------- + +This example makes use of almost all the context-stack features, +including the conditional-assembly construct `%ifctx', to implement a +block IF statement as a set of macros. + + %macro if 1 + + %push if + j%-1 %$ifnot + + %endmacro + + %macro else 0 + + %ifctx if + %repl else + jmp %$ifend + %$ifnot: + %else + %error "expected `if' before `else'" + %endif + + %endmacro + + %macro endif 0 + + %ifctx if + %$ifnot: + %pop + %elifctx else + %$ifend: + %pop + %else + %error "expected `if' or `else' before `endif'" + %endif + + %endmacro + + This code is more robust than the `REPEAT' and `UNTIL' macros given +in *note Section 4.7.2::, because it uses conditional assembly to check +that the macros are issued in the right order (for example, not calling +`endif' before `if') and issues a `%error' if they're not. + + In addition, the `endif' macro has to be able to cope with the two +distinct cases of either directly following an `if', or following an +`else'. It achieves this, again, by using conditional assembly to do +different things depending on whether the context on top of the stack is +`if' or `else'. + + The `else' macro has to preserve the context on the stack, in order +to have the `%$ifnot' referred to by the `if' macro be the same as the +one defined by the `endif' macro, but has to change the context's name +so that `endif' will know there was an intervening `else'. It does +this by the use of `%repl'. + + A sample usage of these macros might look like: + + cmp ax,bx + + if ae + cmp bx,cx + + if ae + mov ax,cx + else + mov ax,bx + endif + + else + cmp ax,cx + + if ae + mov ax,cx + endif + + endif + + The block-`IF' macros handle nesting quite happily, by means of +pushing another context, describing the inner `if', on top of the one +describing the outer `if'; thus `else' and `endif' always refer to the +last unmatched `if' or `else'. + + +File: nasm.info, Node: Section 4.8, Next: Section 4.8.1, Prev: Section 4.7.5, Up: Chapter 4 + +4.8. Stack Relative Preprocessor Directives +=========================================== + +The following preprocessor directives provide a way to use labels to +refer to local variables allocated on the stack. + + * `%arg' (see *note Section 4.8.1::) + + * `%stacksize' (see *note Section 4.8.2::) + + * `%local' (see *note Section 4.8.3::) + +* Menu: + +* Section 4.8.1:: `%arg' Directive +* Section 4.8.2:: `%stacksize' Directive +* Section 4.8.3:: `%local' Directive + + +File: nasm.info, Node: Section 4.8.1, Next: Section 4.8.2, Prev: Section 4.8, Up: Section 4.8 + +4.8.1. `%arg' Directive +----------------------- + +The `%arg' directive is used to simplify the handling of parameters +passed on the stack. Stack based parameter passing is used by many high +level languages, including C, C++ and Pascal. + + While NASM has macros which attempt to duplicate this functionality +(see *note Section 8.4.5::), the syntax is not particularly convenient +to use. and is not TASM compatible. Here is an example which shows the +use of `%arg' without any external macros: + + some_function: + + %push mycontext ; save the current context + %stacksize large ; tell NASM to use bp + %arg i:word, j_ptr:word + + mov ax,[i] + mov bx,[j_ptr] + add ax,[bx] + ret + + %pop ; restore original context + + This is similar to the procedure defined in *note Section 8.4.5:: +and adds the value in i to the value pointed to by j_ptr and returns +the sum in the ax register. See *note Section 4.7.1:: for an +explanation of `push' and `pop' and the use of context stacks. + + +File: nasm.info, Node: Section 4.8.2, Next: Section 4.8.3, Prev: Section 4.8.1, Up: Section 4.8 + +4.8.2. `%stacksize' Directive +----------------------------- + +The `%stacksize' directive is used in conjunction with the `%arg' (see +*note Section 4.8.1::) and the `%local' (see *note Section 4.8.3::) +directives. It tells NASM the default size to use for subsequent `%arg' +and `%local' directives. The `%stacksize' directive takes one required +argument which is one of `flat', `flat64', `large' or `small'. + + %stacksize flat + + This form causes NASM to use stack-based parameter addressing +relative to `ebp' and it assumes that a near form of call was used to +get to this label (i.e. that `eip' is on the stack). + + %stacksize flat64 + + This form causes NASM to use stack-based parameter addressing +relative to `rbp' and it assumes that a near form of call was used to +get to this label (i.e. that `rip' is on the stack). + + %stacksize large + + This form uses `bp' to do stack-based parameter addressing and +assumes that a far form of call was used to get to this address (i.e. +that `ip' and `cs' are on the stack). + + %stacksize small + + This form also uses `bp' to address stack parameters, but it is +different from `large' because it also assumes that the old value of bp +is pushed onto the stack (i.e. it expects an `ENTER' instruction). In +other words, it expects that `bp', `ip' and `cs' are on the top of the +stack, underneath any local space which may have been allocated by +`ENTER'. This form is probably most useful when used in combination +with the `%local' directive (see *note Section 4.8.3::). + + +File: nasm.info, Node: Section 4.8.3, Next: Section 4.9, Prev: Section 4.8.2, Up: Section 4.8 + +4.8.3. `%local' Directive +------------------------- + +The `%local' directive is used to simplify the use of local temporary +stack variables allocated in a stack frame. Automatic local variables +in C are an example of this kind of variable. The `%local' directive is +most useful when used with the `%stacksize' (see *note Section 4.8.2:: +and is also compatible with the `%arg' directive (see *note Section +4.8.1::). It allows simplified reference to variables on the stack which +have been allocated typically by using the `ENTER' instruction. An +example of its use is the following: + + silly_swap: + + %push mycontext ; save the current context + %stacksize small ; tell NASM to use bp + %assign %$localsize 0 ; see text for explanation + %local old_ax:word, old_dx:word + + enter %$localsize,0 ; see text for explanation + mov [old_ax],ax ; swap ax & bx + mov [old_dx],dx ; and swap dx & cx + mov ax,bx + mov dx,cx + mov bx,[old_ax] + mov cx,[old_dx] + leave ; restore old bp + ret ; + + %pop ; restore original context + + The `%$localsize' variable is used internally by the `%local' +directive and _must_ be defined within the current context before the +`%local' directive may be used. Failure to do so will result in one +expression syntax error for each `%local' variable declared. It then +may be used in the construction of an appropriately sized ENTER +instruction as shown in the example. + + +File: nasm.info, Node: Section 4.9, Next: Section 4.10, Prev: Section 4.8.3, Up: Chapter 4 + +4.9. Reporting User-Defined Errors: `%error', `%warning', `%fatal' +================================================================== + +The preprocessor directive `%error' will cause NASM to report an error +if it occurs in assembled code. So if other users are going to try to +assemble your source files, you can ensure that they define the right +macros by means of code like this: + + %ifdef F1 + ; do some setup + %elifdef F2 + ; do some different setup + %else + %error "Neither F1 nor F2 was defined." + %endif + + Then any user who fails to understand the way your code is supposed +to be assembled will be quickly warned of their mistake, rather than +having to wait until the program crashes on being run and then not +knowing what went wrong. + + Similarly, `%warning' issues a warning, but allows assembly to +continue: + + %ifdef F1 + ; do some setup + %elifdef F2 + ; do some different setup + %else + %warning "Neither F1 nor F2 was defined, assuming F1." + %define F1 + %endif + + `%error' and `%warning' are issued only on the final assembly pass. +This makes them safe to use in conjunction with tests that depend on +symbol values. + + `%fatal' terminates assembly immediately, regardless of pass. This is +useful when there is no point in continuing the assembly further, and +doing so is likely just going to cause a spew of confusing error +messages. + + It is optional for the message string after `%error', `%warning' or +`%fatal' to be quoted. If it is _not_, then single-line macros are +expanded in it, which can be used to display more information to the +user. For example: + + %if foo > 64 + %assign foo_over foo-64 + %error foo is foo_over bytes too large + %endif + + +File: nasm.info, Node: Section 4.10, Next: Section 4.10.1, Prev: Section 4.9, Up: Chapter 4 + +4.10. Other Preprocessor Directives +=================================== + +NASM also has preprocessor directives which allow access to information +from external sources. Currently they include: + + * `%line' enables NASM to correctly handle the output of another + preprocessor (see *note Section 4.10.1::). + + * `%!' enables NASM to read in the value of an environment variable, + which can then be used in your program (see *note Section + 4.10.2::). + +* Menu: + +* Section 4.10.1:: `%line' Directive +* Section 4.10.2:: `%!'`<env>': Read an environment variable. + + +File: nasm.info, Node: Section 4.10.1, Next: Section 4.10.2, Prev: Section 4.10, Up: Section 4.10 + +4.10.1. `%line' Directive +------------------------- + +The `%line' directive is used to notify NASM that the input line +corresponds to a specific line number in another file. Typically this +other file would be an original source file, with the current NASM +input being the output of a pre-processor. The `%line' directive allows +NASM to output messages which indicate the line number of the original +source file, instead of the file that is being read by NASM. + + This preprocessor directive is not generally of use to programmers, +by may be of interest to preprocessor authors. The usage of the `%line' +preprocessor directive is as follows: + + %line nnn[+mmm] [filename] + + In this directive, `nnn' identifies the line of the original source +file which this line corresponds to. `mmm' is an optional parameter +which specifies a line increment value; each line of the input file +read in is considered to correspond to `mmm' lines of the original +source file. Finally, `filename' is an optional parameter which +specifies the file name of the original source file. + + After reading a `%line' preprocessor directive, NASM will report all +file name and line numbers relative to the values specified therein. + + +File: nasm.info, Node: Section 4.10.2, Next: Section 4.11, Prev: Section 4.10.1, Up: Section 4.10 + +4.10.2. `%!'`<env>': Read an environment variable. +-------------------------------------------------- + +The `%!<env>' directive makes it possible to read the value of an +environment variable at assembly time. This could, for example, be used +to store the contents of an environment variable into a string, which +could be used at some other point in your code. + + For example, suppose that you have an environment variable `FOO', and +you want the contents of `FOO' to be embedded in your program. You +could do that as follows: + + %defstr FOO %!FOO + + See *note Section 4.1.8:: for notes on the `%defstr' directive. + + +File: nasm.info, Node: Section 4.11, Next: Section 4.11.1, Prev: Section 4.10.2, Up: Chapter 4 + +4.11. Standard Macros +===================== + +NASM defines a set of standard macros, which are already defined when it +starts to process any source file. If you really need a program to be +assembled with no pre-defined macros, you can use the `%clear' +directive to empty the preprocessor of everything but context-local +preprocessor variables and single-line macros. + + Most user-level assembler directives (see *note Chapter 6::) are +implemented as macros which invoke primitive directives; these are +described in *note Chapter 6::. The rest of the standard macro set is +described here. + +* Menu: + +* Section 4.11.1:: NASM Version Macros +* Section 4.11.2:: `__NASM_VERSION_ID__': NASM Version ID +* Section 4.11.3:: `__NASM_VER__': NASM Version string +* Section 4.11.4:: `__FILE__' and `__LINE__': File Name and Line Number +* Section 4.11.5:: `__BITS__': Current BITS Mode +* Section 4.11.6:: `__OUTPUT_FORMAT__': Current Output Format +* Section 4.11.7:: Assembly Date and Time Macros +* Section 4.11.8:: `__USE_'_package_`__': Package Include Test +* Section 4.11.9:: `__PASS__': Assembly Pass +* Section 4.11.10:: `STRUC' and `ENDSTRUC': Declaring Structure Data Types +* Section 4.11.11:: `ISTRUC', `AT' and `IEND': Declaring Instances of Structures +* Section 4.11.12:: `ALIGN' and `ALIGNB': Data Alignment + + +File: nasm.info, Node: Section 4.11.1, Next: Section 4.11.2, Prev: Section 4.11, Up: Section 4.11 + +4.11.1. NASM Version Macros +--------------------------- + +The single-line macros `__NASM_MAJOR__', `__NASM_MINOR__', +`__NASM_SUBMINOR__' and `___NASM_PATCHLEVEL__' expand to the major, +minor, subminor and patch level parts of the version number of NASM +being used. So, under NASM 0.98.32p1 for example, `__NASM_MAJOR__' +would be defined to be 0, `__NASM_MINOR__' would be defined as 98, +`__NASM_SUBMINOR__' would be defined to 32, and `___NASM_PATCHLEVEL__' +would be defined as 1. + + Additionally, the macro `__NASM_SNAPSHOT__' is defined for +automatically generated snapshot releases _only_. + + +File: nasm.info, Node: Section 4.11.2, Next: Section 4.11.3, Prev: Section 4.11.1, Up: Section 4.11 + +4.11.2. `__NASM_VERSION_ID__': NASM Version ID +---------------------------------------------- + +The single-line macro `__NASM_VERSION_ID__' expands to a dword integer +representing the full version number of the version of nasm being used. +The value is the equivalent to `__NASM_MAJOR__', `__NASM_MINOR__', +`__NASM_SUBMINOR__' and `___NASM_PATCHLEVEL__' concatenated to produce +a single doubleword. Hence, for 0.98.32p1, the returned number would be +equivalent to: + + dd 0x00622001 + + or + + db 1,32,98,0 + + Note that the above lines are generate exactly the same code, the +second line is used just to give an indication of the order that the +separate values will be present in memory. + + +File: nasm.info, Node: Section 4.11.3, Next: Section 4.11.4, Prev: Section 4.11.2, Up: Section 4.11 + +4.11.3. `__NASM_VER__': NASM Version string +------------------------------------------- + +The single-line macro `__NASM_VER__' expands to a string which defines +the version number of nasm being used. So, under NASM 0.98.32 for +example, + + db __NASM_VER__ + + would expand to + + db "0.98.32" + + +File: nasm.info, Node: Section 4.11.4, Next: Section 4.11.5, Prev: Section 4.11.3, Up: Section 4.11 + +4.11.4. `__FILE__' and `__LINE__': File Name and Line Number +------------------------------------------------------------ + +Like the C preprocessor, NASM allows the user to find out the file name +and line number containing the current instruction. The macro `__FILE__' +expands to a string constant giving the name of the current input file +(which may change through the course of assembly if `%include' +directives are used), and `__LINE__' expands to a numeric constant +giving the current line number in the input file. + + These macros could be used, for example, to communicate debugging +information to a macro, since invoking `__LINE__' inside a macro +definition (either single-line or multi-line) will return the line +number of the macro _call_, rather than _definition_. So to determine +where in a piece of code a crash is occurring, for example, one could +write a routine `stillhere', which is passed a line number in `EAX' and +outputs something like `line 155: still here'. You could then write a +macro + + %macro notdeadyet 0 + + push eax + mov eax,__LINE__ + call stillhere + pop eax + + %endmacro + + and then pepper your code with calls to `notdeadyet' until you find +the crash point. + + +File: nasm.info, Node: Section 4.11.5, Next: Section 4.11.6, Prev: Section 4.11.4, Up: Section 4.11 + +4.11.5. `__BITS__': Current BITS Mode +------------------------------------- + +The `__BITS__' standard macro is updated every time that the BITS mode +is set using the `BITS XX' or `[BITS XX]' directive, where XX is a +valid mode number of 16, 32 or 64. `__BITS__' receives the specified +mode number and makes it globally available. This can be very useful for +those who utilize mode-dependent macros. + + +File: nasm.info, Node: Section 4.11.6, Next: Section 4.11.7, Prev: Section 4.11.5, Up: Section 4.11 + +4.11.6. `__OUTPUT_FORMAT__': Current Output Format +-------------------------------------------------- + +The `__OUTPUT_FORMAT__' standard macro holds the current Output Format, +as given by the `-f' option or NASM's default. Type `nasm -hf' for a +list. + + %ifidn __OUTPUT_FORMAT__, win32 + %define NEWLINE 13, 10 + %elifidn __OUTPUT_FORMAT__, elf32 + %define NEWLINE 10 + %endif + + +File: nasm.info, Node: Section 4.11.7, Next: Section 4.11.8, Prev: Section 4.11.6, Up: Section 4.11 + +4.11.7. Assembly Date and Time Macros +------------------------------------- + +NASM provides a variety of macros that represent the timestamp of the +assembly session. + + * The `__DATE__' and `__TIME__' macros give the assembly date and + time as strings, in ISO 8601 format (`"YYYY-MM-DD"' and + `"HH:MM:SS"', respectively.) + + * The `__DATE_NUM__' and `__TIME_NUM__' macros give the assembly + date and time in numeric form; in the format `YYYYMMDD' and + `HHMMSS' respectively. + + * The `__UTC_DATE__' and `__UTC_TIME__' macros give the assembly + date and time in universal time (UTC) as strings, in ISO 8601 + format (`"YYYY-MM-DD"' and `"HH:MM:SS"', respectively.) If the host + platform doesn't provide UTC time, these macros are undefined. + + * The `__UTC_DATE_NUM__' and `__UTC_TIME_NUM__' macros give the + assembly date and time universal time (UTC) in numeric form; in + the format `YYYYMMDD' and `HHMMSS' respectively. If the host + platform doesn't provide UTC time, these macros are undefined. + + * The `__POSIX_TIME__' macro is defined as a number containing the + number of seconds since the POSIX epoch, 1 January 1970 00:00:00 + UTC; excluding any leap seconds. This is computed using UTC time + if available on the host platform, otherwise it is computed using + the local time as if it was UTC. + + All instances of time and date macros in the same assembly session +produce consistent output. For example, in an assembly session started +at 42 seconds after midnight on January 1, 2010 in Moscow (timezone +UTC+3) these macros would have the following values, assuming, of +course, a properly configured environment with a correct clock: + + __DATE__ "2010-01-01" + __TIME__ "00:00:42" + __DATE_NUM__ 20100101 + __TIME_NUM__ 000042 + __UTC_DATE__ "2009-12-31" + __UTC_TIME__ "21:00:42" + __UTC_DATE_NUM__ 20091231 + __UTC_TIME_NUM__ 210042 + __POSIX_TIME__ 1262293242 + + +File: nasm.info, Node: Section 4.11.8, Next: Section 4.11.9, Prev: Section 4.11.7, Up: Section 4.11 + +4.11.8. `__USE_'_package_`__': Package Include Test +--------------------------------------------------- + +When a standard macro package (see *note Chapter 5::) is included with +the `%use' directive (see *note Section 4.6.4::), a single-line macro +of the form `__USE_'_package_`__' is automatically defined. This allows +testing if a particular package is invoked or not. + + For example, if the `altreg' package is included (see *note Section +5.1::), then the macro `__USE_ALTREG__' is defined. + + +File: nasm.info, Node: Section 4.11.9, Next: Section 4.11.10, Prev: Section 4.11.8, Up: Section 4.11 + +4.11.9. `__PASS__': Assembly Pass +--------------------------------- + +The macro `__PASS__' is defined to be `1' on preparatory passes, and +`2' on the final pass. In preprocess-only mode, it is set to `3', and +when running only to generate dependencies (due to the `-M' or `-MG' +option, see *note Section 2.1.4::) it is set to `0'. + + _Avoid using this macro if at all possible. It is tremendously easy +to generate very strange errors by misusing it, and the semantics may +change in future versions of NASM._ + + +File: nasm.info, Node: Section 4.11.10, Next: Section 4.11.11, Prev: Section 4.11.9, Up: Section 4.11 + +4.11.10. `STRUC' and `ENDSTRUC': Declaring Structure Data Types +--------------------------------------------------------------- + +The core of NASM contains no intrinsic means of defining data +structures; instead, the preprocessor is sufficiently powerful that +data structures can be implemented as a set of macros. The macros +`STRUC' and `ENDSTRUC' are used to define a structure data type. + + `STRUC' takes one or two parameters. The first parameter is the name +of the data type. The second, optional parameter is the base offset of +the structure. The name of the data type is defined as a symbol with +the value of the base offset, and the name of the data type with the +suffix `_size' appended to it is defined as an `EQU' giving the size of +the structure. Once `STRUC' has been issued, you are defining the +structure, and should define fields using the `RESB' family of pseudo- +instructions, and then invoke `ENDSTRUC' to finish the definition. + + For example, to define a structure called `mytype' containing a +longword, a word, a byte and a string of bytes, you might code + + struc mytype + + mt_long: resd 1 + mt_word: resw 1 + mt_byte: resb 1 + mt_str: resb 32 + + endstruc + + The above code defines six symbols: `mt_long' as 0 (the offset from +the beginning of a `mytype' structure to the longword field), `mt_word' +as 4, `mt_byte' as 6, `mt_str' as 7, `mytype_size' as 39, and `mytype' +itself as zero. + + The reason why the structure type name is defined at zero by default +is a side effect of allowing structures to work with the local label +mechanism: if your structure members tend to have the same names in +more than one structure, you can define the above structure like this: + + struc mytype + + .long: resd 1 + .word: resw 1 + .byte: resb 1 + .str: resb 32 + + endstruc + + This defines the offsets to the structure fields as `mytype.long', +`mytype.word', `mytype.byte' and `mytype.str'. + + NASM, since it has no _intrinsic_ structure support, does not support +any form of period notation to refer to the elements of a structure once +you have one (except the above local-label notation), so code such as +`mov ax,[mystruc.mt_word]' is not valid. `mt_word' is a constant just +like any other constant, so the correct syntax is `mov +ax,[mystruc+mt_word]' or `mov ax,[mystruc+mytype.word]'. + + Sometimes you only have the address of the structure displaced by an +offset. For example, consider this standard stack frame setup: + + push ebp + mov ebp, esp + sub esp, 40 + + In this case, you could access an element by subtracting the offset: + + mov [ebp - 40 + mytype.word], ax + + However, if you do not want to repeat this offset, you can use -40 +as a base offset: + + struc mytype, -40 + + And access an element this way: + + mov [ebp + mytype.word], ax + + +File: nasm.info, Node: Section 4.11.11, Next: Section 4.11.12, Prev: Section 4.11.10, Up: Section 4.11 + +4.11.11. `ISTRUC', `AT' and `IEND': Declaring Instances of Structures +--------------------------------------------------------------------- + +Having defined a structure type, the next thing you typically want to +do is to declare instances of that structure in your data segment. NASM +provides an easy way to do this in the `ISTRUC' mechanism. To declare a +structure of type `mytype' in a program, you code something like this: + + mystruc: + istruc mytype + + at mt_long, dd 123456 + at mt_word, dw 1024 + at mt_byte, db 'x' + at mt_str, db 'hello, world', 13, 10, 0 + + iend + + The function of the `AT' macro is to make use of the `TIMES' prefix +to advance the assembly position to the correct point for the specified +structure field, and then to declare the specified data. Therefore the +structure fields must be declared in the same order as they were +specified in the structure definition. + + If the data to go in a structure field requires more than one source +line to specify, the remaining source lines can easily come after the +`AT' line. For example: + + at mt_str, db 123,134,145,156,167,178,189 + db 190,100,0 + + Depending on personal taste, you can also omit the code part of the +`AT' line completely, and start the structure field on the next line: + + at mt_str + db 'hello, world' + db 13,10,0 + + +File: nasm.info, Node: Section 4.11.12, Next: Chapter 5, Prev: Section 4.11.11, Up: Section 4.11 + +4.11.12. `ALIGN' and `ALIGNB': Data Alignment +--------------------------------------------- + +The `ALIGN' and `ALIGNB' macros provides a convenient way to align code +or data on a word, longword, paragraph or other boundary. (Some +assemblers call this directive `EVEN'.) The syntax of the `ALIGN' and +`ALIGNB' macros is + + align 4 ; align on 4-byte boundary + align 16 ; align on 16-byte boundary + align 8,db 0 ; pad with 0s rather than NOPs + align 4,resb 1 ; align to 4 in the BSS + alignb 4 ; equivalent to previous line + + Both macros require their first argument to be a power of two; they +both compute the number of additional bytes required to bring the +length of the current section up to a multiple of that power of two, +and then apply the `TIMES' prefix to their second argument to perform +the alignment. + + If the second argument is not specified, the default for `ALIGN' is +`NOP', and the default for `ALIGNB' is `RESB 1'. So if the second +argument is specified, the two macros are equivalent. Normally, you can +just use `ALIGN' in code and data sections and `ALIGNB' in BSS +sections, and never need the second argument except for special +purposes. + + `ALIGN' and `ALIGNB', being simple macros, perform no error +checking: they cannot warn you if their first argument fails to be a +power of two, or if their second argument generates more than one byte +of code. In each of these cases they will silently do the wrong thing. + + `ALIGNB' (or `ALIGN' with a second argument of `RESB 1') can be used +within structure definitions: + + struc mytype2 + + mt_byte: + resb 1 + alignb 2 + mt_word: + resw 1 + alignb 4 + mt_long: + resd 1 + mt_str: + resb 32 + + endstruc + + This will ensure that the structure members are sensibly aligned +relative to the base of the structure. + + A final caveat: `ALIGN' and `ALIGNB' work relative to the beginning +of the _section_, not the beginning of the address space in the final +executable. Aligning to a 16-byte boundary when the section you're in +is only guaranteed to be aligned to a 4-byte boundary, for example, is +a waste of effort. Again, NASM does not check that the section's +alignment characteristics are sensible for the use of `ALIGN' or +`ALIGNB'. + + See also the `smartalign' standard macro package, *note Section +5.2::. + + +File: nasm.info, Node: Chapter 5, Next: Section 5.1, Prev: Section 4.11.12, Up: Top + +Chapter 5: Standard Macro Packages +********************************** + +The `%use' directive (see *note Section 4.6.4::) includes one of the +standard macro packages included with the NASM distribution and compiled +into the NASM binary. It operates like the `%include' directive (see +*note Section 4.6.1::), but the included contents is provided by NASM +itself. + + The names of standard macro packages are case insensitive, and can be +quoted or not. + +* Menu: + +* Section 5.1:: `altreg': Alternate Register Names +* Section 5.2:: `smartalign': Smart `ALIGN' Macro + + +File: nasm.info, Node: Section 5.1, Next: Section 5.2, Prev: Chapter 5, Up: Chapter 5 + +5.1. `altreg': Alternate Register Names +======================================= + +The `altreg' standard macro package provides alternate register names. +It provides numeric register names for all registers (not just `R8'- +`R15'), the Intel-defined aliases `R8L'-`R15L' for the low bytes of +register (as opposed to the NASM/AMD standard names `R8B'- `R15B'), and +the names `R0H'-`R3H' (by analogy with `R0L'-`R3L') for `AH', `CH', +`DH', and `BH'. + + Example use: + + %use altreg + + proc: + mov r0l,r3h ; mov al,bh + ret + + See also *note Section 11.1::. + + +File: nasm.info, Node: Section 5.2, Next: Chapter 6, Prev: Section 5.1, Up: Chapter 5 + +5.2. `smartalign': Smart `ALIGN' Macro +====================================== + +The `smartalign' standard macro package provides for an `ALIGN' macro +which is more powerful than the default (and backwards-compatible) one +(see *note Section 4.11.12::). When the `smartalign' package is +enabled, when `ALIGN' is used without a second argument, NASM will +generate a sequence of instructions more efficient than a series of +`NOP'. Furthermore, if the padding exceeds a specific threshold, then +NASM will generate a jump over the entire padding sequence. + + The specific instructions generated can be controlled with the new +`ALIGNMODE' macro. This macro takes two parameters: one mode, and an +optional jump threshold override. The modes are as follows: + + * `generic': Works on all x86 CPUs and should have reasonable + performance. The default jump threshold is 8. This is the default. + + * `nop': Pad out with `NOP' instructions. The only difference + compared to the standard `ALIGN' macro is that NASM can still jump + over a large padding area. The default jump threshold is 16. + + * `k7': Optimize for the AMD K7 (Athlon/Althon XP). These + instructions should still work on all x86 CPUs. The default jump + threshold is 16. + + * `k8': Optimize for the AMD K8 (Opteron/Althon 64). These + instructions should still work on all x86 CPUs. The default jump + threshold is 16. + + * `p6': Optimize for Intel CPUs. This uses the long `NOP' + instructions first introduced in Pentium Pro. This is incompatible + with all CPUs of family 5 or lower, as well as some VIA CPUs and + several virtualization solutions. The default jump threshold is 16. + + The macro `__ALIGNMODE__' is defined to contain the current alignment +mode. A number of other macros beginning with `__ALIGN_' are used +internally by this macro package. + + +File: nasm.info, Node: Chapter 6, Next: Section 6.1, Prev: Section 5.2, Up: Top + +Chapter 6: Assembler Directives +******************************* + +NASM, though it attempts to avoid the bureaucracy of assemblers like +MASM and TASM, is nevertheless forced to support a _few_ directives. +These are described in this chapter. + + NASM's directives come in two types: _user-level_ directives and +_primitive_ directives. Typically, each directive has a user-level form +and a primitive form. In almost all cases, we recommend that users use +the user-level forms of the directives, which are implemented as macros +which call the primitive forms. + + Primitive directives are enclosed in square brackets; user-level +directives are not. + + In addition to the universal directives described in this chapter, +each object file format can optionally supply extra directives in order +to control particular features of that file format. These +_format-specific_ directives are documented along with the formats that +implement them, in *note Chapter 7::. + +* Menu: + +* Section 6.1:: `BITS': Specifying Target Processor Mode +* Section 6.2:: `DEFAULT': Change the assembler defaults +* Section 6.3:: `SECTION' or `SEGMENT': Changing and Defining Sections +* Section 6.4:: `ABSOLUTE': Defining Absolute Labels +* Section 6.5:: `EXTERN': Importing Symbols from Other Modules +* Section 6.6:: `GLOBAL': Exporting Symbols to Other Modules +* Section 6.7:: `COMMON': Defining Common Data Areas +* Section 6.8:: `CPU': Defining CPU Dependencies +* Section 6.9:: `FLOAT': Handling of floating-point constants + + +File: nasm.info, Node: Section 6.1, Next: Section 6.1.1, Prev: Chapter 6, Up: Chapter 6 + +6.1. `BITS': Specifying Target Processor Mode +============================================= + +The `BITS' directive specifies whether NASM should generate code +designed to run on a processor operating in 16-bit mode, 32-bit mode or +64- bit mode. The syntax is `BITS XX', where XX is 16, 32 or 64. + + In most cases, you should not need to use `BITS' explicitly. The +`aout', `coff', `elf', `macho', `win32' and `win64' object formats, +which are designed for use in 32-bit or 64-bit operating systems, all +cause NASM to select 32-bit or 64-bit mode, respectively, by default. +The `obj' object format allows you to specify each segment you define +as either `USE16' or `USE32', and NASM will set its operating mode +accordingly, so the use of the `BITS' directive is once again +unnecessary. + + The most likely reason for using the `BITS' directive is to write 32- +bit or 64-bit code in a flat binary file; this is because the `bin' +output format defaults to 16-bit mode in anticipation of it being used +most frequently to write DOS `.COM' programs, DOS `.SYS' device drivers +and boot loader software. + + You do _not_ need to specify `BITS 32' merely in order to use 32- +bit instructions in a 16-bit DOS program; if you do, the assembler will +generate incorrect code because it will be writing code targeted at a +32- bit platform, to be run on a 16-bit one. + + When NASM is in `BITS 16' mode, instructions which use 32-bit data +are prefixed with an 0x66 byte, and those referring to 32-bit addresses +have an 0x67 prefix. In `BITS 32' mode, the reverse is true: 32-bit +instructions require no prefixes, whereas instructions using 16-bit data +need an 0x66 and those working on 16-bit addresses need an 0x67. + + When NASM is in `BITS 64' mode, most instructions operate the same as +they do for `BITS 32' mode. However, there are 8 more general and SSE +registers, and 16-bit addressing is no longer supported. + + The default address size is 64 bits; 32-bit addressing can be +selected with the 0x67 prefix. The default operand size is still 32 +bits, however, and the 0x66 prefix selects 16-bit operand size. The +`REX' prefix is used both to select 64-bit operand size, and to access +the new registers. NASM automatically inserts REX prefixes when +necessary. + + When the `REX' prefix is used, the processor does not know how to +address the AH, BH, CH or DH (high 8-bit legacy) registers. Instead, it +is possible to access the the low 8-bits of the SP, BP SI and DI +registers as SPL, BPL, SIL and DIL, respectively; but only when the REX +prefix is used. + + The `BITS' directive has an exactly equivalent primitive form, +`[BITS 16]', `[BITS 32]' and `[BITS 64]'. The user-level form is a +macro which has no function other than to call the primitive form. + + Note that the space is neccessary, e.g. `BITS32' will _not_ work! + +* Menu: + +* Section 6.1.1:: `USE16' & `USE32': Aliases for BITS + + +File: nasm.info, Node: Section 6.1.1, Next: Section 6.2, Prev: Section 6.1, Up: Section 6.1 + +6.1.1. `USE16' & `USE32': Aliases for BITS +------------------------------------------ + +The ``USE16'' and ``USE32'' directives can be used in place of ``BITS +16'' and ``BITS 32'', for compatibility with other assemblers. + + +File: nasm.info, Node: Section 6.2, Next: Section 6.3, Prev: Section 6.1.1, Up: Chapter 6 + +6.2. `DEFAULT': Change the assembler defaults +============================================= + +The `DEFAULT' directive changes the assembler defaults. Normally, NASM +defaults to a mode where the programmer is expected to explicitly +specify most features directly. However, this is occationally +obnoxious, as the explicit form is pretty much the only one one wishes +to use. + + Currently, the only `DEFAULT' that is settable is whether or not +registerless instructions in 64-bit mode are `RIP'-relative or not. By +default, they are absolute unless overridden with the `REL' specifier +(see *note Section 3.3::). However, if `DEFAULT REL' is specified, +`REL' is default, unless overridden with the `ABS' specifier, _except +when used with an FS or GS segment override_. + + The special handling of `FS' and `GS' overrides are due to the fact +that these registers are generally used as thread pointers or other +special functions in 64-bit mode, and generating `RIP'-relative +addresses would be extremely confusing. + + `DEFAULT REL' is disabled with `DEFAULT ABS'. + + +File: nasm.info, Node: Section 6.3, Next: Section 6.3.1, Prev: Section 6.2, Up: Chapter 6 + +6.3. `SECTION' or `SEGMENT': Changing and Defining Sections +=========================================================== + +The `SECTION' directive (`SEGMENT' is an exactly equivalent synonym) +changes which section of the output file the code you write will be +assembled into. In some object file formats, the number and names of +sections are fixed; in others, the user may make up as many as they +wish. Hence `SECTION' may sometimes give an error message, or may +define a new section, if you try to switch to a section that does not +(yet) exist. + + The Unix object formats, and the `bin' object format (but see *note +Section 7.1.3::, all support the standardized section names `.text', +`.data' and `.bss' for the code, data and uninitialized-data sections. +The `obj' format, by contrast, does not recognize these section names +as being special, and indeed will strip off the leading period of any +section name that has one. + +* Menu: + +* Section 6.3.1:: The `__SECT__' Macro + + +File: nasm.info, Node: Section 6.3.1, Next: Section 6.4, Prev: Section 6.3, Up: Section 6.3 + +6.3.1. The `__SECT__' Macro +--------------------------- + +The `SECTION' directive is unusual in that its user-level form +functions differently from its primitive form. The primitive form, +`[SECTION xyz]', simply switches the current target section to the one +given. The user-level form, `SECTION xyz', however, first defines the +single-line macro `__SECT__' to be the primitive `[SECTION]' directive +which it is about to issue, and then issues it. So the user-level +directive + + SECTION .text + + expands to the two lines + + %define __SECT__ [SECTION .text] + [SECTION .text] + + Users may find it useful to make use of this in their own macros. For +example, the `writefile' macro defined in *note Section 4.3.4:: can be +usefully rewritten in the following more sophisticated form: + + %macro writefile 2+ + + [section .data] + + %%str: db %2 + %%endstr: + + __SECT__ + + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + This form of the macro, once passed a string to output, first +switches temporarily to the data section of the file, using the +primitive form of the `SECTION' directive so as not to modify +`__SECT__'. It then declares its string in the data section, and then +invokes `__SECT__' to switch back to _whichever_ section the user was +previously working in. It thus avoids the need, in the previous version +of the macro, to include a `JMP' instruction to jump over the data, and +also does not fail if, in a complicated `OBJ' format module, the user +could potentially be assembling the code in any of several separate code +sections. + + +File: nasm.info, Node: Section 6.4, Next: Section 6.5, Prev: Section 6.3.1, Up: Chapter 6 + +6.4. `ABSOLUTE': Defining Absolute Labels +========================================= + +The `ABSOLUTE' directive can be thought of as an alternative form of +`SECTION': it causes the subsequent code to be directed at no physical +section, but at the hypothetical section starting at the given absolute +address. The only instructions you can use in this mode are the `RESB' +family. + + `ABSOLUTE' is used as follows: + + absolute 0x1A + + kbuf_chr resw 1 + kbuf_free resw 1 + kbuf resw 16 + + This example describes a section of the PC BIOS data area, at segment +address 0x40: the above code defines `kbuf_chr' to be 0x1A, `kbuf_free' +to be 0x1C, and `kbuf' to be 0x1E. + + The user-level form of `ABSOLUTE', like that of `SECTION', redefines +the `__SECT__' macro when it is invoked. + + `STRUC' and `ENDSTRUC' are defined as macros which use `ABSOLUTE' +(and also `__SECT__'). + + `ABSOLUTE' doesn't have to take an absolute constant as an argument: +it can take an expression (actually, a critical expression: see *note +Section 3.8::) and it can be a value in a segment. For example, a TSR +can re-use its setup code as run-time BSS like this: + + org 100h ; it's a .COM program + + jmp setup ; setup code comes last + + ; the resident part of the TSR goes here + setup: + ; now write the code that installs the TSR here + + absolute setup + + runtimevar1 resw 1 + runtimevar2 resd 20 + + tsr_end: + + This defines some variables `on top of' the setup code, so that +after the setup has finished running, the space it took up can be +re-used as data storage for the running TSR. The symbol `tsr_end' can +be used to calculate the total size of the part of the TSR that needs +to be made resident. + + +File: nasm.info, Node: Section 6.5, Next: Section 6.6, Prev: Section 6.4, Up: Chapter 6 + +6.5. `EXTERN': Importing Symbols from Other Modules +=================================================== + +`EXTERN' is similar to the MASM directive `EXTRN' and the C keyword +`extern': it is used to declare a symbol which is not defined anywhere +in the module being assembled, but is assumed to be defined in some +other module and needs to be referred to by this one. Not every +object-file format can support external variables: the `bin' format +cannot. + + The `EXTERN' directive takes as many arguments as you like. Each +argument is the name of a symbol: + + extern _printf + extern _sscanf,_fscanf + + Some object-file formats provide extra features to the `EXTERN' +directive. In all cases, the extra features are used by suffixing a +colon to the symbol name followed by object-format specific text. For +example, the `obj' format allows you to declare that the default +segment base of an external should be the group `dgroup' by means of +the directive + + extern _variable:wrt dgroup + + The primitive form of `EXTERN' differs from the user-level form only +in that it can take only one argument at a time: the support for +multiple arguments is implemented at the preprocessor level. + + You can declare the same variable as `EXTERN' more than once: NASM +will quietly ignore the second and later redeclarations. You can't +declare a variable as `EXTERN' as well as something else, though. + + +File: nasm.info, Node: Section 6.6, Next: Section 6.7, Prev: Section 6.5, Up: Chapter 6 + +6.6. `GLOBAL': Exporting Symbols to Other Modules +================================================= + +`GLOBAL' is the other end of `EXTERN': if one module declares a symbol +as `EXTERN' and refers to it, then in order to prevent linker errors, +some other module must actually _define_ the symbol and declare it as +`GLOBAL'. Some assemblers use the name `PUBLIC' for this purpose. + + The `GLOBAL' directive applying to a symbol must appear _before_ the +definition of the symbol. + + `GLOBAL' uses the same syntax as `EXTERN', except that it must refer +to symbols which _are_ defined in the same module as the `GLOBAL' +directive. For example: + + global _main + _main: + ; some code + + `GLOBAL', like `EXTERN', allows object formats to define private +extensions by means of a colon. The `elf' object format, for example, +lets you specify whether global data items are functions or data: + + global hashlookup:function, hashtable:data + + Like `EXTERN', the primitive form of `GLOBAL' differs from the +user-level form only in that it can take only one argument at a time. + + +File: nasm.info, Node: Section 6.7, Next: Section 6.8, Prev: Section 6.6, Up: Chapter 6 + +6.7. `COMMON': Defining Common Data Areas +========================================= + +The `COMMON' directive is used to declare _common variables_. A common +variable is much like a global variable declared in the uninitialized +data section, so that + + common intvar 4 + + is similar in function to + + global intvar + section .bss + + intvar resd 1 + + The difference is that if more than one module defines the same +common variable, then at link time those variables will be _merged_, and +references to `intvar' in all modules will point at the same piece of +memory. + + Like `GLOBAL' and `EXTERN', `COMMON' supports object-format specific +extensions. For example, the `obj' format allows common variables to be +NEAR or FAR, and the `elf' format allows you to specify the alignment +requirements of a common variable: + + common commvar 4:near ; works in OBJ + common intarray 100:4 ; works in ELF: 4 byte aligned + + Once again, like `EXTERN' and `GLOBAL', the primitive form of +`COMMON' differs from the user-level form only in that it can take only +one argument at a time. + + +File: nasm.info, Node: Section 6.8, Next: Section 6.9, Prev: Section 6.7, Up: Chapter 6 + +6.8. `CPU': Defining CPU Dependencies +===================================== + +The `CPU' directive restricts assembly to those instructions which are +available on the specified CPU. + + Options are: + + * `CPU 8086' Assemble only 8086 instruction set + + * `CPU 186' Assemble instructions up to the 80186 instruction set + + * `CPU 286' Assemble instructions up to the 286 instruction set + + * `CPU 386' Assemble instructions up to the 386 instruction set + + * `CPU 486' 486 instruction set + + * `CPU 586' Pentium instruction set + + * `CPU PENTIUM' Same as 586 + + * `CPU 686' P6 instruction set + + * `CPU PPRO' Same as 686 + + * `CPU P2' Same as 686 + + * `CPU P3' Pentium III (Katmai) instruction sets + + * `CPU KATMAI' Same as P3 + + * `CPU P4' Pentium 4 (Willamette) instruction set + + * `CPU WILLAMETTE' Same as P4 + + * `CPU PRESCOTT' Prescott instruction set + + * `CPU X64' x86-64 (x64/AMD64/Intel 64) instruction set + + * `CPU IA64' IA64 CPU (in x86 mode) instruction set + + All options are case insensitive. All instructions will be selected +only if they apply to the selected CPU or lower. By default, all +instructions are available. + + +File: nasm.info, Node: Section 6.9, Next: Chapter 7, Prev: Section 6.8, Up: Chapter 6 + +6.9. `FLOAT': Handling of floating-point constants +================================================== + +By default, floating-point constants are rounded to nearest, and IEEE +denormals are supported. The following options can be set to alter this +behaviour: + + * `FLOAT DAZ' Flush denormals to zero + + * `FLOAT NODAZ' Do not flush denormals to zero (default) + + * `FLOAT NEAR' Round to nearest (default) + + * `FLOAT UP' Round up (toward +Infinity) + + * `FLOAT DOWN' Round down (toward -Infinity) + + * `FLOAT ZERO' Round toward zero + + * `FLOAT DEFAULT' Restore default settings + + The standard macros `__FLOAT_DAZ__', `__FLOAT_ROUND__', and +`__FLOAT__' contain the current state, as long as the programmer has +avoided the use of the brackeded primitive form, (`[FLOAT]'). + + `__FLOAT__' contains the full set of floating-point settings; this +value can be saved away and invoked later to restore the setting. + + +File: nasm.info, Node: Chapter 7, Next: Section 7.1, Prev: Section 6.9, Up: Top + +Chapter 7: Output Formats +************************* + +NASM is a portable assembler, designed to be able to compile on any +ANSI C- supporting platform and produce output to run on a variety of +Intel x86 operating systems. For this reason, it has a large number of +available output formats, selected using the `-f' option on the NASM +command line. Each of these formats, along with its extensions to the +base NASM syntax, is detailed in this chapter. + + As stated in *note Section 2.1.1::, NASM chooses a default name for +your output file based on the input file name and the chosen output +format. This will be generated by removing the extension (`.asm', `.s', +or whatever you like to use) from the input file name, and substituting +an extension defined by the output format. The extensions are given +with each format below. + +* Menu: + +* Section 7.1:: `bin': Flat-Form Binary Output +* Section 7.2:: `ith': Intel Hex Output +* Section 7.3:: `srec': Motorola S-Records Output +* Section 7.4:: `obj': Microsoft OMF Object Files +* Section 7.5:: `win32': Microsoft Win32 Object Files +* Section 7.6:: `win64': Microsoft Win64 Object Files +* Section 7.7:: `coff': Common Object File Format +* Section 7.8:: `macho32' and `macho64': Mach Object File Format +* Section 7.9:: `elf32' and `elf64': Executable and Linkable Format Object Files +* Section 7.10:: `aout': Linux `a.out' Object Files +* Section 7.11:: `aoutb': NetBSD/FreeBSD/OpenBSD `a.out' Object Files +* Section 7.12:: `as86': Minix/Linux `as86' Object Files +* Section 7.13:: `rdf': Relocatable Dynamic Object File Format +* Section 7.14:: `dbg': Debugging Format + + +File: nasm.info, Node: Section 7.1, Next: Section 7.1.1, Prev: Chapter 7, Up: Chapter 7 + +7.1. `bin': Flat-Form Binary Output +=================================== + +The `bin' format does not produce object files: it generates nothing in +the output file except the code you wrote. Such `pure binary' files are +used by MS-DOS: `.COM' executables and `.SYS' device drivers are pure +binary files. Pure binary output is also useful for operating system +and boot loader development. + + The `bin' format supports multiple section names. For details of how +NASM handles sections in the `bin' format, see *note Section 7.1.3::. + + Using the `bin' format puts NASM by default into 16-bit mode (see +*note Section 6.1::). In order to use `bin' to write 32-bit or 64-bit +code, such as an OS kernel, you need to explicitly issue the `BITS 32' +or `BITS 64' directive. + + `bin' has no default output file name extension: instead, it leaves +your file name as it is once the original extension has been removed. +Thus, the default is for NASM to assemble `binprog.asm' into a binary +file called `binprog'. + +* Menu: + +* Section 7.1.1:: `ORG': Binary File Program Origin +* Section 7.1.2:: `bin' Extensions to the `SECTION' Directive +* Section 7.1.3:: Multisection Support for the `bin' Format +* Section 7.1.4:: Map Files + + +File: nasm.info, Node: Section 7.1.1, Next: Section 7.1.2, Prev: Section 7.1, Up: Section 7.1 + +7.1.1. `ORG': Binary File Program Origin +---------------------------------------- + +The `bin' format provides an additional directive to the list given in +*note Chapter 6::: `ORG'. The function of the `ORG' directive is to +specify the origin address which NASM will assume the program begins at +when it is loaded into memory. + + For example, the following code will generate the longword +`0x00000104': + + org 0x100 + dd label + label: + + Unlike the `ORG' directive provided by MASM-compatible assemblers, +which allows you to jump around in the object file and overwrite code +you have already generated, NASM's `ORG' does exactly what the directive +says: _origin_. Its sole function is to specify one offset which is +added to all internal address references within the section; it does not +permit any of the trickery that MASM's version does. See *note Section +12.1.3:: for further comments. + + +File: nasm.info, Node: Section 7.1.2, Next: Section 7.1.3, Prev: Section 7.1.1, Up: Section 7.1 + +7.1.2. `bin' Extensions to the `SECTION' Directive +-------------------------------------------------- + +The `bin' output format extends the `SECTION' (or `SEGMENT') directive +to allow you to specify the alignment requirements of segments. This +is done by appending the `ALIGN' qualifier to the end of the +section-definition line. For example, + + section .data align=16 + + switches to the section `.data' and also specifies that it must be +aligned on a 16-byte boundary. + + The parameter to `ALIGN' specifies how many low bits of the section +start address must be forced to zero. The alignment value given may be +any power of two. + + +File: nasm.info, Node: Section 7.1.3, Next: Section 7.1.4, Prev: Section 7.1.2, Up: Section 7.1 + +7.1.3. Multisection Support for the `bin' Format +------------------------------------------------ + +The `bin' format allows the use of multiple sections, of arbitrary +names, besides the "known" `.text', `.data', and `.bss' names. + + * Sections may be designated `progbits' or `nobits'. Default is + `progbits' (except `.bss', which defaults to `nobits', of course). + + * Sections can be aligned at a specified boundary following the + previous section with `align=', or at an arbitrary byte-granular + position with `start='. + + * Sections can be given a virtual start address, which will be used + for the calculation of all memory references within that section + with `vstart='. + + * Sections can be ordered using `follows='`<section>' or + `vfollows='`<section>' as an alternative to specifying an explicit + start address. + + * Arguments to `org', `start', `vstart', and `align=' are critical + expressions. See *note Section 3.8::. E.g. `align=(1 << + ALIGN_SHIFT)' - `ALIGN_SHIFT' must be defined before it is used + here. + + * Any code which comes before an explicit `SECTION' directive is + directed by default into the `.text' section. + + * If an `ORG' statement is not given, `ORG 0' is used by default. + + * The `.bss' section will be placed after the last `progbits' + section, unless `start=', `vstart=', `follows=', or `vfollows=' + has been specified. + + * All sections are aligned on dword boundaries, unless a different + alignment has been specified. + + * Sections may not overlap. + + * NASM creates the `section.<secname>.start' for each section, which + may be used in your code. + + +File: nasm.info, Node: Section 7.1.4, Next: Section 7.2, Prev: Section 7.1.3, Up: Section 7.1 + +7.1.4. Map Files +---------------- + +Map files can be generated in `-f bin' format by means of the `[map]' +option. Map types of `all' (default), `brief', `sections', `segments', +or `symbols' may be specified. Output may be directed to `stdout' +(default), `stderr', or a specified file. E.g. `[map symbols +myfile.map]'. No "user form" exists, the square brackets must be used. + + +File: nasm.info, Node: Section 7.2, Next: Section 7.3, Prev: Section 7.1.4, Up: Chapter 7 + +7.2. `ith': Intel Hex Output +============================ + +The `ith' file format produces Intel hex-format files. Just as the +`bin' format, this is a flat memory image format with no support for +relocation or linking. It is usually used with ROM programmers and +similar utilities. + + All extensions supported by the `bin' file format is also supported +by the `ith' file format. + + `ith' provides a default output file-name extension of `.ith'. + + +File: nasm.info, Node: Section 7.3, Next: Section 7.4, Prev: Section 7.2, Up: Chapter 7 + +7.3. `srec': Motorola S-Records Output +====================================== + +The `srec' file format produces Motorola S-records files. Just as the +`bin' format, this is a flat memory image format with no support for +relocation or linking. It is usually used with ROM programmers and +similar utilities. + + All extensions supported by the `bin' file format is also supported +by the `srec' file format. + + `srec' provides a default output file-name extension of `.srec'. + + +File: nasm.info, Node: Section 7.4, Next: Section 7.4.1, Prev: Section 7.3, Up: Chapter 7 + +7.4. `obj': Microsoft OMF Object Files +====================================== + +The `obj' file format (NASM calls it `obj' rather than `omf' for +historical reasons) is the one produced by MASM and TASM, which is +typically fed to 16-bit DOS linkers to produce `.EXE' files. It is also +the format used by OS/2. + + `obj' provides a default output file-name extension of `.obj'. + + `obj' is not exclusively a 16-bit format, though: NASM has full +support for the 32-bit extensions to the format. In particular, 32-bit +`obj' format files are used by Borland's Win32 compilers, instead of +using Microsoft's newer `win32' object file format. + + The `obj' format does not define any special segment names: you can +call your segments anything you like. Typical names for segments in +`obj' format files are `CODE', `DATA' and `BSS'. + + If your source file contains code before specifying an explicit +`SEGMENT' directive, then NASM will invent its own segment called +`__NASMDEFSEG' for you. + + When you define a segment in an `obj' file, NASM defines the segment +name as a symbol as well, so that you can access the segment address of +the segment. So, for example: + + segment data + + dvar: dw 1234 + + segment code + + function: + mov ax,data ; get segment address of data + mov ds,ax ; and move it into DS + inc word [dvar] ; now this reference will work + ret + + The `obj' format also enables the use of the `SEG' and `WRT' +operators, so that you can write code which does things like + + extern foo + + mov ax,seg foo ; get preferred segment of foo + mov ds,ax + mov ax,data ; a different segment + mov es,ax + mov ax,[ds:foo] ; this accesses `foo' + mov [es:foo wrt data],bx ; so does this + +* Menu: + +* Section 7.4.1:: `obj' Extensions to the `SEGMENT' Directive +* Section 7.4.2:: `GROUP': Defining Groups of Segments +* Section 7.4.3:: `UPPERCASE': Disabling Case Sensitivity in Output +* Section 7.4.4:: `IMPORT': Importing DLL Symbols +* Section 7.4.5:: `EXPORT': Exporting DLL Symbols +* Section 7.4.6:: `..start': Defining the Program Entry Point +* Section 7.4.7:: `obj' Extensions to the `EXTERN' Directive +* Section 7.4.8:: `obj' Extensions to the `COMMON' Directive + + +File: nasm.info, Node: Section 7.4.1, Next: Section 7.4.2, Prev: Section 7.4, Up: Section 7.4 + +7.4.1. `obj' Extensions to the `SEGMENT' Directive +-------------------------------------------------- + +The `obj' output format extends the `SEGMENT' (or `SECTION') directive +to allow you to specify various properties of the segment you are +defining. This is done by appending extra qualifiers to the end of the +segment-definition line. For example, + + segment code private align=16 + + defines the segment `code', but also declares it to be a private +segment, and requires that the portion of it described in this code +module must be aligned on a 16-byte boundary. + + The available qualifiers are: + + * `PRIVATE', `PUBLIC', `COMMON' and `STACK' specify the combination + characteristics of the segment. `PRIVATE' segments do not get + combined with any others by the linker; `PUBLIC' and `STACK' + segments get concatenated together at link time; and `COMMON' + segments all get overlaid on top of each other rather than stuck + end-to-end. + + * `ALIGN' is used, as shown above, to specify how many low bits of + the segment start address must be forced to zero. The alignment + value given may be any power of two from 1 to 4096; in reality, + the only values supported are 1, 2, 4, 16, 256 and 4096, so if 8 + is specified it will be rounded up to 16, and 32, 64 and 128 will + all be rounded up to 256, and so on. Note that alignment to + 4096-byte boundaries is a PharLap extension to the format and may + not be supported by all linkers. + + * `CLASS' can be used to specify the segment class; this feature + indicates to the linker that segments of the same class should be + placed near each other in the output file. The class name can be + any word, e.g. `CLASS=CODE'. + + * `OVERLAY', like `CLASS', is specified with an arbitrary word as an + argument, and provides overlay information to an overlay-capable + linker. + + * Segments can be declared as `USE16' or `USE32', which has the + effect of recording the choice in the object file and also + ensuring that NASM's default assembly mode when assembling in that + segment is 16-bit or 32-bit respectively. + + * When writing OS/2 object files, you should declare 32-bit segments + as `FLAT', which causes the default segment base for anything in + the segment to be the special group `FLAT', and also defines the + group if it is not already defined. + + * The `obj' file format also allows segments to be declared as + having a pre-defined absolute segment address, although no linkers + are currently known to make sensible use of this feature; + nevertheless, NASM allows you to declare a segment such as + `SEGMENT SCREEN ABSOLUTE=0xB800' if you need to. The `ABSOLUTE' + and `ALIGN' keywords are mutually exclusive. + + NASM's default segment attributes are `PUBLIC', `ALIGN=1', no class, +no overlay, and `USE16'. + + +File: nasm.info, Node: Section 7.4.2, Next: Section 7.4.3, Prev: Section 7.4.1, Up: Section 7.4 + +7.4.2. `GROUP': Defining Groups of Segments +------------------------------------------- + +The `obj' format also allows segments to be grouped, so that a single +segment register can be used to refer to all the segments in a group. +NASM therefore supplies the `GROUP' directive, whereby you can code + + segment data + + ; some data + + segment bss + + ; some uninitialized data + + group dgroup data bss + + which will define a group called `dgroup' to contain the segments +`data' and `bss'. Like `SEGMENT', `GROUP' causes the group name to be +defined as a symbol, so that you can refer to a variable `var' in the +`data' segment as `var wrt data' or as `var wrt dgroup', depending on +which segment value is currently in your segment register. + + If you just refer to `var', however, and `var' is declared in a +segment which is part of a group, then NASM will default to giving you +the offset of `var' from the beginning of the _group_, not the +_segment_. Therefore `SEG var', also, will return the group base rather +than the segment base. + + NASM will allow a segment to be part of more than one group, but will +generate a warning if you do this. Variables declared in a segment +which is part of more than one group will default to being relative to +the first group that was defined to contain the segment. + + A group does not have to contain any segments; you can still make +`WRT' references to a group which does not contain the variable you are +referring to. OS/2, for example, defines the special group `FLAT' with +no segments in it. + + +File: nasm.info, Node: Section 7.4.3, Next: Section 7.4.4, Prev: Section 7.4.2, Up: Section 7.4 + +7.4.3. `UPPERCASE': Disabling Case Sensitivity in Output +-------------------------------------------------------- + +Although NASM itself is case sensitive, some OMF linkers are not; +therefore it can be useful for NASM to output single-case object files. +The `UPPERCASE' format-specific directive causes all segment, group and +symbol names that are written to the object file to be forced to upper +case just before being written. Within a source file, NASM is still +case- sensitive; but the object file can be written entirely in upper +case if desired. + + `UPPERCASE' is used alone on a line; it requires no parameters. + + +File: nasm.info, Node: Section 7.4.4, Next: Section 7.4.5, Prev: Section 7.4.3, Up: Section 7.4 + +7.4.4. `IMPORT': Importing DLL Symbols +-------------------------------------- + +The `IMPORT' format-specific directive defines a symbol to be imported +from a DLL, for use if you are writing a DLL's import library in NASM. +You still need to declare the symbol as `EXTERN' as well as using the +`IMPORT' directive. + + The `IMPORT' directive takes two required parameters, separated by +white space, which are (respectively) the name of the symbol you wish to +import and the name of the library you wish to import it from. For +example: + + import WSAStartup wsock32.dll + + A third optional parameter gives the name by which the symbol is +known in the library you are importing it from, in case this is not the +same as the name you wish the symbol to be known by to your code once +you have imported it. For example: + + import asyncsel wsock32.dll WSAAsyncSelect + + +File: nasm.info, Node: Section 7.4.5, Next: Section 7.4.6, Prev: Section 7.4.4, Up: Section 7.4 + +7.4.5. `EXPORT': Exporting DLL Symbols +-------------------------------------- + +The `EXPORT' format-specific directive defines a global symbol to be +exported as a DLL symbol, for use if you are writing a DLL in NASM. You +still need to declare the symbol as `GLOBAL' as well as using the +`EXPORT' directive. + + `EXPORT' takes one required parameter, which is the name of the +symbol you wish to export, as it was defined in your source file. An +optional second parameter (separated by white space from the first) +gives the _external_ name of the symbol: the name by which you wish the +symbol to be known to programs using the DLL. If this name is the same +as the internal name, you may leave the second parameter off. + + Further parameters can be given to define attributes of the exported +symbol. These parameters, like the second, are separated by white +space. If further parameters are given, the external name must also be +specified, even if it is the same as the internal name. The available +attributes are: + + * `resident' indicates that the exported name is to be kept resident + by the system loader. This is an optimisation for frequently used + symbols imported by name. + + * `nodata' indicates that the exported symbol is a function which + does not make use of any initialized data. + + * `parm=NNN', where `NNN' is an integer, sets the number of + parameter words for the case in which the symbol is a call gate + between 32- bit and 16-bit segments. + + * An attribute which is just a number indicates that the symbol + should be exported with an identifying number (ordinal), and gives + the desired number. + + For example: + + export myfunc + export myfunc TheRealMoreFormalLookingFunctionName + export myfunc myfunc 1234 ; export by ordinal + export myfunc myfunc resident parm=23 nodata + + +File: nasm.info, Node: Section 7.4.6, Next: Section 7.4.7, Prev: Section 7.4.5, Up: Section 7.4 + +7.4.6. `..start': Defining the Program Entry Point +-------------------------------------------------- + +`OMF' linkers require exactly one of the object files being linked to +define the program entry point, where execution will begin when the +program is run. If the object file that defines the entry point is +assembled using NASM, you specify the entry point by declaring the +special symbol `..start' at the point where you wish execution to begin. + + +File: nasm.info, Node: Section 7.4.7, Next: Section 7.4.8, Prev: Section 7.4.6, Up: Section 7.4 + +7.4.7. `obj' Extensions to the `EXTERN' Directive +------------------------------------------------- + +If you declare an external symbol with the directive + + extern foo + + then references such as `mov ax,foo' will give you the offset of +`foo' from its preferred segment base (as specified in whichever module +`foo' is actually defined in). So to access the contents of `foo' you +will usually need to do something like + + mov ax,seg foo ; get preferred segment base + mov es,ax ; move it into ES + mov ax,[es:foo] ; and use offset `foo' from it + + This is a little unwieldy, particularly if you know that an external +is going to be accessible from a given segment or group, say `dgroup'. +So if `DS' already contained `dgroup', you could simply code + + mov ax,[foo wrt dgroup] + + However, having to type this every time you want to access `foo' can +be a pain; so NASM allows you to declare `foo' in the alternative form + + extern foo:wrt dgroup + + This form causes NASM to pretend that the preferred segment base of +`foo' is in fact `dgroup'; so the expression `seg foo' will now return +`dgroup', and the expression `foo' is equivalent to `foo wrt dgroup'. + + This default-`WRT' mechanism can be used to make externals appear to +be relative to any group or segment in your program. It can also be +applied to common variables: see *note Section 7.4.8::. + + +File: nasm.info, Node: Section 7.4.8, Next: Section 7.5, Prev: Section 7.4.7, Up: Section 7.4 + +7.4.8. `obj' Extensions to the `COMMON' Directive +------------------------------------------------- + +The `obj' format allows common variables to be either near or far; NASM +allows you to specify which your variables should be by the use of the +syntax + + common nearvar 2:near ; `nearvar' is a near common + common farvar 10:far ; and `farvar' is far + + Far common variables may be greater in size than 64Kb, and so the OMF +specification says that they are declared as a number of _elements_ of +a given size. So a 10-byte far common variable could be declared as ten +one-byte elements, five two-byte elements, two five-byte elements or one +ten-byte element. + + Some `OMF' linkers require the element size, as well as the variable +size, to match when resolving common variables declared in more than one +module. Therefore NASM must allow you to specify the element size on +your far common variables. This is done by the following syntax: + + common c_5by2 10:far 5 ; two five-byte elements + common c_2by5 10:far 2 ; five two-byte elements + + If no element size is specified, the default is 1. Also, the `FAR' +keyword is not required when an element size is specified, since only +far commons may have element sizes at all. So the above declarations +could equivalently be + + common c_5by2 10:5 ; two five-byte elements + common c_2by5 10:2 ; five two-byte elements + + In addition to these extensions, the `COMMON' directive in `obj' +also supports default-`WRT' specification like `EXTERN' does (explained +in *note Section 7.4.7::). So you can also declare things like + + common foo 10:wrt dgroup + common bar 16:far 2:wrt data + common baz 24:wrt data:6 + + +File: nasm.info, Node: Section 7.5, Next: Section 7.5.1, Prev: Section 7.4.8, Up: Chapter 7 + +7.5. `win32': Microsoft Win32 Object Files +========================================== + +The `win32' output format generates Microsoft Win32 object files, +suitable for passing to Microsoft linkers such as Visual C++. Note that +Borland Win32 compilers do not use this format, but use `obj' instead +(see *note Section 7.4::). + + `win32' provides a default output file-name extension of `.obj'. + + Note that although Microsoft say that Win32 object files follow the +`COFF' (Common Object File Format) standard, the object files produced +by Microsoft Win32 compilers are not compatible with COFF linkers such +as DJGPP's, and vice versa. This is due to a difference of opinion over +the precise semantics of PC-relative relocations. To produce COFF files +suitable for DJGPP, use NASM's `coff' output format; conversely, the +`coff' format does not produce object files that Win32 linkers can +generate correct output from. + +* Menu: + +* Section 7.5.1:: `win32' Extensions to the `SECTION' Directive +* Section 7.5.2:: `win32': Safe Structured Exception Handling + + +File: nasm.info, Node: Section 7.5.1, Next: Section 7.5.2, Prev: Section 7.5, Up: Section 7.5 + +7.5.1. `win32' Extensions to the `SECTION' Directive +---------------------------------------------------- + +Like the `obj' format, `win32' allows you to specify additional +information on the `SECTION' directive line, to control the type and +properties of sections you declare. Section types and properties are +generated automatically by NASM for the standard section names `.text', +`.data' and `.bss', but may still be overridden by these qualifiers. + + The available qualifiers are: + + * `code', or equivalently `text', defines the section to be a code + section. This marks the section as readable and executable, but not + writable, and also indicates to the linker that the type of the + section is code. + + * `data' and `bss' define the section to be a data section, + analogously to `code'. Data sections are marked as readable and + writable, but not executable. `data' declares an initialized data + section, whereas `bss' declares an uninitialized data section. + + * `rdata' declares an initialized data section that is readable but + not writable. Microsoft compilers use this section to place + constants in it. + + * `info' defines the section to be an informational section, which is + not included in the executable file by the linker, but may (for + example) pass information _to_ the linker. For example, declaring + an `info'-type section called `.drectve' causes the linker to + interpret the contents of the section as command-line options. + + * `align=', used with a trailing number as in `obj', gives the + alignment requirements of the section. The maximum you may specify + is 64: the Win32 object file format contains no means to request a + greater section alignment than this. If alignment is not + explicitly specified, the defaults are 16-byte alignment for code + sections, 8-byte alignment for rdata sections and 4-byte alignment + for data (and BSS) sections. Informational sections get a default + alignment of 1 byte (no alignment), though the value does not + matter. + + The defaults assumed by NASM if you do not specify the above +qualifiers are: + + section .text code align=16 + section .data data align=4 + section .rdata rdata align=8 + section .bss bss align=4 + + Any other section name is treated by default like `.text'. + + +File: nasm.info, Node: Section 7.5.2, Next: Section 7.6, Prev: Section 7.5.1, Up: Section 7.5 + +7.5.2. `win32': Safe Structured Exception Handling +-------------------------------------------------- + +Among other improvements in Windows XP SP2 and Windows Server 2003 +Microsoft has introduced concept of "safe structured exception +handling." General idea is to collect handlers' entry points in +designated read-only table and have alleged entry point verified +against this table prior exception control is passed to the handler. In +order for an executable module to be equipped with such "safe exception +handler table," all object modules on linker command line has to comply +with certain criteria. If one single module among them does not, then +the table in question is omitted and above mentioned run-time checks +will not be performed for application in question. Table omission is by +default silent and therefore can be easily overlooked. One can instruct +linker to refuse to produce binary without such table by passing +`/safeseh' command line option. + + Without regard to this run-time check merits it's natural to expect +NASM to be capable of generating modules suitable for `/safeseh' +linking. From developer's viewpoint the problem is two-fold: + + * how to adapt modules not deploying exception handlers of their own; + + * how to adapt/develop modules utilizing custom exception handling; + + Former can be easily achieved with any NASM version by adding +following line to source code: + + $@feat.00 equ 1 + + As of version 2.03 NASM adds this absolute symbol automatically. If +it's not already present to be precise. I.e. if for whatever reason +developer would choose to assign another value in source file, it would +still be perfectly possible. + + Registering custom exception handler on the other hand requires +certain "magic." As of version 2.03 additional directive is implemented, +`safeseh', which instructs the assembler to produce appropriately +formatted input data for above mentioned "safe exception handler table." +Its typical use would be: + + section .text + extern _MessageBoxA@16 + %if __NASM_VERSION_ID__ >= 0x02030000 + safeseh handler ; register handler as "safe handler" + %endif + handler: + push DWORD 1 ; MB_OKCANCEL + push DWORD caption + push DWORD text + push DWORD 0 + call _MessageBoxA@16 + sub eax,1 ; incidentally suits as return value + ; for exception handler + ret + global _main + _main: + push DWORD handler + push DWORD [fs:0] + mov DWORD [fs:0],esp ; engage exception handler + xor eax,eax + mov eax,DWORD[eax] ; cause exception + pop DWORD [fs:0] ; disengage exception handler + add esp,4 + ret + text: db 'OK to rethrow, CANCEL to generate core dump',0 + caption:db 'SEGV',0 + + section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' + + As you might imagine, it's perfectly possible to produce .exe binary +with "safe exception handler table" and yet engage unregistered +exception handler. Indeed, handler is engaged by simply manipulating +`[fs:0]' location at run-time, something linker has no power over, +run-time that is. It should be explicitly mentioned that such failure +to register handler's entry point with `safeseh' directive has +undesired side effect at run- time. If exception is raised and +unregistered handler is to be executed, the application is abruptly +terminated without any notification whatsoever. One can argue that +system could at least have logged some kind "non-safe exception handler +in x.exe at address n" message in event log, but no, literally no +notification is provided and user is left with no clue on what caused +application failure. + + Finally, all mentions of linker in this paragraph refer to Microsoft +linker version 7.x and later. Presence of `@feat.00' symbol and input +data for "safe exception handler table" causes no backward +incompatibilities and "safeseh" modules generated by NASM 2.03 and +later can still be linked by earlier versions or non-Microsoft linkers. + + +File: nasm.info, Node: Section 7.6, Next: Section 7.6.1, Prev: Section 7.5.2, Up: Chapter 7 + +7.6. `win64': Microsoft Win64 Object Files +========================================== + +The `win64' output format generates Microsoft Win64 object files, which +is nearly 100% identical to the `win32' object format (*note Section +7.5::) with the exception that it is meant to target 64-bit code and +the x86-64 platform altogether. This object file is used exactly the +same as the `win32' object format (*note Section 7.5::), in NASM, with +regard to this exception. + +* Menu: + +* Section 7.6.1:: `win64': Writing Position-Independent Code +* Section 7.6.2:: `win64': Structured Exception Handling + + +File: nasm.info, Node: Section 7.6.1, Next: Section 7.6.2, Prev: Section 7.6, Up: Section 7.6 + +7.6.1. `win64': Writing Position-Independent Code +------------------------------------------------- + +While `REL' takes good care of RIP-relative addressing, there is one +aspect that is easy to overlook for a Win64 programmer: indirect +references. Consider a switch dispatch table: + + jmp QWORD[dsptch+rax*8] + ... + dsptch: dq case0 + dq case1 + ... + + Even novice Win64 assembler programmer will soon realize that the +code is not 64-bit savvy. Most notably linker will refuse to link it +with "`'ADDR32' relocation to '.text' invalid without +/LARGEADDRESSAWARE:NO'". So [s]he will have to split jmp instruction +as following: + + lea rbx,[rel dsptch] + jmp QWORD[rbx+rax*8] + + What happens behind the scene is that effective address in `lea' is +encoded relative to instruction pointer, or in perfectly position- +independent manner. But this is only part of the problem! Trouble is +that in .dll context `caseN' relocations will make their way to the +final module and might have to be adjusted at .dll load time. To be +specific when it can't be loaded at preferred address. And when this +occurs, pages with such relocations will be rendered private to current +process, which kind of undermines the idea of sharing .dll. But no +worry, it's trivial to fix: + + lea rbx,[rel dsptch] + add rbx,QWORD[rbx+rax*8] + jmp rbx + ... + dsptch: dq case0-dsptch + dq case1-dsptch + ... + + NASM version 2.03 and later provides another alternative, `wrt +..imagebase' operator, which returns offset from base address of the +current image, be it .exe or .dll module, therefore the name. For those +acquainted with PE-COFF format base address denotes start of +`IMAGE_DOS_HEADER' structure. Here is how to implement switch with +these image-relative references: + + lea rbx,[rel dsptch] + mov eax,DWORD[rbx+rax*4] + sub rbx,dsptch wrt ..imagebase + add rbx,rax + jmp rbx + ... + dsptch: dd case0 wrt ..imagebase + dd case1 wrt ..imagebase + + One can argue that the operator is redundant. Indeed, snippet before +last works just fine with any NASM version and is not even Windows +specific... The real reason for implementing `wrt ..imagebase' will +become apparent in next paragraph. + + It should be noted that `wrt ..imagebase' is defined as 32-bit +operand only: + + dd label wrt ..imagebase ; ok + dq label wrt ..imagebase ; bad + mov eax,label wrt ..imagebase ; ok + mov rax,label wrt ..imagebase ; bad + + +File: nasm.info, Node: Section 7.6.2, Next: Section 7.7, Prev: Section 7.6.1, Up: Section 7.6 + +7.6.2. `win64': Structured Exception Handling +--------------------------------------------- + +Structured exception handing in Win64 is completely different matter +from Win32. Upon exception program counter value is noted, and +linker-generated table comprising start and end addresses of all the +functions [in given executable module] is traversed and compared to the +saved program counter. Thus so called `UNWIND_INFO' structure is +identified. If it's not found, then offending subroutine is assumed to +be "leaf" and just mentioned lookup procedure is attempted for its +caller. In Win64 leaf function is such function that does not call any +other function _nor_ modifies any Win64 non-volatile registers, +including stack pointer. The latter ensures that it's possible to +identify leaf function's caller by simply pulling the value from the +top of the stack. + + While majority of subroutines written in assembler are not calling +any other function, requirement for non-volatile registers' +immutability leaves developer with not more than 7 registers and no +stack frame, which is not necessarily what [s]he counted with. +Customarily one would meet the requirement by saving non-volatile +registers on stack and restoring them upon return, so what can go +wrong? If [and only if] an exception is raised at run-time and no +`UNWIND_INFO' structure is associated with such "leaf" function, the +stack unwind procedure will expect to find caller's return address on +the top of stack immediately followed by its frame. Given that +developer pushed caller's non-volatile registers on stack, would the +value on top point at some code segment or even addressable space? Well, +developer can attempt copying caller's return address to the top of +stack and this would actually work in some very specific circumstances. +But unless developer can guarantee that these circumstances are always +met, it's more appropriate to assume worst case scenario, i.e. stack +unwind procedure going berserk. Relevant question is what happens then? +Application is abruptly terminated without any notification whatsoever. +Just like in Win32 case, one can argue that system could at least have +logged "unwind procedure went berserk in x.exe at address n" in event +log, but no, no trace of failure is left. + + Now, when we understand significance of the `UNWIND_INFO' structure, +let's discuss what's in it and/or how it's processed. First of all it is +checked for presence of reference to custom language-specific exception +handler. If there is one, then it's invoked. Depending on the return +value, execution flow is resumed (exception is said to be "handled"), +_or_ rest of `UNWIND_INFO' structure is processed as following. Beside +optional reference to custom handler, it carries information about +current callee's stack frame and where non-volatile registers are saved. +Information is detailed enough to be able to reconstruct contents of +caller's non-volatile registers upon call to current callee. And so +caller's context is reconstructed, and then unwind procedure is +repeated, i.e. another `UNWIND_INFO' structure is associated, this +time, with caller's instruction pointer, which is then checked for +presence of reference to language-specific handler, etc. The procedure +is recursively repeated till exception is handled. As last resort +system "handles" it by generating memory core dump and terminating the +application. + + As for the moment of this writing NASM unfortunately does not +facilitate generation of above mentioned detailed information about +stack frame layout. But as of version 2.03 it implements building +blocks for generating structures involved in stack unwinding. As +simplest example, here is how to deploy custom exception handler for +leaf function: + + default rel + section .text + extern MessageBoxA + handler: + sub rsp,40 + mov rcx,0 + lea rdx,[text] + lea r8,[caption] + mov r9,1 ; MB_OKCANCEL + call MessageBoxA + sub eax,1 ; incidentally suits as return value + ; for exception handler + add rsp,40 + ret + global main + main: + xor rax,rax + mov rax,QWORD[rax] ; cause exception + ret + main_end: + text: db 'OK to rethrow, CANCEL to generate core dump',0 + caption:db 'SEGV',0 + + section .pdata rdata align=4 + dd main wrt ..imagebase + dd main_end wrt ..imagebase + dd xmain wrt ..imagebase + section .xdata rdata align=8 + xmain: db 9,0,0,0 + dd handler wrt ..imagebase + section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' + + What you see in `.pdata' section is element of the "table comprising +start and end addresses of function" along with reference to associated +`UNWIND_INFO' structure. And what you see in `.xdata' section is +`UNWIND_INFO' structure describing function with no frame, but with +designated exception handler. References are _required_ to be image- +relative (which is the real reason for implementing `wrt ..imagebase' +operator). It should be noted that `rdata align=n', as well as `wrt +..imagebase', are optional in these two segments' contexts, i.e. can +be omitted. Latter means that _all_ 32-bit references, not only above +listed required ones, placed into these two segments turn out image- +relative. Why is it important to understand? Developer is allowed to +append handler-specific data to `UNWIND_INFO' structure, and if [s]he +adds a 32-bit reference, then [s]he will have to remember to adjust its +value to obtain the real pointer. + + As already mentioned, in Win64 terms leaf function is one that does +not call any other function _nor_ modifies any non-volatile register, +including stack pointer. But it's not uncommon that assembler programmer +plans to utilize every single register and sometimes even have variable +stack frame. Is there anything one can do with bare building blocks? +I.e. besides manually composing fully-fledged `UNWIND_INFO' structure, +which would surely be considered error-prone? Yes, there is. Recall that +exception handler is called first, before stack layout is analyzed. As +it turned out, it's perfectly possible to manipulate current callee's +context in custom handler in manner that permits further stack +unwinding. General idea is that handler would not actually "handle" the +exception, but instead restore callee's context, as it was at its entry +point and thus mimic leaf function. In other words, handler would +simply undertake part of unwinding procedure. Consider following +example: + + function: + mov rax,rsp ; copy rsp to volatile register + push r15 ; save non-volatile registers + push rbx + push rbp + mov r11,rsp ; prepare variable stack frame + sub r11,rcx + and r11,-64 + mov QWORD[r11],rax ; check for exceptions + mov rsp,r11 ; allocate stack frame + mov QWORD[rsp],rax ; save original rsp value + magic_point: + ... + mov r11,QWORD[rsp] ; pull original rsp value + mov rbp,QWORD[r11-24] + mov rbx,QWORD[r11-16] + mov r15,QWORD[r11-8] + mov rsp,r11 ; destroy frame + ret + + The keyword is that up to `magic_point' original `rsp' value remains +in chosen volatile register and no non-volatile register, except for +`rsp', is modified. While past `magic_point' `rsp' remains constant +till the very end of the `function'. In this case custom +language-specific exception handler would look like this: + + EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, + CONTEXT *context,DISPATCHER_CONTEXT *disp) + { ULONG64 *rsp; + if (context->Rip<(ULONG64)magic_point) + rsp = (ULONG64 *)context->Rax; + else + { rsp = ((ULONG64 **)context->Rsp)[0]; + context->Rbp = rsp[-3]; + context->Rbx = rsp[-2]; + context->R15 = rsp[-1]; + } + context->Rsp = (ULONG64)rsp; + + memcpy (disp->ContextRecord,context,sizeof(CONTEXT)); + RtlVirtualUnwind(UNW_FLAG_NHANDLER,disp->ImageBase, + dips->ControlPc,disp->FunctionEntry,disp->ContextRecord, + &disp->HandlerData,&disp->EstablisherFrame,NULL); + return ExceptionContinueSearch; + } + + As custom handler mimics leaf function, corresponding `UNWIND_INFO' +structure does not have to contain any information about stack frame and +its layout. + + +File: nasm.info, Node: Section 7.7, Next: Section 7.8, Prev: Section 7.6.2, Up: Chapter 7 + +7.7. `coff': Common Object File Format +====================================== + +The `coff' output type produces `COFF' object files suitable for +linking with the DJGPP linker. + + `coff' provides a default output file-name extension of `.o'. + + The `coff' format supports the same extensions to the `SECTION' +directive as `win32' does, except that the `align' qualifier and the +`info' section type are not supported. + + +File: nasm.info, Node: Section 7.8, Next: Section 7.9, Prev: Section 7.7, Up: Chapter 7 + +7.8. `macho32' and `macho64': Mach Object File Format +===================================================== + +The `macho32' and `macho64' output formts produces `Mach-O' object +files suitable for linking with the MacOS X linker. `macho' is a +synonym for `macho32'. + + `macho' provides a default output file-name extension of `.o'. + + +File: nasm.info, Node: Section 7.9, Next: Section 7.9.1, Prev: Section 7.8, Up: Chapter 7 + +7.9. `elf32' and `elf64': Executable and Linkable Format Object Files +===================================================================== + +The `elf32' and `elf64' output formats generate `ELF32 and ELF64' +(Executable and Linkable Format) object files, as used by Linux as well +as Unix System V, including Solaris x86, UnixWare and SCO Unix. `elf' +provides a default output file-name extension of `.o'. `elf' is a +synonym for `elf32'. + +* Menu: + +* Section 7.9.1:: ELF specific directive `osabi' +* Section 7.9.2:: `elf' Extensions to the `SECTION' Directive +* Section 7.9.3:: Position-Independent Code: `elf' Special Symbols and `WRT' +* Section 7.9.4:: Thread Local Storage: `elf' Special Symbols and `WRT' +* Section 7.9.5:: `elf' Extensions to the `GLOBAL' Directive +* Section 7.9.6:: `elf' Extensions to the `COMMON' Directive +* Section 7.9.7:: 16-bit code and ELF +* Section 7.9.8:: Debug formats and ELF + + +File: nasm.info, Node: Section 7.9.1, Next: Section 7.9.2, Prev: Section 7.9, Up: Section 7.9 + +7.9.1. ELF specific directive `osabi' +------------------------------------- + +The ELF header specifies the application binary interface for the target +operating system (OSABI). This field can be set by using the `osabi' +directive with the numeric value (0-255) of the target system. If this +directive is not used, the default value will be "UNIX System V ABI" (0) +which will work on most systems which support ELF. + + +File: nasm.info, Node: Section 7.9.2, Next: Section 7.9.3, Prev: Section 7.9.1, Up: Section 7.9 + +7.9.2. `elf' Extensions to the `SECTION' Directive +-------------------------------------------------- + +Like the `obj' format, `elf' allows you to specify additional +information on the `SECTION' directive line, to control the type and +properties of sections you declare. Section types and properties are +generated automatically by NASM for the standard section names, but may +still be overridden by these qualifiers. + + The available qualifiers are: + + * `alloc' defines the section to be one which is loaded into memory + when the program is run. `noalloc' defines it to be one which is + not, such as an informational or comment section. + + * `exec' defines the section to be one which should have execute + permission when the program is run. `noexec' defines it as one + which should not. + + * `write' defines the section to be one which should be writable when + the program is run. `nowrite' defines it as one which should not. + + * `progbits' defines the section to be one with explicit contents + stored in the object file: an ordinary code or data section, for + example, `nobits' defines the section to be one with no explicit + contents given, such as a BSS section. + + * `align=', used with a trailing number as in `obj', gives the + alignment requirements of the section. + + * `tls' defines the section to be one which contains thread local + variables. + + The defaults assumed by NASM if you do not specify the above +qualifiers are: + + section .text progbits alloc exec nowrite align=16 + section .rodata progbits alloc noexec nowrite align=4 + section .lrodata progbits alloc noexec nowrite align=4 + section .data progbits alloc noexec write align=4 + section .ldata progbits alloc noexec write align=4 + section .bss nobits alloc noexec write align=4 + section .lbss nobits alloc noexec write align=4 + section .tdata progbits alloc noexec write align=4 tls + section .tbss nobits alloc noexec write align=4 tls + section .comment progbits noalloc noexec nowrite align=1 + section other progbits alloc noexec nowrite align=1 + + (Any section name other than those in the above table is treated by +default like `other' in the above table. Please note that section names +are case sensitive.) + + +File: nasm.info, Node: Section 7.9.3, Next: Section 7.9.4, Prev: Section 7.9.2, Up: Section 7.9 + +7.9.3. Position-Independent Code: `elf' Special Symbols and `WRT' +----------------------------------------------------------------- + +The `ELF' specification contains enough features to allow position- +independent code (PIC) to be written, which makes ELF shared libraries +very flexible. However, it also means NASM has to be able to generate a +variety of ELF specific relocation types in ELF object files, if it is +to be an assembler which can write PIC. + + Since `ELF' does not support segment-base references, the `WRT' +operator is not used for its normal purpose; therefore NASM's `elf' +output format makes use of `WRT' for a different purpose, namely the +PIC-specific relocation types. + + `elf' defines five special symbols which you can use as the +right-hand side of the `WRT' operator to obtain PIC relocation types. +They are `..gotpc', `..gotoff', `..got', `..plt' and `..sym'. Their +functions are summarized here: + + * Referring to the symbol marking the global offset table base using + `wrt ..gotpc' will end up giving the distance from the beginning of + the current section to the global offset table. + (`_GLOBAL_OFFSET_TABLE_' is the standard symbol name used to refer + to the GOT.) So you would then need to add `$$' to the result to + get the real address of the GOT. + + * Referring to a location in one of your own sections using `wrt + ..gotoff' will give the distance from the beginning of the GOT to + the specified location, so that adding on the address of the GOT + would give the real address of the location you wanted. + + * Referring to an external or global symbol using `wrt ..got' causes + the linker to build an entry _in_ the GOT containing the address + of the symbol, and the reference gives the distance from the + beginning of the GOT to the entry; so you can add on the address + of the GOT, load from the resulting address, and end up with the + address of the symbol. + + * Referring to a procedure name using `wrt ..plt' causes the linker + to build a procedure linkage table entry for the symbol, and the + reference gives the address of the PLT entry. You can only use + this in contexts which would generate a PC-relative relocation + normally (i.e. as the destination for `CALL' or `JMP'), since ELF + contains no relocation type to refer to PLT entries absolutely. + + * Referring to a symbol name using `wrt ..sym' causes NASM to write + an ordinary relocation, but instead of making the relocation + relative to the start of the section and then adding on the offset + to the symbol, it will write a relocation record aimed directly at + the symbol in question. The distinction is a necessary one due to + a peculiarity of the dynamic linker. + + A fuller explanation of how to use these relocation types to write +shared libraries entirely in NASM is given in *note Section 9.2::. + + +File: nasm.info, Node: Section 7.9.4, Next: Section 7.9.5, Prev: Section 7.9.3, Up: Section 7.9 + +7.9.4. Thread Local Storage: `elf' Special Symbols and `WRT' +------------------------------------------------------------ + + * In ELF32 mode, referring to an external or global symbol using + `wrt ..tlsie' causes the linker to build an entry _in_ the GOT + containing the offset of the symbol within the TLS block, so you + can access the value of the symbol with code such as: + + mov eax,[tid wrt ..tlsie] + mov [gs:eax],ebx + + * In ELF64 mode, referring to an external or global symbol using + `wrt ..gottpoff' causes the linker to build an entry _in_ the GOT + containing the offset of the symbol within the TLS block, so you + can access the value of the symbol with code such as: + + mov rax,[rel tid wrt ..gottpoff] + mov rcx,[fs:rax] + + +File: nasm.info, Node: Section 7.9.5, Next: Section 7.9.6, Prev: Section 7.9.4, Up: Section 7.9 + +7.9.5. `elf' Extensions to the `GLOBAL' Directive +------------------------------------------------- + +`ELF' object files can contain more information about a global symbol +than just its address: they can contain the size of the symbol and its +type as well. These are not merely debugger conveniences, but are +actually necessary when the program being written is a shared library. +NASM therefore supports some extensions to the `GLOBAL' directive, +allowing you to specify these features. + + You can specify whether a global variable is a function or a data +object by suffixing the name with a colon and the word `function' or +`data'. (`object' is a synonym for `data'.) For example: + + global hashlookup:function, hashtable:data + + exports the global symbol `hashlookup' as a function and `hashtable' +as a data object. + + Optionally, you can control the ELF visibility of the symbol. Just +add one of the visibility keywords: `default', `internal', `hidden', or +`protected'. The default is `default' of course. For example, to make +`hashlookup' hidden: + + global hashlookup:function hidden + + You can also specify the size of the data associated with the +symbol, as a numeric expression (which may involve labels, and even +forward references) after the type specifier. Like this: + + global hashtable:data (hashtable.end - hashtable) + + hashtable: + db this,that,theother ; some data here + .end: + + This makes NASM automatically calculate the length of the table and +place that information into the `ELF' symbol table. + + Declaring the type and size of global symbols is necessary when +writing shared library code. For more information, see *note Section +9.2.4::. + + +File: nasm.info, Node: Section 7.9.6, Next: Section 7.9.7, Prev: Section 7.9.5, Up: Section 7.9 + +7.9.6. `elf' Extensions to the `COMMON' Directive +------------------------------------------------- + +`ELF' also allows you to specify alignment requirements on common +variables. This is done by putting a number (which must be a power of +two) after the name and size of the common variable, separated (as +usual) by a colon. For example, an array of doublewords would benefit +from 4-byte alignment: + + common dwordarray 128:4 + + This declares the total size of the array to be 128 bytes, and +requires that it be aligned on a 4-byte boundary. + + +File: nasm.info, Node: Section 7.9.7, Next: Section 7.9.8, Prev: Section 7.9.6, Up: Section 7.9 + +7.9.7. 16-bit code and ELF +-------------------------- + +The `ELF32' specification doesn't provide relocations for 8- and 16- +bit values, but the GNU `ld' linker adds these as an extension. NASM +can generate GNU-compatible relocations, to allow 16-bit code to be +linked as ELF using GNU `ld'. If NASM is used with the +`-w+gnu-elf-extensions' option, a warning is issued when one of these +relocations is generated. + + +File: nasm.info, Node: Section 7.9.8, Next: Section 7.10, Prev: Section 7.9.7, Up: Section 7.9 + +7.9.8. Debug formats and ELF +---------------------------- + +`ELF32' and `ELF64' provide debug information in `STABS' and `DWARF' +formats. Line number information is generated for all executable +sections, but please note that only the ".text" section is executable +by default. + + +File: nasm.info, Node: Section 7.10, Next: Section 7.11, Prev: Section 7.9.8, Up: Chapter 7 + +7.10. `aout': Linux `a.out' Object Files +======================================== + +The `aout' format generates `a.out' object files, in the form used by +early Linux systems (current Linux systems use ELF, see *note Section +7.9::.) These differ from other `a.out' object files in that the magic +number in the first four bytes of the file is different; also, some +implementations of `a.out', for example NetBSD's, support +position-independent code, which Linux's implementation does not. + + `a.out' provides a default output file-name extension of `.o'. + + `a.out' is a very simple object format. It supports no special +directives, no special symbols, no use of `SEG' or `WRT', and no +extensions to any standard directives. It supports only the three +standard section names `.text', `.data' and `.bss'. + + +File: nasm.info, Node: Section 7.11, Next: Section 7.12, Prev: Section 7.10, Up: Chapter 7 + +7.11. `aoutb': NetBSD/FreeBSD/OpenBSD `a.out' Object Files +========================================================== + +The `aoutb' format generates `a.out' object files, in the form used by +the various free `BSD Unix' clones, `NetBSD', `FreeBSD' and `OpenBSD'. +For simple object files, this object format is exactly the same as +`aout' except for the magic number in the first four bytes of the file. +However, the `aoutb' format supports position-independent code in the +same way as the `elf' format, so you can use it to write `BSD' shared +libraries. + + `aoutb' provides a default output file-name extension of `.o'. + + `aoutb' supports no special directives, no special symbols, and only +the three standard section names `.text', `.data' and `.bss'. However, +it also supports the same use of `WRT' as `elf' does, to provide +position-independent code relocation types. See *note Section 7.9.3:: +for full documentation of this feature. + + `aoutb' also supports the same extensions to the `GLOBAL' directive +as `elf' does: see *note Section 7.9.5:: for documentation of this. + + +File: nasm.info, Node: Section 7.12, Next: Section 7.13, Prev: Section 7.11, Up: Chapter 7 + +7.12. `as86': Minix/Linux `as86' Object Files +============================================= + +The Minix/Linux 16-bit assembler `as86' has its own non-standard object +file format. Although its companion linker `ld86' produces something +close to ordinary `a.out' binaries as output, the object file format +used to communicate between `as86' and `ld86' is not itself `a.out'. + + NASM supports this format, just in case it is useful, as `as86'. +`as86' provides a default output file-name extension of `.o'. + + `as86' is a very simple object format (from the NASM user's point of +view). It supports no special directives, no use of `SEG' or `WRT', and +no extensions to any standard directives. It supports only the three +standard section names `.text', `.data' and `.bss'. The only special +symbol supported is `..start'. + + +File: nasm.info, Node: Section 7.13, Next: Section 7.13.1, Prev: Section 7.12, Up: Chapter 7 + +7.13. `rdf': Relocatable Dynamic Object File Format +=================================================== + +The `rdf' output format produces `RDOFF' object files. `RDOFF' +(Relocatable Dynamic Object File Format) is a home-grown object-file +format, designed alongside NASM itself and reflecting in its file +format the internal structure of the assembler. + + `RDOFF' is not used by any well-known operating systems. Those +writing their own systems, however, may well wish to use `RDOFF' as +their object format, on the grounds that it is designed primarily for +simplicity and contains very little file-header bureaucracy. + + The Unix NASM archive, and the DOS archive which includes sources, +both contain an `rdoff' subdirectory holding a set of RDOFF utilities: +an RDF linker, an `RDF' static-library manager, an RDF file dump +utility, and a program which will load and execute an RDF executable +under Linux. + + `rdf' supports only the standard section names `.text', `.data' and +`.bss'. + +* Menu: + +* Section 7.13.1:: Requiring a Library: The `LIBRARY' Directive +* Section 7.13.2:: Specifying a Module Name: The `MODULE' Directive +* Section 7.13.3:: `rdf' Extensions to the `GLOBAL' Directive +* Section 7.13.4:: `rdf' Extensions to the `EXTERN' Directive + + +File: nasm.info, Node: Section 7.13.1, Next: Section 7.13.2, Prev: Section 7.13, Up: Section 7.13 + +7.13.1. Requiring a Library: The `LIBRARY' Directive +---------------------------------------------------- + +`RDOFF' contains a mechanism for an object file to demand a given +library to be linked to the module, either at load time or run time. +This is done by the `LIBRARY' directive, which takes one argument which +is the name of the module: + + library mylib.rdl + + +File: nasm.info, Node: Section 7.13.2, Next: Section 7.13.3, Prev: Section 7.13.1, Up: Section 7.13 + +7.13.2. Specifying a Module Name: The `MODULE' Directive +-------------------------------------------------------- + +Special `RDOFF' header record is used to store the name of the module. +It can be used, for example, by run-time loader to perform dynamic +linking. `MODULE' directive takes one argument which is the name of +current module: + + module mymodname + + Note that when you statically link modules and tell linker to strip +the symbols from output file, all module names will be stripped too. To +avoid it, you should start module names with `$', like: + + module $kernel.core + + +File: nasm.info, Node: Section 7.13.3, Next: Section 7.13.4, Prev: Section 7.13.2, Up: Section 7.13 + +7.13.3. `rdf' Extensions to the `GLOBAL' Directive +-------------------------------------------------- + +`RDOFF' global symbols can contain additional information needed by the +static linker. You can mark a global symbol as exported, thus telling +the linker do not strip it from target executable or library file. Like +in `ELF', you can also specify whether an exported symbol is a procedure +(function) or data object. + + Suffixing the name with a colon and the word `export' you make the +symbol exported: + + global sys_open:export + + To specify that exported symbol is a procedure (function), you add +the word `proc' or `function' after declaration: + + global sys_open:export proc + + Similarly, to specify exported data object, add the word `data' or +`object' to the directive: + + global kernel_ticks:export data + + +File: nasm.info, Node: Section 7.13.4, Next: Section 7.14, Prev: Section 7.13.3, Up: Section 7.13 + +7.13.4. `rdf' Extensions to the `EXTERN' Directive +-------------------------------------------------- + +By default the `EXTERN' directive in `RDOFF' declares a "pure external" +symbol (i.e. the static linker will complain if such a symbol is not +resolved). To declare an "imported" symbol, which must be resolved +later during a dynamic linking phase, `RDOFF' offers an additional +`import' modifier. As in `GLOBAL', you can also specify whether an +imported symbol is a procedure (function) or data object. For example: + + library $libc + extern _open:import + extern _printf:import proc + extern _errno:import data + + Here the directive `LIBRARY' is also included, which gives the +dynamic linker a hint as to where to find requested symbols. + + +File: nasm.info, Node: Section 7.14, Next: Chapter 8, Prev: Section 7.13.4, Up: Chapter 7 + +7.14. `dbg': Debugging Format +============================= + +The `dbg' output format is not built into NASM in the default +configuration. If you are building your own NASM executable from the +sources, you can define `OF_DBG' in `output/outform.h' or on the +compiler command line, and obtain the `dbg' output format. + + The `dbg' format does not output an object file as such; instead, it +outputs a text file which contains a complete list of all the +transactions between the main body of NASM and the output-format back +end module. It is primarily intended to aid people who want to write +their own output drivers, so that they can get a clearer idea of the +various requests the main program makes of the output driver, and in +what order they happen. + + For simple files, one can easily use the `dbg' format like this: + + nasm -f dbg filename.asm + + which will generate a diagnostic file called `filename.dbg'. However, +this will not work well on files which were designed for a different +object format, because each object format defines its own macros +(usually user- level forms of directives), and those macros will not be +defined in the `dbg' format. Therefore it can be useful to run NASM +twice, in order to do the preprocessing with the native object format +selected: + + nasm -e -f rdf -o rdfprog.i rdfprog.asm + nasm -a -f dbg rdfprog.i + + This preprocesses `rdfprog.asm' into `rdfprog.i', keeping the `rdf' +object format selected in order to make sure RDF special directives are +converted into primitive form correctly. Then the preprocessed source +is fed through the `dbg' format to generate the final diagnostic output. + + This workaround will still typically not work for programs intended +for `obj' format, because the `obj' `SEGMENT' and `GROUP' directives +have side effects of defining the segment and group names as symbols; +`dbg' will not do this, so the program will not assemble. You will have +to work around that by defining the symbols yourself (using `EXTERN', +for example) if you really need to get a `dbg' trace of an +`obj'-specific source file. + + `dbg' accepts any section name and any directives at all, and logs +them all to its output file. + + +File: nasm.info, Node: Chapter 8, Next: Section 8.1, Prev: Section 7.14, Up: Top + +Chapter 8: Writing 16-bit Code (DOS, Windows 3/3.1) +*************************************************** + +This chapter attempts to cover some of the common issues encountered +when writing 16-bit code to run under `MS-DOS' or `Windows 3.x'. It +covers how to link programs to produce `.EXE' or `.COM' files, how to +write `.SYS' device drivers, and how to interface assembly language +code with 16-bit C compilers and with Borland Pascal. + +* Menu: + +* Section 8.1:: Producing `.EXE' Files +* Section 8.2:: Producing `.COM' Files +* Section 8.3:: Producing `.SYS' Files +* Section 8.4:: Interfacing to 16-bit C Programs +* Section 8.5:: Interfacing to Borland Pascal Programs + + +File: nasm.info, Node: Section 8.1, Next: Section 8.1.1, Prev: Chapter 8, Up: Chapter 8 + +8.1. Producing `.EXE' Files +=========================== + +Any large program written under DOS needs to be built as a `.EXE' file: +only `.EXE' files have the necessary internal structure required to +span more than one 64K segment. Windows programs, also, have to be built +as `.EXE' files, since Windows does not support the `.COM' format. + + In general, you generate `.EXE' files by using the `obj' output +format to produce one or more `.OBJ' files, and then linking them +together using a linker. However, NASM also supports the direct +generation of simple DOS `.EXE' files using the `bin' output format (by +using `DB' and `DW' to construct the `.EXE' file header), and a macro +package is supplied to do this. Thanks to Yann Guidon for contributing +the code for this. + + NASM may also support `.EXE' natively as another output format in +future releases. + +* Menu: + +* Section 8.1.1:: Using the `obj' Format To Generate `.EXE' Files +* Section 8.1.2:: Using the `bin' Format To Generate `.EXE' Files + + +File: nasm.info, Node: Section 8.1.1, Next: Section 8.1.2, Prev: Section 8.1, Up: Section 8.1 + +8.1.1. Using the `obj' Format To Generate `.EXE' Files +------------------------------------------------------ + +This section describes the usual method of generating `.EXE' files by +linking `.OBJ' files together. + + Most 16-bit programming language packages come with a suitable +linker; if you have none of these, there is a free linker called VAL, +available in `LZH' archive format from `x2ftp.oulu.fi'. An LZH archiver +can be found at `ftp.simtel.net'. There is another `free' linker +(though this one doesn't come with sources) called FREELINK, available +from `www.pcorner.com'. A third, `djlink', written by DJ Delorie, is +available at `www.delorie.com'. A fourth linker, `ALINK', written by +Anthony A.J. Williams, is available at `alink.sourceforge.net'. + + When linking several `.OBJ' files into a `.EXE' file, you should +ensure that exactly one of them has a start point defined (using the +`..start' special symbol defined by the `obj' format: see *note Section +7.4.6::). If no module defines a start point, the linker will not know +what value to give the entry-point field in the output file header; if +more than one defines a start point, the linker will not know _which_ +value to use. + + An example of a NASM source file which can be assembled to a `.OBJ' +file and linked on its own to a `.EXE' is given here. It demonstrates +the basic principles of defining a stack, initialising the segment +registers, and declaring a start point. This file is also provided in +the `test' subdirectory of the NASM archives, under the name +`objexe.asm'. + + segment code + + ..start: + mov ax,data + mov ds,ax + mov ax,stack + mov ss,ax + mov sp,stacktop + + This initial piece of code sets up `DS' to point to the data segment, +and initializes `SS' and `SP' to point to the top of the provided +stack. Notice that interrupts are implicitly disabled for one +instruction after a move into `SS', precisely for this situation, so +that there's no chance of an interrupt occurring between the loads of +`SS' and `SP' and not having a stack to execute on. + + Note also that the special symbol `..start' is defined at the +beginning of this code, which means that will be the entry point into +the resulting executable file. + + mov dx,hello + mov ah,9 + int 0x21 + + The above is the main program: load `DS:DX' with a pointer to the +greeting message (`hello' is implicitly relative to the segment `data', +which was loaded into `DS' in the setup code, so the full pointer is +valid), and call the DOS print-string function. + + mov ax,0x4c00 + int 0x21 + + This terminates the program using another DOS system call. + + segment data + + hello: db 'hello, world', 13, 10, '$' + + The data segment contains the string we want to display. + + segment stack stack + resb 64 + stacktop: + + The above code declares a stack segment containing 64 bytes of +uninitialized stack space, and points `stacktop' at the top of it. The +directive `segment stack stack' defines a segment _called_ `stack', and +also of _type_ `STACK'. The latter is not necessary to the correct +running of the program, but linkers are likely to issue warnings or +errors if your program has no segment of type `STACK'. + + The above file, when assembled into a `.OBJ' file, will link on its +own to a valid `.EXE' file, which when run will print `hello, world' +and then exit. + + +File: nasm.info, Node: Section 8.1.2, Next: Section 8.2, Prev: Section 8.1.1, Up: Section 8.1 + +8.1.2. Using the `bin' Format To Generate `.EXE' Files +------------------------------------------------------ + +The `.EXE' file format is simple enough that it's possible to build a +`.EXE' file by writing a pure-binary program and sticking a 32-byte +header on the front. This header is simple enough that it can be +generated using `DB' and `DW' commands by NASM itself, so that you can +use the `bin' output format to directly generate `.EXE' files. + + Included in the NASM archives, in the `misc' subdirectory, is a file +`exebin.mac' of macros. It defines three macros: `EXE_begin', +`EXE_stack' and `EXE_end'. + + To produce a `.EXE' file using this method, you should start by using +`%include' to load the `exebin.mac' macro package into your source +file. You should then issue the `EXE_begin' macro call (which takes no +arguments) to generate the file header data. Then write code as normal +for the `bin' format - you can use all three standard sections `.text', +`.data' and `.bss'. At the end of the file you should call the +`EXE_end' macro (again, no arguments), which defines some symbols to +mark section sizes, and these symbols are referred to in the header +code generated by `EXE_begin'. + + In this model, the code you end up writing starts at `0x100', just +like a `.COM' file - in fact, if you strip off the 32-byte header from +the resulting `.EXE' file, you will have a valid `.COM' program. All +the segment bases are the same, so you are limited to a 64K program, +again just like a `.COM' file. Note that an `ORG' directive is issued +by the `EXE_begin' macro, so you should not explicitly issue one of +your own. + + You can't directly refer to your segment base value, unfortunately, +since this would require a relocation in the header, and things would +get a lot more complicated. So you should get your segment base by +copying it out of `CS' instead. + + On entry to your `.EXE' file, `SS:SP' are already set up to point to +the top of a 2Kb stack. You can adjust the default stack size of 2Kb by +calling the `EXE_stack' macro. For example, to change the stack size of +your program to 64 bytes, you would call `EXE_stack 64'. + + A sample program which generates a `.EXE' file in this way is given +in the `test' subdirectory of the NASM archive, as `binexe.asm'. + + +File: nasm.info, Node: Section 8.2, Next: Section 8.2.1, Prev: Section 8.1.2, Up: Chapter 8 + +8.2. Producing `.COM' Files +=========================== + +While large DOS programs must be written as `.EXE' files, small ones +are often better written as `.COM' files. `.COM' files are pure binary, +and therefore most easily produced using the `bin' output format. + +* Menu: + +* Section 8.2.1:: Using the `bin' Format To Generate `.COM' Files +* Section 8.2.2:: Using the `obj' Format To Generate `.COM' Files + + +File: nasm.info, Node: Section 8.2.1, Next: Section 8.2.2, Prev: Section 8.2, Up: Section 8.2 + +8.2.1. Using the `bin' Format To Generate `.COM' Files +------------------------------------------------------ + +`.COM' files expect to be loaded at offset `100h' into their segment +(though the segment may change). Execution then begins at `100h', i.e. +right at the start of the program. So to write a `.COM' program, you +would create a source file looking like + + org 100h + + section .text + + start: + ; put your code here + + section .data + + ; put data items here + + section .bss + + ; put uninitialized data here + + The `bin' format puts the `.text' section first in the file, so you +can declare data or BSS items before beginning to write code if you +want to and the code will still end up at the front of the file where it +belongs. + + The BSS (uninitialized data) section does not take up space in the +`.COM' file itself: instead, addresses of BSS items are resolved to +point at space beyond the end of the file, on the grounds that this +will be free memory when the program is run. Therefore you should not +rely on your BSS being initialized to all zeros when you run. + + To assemble the above program, you should use a command line like + + nasm myprog.asm -fbin -o myprog.com + + The `bin' format would produce a file called `myprog' if no explicit +output file name were specified, so you have to override it and give +the desired file name. + + +File: nasm.info, Node: Section 8.2.2, Next: Section 8.3, Prev: Section 8.2.1, Up: Section 8.2 + +8.2.2. Using the `obj' Format To Generate `.COM' Files +------------------------------------------------------ + +If you are writing a `.COM' program as more than one module, you may +wish to assemble several `.OBJ' files and link them together into a +`.COM' program. You can do this, provided you have a linker capable of +outputting `.COM' files directly (TLINK does this), or alternatively a +converter program such as `EXE2BIN' to transform the `.EXE' file output +from the linker into a `.COM' file. + + If you do this, you need to take care of several things: + + * The first object file containing code should start its code + segment with a line like `RESB 100h'. This is to ensure that the + code begins at offset `100h' relative to the beginning of the code + segment, so that the linker or converter program does not have to + adjust address references within the file when generating the + `.COM' file. Other assemblers use an `ORG' directive for this + purpose, but `ORG' in NASM is a format-specific directive to the + `bin' output format, and does not mean the same thing as it does + in MASM-compatible assemblers. + + * You don't need to define a stack segment. + + * All your segments should be in the same group, so that every time + your code or data references a symbol offset, all offsets are + relative to the same segment base. This is because, when a `.COM' + file is loaded, all the segment registers contain the same value. + + +File: nasm.info, Node: Section 8.3, Next: Section 8.4, Prev: Section 8.2.2, Up: Chapter 8 + +8.3. Producing `.SYS' Files +=========================== + +MS-DOS device drivers - `.SYS' files - are pure binary files, similar +to `.COM' files, except that they start at origin zero rather than +`100h'. Therefore, if you are writing a device driver using the `bin' +format, you do not need the `ORG' directive, since the default origin +for `bin' is zero. Similarly, if you are using `obj', you do not need +the `RESB 100h' at the start of your code segment. + + `.SYS' files start with a header structure, containing pointers to +the various routines inside the driver which do the work. This +structure should be defined at the start of the code segment, even +though it is not actually code. + + For more information on the format of `.SYS' files, and the data +which has to go in the header structure, a list of books is given in the +Frequently Asked Questions list for the newsgroup +`comp.os.msdos.programmer'. + + +File: nasm.info, Node: Section 8.4, Next: Section 8.4.1, Prev: Section 8.3, Up: Chapter 8 + +8.4. Interfacing to 16-bit C Programs +===================================== + +This section covers the basics of writing assembly routines that call, +or are called from, C programs. To do this, you would typically write an +assembly module as a `.OBJ' file, and link it with your C modules to +produce a mixed-language program. + +* Menu: + +* Section 8.4.1:: External Symbol Names +* Section 8.4.2:: Memory Models +* Section 8.4.3:: Function Definitions and Function Calls +* Section 8.4.4:: Accessing Data Items +* Section 8.4.5:: `c16.mac': Helper Macros for the 16-bit C Interface + + +File: nasm.info, Node: Section 8.4.1, Next: Section 8.4.2, Prev: Section 8.4, Up: Section 8.4 + +8.4.1. External Symbol Names +---------------------------- + +C compilers have the convention that the names of all global symbols +(functions or data) they define are formed by prefixing an underscore to +the name as it appears in the C program. So, for example, the function +a C programmer thinks of as `printf' appears to an assembly language +programmer as `_printf'. This means that in your assembly programs, you +can define symbols without a leading underscore, and not have to worry +about name clashes with C symbols. + + If you find the underscores inconvenient, you can define macros to +replace the `GLOBAL' and `EXTERN' directives as follows: + + %macro cglobal 1 + + global _%1 + %define %1 _%1 + + %endmacro + + %macro cextern 1 + + extern _%1 + %define %1 _%1 + + %endmacro + + (These forms of the macros only take one argument at a time; a `%rep' +construct could solve this.) + + If you then declare an external like this: + + cextern printf + + then the macro will expand it as + + extern _printf + %define printf _printf + + Thereafter, you can reference `printf' as if it was a symbol, and the +preprocessor will put the leading underscore on where necessary. + + The `cglobal' macro works similarly. You must use `cglobal' before +defining the symbol in question, but you would have had to do that +anyway if you used `GLOBAL'. + + Also see *note Section 2.1.27::. + + +File: nasm.info, Node: Section 8.4.2, Next: Section 8.4.3, Prev: Section 8.4.1, Up: Section 8.4 + +8.4.2. Memory Models +-------------------- + +NASM contains no mechanism to support the various C memory models +directly; you have to keep track yourself of which one you are writing +for. This means you have to keep track of the following things: + + * In models using a single code segment (tiny, small and compact), + functions are near. This means that function pointers, when stored + in data segments or pushed on the stack as function arguments, are + 16 bits long and contain only an offset field (the `CS' register + never changes its value, and always gives the segment part of the + full function address), and that functions are called using + ordinary near `CALL' instructions and return using `RETN' (which, + in NASM, is synonymous with `RET' anyway). This means both that + you should write your own routines to return with `RETN', and that + you should call external C routines with near `CALL' instructions. + + * In models using more than one code segment (medium, large and + huge), functions are far. This means that function pointers are 32 + bits long (consisting of a 16-bit offset followed by a 16-bit + segment), and that functions are called using `CALL FAR' (or `CALL + seg:offset') and return using `RETF'. Again, you should therefore + write your own routines to return with `RETF' and use `CALL FAR' + to call external routines. + + * In models using a single data segment (tiny, small and medium), + data pointers are 16 bits long, containing only an offset field + (the `DS' register doesn't change its value, and always gives the + segment part of the full data item address). + + * In models using more than one data segment (compact, large and + huge), data pointers are 32 bits long, consisting of a 16-bit + offset followed by a 16- bit segment. You should still be careful + not to modify `DS' in your routines without restoring it + afterwards, but `ES' is free for you to use to access the contents + of 32-bit data pointers you are passed. + + * The huge memory model allows single data items to exceed 64K in + size. In all other memory models, you can access the whole of a + data item just by doing arithmetic on the offset field of the + pointer you are given, whether a segment field is present or not; + in huge model, you have to be more careful of your pointer + arithmetic. + + * In most memory models, there is a _default_ data segment, whose + segment address is kept in `DS' throughout the program. This data + segment is typically the same segment as the stack, kept in `SS', + so that functions' local variables (which are stored on the stack) + and global data items can both be accessed easily without changing + `DS'. Particularly large data items are typically stored in other + segments. However, some memory models (though not the standard + ones, usually) allow the assumption that `SS' and `DS' hold the + same value to be removed. Be careful about functions' local + variables in this latter case. + + In models with a single code segment, the segment is called `_TEXT', +so your code segment must also go by this name in order to be linked +into the same place as the main code segment. In models with a single +data segment, or with a default data segment, it is called `_DATA'. + + +File: nasm.info, Node: Section 8.4.3, Next: Section 8.4.4, Prev: Section 8.4.2, Up: Section 8.4 + +8.4.3. Function Definitions and Function Calls +---------------------------------------------- + +The C calling convention in 16-bit programs is as follows. In the +following description, the words _caller_ and _callee_ are used to +denote the function doing the calling and the function which gets +called. + + * The caller pushes the function's parameters on the stack, one after + another, in reverse order (right to left, so that the first + argument specified to the function is pushed last). + + * The caller then executes a `CALL' instruction to pass control to + the callee. This `CALL' is either near or far depending on the + memory model. + + * The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access their + parameters) starts by saving the value of `SP' in `BP' so as to be + able to use `BP' as a base pointer to find its parameters on the + stack. However, the caller was probably doing this too, so part + of the calling convention states that `BP' must be preserved by + any C function. Hence the callee, if it is going to set up `BP' as + a _frame pointer_, must push the previous value first. + + * The callee may then access its parameters relative to `BP'. The + word at `[BP]' holds the previous value of `BP' as it was pushed; + the next word, at `[BP+2]', holds the offset part of the return + address, pushed implicitly by `CALL'. In a small-model (near) + function, the parameters start after that, at `[BP+4]'; in a + large-model (far) function, the segment part of the return address + lives at `[BP+4]', and the parameters begin at `[BP+6]'. The + leftmost parameter of the function, since it was pushed last, is + accessible at this offset from `BP'; the others follow, at + successively greater offsets. Thus, in a function such as `printf' + which takes a variable number of parameters, the pushing of the + parameters in reverse order means that the function knows where to + find its first parameter, which tells it the number and type of + the remaining ones. + + * The callee may also wish to decrease `SP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `BP'. + + * The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `DX:AX' depending on the size of + the value. Floating-point results are sometimes (depending on the + compiler) returned in `ST0'. + + * Once the callee has finished processing, it restores `SP' from + `BP' if it had allocated local stack space, then pops the previous + value of `BP', and returns via `RETN' or `RETF' depending on + memory model. + + * When the caller regains control from the callee, the function + parameters are still on the stack, so it typically adds an + immediate constant to `SP' to remove them (instead of executing a + number of slow `POP' instructions). Thus, if a function is + accidentally called with the wrong number of parameters due to a + prototype mismatch, the stack will still be returned to a sensible + state since the caller, which _knows_ how many parameters it + pushed, does the removing. + + It is instructive to compare this calling convention with that for +Pascal programs (described in *note Section 8.5.1::). Pascal has a +simpler convention, since no functions have variable numbers of +parameters. Therefore the callee knows how many parameters it should +have been passed, and is able to deallocate them from the stack itself +by passing an immediate argument to the `RET' or `RETF' instruction, so +the caller does not have to do it. Also, the parameters are pushed in +left-to- right order, not right-to-left, which means that a compiler +can give better guarantees about sequence points without performance +suffering. + + Thus, you would define a function in C style in the following way. +The following example is for small model: + + global _myfunc + + _myfunc: + push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+4] ; first parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + ret + + For a large-model function, you would replace `RET' by `RETF', and +look for the first parameter at `[BP+6]' instead of `[BP+4]'. Of +course, if one of the parameters is a pointer, then the offsets of +_subsequent_ parameters will change depending on the memory model as +well: far pointers take up four bytes on the stack when passed as a +parameter, whereas near pointers take up two. + + At the other end of the process, to call a C function from your +assembly code, you would do something like this: + + extern _printf + + ; and then, further down... + + push word [myint] ; one of my integer variables + push word mystring ; pointer into my data segment + call _printf + add sp,byte 4 ; `byte' saves space + + ; then those data items... + + segment _DATA + + myint dw 1234 + mystring db 'This number -> %d <- should be 1234',10,0 + + This piece of code is the small-model assembly equivalent of the C +code + + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); + + In large model, the function-call code might look more like this. In +this example, it is assumed that `DS' already holds the segment base of +the segment `_DATA'. If not, you would have to initialize it first. + + push word [myint] + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + call far _printf + add sp,byte 6 + + The integer value still takes up one word on the stack, since large +model does not affect the size of the `int' data type. The first +argument (pushed last) to `printf', however, is a data pointer, and +therefore has to contain a segment and offset part. The segment should +be stored second in memory, and therefore must be pushed first. (Of +course, `PUSH DS' would have been a shorter instruction than `PUSH WORD +SEG mystring', if `DS' was set up as the above example assumed.) Then +the actual call becomes a far call, since functions expect far calls in +large model; and `SP' has to be increased by 6 rather than 4 afterwards +to make up for the extra word of parameters. + + +File: nasm.info, Node: Section 8.4.4, Next: Section 8.4.5, Prev: Section 8.4.3, Up: Section 8.4 + +8.4.4. Accessing Data Items +--------------------------- + +To get at the contents of C variables, or to declare variables which C +can access, you need only declare the names as `GLOBAL' or `EXTERN'. +(Again, the names require leading underscores, as stated in *note +Section 8.4.1::.) Thus, a C variable declared as `int i' can be +accessed from assembler as + + extern _i + + mov ax,[_i] + + And to declare your own integer variable which C programs can access +as `extern int j', you do this (making sure you are assembling in the +`_DATA' segment, if necessary): + + global _j + + _j dw 0 + + To access a C array, you need to know the size of the components of +the array. For example, `int' variables are two bytes long, so if a C +program declares an array as `int a[10]', you can access `a[3]' by +coding `mov ax,[_a+6]'. (The byte offset 6 is obtained by multiplying +the desired array index, 3, by the size of the array element, 2.) The +sizes of the C base types in 16-bit compilers are: 1 for `char', 2 for +`short' and `int', 4 for `long' and `float', and 8 for `double'. + + To access a C data structure, you need to know the offset from the +base of the structure to the field you are interested in. You can +either do this by converting the C structure definition into a NASM +structure definition (using `STRUC'), or by calculating the one offset +and using just that. + + To do either of these, you should read your C compiler's manual to +find out how it organizes data structures. NASM gives no special +alignment to structure members in its own `STRUC' macro, so you have to +specify alignment yourself if the C compiler generates it. Typically, +you might find that a structure like + + struct { + char c; + int i; + } foo; + + might be four bytes long rather than three, since the `int' field +would be aligned to a two-byte boundary. However, this sort of feature +tends to be a configurable option in the C compiler, either using +command- line options or `#pragma' lines, so you have to find out how +your own compiler does it. + + +File: nasm.info, Node: Section 8.4.5, Next: Section 8.5, Prev: Section 8.4.4, Up: Section 8.4 + +8.4.5. `c16.mac': Helper Macros for the 16-bit C Interface +---------------------------------------------------------- + +Included in the NASM archives, in the `misc' directory, is a file +`c16.mac' of macros. It defines three macros: `proc', `arg' and +`endproc'. These are intended to be used for C-style procedure +definitions, and they automate a lot of the work involved in keeping +track of the calling convention. + + (An alternative, TASM compatible form of `arg' is also now built into +NASM's preprocessor. See *note Section 4.8:: for details.) + + An example of an assembly function using the macro set is given here: + + proc _nearproc + + %$i arg + %$j arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + add ax,[bx] + + endproc + + This defines `_nearproc' to be a procedure taking two arguments, the +first (`i') an integer and the second (`j') a pointer to an integer. It +returns `i + *j'. + + Note that the `arg' macro has an `EQU' as the first line of its +expansion, and since the label before the macro call gets prepended to +the first line of the expanded macro, the `EQU' works, defining `%$i' +to be an offset from `BP'. A context-local variable is used, local to +the context pushed by the `proc' macro and popped by the `endproc' +macro, so that the same argument name can be used in later procedures. +Of course, you don't _have_ to do that. + + The macro set produces code for near functions (tiny, small and +compact- model code) by default. You can have it generate far functions +(medium, large and huge-model code) by means of coding `%define +FARCODE'. This changes the kind of return instruction generated by +`endproc', and also changes the starting point for the argument +offsets. The macro set contains no intrinsic dependency on whether data +pointers are far or not. + + `arg' can take an optional parameter, giving the size of the +argument. If no size is given, 2 is assumed, since it is likely that +many function parameters will be of type `int'. + + The large-model equivalent of the above function would look like +this: + + %define FARCODE + + proc _farproc + + %$i arg + %$j arg 4 + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + + endproc + + This makes use of the argument to the `arg' macro to define a +parameter of size 4, because `j' is now a far pointer. When we load +from `j', we must load a segment and an offset. + + +File: nasm.info, Node: Section 8.5, Next: Section 8.5.1, Prev: Section 8.4.5, Up: Chapter 8 + +8.5. Interfacing to Borland Pascal Programs +=========================================== + +Interfacing to Borland Pascal programs is similar in concept to +interfacing to 16-bit C programs. The differences are: + + * The leading underscore required for interfacing to C programs is + not required for Pascal. + + * The memory model is always large: functions are far, data pointers + are far, and no data item can be more than 64K long. (Actually, + some functions are near, but only those functions that are local + to a Pascal unit and never called from outside it. All assembly + functions that Pascal calls, and all Pascal functions that + assembly routines are able to call, are far.) However, all static + data declared in a Pascal program goes into the default data + segment, which is the one whose segment address will be in `DS' + when control is passed to your assembly code. The only things that + do not live in the default data segment are local variables (they + live in the stack segment) and dynamically allocated variables. + All data _pointers_, however, are far. + + * The function calling convention is different - described below. + + * Some data types, such as strings, are stored differently. + + * There are restrictions on the segment names you are allowed to use + - Borland Pascal will ignore code or data declared in a segment it + doesn't like the name of. The restrictions are described below. + +* Menu: + +* Section 8.5.1:: The Pascal Calling Convention +* Section 8.5.2:: Borland Pascal Segment Name Restrictions +* Section 8.5.3:: Using `c16.mac' With Pascal Programs + + +File: nasm.info, Node: Section 8.5.1, Next: Section 8.5.2, Prev: Section 8.5, Up: Section 8.5 + +8.5.1. The Pascal Calling Convention +------------------------------------ + +The 16-bit Pascal calling convention is as follows. In the following +description, the words _caller_ and _callee_ are used to denote the +function doing the calling and the function which gets called. + + * The caller pushes the function's parameters on the stack, one after + another, in normal order (left to right, so that the first argument + specified to the function is pushed first). + + * The caller then executes a far `CALL' instruction to pass control + to the callee. + + * The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access their + parameters) starts by saving the value of `SP' in `BP' so as to be + able to use `BP' as a base pointer to find its parameters on the + stack. However, the caller was probably doing this too, so part + of the calling convention states that `BP' must be preserved by + any function. Hence the callee, if it is going to set up `BP' as a + frame pointer, must push the previous value first. + + * The callee may then access its parameters relative to `BP'. The + word at `[BP]' holds the previous value of `BP' as it was pushed. + The next word, at `[BP+2]', holds the offset part of the return + address, and the next one at `[BP+4]' the segment part. The + parameters begin at `[BP+6]'. The rightmost parameter of the + function, since it was pushed last, is accessible at this offset + from `BP'; the others follow, at successively greater offsets. + + * The callee may also wish to decrease `SP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `BP'. + + * The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `DX:AX' depending on the size of + the value. Floating-point results are returned in `ST0'. Results + of type `Real' (Borland's own custom floating-point data type, not + handled directly by the FPU) are returned in `DX:BX:AX'. To return + a result of type `String', the caller pushes a pointer to a + temporary string before pushing the parameters, and the callee + places the returned string value at that location. The pointer is + not a parameter, and should not be removed from the stack by the + `RETF' instruction. + + * Once the callee has finished processing, it restores `SP' from + `BP' if it had allocated local stack space, then pops the previous + value of `BP', and returns via `RETF'. It uses the form of `RETF' + with an immediate parameter, giving the number of bytes taken up + by the parameters on the stack. This causes the parameters to be + removed from the stack as a side effect of the return instruction. + + * When the caller regains control from the callee, the function + parameters have already been removed from the stack, so it needs + to do nothing further. + + Thus, you would define a function in Pascal style, taking two +`Integer'-type parameters, in the following way: + + global myfunc + + myfunc: push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+8] ; first parameter to function + mov bx,[bp+6] ; second parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + retf 4 ; total size of params is 4 + + At the other end of the process, to call a Pascal function from your +assembly code, you would do something like this: + + extern SomeFunc + + ; and then, further down... + + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + push word [myint] ; one of my variables + call far SomeFunc + + This is equivalent to the Pascal code + + procedure SomeFunc(String: PChar; Int: Integer); + SomeFunc(@mystring, myint); + + +File: nasm.info, Node: Section 8.5.2, Next: Section 8.5.3, Prev: Section 8.5.1, Up: Section 8.5 + +8.5.2. Borland Pascal Segment Name Restrictions +----------------------------------------------- + +Since Borland Pascal's internal unit file format is completely different +from `OBJ', it only makes a very sketchy job of actually reading and +understanding the various information contained in a real `OBJ' file +when it links that in. Therefore an object file intended to be linked +to a Pascal program must obey a number of restrictions: + + * Procedures and functions must be in a segment whose name is either + `CODE', `CSEG', or something ending in `_TEXT'. + + * initialized data must be in a segment whose name is either `CONST' + or something ending in `_DATA'. + + * Uninitialized data must be in a segment whose name is either + `DATA', `DSEG', or something ending in `_BSS'. + + * Any other segments in the object file are completely ignored. + `GROUP' directives and segment attributes are also ignored. + + +File: nasm.info, Node: Section 8.5.3, Next: Chapter 9, Prev: Section 8.5.2, Up: Section 8.5 + +8.5.3. Using `c16.mac' With Pascal Programs +------------------------------------------- + +The `c16.mac' macro package, described in *note Section 8.4.5::, can +also be used to simplify writing functions to be called from Pascal +programs, if you code `%define PASCAL'. This definition ensures that +functions are far (it implies `FARCODE'), and also causes procedure +return instructions to be generated with an operand. + + Defining `PASCAL' does not change the code which calculates the +argument offsets; you must declare your function's arguments in reverse +order. For example: + + %define PASCAL + + proc _pascalproc + + %$j arg 4 + %$i arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + + endproc + + This defines the same routine, conceptually, as the example in *note +Section 8.4.5::: it defines a function taking two arguments, an integer +and a pointer to an integer, which returns the sum of the integer and +the contents of the pointer. The only difference between this code and +the large-model C version is that `PASCAL' is defined instead of +`FARCODE', and that the arguments are declared in reverse order. + + +File: nasm.info, Node: Chapter 9, Next: Section 9.1, Prev: Section 8.5.3, Up: Top + +Chapter 9: Writing 32-bit Code (Unix, Win32, DJGPP) +*************************************************** + +This chapter attempts to cover some of the common issues involved when +writing 32-bit code, to run under Win32 or Unix, or to be linked with C +code generated by a Unix-style C compiler such as DJGPP. It covers how +to write assembly code to interface with 32-bit C routines, and how to +write position-independent code for shared libraries. + + Almost all 32-bit code, and in particular all code running under +`Win32', `DJGPP' or any of the PC Unix variants, runs in _flat_ memory +model. This means that the segment registers and paging have already +been set up to give you the same 32-bit 4Gb address space no matter +what segment you work relative to, and that you should ignore all +segment registers completely. When writing flat-model application code, +you never need to use a segment override or modify any segment +register, and the code-section addresses you pass to `CALL' and `JMP' +live in the same address space as the data-section addresses you access +your variables by and the stack-section addresses you access local +variables and procedure parameters by. Every address is 32 bits long +and contains only an offset part. + +* Menu: + +* Section 9.1:: Interfacing to 32-bit C Programs +* Section 9.2:: Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries + + +File: nasm.info, Node: Section 9.1, Next: Section 9.1.1, Prev: Chapter 9, Up: Chapter 9 + +9.1. Interfacing to 32-bit C Programs +===================================== + +A lot of the discussion in *note Section 8.4::, about interfacing to +16-bit C programs, still applies when working in 32 bits. The absence +of memory models or segmentation worries simplifies things a lot. + +* Menu: + +* Section 9.1.1:: External Symbol Names +* Section 9.1.2:: Function Definitions and Function Calls +* Section 9.1.3:: Accessing Data Items +* Section 9.1.4:: `c32.mac': Helper Macros for the 32-bit C Interface + + +File: nasm.info, Node: Section 9.1.1, Next: Section 9.1.2, Prev: Section 9.1, Up: Section 9.1 + +9.1.1. External Symbol Names +---------------------------- + +Most 32-bit C compilers share the convention used by 16-bit compilers, +that the names of all global symbols (functions or data) they define +are formed by prefixing an underscore to the name as it appears in the +C program. However, not all of them do: the `ELF' specification states +that C symbols do _not_ have a leading underscore on their +assembly-language names. + + The older Linux `a.out' C compiler, all `Win32' compilers, `DJGPP', +and `NetBSD' and `FreeBSD', all use the leading underscore; for these +compilers, the macros `cextern' and `cglobal', as given in *note +Section 8.4.1::, will still work. For `ELF', though, the leading +underscore should not be used. + + See also *note Section 2.1.27::. + + +File: nasm.info, Node: Section 9.1.2, Next: Section 9.1.3, Prev: Section 9.1.1, Up: Section 9.1 + +9.1.2. Function Definitions and Function Calls +---------------------------------------------- + +The C calling convention in 32-bit programs is as follows. In the +following description, the words _caller_ and _callee_ are used to +denote the function doing the calling and the function which gets +called. + + * The caller pushes the function's parameters on the stack, one after + another, in reverse order (right to left, so that the first + argument specified to the function is pushed last). + + * The caller then executes a near `CALL' instruction to pass control + to the callee. + + * The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access their + parameters) starts by saving the value of `ESP' in `EBP' so as to + be able to use `EBP' as a base pointer to find its parameters on + the stack. However, the caller was probably doing this too, so + part of the calling convention states that `EBP' must be preserved + by any C function. Hence the callee, if it is going to set up + `EBP' as a frame pointer, must push the previous value first. + + * The callee may then access its parameters relative to `EBP'. The + doubleword at `[EBP]' holds the previous value of `EBP' as it was + pushed; the next doubleword, at `[EBP+4]', holds the return + address, pushed implicitly by `CALL'. The parameters start after + that, at `[EBP+8]'. The leftmost parameter of the function, since + it was pushed last, is accessible at this offset from `EBP'; the + others follow, at successively greater offsets. Thus, in a + function such as `printf' which takes a variable number of + parameters, the pushing of the parameters in reverse order means + that the function knows where to find its first parameter, which + tells it the number and type of the remaining ones. + + * The callee may also wish to decrease `ESP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `EBP'. + + * The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `EAX' depending on the size of the + value. Floating-point results are typically returned in `ST0'. + + * Once the callee has finished processing, it restores `ESP' from + `EBP' if it had allocated local stack space, then pops the previous + value of `EBP', and returns via `RET' (equivalently, `RETN'). + + * When the caller regains control from the callee, the function + parameters are still on the stack, so it typically adds an + immediate constant to `ESP' to remove them (instead of executing a + number of slow `POP' instructions). Thus, if a function is + accidentally called with the wrong number of parameters due to a + prototype mismatch, the stack will still be returned to a sensible + state since the caller, which _knows_ how many parameters it + pushed, does the removing. + + There is an alternative calling convention used by Win32 programs for +Windows API calls, and also for functions called _by_ the Windows API +such as window procedures: they follow what Microsoft calls the +`__stdcall' convention. This is slightly closer to the Pascal +convention, in that the callee clears the stack by passing a parameter +to the `RET' instruction. However, the parameters are still pushed in +right-to-left order. + + Thus, you would define a function in C style in the following way: + + global _myfunc + + _myfunc: + push ebp + mov ebp,esp + sub esp,0x40 ; 64 bytes of local stack space + mov ebx,[ebp+8] ; first parameter to function + + ; some more code + + leave ; mov esp,ebp / pop ebp + ret + + At the other end of the process, to call a C function from your +assembly code, you would do something like this: + + extern _printf + + ; and then, further down... + + push dword [myint] ; one of my integer variables + push dword mystring ; pointer into my data segment + call _printf + add esp,byte 8 ; `byte' saves space + + ; then those data items... + + segment _DATA + + myint dd 1234 + mystring db 'This number -> %d <- should be 1234',10,0 + + This piece of code is the assembly equivalent of the C code + + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); + diff --git a/doc/info/nasm.info-2 b/doc/info/nasm.info-2 new file mode 100644 index 0000000..dd66a29 --- /dev/null +++ b/doc/info/nasm.info-2 @@ -0,0 +1,6521 @@ +This is nasm.info, produced by makeinfo version 4.13 from nasmdoc.texi. + +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* NASM: (nasm). The Netwide Assembler for x86. +END-INFO-DIR-ENTRY + + This file documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. + + Copyright 1996-2009 The NASM Development Team + + This document is redistributable under the license given in the file +"COPYING" distributed in the NASM archive. + + +File: nasm.info, Node: Section 9.1.3, Next: Section 9.1.4, Prev: Section 9.1.2, Up: Section 9.1 + +9.1.3. Accessing Data Items +--------------------------- + +To get at the contents of C variables, or to declare variables which C +can access, you need only declare the names as `GLOBAL' or `EXTERN'. +(Again, the names require leading underscores, as stated in *note +Section 9.1.1::.) Thus, a C variable declared as `int i' can be +accessed from assembler as + + extern _i + mov eax,[_i] + + And to declare your own integer variable which C programs can access +as `extern int j', you do this (making sure you are assembling in the +`_DATA' segment, if necessary): + + global _j + _j dd 0 + + To access a C array, you need to know the size of the components of +the array. For example, `int' variables are four bytes long, so if a C +program declares an array as `int a[10]', you can access `a[3]' by +coding `mov ax,[_a+12]'. (The byte offset 12 is obtained by multiplying +the desired array index, 3, by the size of the array element, 4.) The +sizes of the C base types in 32-bit compilers are: 1 for `char', 2 for +`short', 4 for `int', `long' and `float', and 8 for `double'. Pointers, +being 32-bit addresses, are also 4 bytes long. + + To access a C data structure, you need to know the offset from the +base of the structure to the field you are interested in. You can +either do this by converting the C structure definition into a NASM +structure definition (using `STRUC'), or by calculating the one offset +and using just that. + + To do either of these, you should read your C compiler's manual to +find out how it organizes data structures. NASM gives no special +alignment to structure members in its own `STRUC' macro, so you have to +specify alignment yourself if the C compiler generates it. Typically, +you might find that a structure like + + struct { + char c; + int i; + } foo; + + might be eight bytes long rather than five, since the `int' field +would be aligned to a four-byte boundary. However, this sort of feature +is sometimes a configurable option in the C compiler, either using +command- line options or `#pragma' lines, so you have to find out how +your own compiler does it. + + +File: nasm.info, Node: Section 9.1.4, Next: Section 9.2, Prev: Section 9.1.3, Up: Section 9.1 + +9.1.4. `c32.mac': Helper Macros for the 32-bit C Interface +---------------------------------------------------------- + +Included in the NASM archives, in the `misc' directory, is a file +`c32.mac' of macros. It defines three macros: `proc', `arg' and +`endproc'. These are intended to be used for C-style procedure +definitions, and they automate a lot of the work involved in keeping +track of the calling convention. + + An example of an assembly function using the macro set is given here: + + proc _proc32 + + %$i arg + %$j arg + mov eax,[ebp + %$i] + mov ebx,[ebp + %$j] + add eax,[ebx] + + endproc + + This defines `_proc32' to be a procedure taking two arguments, the +first (`i') an integer and the second (`j') a pointer to an integer. It +returns `i + *j'. + + Note that the `arg' macro has an `EQU' as the first line of its +expansion, and since the label before the macro call gets prepended to +the first line of the expanded macro, the `EQU' works, defining `%$i' +to be an offset from `BP'. A context-local variable is used, local to +the context pushed by the `proc' macro and popped by the `endproc' +macro, so that the same argument name can be used in later procedures. +Of course, you don't _have_ to do that. + + `arg' can take an optional parameter, giving the size of the +argument. If no size is given, 4 is assumed, since it is likely that +many function parameters will be of type `int' or pointers. + + +File: nasm.info, Node: Section 9.2, Next: Section 9.2.1, Prev: Section 9.1.4, Up: Chapter 9 + +9.2. Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries +================================================================== + +`ELF' replaced the older `a.out' object file format under Linux because +it contains support for position-independent code (PIC), which makes +writing shared libraries much easier. NASM supports the `ELF' +position-independent code features, so you can write Linux `ELF' shared +libraries in NASM. + + NetBSD, and its close cousins FreeBSD and OpenBSD, take a different +approach by hacking PIC support into the `a.out' format. NASM supports +this as the `aoutb' output format, so you can write BSD shared +libraries in NASM too. + + The operating system loads a PIC shared library by memory-mapping the +library file at an arbitrarily chosen point in the address space of the +running process. The contents of the library's code section must +therefore not depend on where it is loaded in memory. + + Therefore, you cannot get at your variables by writing code like +this: + + mov eax,[myvar] ; WRONG + + Instead, the linker provides an area of memory called the _global +offset table_, or GOT; the GOT is situated at a constant distance from +your library's code, so if you can find out where your library is +loaded (which is typically done using a `CALL' and `POP' combination), +you can obtain the address of the GOT, and you can then load the +addresses of your variables out of linker-generated entries in the GOT. + + The _data_ section of a PIC shared library does not have these +restrictions: since the data section is writable, it has to be copied +into memory anyway rather than just paged in from the library file, so +as long as it's being copied it can be relocated too. So you can put +ordinary types of relocation in the data section without too much worry +(but see *note Section 9.2.4:: for a caveat). + +* Menu: + +* Section 9.2.1:: Obtaining the Address of the GOT +* Section 9.2.2:: Finding Your Local Data Items +* Section 9.2.3:: Finding External and Common Data Items +* Section 9.2.4:: Exporting Symbols to the Library User +* Section 9.2.5:: Calling Procedures Outside the Library +* Section 9.2.6:: Generating the Library File + + +File: nasm.info, Node: Section 9.2.1, Next: Section 9.2.2, Prev: Section 9.2, Up: Section 9.2 + +9.2.1. Obtaining the Address of the GOT +--------------------------------------- + +Each code module in your shared library should define the GOT as an +external symbol: + + extern _GLOBAL_OFFSET_TABLE_ ; in ELF + extern __GLOBAL_OFFSET_TABLE_ ; in BSD a.out + + At the beginning of any function in your shared library which plans +to access your data or BSS sections, you must first calculate the +address of the GOT. This is typically done by writing the function in +this form: + + func: push ebp + mov ebp,esp + push ebx + call .get_GOT + .get_GOT: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc + + ; the function body comes here + + mov ebx,[ebp-4] + mov esp,ebp + pop ebp + ret + + (For BSD, again, the symbol `_GLOBAL_OFFSET_TABLE' requires a second +leading underscore.) + + The first two lines of this function are simply the standard C +prologue to set up a stack frame, and the last three lines are standard +C function epilogue. The third line, and the fourth to last line, save +and restore the `EBX' register, because PIC shared libraries use this +register to store the address of the GOT. + + The interesting bit is the `CALL' instruction and the following two +lines. The `CALL' and `POP' combination obtains the address of the +label `.get_GOT', without having to know in advance where the program +was loaded (since the `CALL' instruction is encoded relative to the +current position). The `ADD' instruction makes use of one of the +special PIC relocation types: GOTPC relocation. With the `WRT ..gotpc' +qualifier specified, the symbol referenced (here +`_GLOBAL_OFFSET_TABLE_', the special symbol assigned to the GOT) is +given as an offset from the beginning of the section. (Actually, `ELF' +encodes it as the offset from the operand field of the `ADD' +instruction, but NASM simplifies this deliberately, so you do things the +same way for both `ELF' and `BSD'.) So the instruction then _adds_ the +beginning of the section, to get the real address of the GOT, and +subtracts the value of `.get_GOT' which it knows is in `EBX'. +Therefore, by the time that instruction has finished, `EBX' contains +the address of the GOT. + + If you didn't follow that, don't worry: it's never necessary to +obtain the address of the GOT by any other means, so you can put those +three instructions into a macro and safely ignore them: + + %macro get_GOT 0 + + call %%getgot + %%getgot: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-%%getgot wrt ..gotpc + + %endmacro + + +File: nasm.info, Node: Section 9.2.2, Next: Section 9.2.3, Prev: Section 9.2.1, Up: Section 9.2 + +9.2.2. Finding Your Local Data Items +------------------------------------ + +Having got the GOT, you can then use it to obtain the addresses of your +data items. Most variables will reside in the sections you have +declared; they can be accessed using the `..gotoff' special `WRT' type. +The way this works is like this: + + lea eax,[ebx+myvar wrt ..gotoff] + + The expression `myvar wrt ..gotoff' is calculated, when the shared +library is linked, to be the offset to the local variable `myvar' from +the beginning of the GOT. Therefore, adding it to `EBX' as above will +place the real address of `myvar' in `EAX'. + + If you declare variables as `GLOBAL' without specifying a size for +them, they are shared between code modules in the library, but do not +get exported from the library to the program that loaded it. They will +still be in your ordinary data and BSS sections, so you can access them +in the same way as local variables, using the above `..gotoff' +mechanism. + + Note that due to a peculiarity of the way BSD `a.out' format handles +this relocation type, there must be at least one non-local symbol in the +same section as the address you're trying to access. + + +File: nasm.info, Node: Section 9.2.3, Next: Section 9.2.4, Prev: Section 9.2.2, Up: Section 9.2 + +9.2.3. Finding External and Common Data Items +--------------------------------------------- + +If your library needs to get at an external variable (external to the +_library_, not just to one of the modules within it), you must use the +`..got' type to get at it. The `..got' type, instead of giving you the +offset from the GOT base to the variable, gives you the offset from the +GOT base to a GOT _entry_ containing the address of the variable. The +linker will set up this GOT entry when it builds the library, and the +dynamic linker will place the correct address in it at load time. So to +obtain the address of an external variable `extvar' in `EAX', you would +code + + mov eax,[ebx+extvar wrt ..got] + + This loads the address of `extvar' out of an entry in the GOT. The +linker, when it builds the shared library, collects together every +relocation of type `..got', and builds the GOT so as to ensure it has +every necessary entry present. + + Common variables must also be accessed in this way. + + +File: nasm.info, Node: Section 9.2.4, Next: Section 9.2.5, Prev: Section 9.2.3, Up: Section 9.2 + +9.2.4. Exporting Symbols to the Library User +-------------------------------------------- + +If you want to export symbols to the user of the library, you have to +declare whether they are functions or data, and if they are data, you +have to give the size of the data item. This is because the dynamic +linker has to build procedure linkage table entries for any exported +functions, and also moves exported data items away from the library's +data section in which they were declared. + + So to export a function to users of the library, you must use + + global func:function ; declare it as a function + + func: push ebp + + ; etc. + + And to export a data item such as an array, you would have to code + + global array:data array.end-array ; give the size too + + array: resd 128 + .end: + + Be careful: If you export a variable to the library user, by +declaring it as `GLOBAL' and supplying a size, the variable will end up +living in the data section of the main program, rather than in your +library's data section, where you declared it. So you will have to +access your own global variable with the `..got' mechanism rather than +`..gotoff', as if it were external (which, effectively, it has become). + + Equally, if you need to store the address of an exported global in +one of your data sections, you can't do it by means of the standard +sort of code: + + dataptr: dd global_data_item ; WRONG + + NASM will interpret this code as an ordinary relocation, in which +`global_data_item' is merely an offset from the beginning of the +`.data' section (or whatever); so this reference will end up pointing +at your data section instead of at the exported global which resides +elsewhere. + + Instead of the above code, then, you must write + + dataptr: dd global_data_item wrt ..sym + + which makes use of the special `WRT' type `..sym' to instruct NASM +to search the symbol table for a particular symbol at that address, +rather than just relocating by section base. + + Either method will work for functions: referring to one of your +functions by means of + + funcptr: dd my_function + + will give the user the address of the code you wrote, whereas + + funcptr: dd my_function wrt .sym + + will give the address of the procedure linkage table for the +function, which is where the calling program will _believe_ the +function lives. Either address is a valid way to call the function. + + +File: nasm.info, Node: Section 9.2.5, Next: Section 9.2.6, Prev: Section 9.2.4, Up: Section 9.2 + +9.2.5. Calling Procedures Outside the Library +--------------------------------------------- + +Calling procedures outside your shared library has to be done by means +of a _procedure linkage table_, or PLT. The PLT is placed at a known +offset from where the library is loaded, so the library code can make +calls to the PLT in a position-independent way. Within the PLT there is +code to jump to offsets contained in the GOT, so function calls to +other shared libraries or to routines in the main program can be +transparently passed off to their real destinations. + + To call an external routine, you must use another special PIC +relocation type, `WRT ..plt'. This is much easier than the GOT-based +ones: you simply replace calls such as `CALL printf' with the +PLT-relative version `CALL printf WRT ..plt'. + + +File: nasm.info, Node: Section 9.2.6, Next: Chapter 10, Prev: Section 9.2.5, Up: Section 9.2 + +9.2.6. Generating the Library File +---------------------------------- + +Having written some code modules and assembled them to `.o' files, you +then generate your shared library with a command such as + + ld -shared -o library.so module1.o module2.o # for ELF + ld -Bshareable -o library.so module1.o module2.o # for BSD + + For ELF, if your shared library is going to reside in system +directories such as `/usr/lib' or `/lib', it is usually worth using the +`-soname' flag to the linker, to store the final library file name, +with a version number, into the library: + + ld -shared -soname library.so.1 -o library.so.1.2 *.o + + You would then copy `library.so.1.2' into the library directory, and +create `library.so.1' as a symbolic link to it. + + +File: nasm.info, Node: Chapter 10, Next: Section 10.1, Prev: Section 9.2.6, Up: Top + +Chapter 10: Mixing 16 and 32 Bit Code +************************************* + +This chapter tries to cover some of the issues, largely related to +unusual forms of addressing and jump instructions, encountered when +writing operating system code such as protected-mode initialisation +routines, which require code that operates in mixed segment sizes, such +as code in a 16-bit segment trying to modify data in a 32-bit one, or +jumps between different- size segments. + +* Menu: + +* Section 10.1:: Mixed-Size Jumps +* Section 10.2:: Addressing Between Different-Size Segments +* Section 10.3:: Other Mixed-Size Instructions + + +File: nasm.info, Node: Section 10.1, Next: Section 10.2, Prev: Chapter 10, Up: Chapter 10 + +10.1. Mixed-Size Jumps +====================== + +The most common form of mixed-size instruction is the one used when +writing a 32-bit OS: having done your setup in 16-bit mode, such as +loading the kernel, you then have to boot it by switching into +protected mode and jumping to the 32-bit kernel start address. In a +fully 32-bit OS, this tends to be the _only_ mixed-size instruction you +need, since everything before it can be done in pure 16-bit code, and +everything after it can be pure 32-bit. + + This jump must specify a 48-bit far address, since the target +segment is a 32-bit one. However, it must be assembled in a 16-bit +segment, so just coding, for example, + + jmp 0x1234:0x56789ABC ; wrong! + + will not work, since the offset part of the address will be +truncated to `0x9ABC' and the jump will be an ordinary 16-bit far one. + + The Linux kernel setup code gets round the inability of `as86' to +generate the required instruction by coding it manually, using `DB' +instructions. NASM can go one better than that, by actually generating +the right instruction itself. Here's how to do it right: + + jmp dword 0x1234:0x56789ABC ; right + + The `DWORD' prefix (strictly speaking, it should come _after_ the +colon, since it is declaring the _offset_ field to be a doubleword; but +NASM will accept either form, since both are unambiguous) forces the +offset part to be treated as far, in the assumption that you are +deliberately writing a jump from a 16-bit segment to a 32-bit one. + + You can do the reverse operation, jumping from a 32-bit segment to a +16-bit one, by means of the `WORD' prefix: + + jmp word 0x8765:0x4321 ; 32 to 16 bit + + If the `WORD' prefix is specified in 16-bit mode, or the `DWORD' +prefix in 32-bit mode, they will be ignored, since each is explicitly +forcing NASM into a mode it was in anyway. + + +File: nasm.info, Node: Section 10.2, Next: Section 10.3, Prev: Section 10.1, Up: Chapter 10 + +10.2. Addressing Between Different-Size Segments +================================================ + +If your OS is mixed 16 and 32-bit, or if you are writing a DOS extender, +you are likely to have to deal with some 16-bit segments and some 32-bit +ones. At some point, you will probably end up writing code in a 16-bit +segment which has to access data in a 32-bit segment, or vice versa. + + If the data you are trying to access in a 32-bit segment lies within +the first 64K of the segment, you may be able to get away with using an +ordinary 16-bit addressing operation for the purpose; but sooner or +later, you will want to do 32-bit addressing from 16-bit mode. + + The easiest way to do this is to make sure you use a register for the +address, since any effective address containing a 32-bit register is +forced to be a 32-bit address. So you can do + + mov eax,offset_into_32_bit_segment_specified_by_fs + mov dword [fs:eax],0x11223344 + + This is fine, but slightly cumbersome (since it wastes an +instruction and a register) if you already know the precise offset you +are aiming at. The x86 architecture does allow 32-bit effective +addresses to specify nothing but a 4-byte offset, so why shouldn't NASM +be able to generate the best instruction for the purpose? + + It can. As in *note Section 10.1::, you need only prefix the address +with the `DWORD' keyword, and it will be forced to be a 32-bit address: + + mov dword [fs:dword my_offset],0x11223344 + + Also as in *note Section 10.1::, NASM is not fussy about whether the +`DWORD' prefix comes before or after the segment override, so arguably +a nicer-looking way to code the above instruction is + + mov dword [dword fs:my_offset],0x11223344 + + Don't confuse the `DWORD' prefix _outside_ the square brackets, +which controls the size of the data stored at the address, with the one +`inside' the square brackets which controls the length of the address +itself. The two can quite easily be different: + + mov word [dword 0x12345678],0x9ABC + + This moves 16 bits of data to an address specified by a 32-bit +offset. + + You can also specify `WORD' or `DWORD' prefixes along with the `FAR' +prefix to indirect far jumps or calls. For example: + + call dword far [fs:word 0x4321] + + This instruction contains an address specified by a 16-bit offset; +it loads a 48-bit far pointer from that (16-bit segment and 32-bit +offset), and calls that address. + + +File: nasm.info, Node: Section 10.3, Next: Chapter 11, Prev: Section 10.2, Up: Chapter 10 + +10.3. Other Mixed-Size Instructions +=================================== + +The other way you might want to access data might be using the string +instructions (`LODSx', `STOSx' and so on) or the `XLATB' instruction. +These instructions, since they take no parameters, might seem to have +no easy way to make them perform 32-bit addressing when assembled in a +16-bit segment. + + This is the purpose of NASM's `a16', `a32' and `a64' prefixes. If +you are coding `LODSB' in a 16-bit segment but it is supposed to be +accessing a string in a 32-bit segment, you should load the desired +address into `ESI' and then code + + a32 lodsb + + The prefix forces the addressing size to 32 bits, meaning that +`LODSB' loads from `[DS:ESI]' instead of `[DS:SI]'. To access a string +in a 16-bit segment when coding in a 32-bit one, the corresponding `a16' +prefix can be used. + + The `a16', `a32' and `a64' prefixes can be applied to any +instruction in NASM's instruction table, but most of them can generate +all the useful forms without them. The prefixes are necessary only for +instructions with implicit addressing: `CMPSx', `SCASx', `LODSx', +`STOSx', `MOVSx', `INSx', `OUTSx', and `XLATB'. Also, the various push +and pop instructions (`PUSHA' and `POPF' as well as the more usual +`PUSH' and `POP') can accept `a16', `a32' or `a64' prefixes to force a +particular one of `SP', `ESP' or `RSP' to be used as a stack pointer, +in case the stack segment in use is a different size from the code +segment. + + `PUSH' and `POP', when applied to segment registers in 32-bit mode, +also have the slightly odd behaviour that they push and pop 4 bytes at +a time, of which the top two are ignored and the bottom two give the +value of the segment register being manipulated. To force the 16-bit +behaviour of segment-register push and pop instructions, you can use the +operand-size prefix `o16': + + o16 push ss + o16 push ds + + This code saves a doubleword of stack space by fitting two segment +registers into the space which would normally be consumed by pushing +one. + + (You can also use the `o32' prefix to force the 32-bit behaviour when +in 16-bit mode, but this seems less useful.) + + +File: nasm.info, Node: Chapter 11, Next: Section 11.1, Prev: Section 10.3, Up: Top + +Chapter 11: Writing 64-bit Code (Unix, Win64) +********************************************* + +This chapter attempts to cover some of the common issues involved when +writing 64-bit code, to run under Win64 or Unix. It covers how to write +assembly code to interface with 64-bit C routines, and how to write +position-independent code for shared libraries. + + All 64-bit code uses a flat memory model, since segmentation is not +available in 64-bit mode. The one exception is the `FS' and `GS' +registers, which still add their bases. + + Position independence in 64-bit mode is significantly simpler, since +the processor supports `RIP'-relative addressing directly; see the +`REL' keyword (*note Section 3.3::). On most 64-bit platforms, it is +probably desirable to make that the default, using the directive +`DEFAULT REL' (*note Section 6.2::). + + 64-bit programming is relatively similar to 32-bit programming, but +of course pointers are 64 bits long; additionally, all existing +platforms pass arguments in registers rather than on the stack. +Furthermore, 64-bit platforms use SSE2 by default for floating point. +Please see the ABI documentation for your platform. + + 64-bit platforms differ in the sizes of the fundamental datatypes, +not just from 32-bit platforms but from each other. If a specific size +data type is desired, it is probably best to use the types defined in +the Standard C header `<inttypes.h>'. + + In 64-bit mode, the default instruction size is still 32 bits. When +loading a value into a 32-bit register (but not an 8- or 16-bit +register), the upper 32 bits of the corresponding 64-bit register are +set to zero. + +* Menu: + +* Section 11.1:: Register Names in 64-bit Mode +* Section 11.2:: Immediates and Displacements in 64-bit Mode +* Section 11.3:: Interfacing to 64-bit C Programs (Unix) +* Section 11.4:: Interfacing to 64-bit C Programs (Win64) + + +File: nasm.info, Node: Section 11.1, Next: Section 11.2, Prev: Chapter 11, Up: Chapter 11 + +11.1. Register Names in 64-bit Mode +=================================== + +NASM uses the following names for general-purpose registers in 64-bit +mode, for 8-, 16-, 32- and 64-bit references, respecitively: + + AL/AH, CL/CH, DL/DH, BL/BH, SPL, BPL, SIL, DIL, R8B-R15B + AX, CX, DX, BX, SP, BP, SI, DI, R8W-R15W + EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D-R15D + RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8-R15 + + This is consistent with the AMD documentation and most other +assemblers. The Intel documentation, however, uses the names +`R8L-R15L' for 8-bit references to the higher registers. It is possible +to use those names by definiting them as macros; similarly, if one +wants to use numeric names for the low 8 registers, define them as +macros. The standard macro package `altreg' (see *note Section 5.1::) +can be used for this purpose. + + +File: nasm.info, Node: Section 11.2, Next: Section 11.3, Prev: Section 11.1, Up: Chapter 11 + +11.2. Immediates and Displacements in 64-bit Mode +================================================= + +In 64-bit mode, immediates and displacements are generally only 32 bits +wide. NASM will therefore truncate most displacements and immediates to +32 bits. + + The only instruction which takes a full 64-bit immediate is: + + MOV reg64,imm64 + + NASM will produce this instruction whenever the programmer uses `MOV' +with an immediate into a 64-bit register. If this is not desirable, +simply specify the equivalent 32-bit register, which will be +automatically zero- extended by the processor, or specify the immediate +as `DWORD': + + mov rax,foo ; 64-bit immediate + mov rax,qword foo ; (identical) + mov eax,foo ; 32-bit immediate, zero-extended + mov rax,dword foo ; 32-bit immediate, sign-extended + + The length of these instructions are 10, 5 and 7 bytes, respectively. + + The only instructions which take a full 64-bit _displacement_ is +loading or storing, using `MOV', `AL', `AX', `EAX' or `RAX' (but no +other registers) to an absolute 64-bit address. Since this is a +relatively rarely used instruction (64-bit code generally uses relative +addressing), the programmer has to explicitly declare the displacement +size as `QWORD': + + default abs + + mov eax,[foo] ; 32-bit absolute disp, sign-extended + mov eax,[a32 foo] ; 32-bit absolute disp, zero-extended + mov eax,[qword foo] ; 64-bit absolute disp + + default rel + + mov eax,[foo] ; 32-bit relative disp + mov eax,[a32 foo] ; d:o, address truncated to 32 bits(!) + mov eax,[qword foo] ; error + mov eax,[abs qword foo] ; 64-bit absolute disp + + A sign-extended absolute displacement can access from -2 GB to +2 +GB; a zero-extended absolute displacement can access from 0 to 4 GB. + + +File: nasm.info, Node: Section 11.3, Next: Section 11.4, Prev: Section 11.2, Up: Chapter 11 + +11.3. Interfacing to 64-bit C Programs (Unix) +============================================= + +On Unix, the 64-bit ABI is defined by the document: + + `http://www.x86-64.org/documentation/abi.pdf' + + Although written for AT&T-syntax assembly, the concepts apply +equally well for NASM-style assembly. What follows is a simplified +summary. + + The first six integer arguments (from the left) are passed in `RDI', +`RSI', `RDX', `RCX', `R8', and `R9', in that order. Additional integer +arguments are passed on the stack. These registers, plus `RAX', `R10' +and `R11' are destroyed by function calls, and thus are available for +use by the function without saving. + + Integer return values are passed in `RAX' and `RDX', in that order. + + Floating point is done using SSE registers, except for `long double'. +Floating-point arguments are passed in `XMM0' to `XMM7'; return is +`XMM0' and `XMM1'. `long double' are passed on the stack, and returned +in `ST0' and `ST1'. + + All SSE and x87 registers are destroyed by function calls. + + On 64-bit Unix, `long' is 64 bits. + + Integer and SSE register arguments are counted separately, so for +the case of + + void foo(long a, double b, int c) + + `a' is passed in `RDI', `b' in `XMM0', and `c' in `ESI'. + + +File: nasm.info, Node: Section 11.4, Next: Chapter 12, Prev: Section 11.3, Up: Chapter 11 + +11.4. Interfacing to 64-bit C Programs (Win64) +============================================== + +The Win64 ABI is described at: + + `http://msdn2.microsoft.com/en-gb/library/ms794533.aspx' + + What follows is a simplified summary. + + The first four integer arguments are passed in `RCX', `RDX', `R8' +and `R9', in that order. Additional integer arguments are passed on the +stack. These registers, plus `RAX', `R10' and `R11' are destroyed by +function calls, and thus are available for use by the function without +saving. + + Integer return values are passed in `RAX' only. + + Floating point is done using SSE registers, except for `long double'. +Floating-point arguments are passed in `XMM0' to `XMM3'; return is +`XMM0' only. + + On Win64, `long' is 32 bits; `long long' or `_int64' is 64 bits. + + Integer and SSE register arguments are counted together, so for the +case of + + void foo(long long a, double b, int c) + + `a' is passed in `RCX', `b' in `XMM1', and `c' in `R8D'. + + +File: nasm.info, Node: Chapter 12, Next: Section 12.1, Prev: Section 11.4, Up: Top + +Chapter 12: Troubleshooting +*************************** + +This chapter describes some of the common problems that users have been +known to encounter with NASM, and answers them. It also gives +instructions for reporting bugs in NASM if you find a difficulty that +isn't listed here. + +* Menu: + +* Section 12.1:: Common Problems +* Section 12.2:: Bugs + + +File: nasm.info, Node: Section 12.1, Next: Section 12.1.1, Prev: Chapter 12, Up: Chapter 12 + +12.1. Common Problems +===================== + +* Menu: + +* Section 12.1.1:: NASM Generates Inefficient Code +* Section 12.1.2:: My Jumps are Out of Range +* Section 12.1.3:: `ORG' Doesn't Work +* Section 12.1.4:: `TIMES' Doesn't Work + + +File: nasm.info, Node: Section 12.1.1, Next: Section 12.1.2, Prev: Section 12.1, Up: Section 12.1 + +12.1.1. NASM Generates Inefficient Code +--------------------------------------- + +We sometimes get `bug' reports about NASM generating inefficient, or +even `wrong', code on instructions such as `ADD ESP,8'. This is a +deliberate design feature, connected to predictability of output: NASM, +on seeing `ADD ESP,8', will generate the form of the instruction which +leaves room for a 32-bit offset. You need to code `ADD ESP,BYTE 8' if +you want the space-efficient form of the instruction. This isn't a bug, +it's user error: if you prefer to have NASM produce the more efficient +code automatically enable optimization with the `-O' option (see *note +Section 2.1.22::). + + +File: nasm.info, Node: Section 12.1.2, Next: Section 12.1.3, Prev: Section 12.1.1, Up: Section 12.1 + +12.1.2. My Jumps are Out of Range +--------------------------------- + +Similarly, people complain that when they issue conditional jumps (which +are `SHORT' by default) that try to jump too far, NASM reports `short +jump out of range' instead of making the jumps longer. + + This, again, is partly a predictability issue, but in fact has a more +practical reason as well. NASM has no means of being told what type of +processor the code it is generating will be run on; so it cannot decide +for itself that it should generate `Jcc NEAR' type instructions, because +it doesn't know that it's working for a 386 or above. Alternatively, it +could replace the out-of-range short `JNE' instruction with a very +short `JE' instruction that jumps over a `JMP NEAR'; this is a sensible +solution for processors below a 386, but hardly efficient on processors +which have good branch prediction _and_ could have used `JNE NEAR' +instead. So, once again, it's up to the user, not the assembler, to +decide what instructions should be generated. See *note Section +2.1.22::. + + +File: nasm.info, Node: Section 12.1.3, Next: Section 12.1.4, Prev: Section 12.1.2, Up: Section 12.1 + +12.1.3. `ORG' Doesn't Work +-------------------------- + +People writing boot sector programs in the `bin' format often complain +that `ORG' doesn't work the way they'd like: in order to place the +`0xAA55' signature word at the end of a 512-byte boot sector, people +who are used to MASM tend to code + + ORG 0 + + ; some boot sector code + + ORG 510 + DW 0xAA55 + + This is not the intended use of the `ORG' directive in NASM, and will +not work. The correct way to solve this problem in NASM is to use the +`TIMES' directive, like this: + + ORG 0 + + ; some boot sector code + + TIMES 510-($-$$) DB 0 + DW 0xAA55 + + The `TIMES' directive will insert exactly enough zero bytes into the +output to move the assembly point up to 510. This method also has the +advantage that if you accidentally fill your boot sector too full, NASM +will catch the problem at assembly time and report it, so you won't end +up with a boot sector that you have to disassemble to find out what's +wrong with it. + + +File: nasm.info, Node: Section 12.1.4, Next: Section 12.2, Prev: Section 12.1.3, Up: Section 12.1 + +12.1.4. `TIMES' Doesn't Work +---------------------------- + +The other common problem with the above code is people who write the +`TIMES' line as + + TIMES 510-$ DB 0 + + by reasoning that `$' should be a pure number, just like 510, so the +difference between them is also a pure number and can happily be fed to +`TIMES'. + + NASM is a _modular_ assembler: the various component parts are +designed to be easily separable for re-use, so they don't exchange +information unnecessarily. In consequence, the `bin' output format, +even though it has been told by the `ORG' directive that the `.text' +section should start at 0, does not pass that information back to the +expression evaluator. So from the evaluator's point of view, `$' isn't +a pure number: it's an offset from a section base. Therefore the +difference between `$' and 510 is also not a pure number, but involves +a section base. Values involving section bases cannot be passed as +arguments to `TIMES'. + + The solution, as in the previous section, is to code the `TIMES' line +in the form + + TIMES 510-($-$$) DB 0 + + in which `$' and `$$' are offsets from the same section base, and so +their difference is a pure number. This will solve the problem and +generate sensible code. + + +File: nasm.info, Node: Section 12.2, Next: Appendix A, Prev: Section 12.1.4, Up: Chapter 12 + +12.2. Bugs +========== + +We have never yet released a version of NASM with any _known_ bugs. +That doesn't usually stop there being plenty we didn't know about, +though. Any that you find should be reported firstly via the +`bugtracker' at `https://sourceforge.net/projects/nasm/' (click on +"Bugs"), or if that fails then through one of the contacts in *note +Section 1.2::. + + Please read *note Section 2.2:: first, and don't report the bug if +it's listed in there as a deliberate feature. (If you think the feature +is badly thought out, feel free to send us reasons why you think it +should be changed, but don't just send us mail saying `This is a bug' +if the documentation says we did it on purpose.) Then read *note +Section 12.1::, and don't bother reporting the bug if it's listed there. + + If you do report a bug, _please_ give us all of the following +information: + + * What operating system you're running NASM under. DOS, Linux, + NetBSD, Win16, Win32, VMS (I'd be impressed), whatever. + + * If you're running NASM under DOS or Win32, tell us whether you've + compiled your own executable from the DOS source archive, or + whether you were using the standard distribution binaries out of + the archive. If you were using a locally built executable, try to + reproduce the problem using one of the standard binaries, as this + will make it easier for us to reproduce your problem prior to + fixing it. + + * Which version of NASM you're using, and exactly how you invoked + it. Give us the precise command line, and the contents of the + `NASMENV' environment variable if any. + + * Which versions of any supplementary programs you're using, and how + you invoked them. If the problem only becomes visible at link + time, tell us what linker you're using, what version of it you've + got, and the exact linker command line. If the problem involves + linking against object files generated by a compiler, tell us what + compiler, what version, and what command line or options you used. + (If you're compiling in an IDE, please try to reproduce the + problem with the command-line version of the compiler.) + + * If at all possible, send us a NASM source file which exhibits the + problem. If this causes copyright problems (e.g. you can only + reproduce the bug in restricted-distribution code) then bear in + mind the following two points: firstly, we guarantee that any + source code sent to us for the purposes of debugging NASM will be + used _only_ for the purposes of debugging NASM, and that we will + delete all our copies of it as soon as we have found and fixed the + bug or bugs in question; and secondly, we would prefer _not_ to be + mailed large chunks of code anyway. The smaller the file, the + better. A three-line sample file that does nothing useful + _except_ demonstrate the problem is much easier to work with than + a fully fledged ten-thousand- line program. (Of course, some + errors _do_ only crop up in large files, so this may not be + possible.) + + * A description of what the problem actually _is_. `It doesn't work' + is _not_ a helpful description! Please describe exactly what is + happening that shouldn't be, or what isn't happening that should. + Examples might be: `NASM generates an error message saying Line 3 + for an error that's actually on Line 5'; `NASM generates an error + message that I believe it shouldn't be generating at all'; `NASM + fails to generate an error message that I believe it _should_ be + generating'; `the object file produced from this source code + crashes my linker'; `the ninth byte of the output file is 66 and I + think it should be 77 instead'. + + * If you believe the output file from NASM to be faulty, send it to + us. That allows us to determine whether our own copy of NASM + generates the same file, or whether the problem is related to + portability issues between our development platforms and yours. We + can handle binary files mailed to us as MIME attachments, + uuencoded, and even BinHex. Alternatively, we may be able to + provide an FTP site you can upload the suspect files to; but + mailing them is easier for us. + + * Any other information or data files that might be helpful. If, for + example, the problem involves NASM failing to generate an object + file while TASM can generate an equivalent file without trouble, + then send us _both_ object files, so we can see what TASM is doing + differently from us. + + +File: nasm.info, Node: Appendix A, Next: Section A.1, Prev: Section 12.2, Up: Top + +Appendix A: Ndisasm +******************* + +The Netwide Disassembler, NDISASM + +* Menu: + +* Section A.1:: Introduction +* Section A.2:: Getting Started: Installation +* Section A.3:: Running NDISASM +* Section A.4:: Bugs and Improvements + + +File: nasm.info, Node: Section A.1, Next: Section A.2, Prev: Appendix A, Up: Appendix A + +A.1. Introduction +================= + +The Netwide Disassembler is a small companion program to the Netwide +Assembler, NASM. It seemed a shame to have an x86 assembler, complete +with a full instruction table, and not make as much use of it as +possible, so here's a disassembler which shares the instruction table +(and some other bits of code) with NASM. + + The Netwide Disassembler does nothing except to produce +disassemblies of _binary_ source files. NDISASM does not have any +understanding of object file formats, like `objdump', and it will not +understand `DOS .EXE' files like `debug' will. It just disassembles. + + +File: nasm.info, Node: Section A.2, Next: Section A.3, Prev: Section A.1, Up: Appendix A + +A.2. Getting Started: Installation +================================== + +See *note Section 1.3:: for installation instructions. NDISASM, like +NASM, has a `man page' which you may want to put somewhere useful, if +you are on a Unix system. + + +File: nasm.info, Node: Section A.3, Next: Section A.3.1, Prev: Section A.2, Up: Appendix A + +A.3. Running NDISASM +==================== + +To disassemble a file, you will typically use a command of the form + + ndisasm -b {16|32|64} filename + + NDISASM can disassemble 16-, 32- or 64-bit code equally easily, +provided of course that you remember to specify which it is to work +with. If no `-b' switch is present, NDISASM works in 16-bit mode by +default. The `-u' switch (for USE32) also invokes 32-bit mode. + + Two more command line options are `-r' which reports the version +number of NDISASM you are running, and `-h' which gives a short summary +of command line options. + +* Menu: + +* Section A.3.1:: COM Files: Specifying an Origin +* Section A.3.2:: Code Following Data: Synchronisation +* Section A.3.3:: Mixed Code and Data: Automatic (Intelligent) Synchronisation +* Section A.3.4:: Other Options + + +File: nasm.info, Node: Section A.3.1, Next: Section A.3.2, Prev: Section A.3, Up: Section A.3 + +A.3.1. COM Files: Specifying an Origin +-------------------------------------- + +To disassemble a `DOS .COM' file correctly, a disassembler must assume +that the first instruction in the file is loaded at address `0x100', +rather than at zero. NDISASM, which assumes by default that any file you +give it is loaded at zero, will therefore need to be informed of this. + + The `-o' option allows you to declare a different origin for the file +you are disassembling. Its argument may be expressed in any of the NASM +numeric formats: decimal by default, if it begins with ``$'' or ``0x'' +or ends in ``H'' it's `hex', if it ends in ``Q'' it's `octal', and if +it ends in ``B'' it's `binary'. + + Hence, to disassemble a `.COM' file: + + ndisasm -o100h filename.com + + will do the trick. + + +File: nasm.info, Node: Section A.3.2, Next: Section A.3.3, Prev: Section A.3.1, Up: Section A.3 + +A.3.2. Code Following Data: Synchronisation +------------------------------------------- + +Suppose you are disassembling a file which contains some data which +isn't machine code, and _then_ contains some machine code. NDISASM will +faithfully plough through the data section, producing machine +instructions wherever it can (although most of them will look bizarre, +and some may have unusual prefixes, e.g. ``FS OR AX,0x240A''), and +generating `DB' instructions ever so often if it's totally stumped. +Then it will reach the code section. + + Supposing NDISASM has just finished generating a strange machine +instruction from part of the data section, and its file position is now +one byte _before_ the beginning of the code section. It's entirely +possible that another spurious instruction will get generated, starting +with the final byte of the data section, and then the correct first +instruction in the code section will not be seen because the starting +point skipped over it. This isn't really ideal. + + To avoid this, you can specify a ``synchronisation'' point, or indeed +as many synchronisation points as you like (although NDISASM can only +handle 2147483647 sync points internally). The definition of a sync +point is this: NDISASM guarantees to hit sync points exactly during +disassembly. If it is thinking about generating an instruction which +would cause it to jump over a sync point, it will discard that +instruction and output a ``db'' instead. So it _will_ start disassembly +exactly from the sync point, and so you _will_ see all the instructions +in your code section. + + Sync points are specified using the `-s' option: they are measured in +terms of the program origin, not the file position. So if you want to +synchronize after 32 bytes of a `.COM' file, you would have to do + + ndisasm -o100h -s120h file.com + + rather than + + ndisasm -o100h -s20h file.com + + As stated above, you can specify multiple sync markers if you need +to, just by repeating the `-s' option. + + +File: nasm.info, Node: Section A.3.3, Next: Section A.3.4, Prev: Section A.3.2, Up: Section A.3 + +A.3.3. Mixed Code and Data: Automatic (Intelligent) Synchronisation +------------------------------------------------------------------- + +Suppose you are disassembling the boot sector of a `DOS' floppy (maybe +it has a virus, and you need to understand the virus so that you know +what kinds of damage it might have done you). Typically, this will +contain a `JMP' instruction, then some data, then the rest of the code. +So there is a very good chance of NDISASM being _misaligned_ when the +data ends and the code begins. Hence a sync point is needed. + + On the other hand, why should you have to specify the sync point +manually? What you'd do in order to find where the sync point would +be, surely, would be to read the `JMP' instruction, and then to use its +target address as a sync point. So can NDISASM do that for you? + + The answer, of course, is yes: using either of the synonymous +switches `-a' (for automatic sync) or `-i' (for intelligent sync) will +enable `auto-sync' mode. Auto-sync mode automatically generates a sync +point for any forward-referring PC-relative jump or call instruction +that NDISASM encounters. (Since NDISASM is one-pass, if it encounters a +PC- relative jump whose target has already been processed, there isn't +much it can do about it...) + + Only PC-relative jumps are processed, since an absolute jump is +either through a register (in which case NDISASM doesn't know what the +register contains) or involves a segment address (in which case the +target code isn't in the same segment that NDISASM is working in, and +so the sync point can't be placed anywhere useful). + + For some kinds of file, this mechanism will automatically put sync +points in all the right places, and save you from having to place any +sync points manually. However, it should be stressed that auto-sync +mode is _not_ guaranteed to catch all the sync points, and you may +still have to place some manually. + + Auto-sync mode doesn't prevent you from declaring manual sync +points: it just adds automatically generated ones to the ones you +provide. It's perfectly feasible to specify `-i' _and_ some `-s' +options. + + Another caveat with auto-sync mode is that if, by some unpleasant +fluke, something in your data section should disassemble to a +PC-relative call or jump instruction, NDISASM may obediently place a +sync point in a totally random place, for example in the middle of one +of the instructions in your code section. So you may end up with a +wrong disassembly even if you use auto-sync. Again, there isn't much I +can do about this. If you have problems, you'll have to use manual sync +points, or use the `-k' option (documented below) to suppress +disassembly of the data area. + + +File: nasm.info, Node: Section A.3.4, Next: Section A.4, Prev: Section A.3.3, Up: Section A.3 + +A.3.4. Other Options +-------------------- + +The `-e' option skips a header on the file, by ignoring the first N +bytes. This means that the header is _not_ counted towards the +disassembly offset: if you give `-e10 -o10', disassembly will start at +byte 10 in the file, and this will be given offset 10, not 20. + + The `-k' option is provided with two comma-separated numeric +arguments, the first of which is an assembly offset and the second is a +number of bytes to skip. This _will_ count the skipped bytes towards +the assembly offset: its use is to suppress disassembly of a data +section which wouldn't contain anything you wanted to see anyway. + + +File: nasm.info, Node: Section A.4, Next: Appendix B, Prev: Section A.3.4, Up: Appendix A + +A.4. Bugs and Improvements +========================== + +There are no known bugs. However, any you find, with patches if +possible, should be sent to `nasm-bugs@lists.sourceforge.net', or to the +developer's site at `https://sourceforge.net/projects/nasm/' and we'll +try to fix them. Feel free to send contributions and new features as +well. + + +File: nasm.info, Node: Appendix B, Next: Section B.1, Prev: Section A.4, Up: Top + +Appendix B: Instruction List +**************************** + +* Menu: + +* Section B.1:: Introduction + + +File: nasm.info, Node: Section B.1, Next: Section B.1.1, Prev: Appendix B, Up: Appendix B + +B.1. Introduction +================= + +The following sections show the instructions which NASM currently +supports. For each instruction, there is a separate entry for each +supported addressing mode. The third column shows the processor type in +which the instruction was introduced and, when appropriate, one or more +usage flags. + +* Menu: + +* Section B.1.1:: Special instructions... +* Section B.1.2:: Conventional instructions +* Section B.1.3:: Katmai Streaming SIMD instructions (SSE ---- a.k.a. KNI, XMM, MMX2) +* Section B.1.4:: Introduced in Deschutes but necessary for SSE support +* Section B.1.5:: XSAVE group (AVX and extended state) +* Section B.1.6:: Generic memory operations +* Section B.1.7:: New MMX instructions introduced in Katmai +* Section B.1.8:: AMD Enhanced 3DNow! (Athlon) instructions +* Section B.1.9:: Willamette SSE2 Cacheability Instructions +* Section B.1.10:: Willamette MMX instructions (SSE2 SIMD Integer Instructions) +* Section B.1.11:: Willamette Streaming SIMD instructions (SSE2) +* Section B.1.12:: Prescott New Instructions (SSE3) +* Section B.1.13:: VMX Instructions +* Section B.1.14:: Extended Page Tables VMX instructions +* Section B.1.15:: Tejas New Instructions (SSSE3) +* Section B.1.16:: AMD SSE4A +* Section B.1.17:: New instructions in Barcelona +* Section B.1.18:: Penryn New Instructions (SSE4.1) +* Section B.1.19:: Nehalem New Instructions (SSE4.2) +* Section B.1.20:: Intel SMX +* Section B.1.21:: Geode (Cyrix) 3DNow! additions +* Section B.1.22:: Intel new instructions in ??? +* Section B.1.23:: Intel AES instructions +* Section B.1.24:: Intel AVX AES instructions +* Section B.1.25:: Intel AVX instructions +* Section B.1.26:: Intel Carry-Less Multiplication instructions (CLMUL) +* Section B.1.27:: Intel AVX Carry-Less Multiplication instructions (CLMUL) +* Section B.1.28:: Intel Fused Multiply-Add instructions (FMA) +* Section B.1.29:: VIA (Centaur) security instructions +* Section B.1.30:: AMD Lightweight Profiling (LWP) instructions +* Section B.1.31:: AMD XOP, FMA4 and CVT16 instructions (SSE5) +* Section B.1.32:: Systematic names for the hinting nop instructions + + +File: nasm.info, Node: Section B.1.1, Next: Section B.1.2, Prev: Section B.1, Up: Section B.1 + +B.1.1. Special instructions... +------------------------------ + + DB + DW + DD + DQ + DT + DO + DY + RESB imm 8086 + RESW + RESD + RESQ + REST + RESO + RESY + + +File: nasm.info, Node: Section B.1.2, Next: Section B.1.3, Prev: Section B.1.1, Up: Section B.1 + +B.1.2. Conventional instructions +-------------------------------- + + AAA 8086,NOLONG + AAD 8086,NOLONG + AAD imm 8086,NOLONG + AAM 8086,NOLONG + AAM imm 8086,NOLONG + AAS 8086,NOLONG + ADC mem,reg8 8086 + ADC reg8,reg8 8086 + ADC mem,reg16 8086 + ADC reg16,reg16 8086 + ADC mem,reg32 386 + ADC reg32,reg32 386 + ADC mem,reg64 X64 + ADC reg64,reg64 X64 + ADC reg8,mem 8086 + ADC reg8,reg8 8086 + ADC reg16,mem 8086 + ADC reg16,reg16 8086 + ADC reg32,mem 386 + ADC reg32,reg32 386 + ADC reg64,mem X64 + ADC reg64,reg64 X64 + ADC rm16,imm8 8086 + ADC rm32,imm8 386 + ADC rm64,imm8 X64 + ADC reg_al,imm 8086 + ADC reg_ax,sbyte16 8086 + ADC reg_ax,imm 8086 + ADC reg_eax,sbyte32 386 + ADC reg_eax,imm 386 + ADC reg_rax,sbyte64 X64 + ADC reg_rax,imm X64 + ADC rm8,imm 8086 + ADC rm16,imm 8086 + ADC rm32,imm 386 + ADC rm64,imm X64 + ADC mem,imm8 8086 + ADC mem,imm16 8086 + ADC mem,imm32 386 + ADD mem,reg8 8086 + ADD reg8,reg8 8086 + ADD mem,reg16 8086 + ADD reg16,reg16 8086 + ADD mem,reg32 386 + ADD reg32,reg32 386 + ADD mem,reg64 X64 + ADD reg64,reg64 X64 + ADD reg8,mem 8086 + ADD reg8,reg8 8086 + ADD reg16,mem 8086 + ADD reg16,reg16 8086 + ADD reg32,mem 386 + ADD reg32,reg32 386 + ADD reg64,mem X64 + ADD reg64,reg64 X64 + ADD rm16,imm8 8086 + ADD rm32,imm8 386 + ADD rm64,imm8 X64 + ADD reg_al,imm 8086 + ADD reg_ax,sbyte16 8086 + ADD reg_ax,imm 8086 + ADD reg_eax,sbyte32 386 + ADD reg_eax,imm 386 + ADD reg_rax,sbyte64 X64 + ADD reg_rax,imm X64 + ADD rm8,imm 8086 + ADD rm16,imm 8086 + ADD rm32,imm 386 + ADD rm64,imm X64 + ADD mem,imm8 8086 + ADD mem,imm16 8086 + ADD mem,imm32 386 + AND mem,reg8 8086 + AND reg8,reg8 8086 + AND mem,reg16 8086 + AND reg16,reg16 8086 + AND mem,reg32 386 + AND reg32,reg32 386 + AND mem,reg64 X64 + AND reg64,reg64 X64 + AND reg8,mem 8086 + AND reg8,reg8 8086 + AND reg16,mem 8086 + AND reg16,reg16 8086 + AND reg32,mem 386 + AND reg32,reg32 386 + AND reg64,mem X64 + AND reg64,reg64 X64 + AND rm16,imm8 8086 + AND rm32,imm8 386 + AND rm64,imm8 X64 + AND reg_al,imm 8086 + AND reg_ax,sbyte16 8086 + AND reg_ax,imm 8086 + AND reg_eax,sbyte32 386 + AND reg_eax,imm 386 + AND reg_rax,sbyte64 X64 + AND reg_rax,imm X64 + AND rm8,imm 8086 + AND rm16,imm 8086 + AND rm32,imm 386 + AND rm64,imm X64 + AND mem,imm8 8086 + AND mem,imm16 8086 + AND mem,imm32 386 + ARPL mem,reg16 286,PROT,NOLONG + ARPL reg16,reg16 286,PROT,NOLONG + BB0_RESET PENT,CYRIX,ND + BB1_RESET PENT,CYRIX,ND + BOUND reg16,mem 186,NOLONG + BOUND reg32,mem 386,NOLONG + BSF reg16,mem 386 + BSF reg16,reg16 386 + BSF reg32,mem 386 + BSF reg32,reg32 386 + BSF reg64,mem X64 + BSF reg64,reg64 X64 + BSR reg16,mem 386 + BSR reg16,reg16 386 + BSR reg32,mem 386 + BSR reg32,reg32 386 + BSR reg64,mem X64 + BSR reg64,reg64 X64 + BSWAP reg32 486 + BSWAP reg64 X64 + BT mem,reg16 386 + BT reg16,reg16 386 + BT mem,reg32 386 + BT reg32,reg32 386 + BT mem,reg64 X64 + BT reg64,reg64 X64 + BT rm16,imm 386 + BT rm32,imm 386 + BT rm64,imm X64 + BTC mem,reg16 386 + BTC reg16,reg16 386 + BTC mem,reg32 386 + BTC reg32,reg32 386 + BTC mem,reg64 X64 + BTC reg64,reg64 X64 + BTC rm16,imm 386 + BTC rm32,imm 386 + BTC rm64,imm X64 + BTR mem,reg16 386 + BTR reg16,reg16 386 + BTR mem,reg32 386 + BTR reg32,reg32 386 + BTR mem,reg64 X64 + BTR reg64,reg64 X64 + BTR rm16,imm 386 + BTR rm32,imm 386 + BTR rm64,imm X64 + BTS mem,reg16 386 + BTS reg16,reg16 386 + BTS mem,reg32 386 + BTS reg32,reg32 386 + BTS mem,reg64 X64 + BTS reg64,reg64 X64 + BTS rm16,imm 386 + BTS rm32,imm 386 + BTS rm64,imm X64 + CALL imm 8086 + CALL imm|near 8086 + CALL imm|far 8086,ND,NOLONG + CALL imm16 8086 + CALL imm16|near 8086 + CALL imm16|far 8086,ND,NOLONG + CALL imm32 386 + CALL imm32|near 386 + CALL imm32|far 386,ND,NOLONG + CALL imm:imm 8086,NOLONG + CALL imm16:imm 8086,NOLONG + CALL imm:imm16 8086,NOLONG + CALL imm32:imm 386,NOLONG + CALL imm:imm32 386,NOLONG + CALL mem|far 8086,NOLONG + CALL mem|far X64 + CALL mem16|far 8086 + CALL mem32|far 386 + CALL mem64|far X64 + CALL mem|near 8086 + CALL mem16|near 8086 + CALL mem32|near 386,NOLONG + CALL mem64|near X64 + CALL reg16 8086 + CALL reg32 386,NOLONG + CALL reg64 X64 + CALL mem 8086 + CALL mem16 8086 + CALL mem32 386,NOLONG + CALL mem64 X64 + CBW 8086 + CDQ 386 + CDQE X64 + CLC 8086 + CLD 8086 + CLGI X64,AMD + CLI 8086 + CLTS 286,PRIV + CMC 8086 + CMP mem,reg8 8086 + CMP reg8,reg8 8086 + CMP mem,reg16 8086 + CMP reg16,reg16 8086 + CMP mem,reg32 386 + CMP reg32,reg32 386 + CMP mem,reg64 X64 + CMP reg64,reg64 X64 + CMP reg8,mem 8086 + CMP reg8,reg8 8086 + CMP reg16,mem 8086 + CMP reg16,reg16 8086 + CMP reg32,mem 386 + CMP reg32,reg32 386 + CMP reg64,mem X64 + CMP reg64,reg64 X64 + CMP rm16,imm8 8086 + CMP rm32,imm8 386 + CMP rm64,imm8 X64 + CMP reg_al,imm 8086 + CMP reg_ax,sbyte16 8086 + CMP reg_ax,imm 8086 + CMP reg_eax,sbyte32 386 + CMP reg_eax,imm 386 + CMP reg_rax,sbyte64 X64 + CMP reg_rax,imm X64 + CMP rm8,imm 8086 + CMP rm16,imm 8086 + CMP rm32,imm 386 + CMP rm64,imm X64 + CMP mem,imm8 8086 + CMP mem,imm16 8086 + CMP mem,imm32 386 + CMPSB 8086 + CMPSD 386 + CMPSQ X64 + CMPSW 8086 + CMPXCHG mem,reg8 PENT + CMPXCHG reg8,reg8 PENT + CMPXCHG mem,reg16 PENT + CMPXCHG reg16,reg16 PENT + CMPXCHG mem,reg32 PENT + CMPXCHG reg32,reg32 PENT + CMPXCHG mem,reg64 X64 + CMPXCHG reg64,reg64 X64 + CMPXCHG486 mem,reg8 486,UNDOC,ND + CMPXCHG486 reg8,reg8 486,UNDOC,ND + CMPXCHG486 mem,reg16 486,UNDOC,ND + CMPXCHG486 reg16,reg16 486,UNDOC,ND + CMPXCHG486 mem,reg32 486,UNDOC,ND + CMPXCHG486 reg32,reg32 486,UNDOC,ND + CMPXCHG8B mem PENT + CMPXCHG16B mem X64 + CPUID PENT + CPU_READ PENT,CYRIX + CPU_WRITE PENT,CYRIX + CQO X64 + CWD 8086 + CWDE 386 + DAA 8086,NOLONG + DAS 8086,NOLONG + DEC reg16 8086,NOLONG + DEC reg32 386,NOLONG + DEC rm8 8086 + DEC rm16 8086 + DEC rm32 386 + DEC rm64 X64 + DIV rm8 8086 + DIV rm16 8086 + DIV rm32 386 + DIV rm64 X64 + DMINT P6,CYRIX + EMMS PENT,MMX + ENTER imm,imm 186 + EQU imm 8086 + EQU imm:imm 8086 + F2XM1 8086,FPU + FABS 8086,FPU + FADD mem32 8086,FPU + FADD mem64 8086,FPU + FADD fpureg|to 8086,FPU + FADD fpureg 8086,FPU + FADD fpureg,fpu0 8086,FPU + FADD fpu0,fpureg 8086,FPU + FADD 8086,FPU,ND + FADDP fpureg 8086,FPU + FADDP fpureg,fpu0 8086,FPU + FADDP 8086,FPU,ND + FBLD mem80 8086,FPU + FBLD mem 8086,FPU + FBSTP mem80 8086,FPU + FBSTP mem 8086,FPU + FCHS 8086,FPU + FCLEX 8086,FPU + FCMOVB fpureg P6,FPU + FCMOVB fpu0,fpureg P6,FPU + FCMOVB P6,FPU,ND + FCMOVBE fpureg P6,FPU + FCMOVBE fpu0,fpureg P6,FPU + FCMOVBE P6,FPU,ND + FCMOVE fpureg P6,FPU + FCMOVE fpu0,fpureg P6,FPU + FCMOVE P6,FPU,ND + FCMOVNB fpureg P6,FPU + FCMOVNB fpu0,fpureg P6,FPU + FCMOVNB P6,FPU,ND + FCMOVNBE fpureg P6,FPU + FCMOVNBE fpu0,fpureg P6,FPU + FCMOVNBE P6,FPU,ND + FCMOVNE fpureg P6,FPU + FCMOVNE fpu0,fpureg P6,FPU + FCMOVNE P6,FPU,ND + FCMOVNU fpureg P6,FPU + FCMOVNU fpu0,fpureg P6,FPU + FCMOVNU P6,FPU,ND + FCMOVU fpureg P6,FPU + FCMOVU fpu0,fpureg P6,FPU + FCMOVU P6,FPU,ND + FCOM mem32 8086,FPU + FCOM mem64 8086,FPU + FCOM fpureg 8086,FPU + FCOM fpu0,fpureg 8086,FPU + FCOM 8086,FPU,ND + FCOMI fpureg P6,FPU + FCOMI fpu0,fpureg P6,FPU + FCOMI P6,FPU,ND + FCOMIP fpureg P6,FPU + FCOMIP fpu0,fpureg P6,FPU + FCOMIP P6,FPU,ND + FCOMP mem32 8086,FPU + FCOMP mem64 8086,FPU + FCOMP fpureg 8086,FPU + FCOMP fpu0,fpureg 8086,FPU + FCOMP 8086,FPU,ND + FCOMPP 8086,FPU + FCOS 386,FPU + FDECSTP 8086,FPU + FDISI 8086,FPU + FDIV mem32 8086,FPU + FDIV mem64 8086,FPU + FDIV fpureg|to 8086,FPU + FDIV fpureg 8086,FPU + FDIV fpureg,fpu0 8086,FPU + FDIV fpu0,fpureg 8086,FPU + FDIV 8086,FPU,ND + FDIVP fpureg 8086,FPU + FDIVP fpureg,fpu0 8086,FPU + FDIVP 8086,FPU,ND + FDIVR mem32 8086,FPU + FDIVR mem64 8086,FPU + FDIVR fpureg|to 8086,FPU + FDIVR fpureg,fpu0 8086,FPU + FDIVR fpureg 8086,FPU + FDIVR fpu0,fpureg 8086,FPU + FDIVR 8086,FPU,ND + FDIVRP fpureg 8086,FPU + FDIVRP fpureg,fpu0 8086,FPU + FDIVRP 8086,FPU,ND + FEMMS PENT,3DNOW + FENI 8086,FPU + FFREE fpureg 8086,FPU + FFREE 8086,FPU + FFREEP fpureg 286,FPU,UNDOC + FFREEP 286,FPU,UNDOC + FIADD mem32 8086,FPU + FIADD mem16 8086,FPU + FICOM mem32 8086,FPU + FICOM mem16 8086,FPU + FICOMP mem32 8086,FPU + FICOMP mem16 8086,FPU + FIDIV mem32 8086,FPU + FIDIV mem16 8086,FPU + FIDIVR mem32 8086,FPU + FIDIVR mem16 8086,FPU + FILD mem32 8086,FPU + FILD mem16 8086,FPU + FILD mem64 8086,FPU + FIMUL mem32 8086,FPU + FIMUL mem16 8086,FPU + FINCSTP 8086,FPU + FINIT 8086,FPU + FIST mem32 8086,FPU + FIST mem16 8086,FPU + FISTP mem32 8086,FPU + FISTP mem16 8086,FPU + FISTP mem64 8086,FPU + FISTTP mem16 PRESCOTT,FPU + FISTTP mem32 PRESCOTT,FPU + FISTTP mem64 PRESCOTT,FPU + FISUB mem32 8086,FPU + FISUB mem16 8086,FPU + FISUBR mem32 8086,FPU + FISUBR mem16 8086,FPU + FLD mem32 8086,FPU + FLD mem64 8086,FPU + FLD mem80 8086,FPU + FLD fpureg 8086,FPU + FLD 8086,FPU,ND + FLD1 8086,FPU + FLDCW mem 8086,FPU,SW + FLDENV mem 8086,FPU + FLDL2E 8086,FPU + FLDL2T 8086,FPU + FLDLG2 8086,FPU + FLDLN2 8086,FPU + FLDPI 8086,FPU + FLDZ 8086,FPU + FMUL mem32 8086,FPU + FMUL mem64 8086,FPU + FMUL fpureg|to 8086,FPU + FMUL fpureg,fpu0 8086,FPU + FMUL fpureg 8086,FPU + FMUL fpu0,fpureg 8086,FPU + FMUL 8086,FPU,ND + FMULP fpureg 8086,FPU + FMULP fpureg,fpu0 8086,FPU + FMULP 8086,FPU,ND + FNCLEX 8086,FPU + FNDISI 8086,FPU + FNENI 8086,FPU + FNINIT 8086,FPU + FNOP 8086,FPU + FNSAVE mem 8086,FPU + FNSTCW mem 8086,FPU,SW + FNSTENV mem 8086,FPU + FNSTSW mem 8086,FPU,SW + FNSTSW reg_ax 286,FPU + FPATAN 8086,FPU + FPREM 8086,FPU + FPREM1 386,FPU + FPTAN 8086,FPU + FRNDINT 8086,FPU + FRSTOR mem 8086,FPU + FSAVE mem 8086,FPU + FSCALE 8086,FPU + FSETPM 286,FPU + FSIN 386,FPU + FSINCOS 386,FPU + FSQRT 8086,FPU + FST mem32 8086,FPU + FST mem64 8086,FPU + FST fpureg 8086,FPU + FST 8086,FPU,ND + FSTCW mem 8086,FPU,SW + FSTENV mem 8086,FPU + FSTP mem32 8086,FPU + FSTP mem64 8086,FPU + FSTP mem80 8086,FPU + FSTP fpureg 8086,FPU + FSTP 8086,FPU,ND + FSTSW mem 8086,FPU,SW + FSTSW reg_ax 286,FPU + FSUB mem32 8086,FPU + FSUB mem64 8086,FPU + FSUB fpureg|to 8086,FPU + FSUB fpureg,fpu0 8086,FPU + FSUB fpureg 8086,FPU + FSUB fpu0,fpureg 8086,FPU + FSUB 8086,FPU,ND + FSUBP fpureg 8086,FPU + FSUBP fpureg,fpu0 8086,FPU + FSUBP 8086,FPU,ND + FSUBR mem32 8086,FPU + FSUBR mem64 8086,FPU + FSUBR fpureg|to 8086,FPU + FSUBR fpureg,fpu0 8086,FPU + FSUBR fpureg 8086,FPU + FSUBR fpu0,fpureg 8086,FPU + FSUBR 8086,FPU,ND + FSUBRP fpureg 8086,FPU + FSUBRP fpureg,fpu0 8086,FPU + FSUBRP 8086,FPU,ND + FTST 8086,FPU + FUCOM fpureg 386,FPU + FUCOM fpu0,fpureg 386,FPU + FUCOM 386,FPU,ND + FUCOMI fpureg P6,FPU + FUCOMI fpu0,fpureg P6,FPU + FUCOMI P6,FPU,ND + FUCOMIP fpureg P6,FPU + FUCOMIP fpu0,fpureg P6,FPU + FUCOMIP P6,FPU,ND + FUCOMP fpureg 386,FPU + FUCOMP fpu0,fpureg 386,FPU + FUCOMP 386,FPU,ND + FUCOMPP 386,FPU + FXAM 8086,FPU + FXCH fpureg 8086,FPU + FXCH fpureg,fpu0 8086,FPU + FXCH fpu0,fpureg 8086,FPU + FXCH 8086,FPU,ND + FXTRACT 8086,FPU + FYL2X 8086,FPU + FYL2XP1 8086,FPU + HLT 8086,PRIV + IBTS mem,reg16 386,SW,UNDOC,ND + IBTS reg16,reg16 386,UNDOC,ND + IBTS mem,reg32 386,SD,UNDOC,ND + IBTS reg32,reg32 386,UNDOC,ND + ICEBP 386,ND + IDIV rm8 8086 + IDIV rm16 8086 + IDIV rm32 386 + IDIV rm64 X64 + IMUL rm8 8086 + IMUL rm16 8086 + IMUL rm32 386 + IMUL rm64 X64 + IMUL reg16,mem 386 + IMUL reg16,reg16 386 + IMUL reg32,mem 386 + IMUL reg32,reg32 386 + IMUL reg64,mem X64 + IMUL reg64,reg64 X64 + IMUL reg16,mem,imm8 186 + IMUL reg16,mem,sbyte16 186,ND + IMUL reg16,mem,imm16 186 + IMUL reg16,mem,imm 186,ND + IMUL reg16,reg16,imm8 186 + IMUL reg16,reg16,sbyte16 186,ND + IMUL reg16,reg16,imm16 186 + IMUL reg16,reg16,imm 186,ND + IMUL reg32,mem,imm8 386 + IMUL reg32,mem,sbyte32 386,ND + IMUL reg32,mem,imm32 386 + IMUL reg32,mem,imm 386,ND + IMUL reg32,reg32,imm8 386 + IMUL reg32,reg32,sbyte32 386,ND + IMUL reg32,reg32,imm32 386 + IMUL reg32,reg32,imm 386,ND + IMUL reg64,mem,imm8 X64 + IMUL reg64,mem,sbyte64 X64,ND + IMUL reg64,mem,imm32 X64 + IMUL reg64,mem,imm X64,ND + IMUL reg64,reg64,imm8 X64 + IMUL reg64,reg64,sbyte64 X64,ND + IMUL reg64,reg64,imm32 X64 + IMUL reg64,reg64,imm X64,ND + IMUL reg16,imm8 186 + IMUL reg16,sbyte16 186,ND + IMUL reg16,imm16 186 + IMUL reg16,imm 186,ND + IMUL reg32,imm8 386 + IMUL reg32,sbyte32 386,ND + IMUL reg32,imm32 386 + IMUL reg32,imm 386,ND + IMUL reg64,imm8 X64 + IMUL reg64,sbyte64 X64,ND + IMUL reg64,imm32 X64 + IMUL reg64,imm X64,ND + IN reg_al,imm 8086 + IN reg_ax,imm 8086 + IN reg_eax,imm 386 + IN reg_al,reg_dx 8086 + IN reg_ax,reg_dx 8086 + IN reg_eax,reg_dx 386 + INC reg16 8086,NOLONG + INC reg32 386,NOLONG + INC rm8 8086 + INC rm16 8086 + INC rm32 386 + INC rm64 X64 + INCBIN + INSB 186 + INSD 386 + INSW 186 + INT imm 8086 + INT01 386,ND + INT1 386 + INT03 8086,ND + INT3 8086 + INTO 8086,NOLONG + INVD 486,PRIV + INVLPG mem 486,PRIV + INVLPGA reg_ax,reg_ecx X86_64,AMD,NOLONG + INVLPGA reg_eax,reg_ecx X86_64,AMD + INVLPGA reg_rax,reg_ecx X64,AMD + INVLPGA X86_64,AMD + IRET 8086 + IRETD 386 + IRETQ X64 + IRETW 8086 + JCXZ imm 8086,NOLONG + JECXZ imm 386 + JRCXZ imm X64 + JMP imm|short 8086 + JMP imm 8086,ND + JMP imm 8086 + JMP imm|near 8086,ND + JMP imm|far 8086,ND,NOLONG + JMP imm16 8086 + JMP imm16|near 8086,ND + JMP imm16|far 8086,ND,NOLONG + JMP imm32 386 + JMP imm32|near 386,ND + JMP imm32|far 386,ND,NOLONG + JMP imm:imm 8086,NOLONG + JMP imm16:imm 8086,NOLONG + JMP imm:imm16 8086,NOLONG + JMP imm32:imm 386,NOLONG + JMP imm:imm32 386,NOLONG + JMP mem|far 8086,NOLONG + JMP mem|far X64 + JMP mem16|far 8086 + JMP mem32|far 386 + JMP mem64|far X64 + JMP mem|near 8086 + JMP mem16|near 8086 + JMP mem32|near 386,NOLONG + JMP mem64|near X64 + JMP reg16 8086 + JMP reg32 386,NOLONG + JMP reg64 X64 + JMP mem 8086 + JMP mem16 8086 + JMP mem32 386,NOLONG + JMP mem64 X64 + JMPE imm IA64 + JMPE imm16 IA64 + JMPE imm32 IA64 + JMPE rm16 IA64 + JMPE rm32 IA64 + LAHF 8086 + LAR reg16,mem 286,PROT,SW + LAR reg16,reg16 286,PROT + LAR reg16,reg32 386,PROT + LAR reg16,reg64 X64,PROT,ND + LAR reg32,mem 386,PROT,SW + LAR reg32,reg16 386,PROT + LAR reg32,reg32 386,PROT + LAR reg32,reg64 X64,PROT,ND + LAR reg64,mem X64,PROT,SW + LAR reg64,reg16 X64,PROT + LAR reg64,reg32 X64,PROT + LAR reg64,reg64 X64,PROT + LDS reg16,mem 8086,NOLONG + LDS reg32,mem 386,NOLONG + LEA reg16,mem 8086 + LEA reg32,mem 386 + LEA reg64,mem X64 + LEAVE 186 + LES reg16,mem 8086,NOLONG + LES reg32,mem 386,NOLONG + LFENCE X64,AMD + LFS reg16,mem 386 + LFS reg32,mem 386 + LGDT mem 286,PRIV + LGS reg16,mem 386 + LGS reg32,mem 386 + LIDT mem 286,PRIV + LLDT mem 286,PROT,PRIV + LLDT mem16 286,PROT,PRIV + LLDT reg16 286,PROT,PRIV + LMSW mem 286,PRIV + LMSW mem16 286,PRIV + LMSW reg16 286,PRIV + LOADALL 386,UNDOC + LOADALL286 286,UNDOC + LODSB 8086 + LODSD 386 + LODSQ X64 + LODSW 8086 + LOOP imm 8086 + LOOP imm,reg_cx 8086,NOLONG + LOOP imm,reg_ecx 386 + LOOP imm,reg_rcx X64 + LOOPE imm 8086 + LOOPE imm,reg_cx 8086,NOLONG + LOOPE imm,reg_ecx 386 + LOOPE imm,reg_rcx X64 + LOOPNE imm 8086 + LOOPNE imm,reg_cx 8086,NOLONG + LOOPNE imm,reg_ecx 386 + LOOPNE imm,reg_rcx X64 + LOOPNZ imm 8086 + LOOPNZ imm,reg_cx 8086,NOLONG + LOOPNZ imm,reg_ecx 386 + LOOPNZ imm,reg_rcx X64 + LOOPZ imm 8086 + LOOPZ imm,reg_cx 8086,NOLONG + LOOPZ imm,reg_ecx 386 + LOOPZ imm,reg_rcx X64 + LSL reg16,mem 286,PROT,SW + LSL reg16,reg16 286,PROT + LSL reg16,reg32 386,PROT + LSL reg16,reg64 X64,PROT,ND + LSL reg32,mem 386,PROT,SW + LSL reg32,reg16 386,PROT + LSL reg32,reg32 386,PROT + LSL reg32,reg64 X64,PROT,ND + LSL reg64,mem X64,PROT,SW + LSL reg64,reg16 X64,PROT + LSL reg64,reg32 X64,PROT + LSL reg64,reg64 X64,PROT + LSS reg16,mem 386 + LSS reg32,mem 386 + LTR mem 286,PROT,PRIV + LTR mem16 286,PROT,PRIV + LTR reg16 286,PROT,PRIV + MFENCE X64,AMD + MONITOR PRESCOTT + MONITOR reg_eax,reg_ecx,reg_edx PRESCOTT,ND + MONITOR reg_rax,reg_ecx,reg_edx X64,ND + MOV mem,reg_sreg 8086 + MOV reg16,reg_sreg 8086 + MOV reg32,reg_sreg 386 + MOV reg_sreg,mem 8086 + MOV reg_sreg,reg16 8086 + MOV reg_sreg,reg32 386 + MOV reg_al,mem_offs 8086 + MOV reg_ax,mem_offs 8086 + MOV reg_eax,mem_offs 386 + MOV reg_rax,mem_offs X64 + MOV mem_offs,reg_al 8086 + MOV mem_offs,reg_ax 8086 + MOV mem_offs,reg_eax 386 + MOV mem_offs,reg_rax X64 + MOV reg32,reg_creg 386,PRIV,NOLONG + MOV reg64,reg_creg X64,PRIV + MOV reg_creg,reg32 386,PRIV,NOLONG + MOV reg_creg,reg64 X64,PRIV + MOV reg32,reg_dreg 386,PRIV,NOLONG + MOV reg64,reg_dreg X64,PRIV + MOV reg_dreg,reg32 386,PRIV,NOLONG + MOV reg_dreg,reg64 X64,PRIV + MOV reg32,reg_treg 386,NOLONG,ND + MOV reg_treg,reg32 386,NOLONG,ND + MOV mem,reg8 8086 + MOV reg8,reg8 8086 + MOV mem,reg16 8086 + MOV reg16,reg16 8086 + MOV mem,reg32 386 + MOV reg32,reg32 386 + MOV mem,reg64 X64 + MOV reg64,reg64 X64 + MOV reg8,mem 8086 + MOV reg8,reg8 8086 + MOV reg16,mem 8086 + MOV reg16,reg16 8086 + MOV reg32,mem 386 + MOV reg32,reg32 386 + MOV reg64,mem X64 + MOV reg64,reg64 X64 + MOV reg8,imm 8086 + MOV reg16,imm 8086 + MOV reg32,imm 386 + MOV reg64,imm X64 + MOV reg64,imm32 X64 + MOV rm8,imm 8086 + MOV rm16,imm 8086 + MOV rm32,imm 386 + MOV rm64,imm X64 + MOV mem,imm8 8086 + MOV mem,imm16 8086 + MOV mem,imm32 386 + MOVD mmxreg,mem PENT,MMX,SD + MOVD mmxreg,reg32 PENT,MMX + MOVD mem,mmxreg PENT,MMX,SD + MOVD reg32,mmxreg PENT,MMX + MOVD xmmreg,mem X64,SD + MOVD xmmreg,reg32 X64 + MOVD mem,xmmreg X64,SD + MOVD reg32,xmmreg X64,SSE + MOVQ mmxreg,mmxrm PENT,MMX + MOVQ mmxrm,mmxreg PENT,MMX + MOVQ mmxreg,rm64 X64,MMX + MOVQ rm64,mmxreg X64,MMX + MOVSB 8086 + MOVSD 386 + MOVSQ X64 + MOVSW 8086 + MOVSX reg16,mem 386 + MOVSX reg16,reg8 386 + MOVSX reg32,rm8 386 + MOVSX reg32,rm16 386 + MOVSX reg64,rm8 X64 + MOVSX reg64,rm16 X64 + MOVSXD reg64,rm32 X64 + MOVSX reg64,rm32 X64,ND + MOVZX reg16,mem 386 + MOVZX reg16,reg8 386 + MOVZX reg32,rm8 386 + MOVZX reg32,rm16 386 + MOVZX reg64,rm8 X64 + MOVZX reg64,rm16 X64 + MUL rm8 8086 + MUL rm16 8086 + MUL rm32 386 + MUL rm64 X64 + MWAIT PRESCOTT + MWAIT reg_eax,reg_ecx PRESCOTT,ND + NEG rm8 8086 + NEG rm16 8086 + NEG rm32 386 + NEG rm64 X64 + NOP 8086 + NOP rm16 P6 + NOP rm32 P6 + NOP rm64 X64 + NOT rm8 8086 + NOT rm16 8086 + NOT rm32 386 + NOT rm64 X64 + OR mem,reg8 8086 + OR reg8,reg8 8086 + OR mem,reg16 8086 + OR reg16,reg16 8086 + OR mem,reg32 386 + OR reg32,reg32 386 + OR mem,reg64 X64 + OR reg64,reg64 X64 + OR reg8,mem 8086 + OR reg8,reg8 8086 + OR reg16,mem 8086 + OR reg16,reg16 8086 + OR reg32,mem 386 + OR reg32,reg32 386 + OR reg64,mem X64 + OR reg64,reg64 X64 + OR rm16,imm8 8086 + OR rm32,imm8 386 + OR rm64,imm8 X64 + OR reg_al,imm 8086 + OR reg_ax,sbyte16 8086 + OR reg_ax,imm 8086 + OR reg_eax,sbyte32 386 + OR reg_eax,imm 386 + OR reg_rax,sbyte64 X64 + OR reg_rax,imm X64 + OR rm8,imm 8086 + OR rm16,imm 8086 + OR rm32,imm 386 + OR rm64,imm X64 + OR mem,imm8 8086 + OR mem,imm16 8086 + OR mem,imm32 386 + OUT imm,reg_al 8086 + OUT imm,reg_ax 8086 + OUT imm,reg_eax 386 + OUT reg_dx,reg_al 8086 + OUT reg_dx,reg_ax 8086 + OUT reg_dx,reg_eax 386 + OUTSB 186 + OUTSD 386 + OUTSW 186 + PACKSSDW mmxreg,mmxrm PENT,MMX + PACKSSWB mmxreg,mmxrm PENT,MMX + PACKUSWB mmxreg,mmxrm PENT,MMX + PADDB mmxreg,mmxrm PENT,MMX + PADDD mmxreg,mmxrm PENT,MMX + PADDSB mmxreg,mmxrm PENT,MMX + PADDSIW mmxreg,mmxrm PENT,MMX,CYRIX + PADDSW mmxreg,mmxrm PENT,MMX + PADDUSB mmxreg,mmxrm PENT,MMX + PADDUSW mmxreg,mmxrm PENT,MMX + PADDW mmxreg,mmxrm PENT,MMX + PAND mmxreg,mmxrm PENT,MMX + PANDN mmxreg,mmxrm PENT,MMX + PAUSE 8086 + PAVEB mmxreg,mmxrm PENT,MMX,CYRIX + PAVGUSB mmxreg,mmxrm PENT,3DNOW + PCMPEQB mmxreg,mmxrm PENT,MMX + PCMPEQD mmxreg,mmxrm PENT,MMX + PCMPEQW mmxreg,mmxrm PENT,MMX + PCMPGTB mmxreg,mmxrm PENT,MMX + PCMPGTD mmxreg,mmxrm PENT,MMX + PCMPGTW mmxreg,mmxrm PENT,MMX + PDISTIB mmxreg,mem PENT,MMX,CYRIX + PF2ID mmxreg,mmxrm PENT,3DNOW + PFACC mmxreg,mmxrm PENT,3DNOW + PFADD mmxreg,mmxrm PENT,3DNOW + PFCMPEQ mmxreg,mmxrm PENT,3DNOW + PFCMPGE mmxreg,mmxrm PENT,3DNOW + PFCMPGT mmxreg,mmxrm PENT,3DNOW + PFMAX mmxreg,mmxrm PENT,3DNOW + PFMIN mmxreg,mmxrm PENT,3DNOW + PFMUL mmxreg,mmxrm PENT,3DNOW + PFRCP mmxreg,mmxrm PENT,3DNOW + PFRCPIT1 mmxreg,mmxrm PENT,3DNOW + PFRCPIT2 mmxreg,mmxrm PENT,3DNOW + PFRSQIT1 mmxreg,mmxrm PENT,3DNOW + PFRSQRT mmxreg,mmxrm PENT,3DNOW + PFSUB mmxreg,mmxrm PENT,3DNOW + PFSUBR mmxreg,mmxrm PENT,3DNOW + PI2FD mmxreg,mmxrm PENT,3DNOW + PMACHRIW mmxreg,mem PENT,MMX,CYRIX + PMADDWD mmxreg,mmxrm PENT,MMX + PMAGW mmxreg,mmxrm PENT,MMX,CYRIX + PMULHRIW mmxreg,mmxrm PENT,MMX,CYRIX + PMULHRWA mmxreg,mmxrm PENT,3DNOW + PMULHRWC mmxreg,mmxrm PENT,MMX,CYRIX + PMULHW mmxreg,mmxrm PENT,MMX + PMULLW mmxreg,mmxrm PENT,MMX + PMVGEZB mmxreg,mem PENT,MMX,CYRIX + PMVLZB mmxreg,mem PENT,MMX,CYRIX + PMVNZB mmxreg,mem PENT,MMX,CYRIX + PMVZB mmxreg,mem PENT,MMX,CYRIX + POP reg16 8086 + POP reg32 386,NOLONG + POP reg64 X64 + POP rm16 8086 + POP rm32 386,NOLONG + POP rm64 X64 + POP reg_cs 8086,UNDOC,ND + POP reg_dess 8086,NOLONG + POP reg_fsgs 386 + POPA 186,NOLONG + POPAD 386,NOLONG + POPAW 186,NOLONG + POPF 8086 + POPFD 386,NOLONG + POPFQ X64 + POPFW 8086 + POR mmxreg,mmxrm PENT,MMX + PREFETCH mem PENT,3DNOW + PREFETCHW mem PENT,3DNOW + PSLLD mmxreg,mmxrm PENT,MMX + PSLLD mmxreg,imm PENT,MMX + PSLLQ mmxreg,mmxrm PENT,MMX + PSLLQ mmxreg,imm PENT,MMX + PSLLW mmxreg,mmxrm PENT,MMX + PSLLW mmxreg,imm PENT,MMX + PSRAD mmxreg,mmxrm PENT,MMX + PSRAD mmxreg,imm PENT,MMX + PSRAW mmxreg,mmxrm PENT,MMX + PSRAW mmxreg,imm PENT,MMX + PSRLD mmxreg,mmxrm PENT,MMX + PSRLD mmxreg,imm PENT,MMX + PSRLQ mmxreg,mmxrm PENT,MMX + PSRLQ mmxreg,imm PENT,MMX + PSRLW mmxreg,mmxrm PENT,MMX + PSRLW mmxreg,imm PENT,MMX + PSUBB mmxreg,mmxrm PENT,MMX + PSUBD mmxreg,mmxrm PENT,MMX + PSUBSB mmxreg,mmxrm PENT,MMX + PSUBSIW mmxreg,mmxrm PENT,MMX,CYRIX + PSUBSW mmxreg,mmxrm PENT,MMX + PSUBUSB mmxreg,mmxrm PENT,MMX + PSUBUSW mmxreg,mmxrm PENT,MMX + PSUBW mmxreg,mmxrm PENT,MMX + PUNPCKHBW mmxreg,mmxrm PENT,MMX + PUNPCKHDQ mmxreg,mmxrm PENT,MMX + PUNPCKHWD mmxreg,mmxrm PENT,MMX + PUNPCKLBW mmxreg,mmxrm PENT,MMX + PUNPCKLDQ mmxreg,mmxrm PENT,MMX + PUNPCKLWD mmxreg,mmxrm PENT,MMX + PUSH reg16 8086 + PUSH reg32 386,NOLONG + PUSH reg64 X64 + PUSH rm16 8086 + PUSH rm32 386,NOLONG + PUSH rm64 X64 + PUSH reg_cs 8086,NOLONG + PUSH reg_dess 8086,NOLONG + PUSH reg_fsgs 386 + PUSH imm8 186 + PUSH imm16 186,AR0,SZ + PUSH imm32 386,NOLONG,AR0,SZ + PUSH imm32 386,NOLONG,SD + PUSH imm64 X64,AR0,SZ + PUSHA 186,NOLONG + PUSHAD 386,NOLONG + PUSHAW 186,NOLONG + PUSHF 8086 + PUSHFD 386,NOLONG + PUSHFQ X64 + PUSHFW 8086 + PXOR mmxreg,mmxrm PENT,MMX + RCL rm8,unity 8086 + RCL rm8,reg_cl 8086 + RCL rm8,imm 186 + RCL rm16,unity 8086 + RCL rm16,reg_cl 8086 + RCL rm16,imm 186 + RCL rm32,unity 386 + RCL rm32,reg_cl 386 + RCL rm32,imm 386 + RCL rm64,unity X64 + RCL rm64,reg_cl X64 + RCL rm64,imm X64 + RCR rm8,unity 8086 + RCR rm8,reg_cl 8086 + RCR rm8,imm 186 + RCR rm16,unity 8086 + RCR rm16,reg_cl 8086 + RCR rm16,imm 186 + RCR rm32,unity 386 + RCR rm32,reg_cl 386 + RCR rm32,imm 386 + RCR rm64,unity X64 + RCR rm64,reg_cl X64 + RCR rm64,imm X64 + RDSHR rm32 P6,CYRIXM + RDMSR PENT,PRIV + RDPMC P6 + RDTSC PENT + RDTSCP X86_64 + RET 8086 + RET imm 8086,SW + RETF 8086 + RETF imm 8086,SW + RETN 8086 + RETN imm 8086,SW + ROL rm8,unity 8086 + ROL rm8,reg_cl 8086 + ROL rm8,imm 186 + ROL rm16,unity 8086 + ROL rm16,reg_cl 8086 + ROL rm16,imm 186 + ROL rm32,unity 386 + ROL rm32,reg_cl 386 + ROL rm32,imm 386 + ROL rm64,unity X64 + ROL rm64,reg_cl X64 + ROL rm64,imm X64 + ROR rm8,unity 8086 + ROR rm8,reg_cl 8086 + ROR rm8,imm 186 + ROR rm16,unity 8086 + ROR rm16,reg_cl 8086 + ROR rm16,imm 186 + ROR rm32,unity 386 + ROR rm32,reg_cl 386 + ROR rm32,imm 386 + ROR rm64,unity X64 + ROR rm64,reg_cl X64 + ROR rm64,imm X64 + RDM P6,CYRIX,ND + RSDC reg_sreg,mem80 486,CYRIXM + RSLDT mem80 486,CYRIXM + RSM PENTM + RSTS mem80 486,CYRIXM + SAHF 8086 + SAL rm8,unity 8086,ND + SAL rm8,reg_cl 8086,ND + SAL rm8,imm 186,ND + SAL rm16,unity 8086,ND + SAL rm16,reg_cl 8086,ND + SAL rm16,imm 186,ND + SAL rm32,unity 386,ND + SAL rm32,reg_cl 386,ND + SAL rm32,imm 386,ND + SAL rm64,unity X64,ND + SAL rm64,reg_cl X64,ND + SAL rm64,imm X64,ND + SALC 8086,UNDOC + SAR rm8,unity 8086 + SAR rm8,reg_cl 8086 + SAR rm8,imm 186 + SAR rm16,unity 8086 + SAR rm16,reg_cl 8086 + SAR rm16,imm 186 + SAR rm32,unity 386 + SAR rm32,reg_cl 386 + SAR rm32,imm 386 + SAR rm64,unity X64 + SAR rm64,reg_cl X64 + SAR rm64,imm X64 + SBB mem,reg8 8086 + SBB reg8,reg8 8086 + SBB mem,reg16 8086 + SBB reg16,reg16 8086 + SBB mem,reg32 386 + SBB reg32,reg32 386 + SBB mem,reg64 X64 + SBB reg64,reg64 X64 + SBB reg8,mem 8086 + SBB reg8,reg8 8086 + SBB reg16,mem 8086 + SBB reg16,reg16 8086 + SBB reg32,mem 386 + SBB reg32,reg32 386 + SBB reg64,mem X64 + SBB reg64,reg64 X64 + SBB rm16,imm8 8086 + SBB rm32,imm8 386 + SBB rm64,imm8 X64 + SBB reg_al,imm 8086 + SBB reg_ax,sbyte16 8086 + SBB reg_ax,imm 8086 + SBB reg_eax,sbyte32 386 + SBB reg_eax,imm 386 + SBB reg_rax,sbyte64 X64 + SBB reg_rax,imm X64 + SBB rm8,imm 8086 + SBB rm16,imm 8086 + SBB rm32,imm 386 + SBB rm64,imm X64 + SBB mem,imm8 8086 + SBB mem,imm16 8086 + SBB mem,imm32 386 + SCASB 8086 + SCASD 386 + SCASQ X64 + SCASW 8086 + SFENCE X64,AMD + SGDT mem 286 + SHL rm8,unity 8086 + SHL rm8,reg_cl 8086 + SHL rm8,imm 186 + SHL rm16,unity 8086 + SHL rm16,reg_cl 8086 + SHL rm16,imm 186 + SHL rm32,unity 386 + SHL rm32,reg_cl 386 + SHL rm32,imm 386 + SHL rm64,unity X64 + SHL rm64,reg_cl X64 + SHL rm64,imm X64 + SHLD mem,reg16,imm 3862 + SHLD reg16,reg16,imm 3862 + SHLD mem,reg32,imm 3862 + SHLD reg32,reg32,imm 3862 + SHLD mem,reg64,imm X642 + SHLD reg64,reg64,imm X642 + SHLD mem,reg16,reg_cl 386 + SHLD reg16,reg16,reg_cl 386 + SHLD mem,reg32,reg_cl 386 + SHLD reg32,reg32,reg_cl 386 + SHLD mem,reg64,reg_cl X64 + SHLD reg64,reg64,reg_cl X64 + SHR rm8,unity 8086 + SHR rm8,reg_cl 8086 + SHR rm8,imm 186 + SHR rm16,unity 8086 + SHR rm16,reg_cl 8086 + SHR rm16,imm 186 + SHR rm32,unity 386 + SHR rm32,reg_cl 386 + SHR rm32,imm 386 + SHR rm64,unity X64 + SHR rm64,reg_cl X64 + SHR rm64,imm X64 + SHRD mem,reg16,imm 3862 + SHRD reg16,reg16,imm 3862 + SHRD mem,reg32,imm 3862 + SHRD reg32,reg32,imm 3862 + SHRD mem,reg64,imm X642 + SHRD reg64,reg64,imm X642 + SHRD mem,reg16,reg_cl 386 + SHRD reg16,reg16,reg_cl 386 + SHRD mem,reg32,reg_cl 386 + SHRD reg32,reg32,reg_cl 386 + SHRD mem,reg64,reg_cl X64 + SHRD reg64,reg64,reg_cl X64 + SIDT mem 286 + SLDT mem 286 + SLDT mem16 286 + SLDT reg16 286 + SLDT reg32 386 + SLDT reg64 X64,ND + SLDT reg64 X64 + SKINIT X64 + SMI 386,UNDOC + SMINT P6,CYRIX,ND + SMINTOLD 486,CYRIX,ND + SMSW mem 286 + SMSW mem16 286 + SMSW reg16 286 + SMSW reg32 386 + STC 8086 + STD 8086 + STGI X64 + STI 8086 + STOSB 8086 + STOSD 386 + STOSQ X64 + STOSW 8086 + STR mem 286,PROT + STR mem16 286,PROT + STR reg16 286,PROT + STR reg32 386,PROT + STR reg64 X64 + SUB mem,reg8 8086 + SUB reg8,reg8 8086 + SUB mem,reg16 8086 + SUB reg16,reg16 8086 + SUB mem,reg32 386 + SUB reg32,reg32 386 + SUB mem,reg64 X64 + SUB reg64,reg64 X64 + SUB reg8,mem 8086 + SUB reg8,reg8 8086 + SUB reg16,mem 8086 + SUB reg16,reg16 8086 + SUB reg32,mem 386 + SUB reg32,reg32 386 + SUB reg64,mem X64 + SUB reg64,reg64 X64 + SUB rm16,imm8 8086 + SUB rm32,imm8 386 + SUB rm64,imm8 X64 + SUB reg_al,imm 8086 + SUB reg_ax,sbyte16 8086 + SUB reg_ax,imm 8086 + SUB reg_eax,sbyte32 386 + SUB reg_eax,imm 386 + SUB reg_rax,sbyte64 X64 + SUB reg_rax,imm X64 + SUB rm8,imm 8086 + SUB rm16,imm 8086 + SUB rm32,imm 386 + SUB rm64,imm X64 + SUB mem,imm8 8086 + SUB mem,imm16 8086 + SUB mem,imm32 386 + SVDC mem80,reg_sreg 486,CYRIXM + SVLDT mem80 486,CYRIXM,ND + SVTS mem80 486,CYRIXM + SWAPGS X64 + SYSCALL P6,AMD + SYSENTER P6 + SYSEXIT P6,PRIV + SYSRET P6,PRIV,AMD + TEST mem,reg8 8086 + TEST reg8,reg8 8086 + TEST mem,reg16 8086 + TEST reg16,reg16 8086 + TEST mem,reg32 386 + TEST reg32,reg32 386 + TEST mem,reg64 X64 + TEST reg64,reg64 X64 + TEST reg8,mem 8086 + TEST reg16,mem 8086 + TEST reg32,mem 386 + TEST reg64,mem X64 + TEST reg_al,imm 8086 + TEST reg_ax,imm 8086 + TEST reg_eax,imm 386 + TEST reg_rax,imm X64 + TEST rm8,imm 8086 + TEST rm16,imm 8086 + TEST rm32,imm 386 + TEST rm64,imm X64 + TEST mem,imm8 8086 + TEST mem,imm16 8086 + TEST mem,imm32 386 + UD0 186,UNDOC + UD1 186,UNDOC + UD2B 186,UNDOC,ND + UD2 186 + UD2A 186,ND + UMOV mem,reg8 386,UNDOC,ND + UMOV reg8,reg8 386,UNDOC,ND + UMOV mem,reg16 386,UNDOC,ND + UMOV reg16,reg16 386,UNDOC,ND + UMOV mem,reg32 386,UNDOC,ND + UMOV reg32,reg32 386,UNDOC,ND + UMOV reg8,mem 386,UNDOC,ND + UMOV reg8,reg8 386,UNDOC,ND + UMOV reg16,mem 386,UNDOC,ND + UMOV reg16,reg16 386,UNDOC,ND + UMOV reg32,mem 386,UNDOC,ND + UMOV reg32,reg32 386,UNDOC,ND + VERR mem 286,PROT + VERR mem16 286,PROT + VERR reg16 286,PROT + VERW mem 286,PROT + VERW mem16 286,PROT + VERW reg16 286,PROT + FWAIT 8086 + WBINVD 486,PRIV + WRSHR rm32 P6,CYRIXM + WRMSR PENT,PRIV + XADD mem,reg8 486 + XADD reg8,reg8 486 + XADD mem,reg16 486 + XADD reg16,reg16 486 + XADD mem,reg32 486 + XADD reg32,reg32 486 + XADD mem,reg64 X64 + XADD reg64,reg64 X64 + XBTS reg16,mem 386,SW,UNDOC,ND + XBTS reg16,reg16 386,UNDOC,ND + XBTS reg32,mem 386,SD,UNDOC,ND + XBTS reg32,reg32 386,UNDOC,ND + XCHG reg_ax,reg16 8086 + XCHG reg_eax,reg32na 386 + XCHG reg_rax,reg64 X64 + XCHG reg16,reg_ax 8086 + XCHG reg32na,reg_eax 386 + XCHG reg64,reg_rax X64 + XCHG reg_eax,reg_eax 386,NOLONG + XCHG reg8,mem 8086 + XCHG reg8,reg8 8086 + XCHG reg16,mem 8086 + XCHG reg16,reg16 8086 + XCHG reg32,mem 386 + XCHG reg32,reg32 386 + XCHG reg64,mem X64 + XCHG reg64,reg64 X64 + XCHG mem,reg8 8086 + XCHG reg8,reg8 8086 + XCHG mem,reg16 8086 + XCHG reg16,reg16 8086 + XCHG mem,reg32 386 + XCHG reg32,reg32 386 + XCHG mem,reg64 X64 + XCHG reg64,reg64 X64 + XLATB 8086 + XLAT 8086 + XOR mem,reg8 8086 + XOR reg8,reg8 8086 + XOR mem,reg16 8086 + XOR reg16,reg16 8086 + XOR mem,reg32 386 + XOR reg32,reg32 386 + XOR mem,reg64 X64 + XOR reg64,reg64 X64 + XOR reg8,mem 8086 + XOR reg8,reg8 8086 + XOR reg16,mem 8086 + XOR reg16,reg16 8086 + XOR reg32,mem 386 + XOR reg32,reg32 386 + XOR reg64,mem X64 + XOR reg64,reg64 X64 + XOR rm16,imm8 8086 + XOR rm32,imm8 386 + XOR rm64,imm8 X64 + XOR reg_al,imm 8086 + XOR reg_ax,sbyte16 8086 + XOR reg_ax,imm 8086 + XOR reg_eax,sbyte32 386 + XOR reg_eax,imm 386 + XOR reg_rax,sbyte64 X64 + XOR reg_rax,imm X64 + XOR rm8,imm 8086 + XOR rm16,imm 8086 + XOR rm32,imm 386 + XOR rm64,imm X64 + XOR mem,imm8 8086 + XOR mem,imm16 8086 + XOR mem,imm32 386 + CMOVcc reg16,mem P6 + CMOVcc reg16,reg16 P6 + CMOVcc reg32,mem P6 + CMOVcc reg32,reg32 P6 + CMOVcc reg64,mem X64 + CMOVcc reg64,reg64 X64 + Jcc imm|near 386 + Jcc imm16|near 386 + Jcc imm32|near 386 + Jcc imm|short 8086,ND + Jcc imm 8086,ND + Jcc imm 386,ND + Jcc imm 8086,ND + Jcc imm 8086 + SETcc mem 386 + SETcc reg8 386 + + +File: nasm.info, Node: Section B.1.3, Next: Section B.1.4, Prev: Section B.1.2, Up: Section B.1 + +B.1.3. Katmai Streaming SIMD instructions (SSE --- a.k.a. KNI, XMM, MMX2) +------------------------------------------------------------------------- + + ADDPS xmmreg,xmmrm KATMAI,SSE + ADDSS xmmreg,xmmrm KATMAI,SSE,SD + ANDNPS xmmreg,xmmrm KATMAI,SSE + ANDPS xmmreg,xmmrm KATMAI,SSE + CMPEQPS xmmreg,xmmrm KATMAI,SSE + CMPEQSS xmmreg,xmmrm KATMAI,SSE + CMPLEPS xmmreg,xmmrm KATMAI,SSE + CMPLESS xmmreg,xmmrm KATMAI,SSE + CMPLTPS xmmreg,xmmrm KATMAI,SSE + CMPLTSS xmmreg,xmmrm KATMAI,SSE + CMPNEQPS xmmreg,xmmrm KATMAI,SSE + CMPNEQSS xmmreg,xmmrm KATMAI,SSE + CMPNLEPS xmmreg,xmmrm KATMAI,SSE + CMPNLESS xmmreg,xmmrm KATMAI,SSE + CMPNLTPS xmmreg,xmmrm KATMAI,SSE + CMPNLTSS xmmreg,xmmrm KATMAI,SSE + CMPORDPS xmmreg,xmmrm KATMAI,SSE + CMPORDSS xmmreg,xmmrm KATMAI,SSE + CMPUNORDPS xmmreg,xmmrm KATMAI,SSE + CMPUNORDSS xmmreg,xmmrm KATMAI,SSE + CMPPS xmmreg,mem,imm KATMAI,SSE + CMPPS xmmreg,xmmreg,imm KATMAI,SSE + CMPSS xmmreg,mem,imm KATMAI,SSE + CMPSS xmmreg,xmmreg,imm KATMAI,SSE + COMISS xmmreg,xmmrm KATMAI,SSE + CVTPI2PS xmmreg,mmxrm KATMAI,SSE,MMX + CVTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX + CVTSI2SS xmmreg,mem KATMAI,SSE,SD,AR1,ND + CVTSI2SS xmmreg,rm32 KATMAI,SSE,SD,AR1 + CVTSI2SS xmmreg,rm64 X64,SSE,AR1 + CVTSS2SI reg32,xmmreg KATMAI,SSE,SD,AR1 + CVTSS2SI reg32,mem KATMAI,SSE,SD,AR1 + CVTSS2SI reg64,xmmreg X64,SSE,SD,AR1 + CVTSS2SI reg64,mem X64,SSE,SD,AR1 + CVTTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX + CVTTSS2SI reg32,xmmrm KATMAI,SSE,SD,AR1 + CVTTSS2SI reg64,xmmrm X64,SSE,SD,AR1 + DIVPS xmmreg,xmmrm KATMAI,SSE + DIVSS xmmreg,xmmrm KATMAI,SSE + LDMXCSR mem KATMAI,SSE,SD + MAXPS xmmreg,xmmrm KATMAI,SSE + MAXSS xmmreg,xmmrm KATMAI,SSE + MINPS xmmreg,xmmrm KATMAI,SSE + MINSS xmmreg,xmmrm KATMAI,SSE + MOVAPS xmmreg,mem KATMAI,SSE + MOVAPS mem,xmmreg KATMAI,SSE + MOVAPS xmmreg,xmmreg KATMAI,SSE + MOVAPS xmmreg,xmmreg KATMAI,SSE + MOVHPS xmmreg,mem KATMAI,SSE + MOVHPS mem,xmmreg KATMAI,SSE + MOVLHPS xmmreg,xmmreg KATMAI,SSE + MOVLPS xmmreg,mem KATMAI,SSE + MOVLPS mem,xmmreg KATMAI,SSE + MOVHLPS xmmreg,xmmreg KATMAI,SSE + MOVMSKPS reg32,xmmreg KATMAI,SSE + MOVMSKPS reg64,xmmreg X64,SSE + MOVNTPS mem,xmmreg KATMAI,SSE + MOVSS xmmreg,mem KATMAI,SSE + MOVSS mem,xmmreg KATMAI,SSE + MOVSS xmmreg,xmmreg KATMAI,SSE + MOVSS xmmreg,xmmreg KATMAI,SSE + MOVUPS xmmreg,mem KATMAI,SSE + MOVUPS mem,xmmreg KATMAI,SSE + MOVUPS xmmreg,xmmreg KATMAI,SSE + MOVUPS xmmreg,xmmreg KATMAI,SSE + MULPS xmmreg,xmmrm KATMAI,SSE + MULSS xmmreg,xmmrm KATMAI,SSE + ORPS xmmreg,xmmrm KATMAI,SSE + RCPPS xmmreg,xmmrm KATMAI,SSE + RCPSS xmmreg,xmmrm KATMAI,SSE + RSQRTPS xmmreg,xmmrm KATMAI,SSE + RSQRTSS xmmreg,xmmrm KATMAI,SSE + SHUFPS xmmreg,mem,imm KATMAI,SSE + SHUFPS xmmreg,xmmreg,imm KATMAI,SSE + SQRTPS xmmreg,xmmrm KATMAI,SSE + SQRTSS xmmreg,xmmrm KATMAI,SSE + STMXCSR mem KATMAI,SSE,SD + SUBPS xmmreg,xmmrm KATMAI,SSE + SUBSS xmmreg,xmmrm KATMAI,SSE + UCOMISS xmmreg,xmmrm KATMAI,SSE + UNPCKHPS xmmreg,xmmrm KATMAI,SSE + UNPCKLPS xmmreg,xmmrm KATMAI,SSE + XORPS xmmreg,xmmrm KATMAI,SSE + + +File: nasm.info, Node: Section B.1.4, Next: Section B.1.5, Prev: Section B.1.3, Up: Section B.1 + +B.1.4. Introduced in Deschutes but necessary for SSE support +------------------------------------------------------------ + + FXRSTOR mem P6,SSE,FPU + FXSAVE mem P6,SSE,FPU + + +File: nasm.info, Node: Section B.1.5, Next: Section B.1.6, Prev: Section B.1.4, Up: Section B.1 + +B.1.5. XSAVE group (AVX and extended state) +------------------------------------------- + + XGETBV NEHALEM + XSETBV NEHALEM,PRIV + XSAVE mem NEHALEM + XRSTOR mem NEHALEM + + +File: nasm.info, Node: Section B.1.6, Next: Section B.1.7, Prev: Section B.1.5, Up: Section B.1 + +B.1.6. Generic memory operations +-------------------------------- + + PREFETCHNTA mem KATMAI + PREFETCHT0 mem KATMAI + PREFETCHT1 mem KATMAI + PREFETCHT2 mem KATMAI + SFENCE KATMAI + + +File: nasm.info, Node: Section B.1.7, Next: Section B.1.8, Prev: Section B.1.6, Up: Section B.1 + +B.1.7. New MMX instructions introduced in Katmai +------------------------------------------------ + + MASKMOVQ mmxreg,mmxreg KATMAI,MMX + MOVNTQ mem,mmxreg KATMAI,MMX + PAVGB mmxreg,mmxrm KATMAI,MMX + PAVGW mmxreg,mmxrm KATMAI,MMX + PEXTRW reg32,mmxreg,imm KATMAI,MMX + PINSRW mmxreg,mem,imm KATMAI,MMX + PINSRW mmxreg,rm16,imm KATMAI,MMX + PINSRW mmxreg,reg32,imm KATMAI,MMX + PMAXSW mmxreg,mmxrm KATMAI,MMX + PMAXUB mmxreg,mmxrm KATMAI,MMX + PMINSW mmxreg,mmxrm KATMAI,MMX + PMINUB mmxreg,mmxrm KATMAI,MMX + PMOVMSKB reg32,mmxreg KATMAI,MMX + PMULHUW mmxreg,mmxrm KATMAI,MMX + PSADBW mmxreg,mmxrm KATMAI,MMX + PSHUFW mmxreg,mmxrm,imm KATMAI,MMX2 + + +File: nasm.info, Node: Section B.1.8, Next: Section B.1.9, Prev: Section B.1.7, Up: Section B.1 + +B.1.8. AMD Enhanced 3DNow! (Athlon) instructions +------------------------------------------------ + + PF2IW mmxreg,mmxrm PENT,3DNOW + PFNACC mmxreg,mmxrm PENT,3DNOW + PFPNACC mmxreg,mmxrm PENT,3DNOW + PI2FW mmxreg,mmxrm PENT,3DNOW + PSWAPD mmxreg,mmxrm PENT,3DNOW + + +File: nasm.info, Node: Section B.1.9, Next: Section B.1.10, Prev: Section B.1.8, Up: Section B.1 + +B.1.9. Willamette SSE2 Cacheability Instructions +------------------------------------------------ + + MASKMOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + CLFLUSH mem WILLAMETTE,SSE2 + MOVNTDQ mem,xmmreg WILLAMETTE,SSE2,SO + MOVNTI mem,reg32 WILLAMETTE,SD + MOVNTI mem,reg64 X64 + MOVNTPD mem,xmmreg WILLAMETTE,SSE2,SO + LFENCE WILLAMETTE,SSE2 + MFENCE WILLAMETTE,SSE2 + + +File: nasm.info, Node: Section B.1.10, Next: Section B.1.11, Prev: Section B.1.9, Up: Section B.1 + +B.1.10. Willamette MMX instructions (SSE2 SIMD Integer Instructions) +-------------------------------------------------------------------- + + MOVD mem,xmmreg WILLAMETTE,SSE2,SD + MOVD xmmreg,mem WILLAMETTE,SSE2,SD + MOVD xmmreg,rm32 WILLAMETTE,SSE2 + MOVD rm32,xmmreg WILLAMETTE,SSE2 + MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQA mem,xmmreg WILLAMETTE,SSE2,SO + MOVDQA xmmreg,mem WILLAMETTE,SSE2,SO + MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQU mem,xmmreg WILLAMETTE,SSE2,SO + MOVDQU xmmreg,mem WILLAMETTE,SSE2,SO + MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQ2Q mmxreg,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 + MOVQ mem,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,mem WILLAMETTE,SSE2 + MOVQ xmmreg,rm64 X64,SSE2 + MOVQ rm64,xmmreg X64,SSE2 + MOVQ2DQ xmmreg,mmxreg WILLAMETTE,SSE2 + PACKSSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PACKSSDW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PACKUSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDQ mmxreg,mmxrm WILLAMETTE,MMX + PADDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAND xmmreg,xmmrm WILLAMETTE,SSE2,SO + PANDN xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAVGB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAVGW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PEXTRW reg32,xmmreg,imm WILLAMETTE,SSE2 + PINSRW xmmreg,reg16,imm WILLAMETTE,SSE2 + PINSRW xmmreg,reg32,imm WILLAMETTE,SSE2,ND + PINSRW xmmreg,mem,imm WILLAMETTE,SSE2 + PINSRW xmmreg,mem16,imm WILLAMETTE,SSE2 + PMADDWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMAXSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMAXUB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMINSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMINUB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMOVMSKB reg32,xmmreg WILLAMETTE,SSE2 + PMULHUW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULHW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULUDQ mmxreg,mmxrm WILLAMETTE,SSE2,SO + PMULUDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + POR xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSADBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSHUFD xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFD xmmreg,mem,imm WILLAMETTE,SSE22 + PSHUFHW xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFHW xmmreg,mem,imm WILLAMETTE,SSE22 + PSHUFLW xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFLW xmmreg,mem,imm WILLAMETTE,SSE22 + PSLLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRAW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRAW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRAD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRAD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSUBB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBQ mmxreg,mmxrm WILLAMETTE,SSE2,SO + PSUBQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PXOR xmmreg,xmmrm WILLAMETTE,SSE2,SO + + +File: nasm.info, Node: Section B.1.11, Next: Section B.1.12, Prev: Section B.1.10, Up: Section B.1 + +B.1.11. Willamette Streaming SIMD instructions (SSE2) +----------------------------------------------------- + + ADDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + ADDSD xmmreg,xmmrm WILLAMETTE,SSE2 + ANDNPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + ANDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPEQSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPLESD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPLTSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNEQSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNLESD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNLTSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPORDSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPUNORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPUNORDSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPPD xmmreg,xmmrm,imm WILLAMETTE,SSE22 + CMPSD xmmreg,xmmrm,imm WILLAMETTE,SSE2 + COMISD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTDQ2PD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTDQ2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPI2PD xmmreg,mmxrm WILLAMETTE,SSE2 + CVTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPS2PD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 + CVTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 + CVTSD2SI reg64,xmmreg X64,SSE2,AR1 + CVTSD2SI reg64,mem X64,SSE2,AR1 + CVTSD2SS xmmreg,xmmrm WILLAMETTE,SSE2 + CVTSI2SD xmmreg,mem WILLAMETTE,SSE2,SD,AR1,ND + CVTSI2SD xmmreg,rm32 WILLAMETTE,SSE2,SD,AR1 + CVTSI2SD xmmreg,rm64 X64,SSE2,AR1 + CVTSS2SD xmmreg,xmmrm WILLAMETTE,SSE2,SD + CVTTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO + CVTTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 + CVTTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 + CVTTSD2SI reg64,xmmreg X64,SSE2,AR1 + CVTTSD2SI reg64,mem X64,SSE2,AR1 + DIVPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + DIVSD xmmreg,xmmrm WILLAMETTE,SSE2 + MAXPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MAXSD xmmreg,xmmrm WILLAMETTE,SSE2 + MINPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MINSD xmmreg,xmmrm WILLAMETTE,SSE2 + MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVAPD mem,xmmreg WILLAMETTE,SSE2,SO + MOVAPD xmmreg,mem WILLAMETTE,SSE2,SO + MOVHPD mem,xmmreg WILLAMETTE,SSE2 + MOVHPD xmmreg,mem WILLAMETTE,SSE2 + MOVLPD mem,xmmreg WILLAMETTE,SSE2 + MOVLPD xmmreg,mem WILLAMETTE,SSE2 + MOVMSKPD reg32,xmmreg WILLAMETTE,SSE2 + MOVMSKPD reg64,xmmreg X64,SSE2 + MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVSD mem,xmmreg WILLAMETTE,SSE2 + MOVSD xmmreg,mem WILLAMETTE,SSE2 + MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVUPD mem,xmmreg WILLAMETTE,SSE2,SO + MOVUPD xmmreg,mem WILLAMETTE,SSE2,SO + MULPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MULSD xmmreg,xmmrm WILLAMETTE,SSE2 + ORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SHUFPD xmmreg,xmmreg,imm WILLAMETTE,SSE2 + SHUFPD xmmreg,mem,imm WILLAMETTE,SSE2 + SQRTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SQRTSD xmmreg,xmmrm WILLAMETTE,SSE2 + SUBPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SUBSD xmmreg,xmmrm WILLAMETTE,SSE2 + UCOMISD xmmreg,xmmrm WILLAMETTE,SSE2 + UNPCKHPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + UNPCKLPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + XORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + + +File: nasm.info, Node: Section B.1.12, Next: Section B.1.13, Prev: Section B.1.11, Up: Section B.1 + +B.1.12. Prescott New Instructions (SSE3) +---------------------------------------- + + ADDSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO + ADDSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO + HADDPD xmmreg,xmmrm PRESCOTT,SSE3,SO + HADDPS xmmreg,xmmrm PRESCOTT,SSE3,SO + HSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO + HSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO + LDDQU xmmreg,mem PRESCOTT,SSE3,SO + MOVDDUP xmmreg,xmmrm PRESCOTT,SSE3 + MOVSHDUP xmmreg,xmmrm PRESCOTT,SSE3 + MOVSLDUP xmmreg,xmmrm PRESCOTT,SSE3 + + +File: nasm.info, Node: Section B.1.13, Next: Section B.1.14, Prev: Section B.1.12, Up: Section B.1 + +B.1.13. VMX Instructions +------------------------ + + VMCALL VMX + VMCLEAR mem VMX + VMLAUNCH VMX + VMLOAD X64,VMX + VMMCALL X64,VMX + VMPTRLD mem VMX + VMPTRST mem VMX + VMREAD rm32,reg32 VMX,NOLONG,SD + VMREAD rm64,reg64 X64,VMX + VMRESUME VMX + VMRUN X64,VMX + VMSAVE X64,VMX + VMWRITE reg32,rm32 VMX,NOLONG,SD + VMWRITE reg64,rm64 X64,VMX + VMXOFF VMX + VMXON mem VMX + + +File: nasm.info, Node: Section B.1.14, Next: Section B.1.15, Prev: Section B.1.13, Up: Section B.1 + +B.1.14. Extended Page Tables VMX instructions +--------------------------------------------- + + INVEPT reg32,mem VMX,SO,NOLONG + INVEPT reg64,mem VMX,SO,LONG + INVVPID reg32,mem VMX,SO,NOLONG + INVVPID reg64,mem VMX,SO,LONG + + +File: nasm.info, Node: Section B.1.15, Next: Section B.1.16, Prev: Section B.1.14, Up: Section B.1 + +B.1.15. Tejas New Instructions (SSSE3) +-------------------------------------- + + PABSB mmxreg,mmxrm SSSE3,MMX + PABSB xmmreg,xmmrm SSSE3 + PABSW mmxreg,mmxrm SSSE3,MMX + PABSW xmmreg,xmmrm SSSE3 + PABSD mmxreg,mmxrm SSSE3,MMX + PABSD xmmreg,xmmrm SSSE3 + PALIGNR mmxreg,mmxrm,imm SSSE3,MMX + PALIGNR xmmreg,xmmrm,imm SSSE3 + PHADDW mmxreg,mmxrm SSSE3,MMX + PHADDW xmmreg,xmmrm SSSE3 + PHADDD mmxreg,mmxrm SSSE3,MMX + PHADDD xmmreg,xmmrm SSSE3 + PHADDSW mmxreg,mmxrm SSSE3,MMX + PHADDSW xmmreg,xmmrm SSSE3 + PHSUBW mmxreg,mmxrm SSSE3,MMX + PHSUBW xmmreg,xmmrm SSSE3 + PHSUBD mmxreg,mmxrm SSSE3,MMX + PHSUBD xmmreg,xmmrm SSSE3 + PHSUBSW mmxreg,mmxrm SSSE3,MMX + PHSUBSW xmmreg,xmmrm SSSE3 + PMADDUBSW mmxreg,mmxrm SSSE3,MMX + PMADDUBSW xmmreg,xmmrm SSSE3 + PMULHRSW mmxreg,mmxrm SSSE3,MMX + PMULHRSW xmmreg,xmmrm SSSE3 + PSHUFB mmxreg,mmxrm SSSE3,MMX + PSHUFB xmmreg,xmmrm SSSE3 + PSIGNB mmxreg,mmxrm SSSE3,MMX + PSIGNB xmmreg,xmmrm SSSE3 + PSIGNW mmxreg,mmxrm SSSE3,MMX + PSIGNW xmmreg,xmmrm SSSE3 + PSIGND mmxreg,mmxrm SSSE3,MMX + PSIGND xmmreg,xmmrm SSSE3 + + +File: nasm.info, Node: Section B.1.16, Next: Section B.1.17, Prev: Section B.1.15, Up: Section B.1 + +B.1.16. AMD SSE4A +----------------- + + EXTRQ xmmreg,imm,imm SSE4A,AMD + EXTRQ xmmreg,xmmreg SSE4A,AMD + INSERTQ xmmreg,xmmreg,imm,imm SSE4A,AMD + INSERTQ xmmreg,xmmreg SSE4A,AMD + MOVNTSD mem,xmmreg SSE4A,AMD + MOVNTSS mem,xmmreg SSE4A,AMD,SD + + +File: nasm.info, Node: Section B.1.17, Next: Section B.1.18, Prev: Section B.1.16, Up: Section B.1 + +B.1.17. New instructions in Barcelona +------------------------------------- + + LZCNT reg16,rm16 P6,AMD + LZCNT reg32,rm32 P6,AMD + LZCNT reg64,rm64 X64,AMD + + +File: nasm.info, Node: Section B.1.18, Next: Section B.1.19, Prev: Section B.1.17, Up: Section B.1 + +B.1.18. Penryn New Instructions (SSE4.1) +---------------------------------------- + + BLENDPD xmmreg,xmmrm,imm SSE41 + BLENDPS xmmreg,xmmrm,imm SSE41 + BLENDVPD xmmreg,xmmrm,xmm0 SSE41 + BLENDVPS xmmreg,xmmrm,xmm0 SSE41 + DPPD xmmreg,xmmrm,imm SSE41 + DPPS xmmreg,xmmrm,imm SSE41 + EXTRACTPS rm32,xmmreg,imm SSE41 + EXTRACTPS reg64,xmmreg,imm SSE41,X64 + INSERTPS xmmreg,xmmrm,imm SSE41,SD + MOVNTDQA xmmreg,mem SSE41 + MPSADBW xmmreg,xmmrm,imm SSE41 + PACKUSDW xmmreg,xmmrm SSE41 + PBLENDVB xmmreg,xmmrm,xmm0 SSE41 + PBLENDW xmmreg,xmmrm,imm SSE41 + PCMPEQQ xmmreg,xmmrm SSE41 + PEXTRB reg32,xmmreg,imm SSE41 + PEXTRB mem8,xmmreg,imm SSE41 + PEXTRB reg64,xmmreg,imm SSE41,X64 + PEXTRD rm32,xmmreg,imm SSE41 + PEXTRQ rm64,xmmreg,imm SSE41,X64 + PEXTRW reg32,xmmreg,imm SSE41 + PEXTRW mem16,xmmreg,imm SSE41 + PEXTRW reg64,xmmreg,imm SSE41,X64 + PHMINPOSUW xmmreg,xmmrm SSE41 + PINSRB xmmreg,mem,imm SSE41 + PINSRB xmmreg,rm8,imm SSE41 + PINSRB xmmreg,reg32,imm SSE41 + PINSRD xmmreg,mem,imm SSE41 + PINSRD xmmreg,rm32,imm SSE41 + PINSRQ xmmreg,mem,imm SSE41,X64 + PINSRQ xmmreg,rm64,imm SSE41,X64 + PMAXSB xmmreg,xmmrm SSE41 + PMAXSD xmmreg,xmmrm SSE41 + PMAXUD xmmreg,xmmrm SSE41 + PMAXUW xmmreg,xmmrm SSE41 + PMINSB xmmreg,xmmrm SSE41 + PMINSD xmmreg,xmmrm SSE41 + PMINUD xmmreg,xmmrm SSE41 + PMINUW xmmreg,xmmrm SSE41 + PMOVSXBW xmmreg,xmmrm SSE41 + PMOVSXBD xmmreg,xmmrm SSE41,SD + PMOVSXBQ xmmreg,xmmrm SSE41,SW + PMOVSXWD xmmreg,xmmrm SSE41 + PMOVSXWQ xmmreg,xmmrm SSE41,SD + PMOVSXDQ xmmreg,xmmrm SSE41 + PMOVZXBW xmmreg,xmmrm SSE41 + PMOVZXBD xmmreg,xmmrm SSE41,SD + PMOVZXBQ xmmreg,xmmrm SSE41,SW + PMOVZXWD xmmreg,xmmrm SSE41 + PMOVZXWQ xmmreg,xmmrm SSE41,SD + PMOVZXDQ xmmreg,xmmrm SSE41 + PMULDQ xmmreg,xmmrm SSE41 + PMULLD xmmreg,xmmrm SSE41 + PTEST xmmreg,xmmrm SSE41 + ROUNDPD xmmreg,xmmrm,imm SSE41 + ROUNDPS xmmreg,xmmrm,imm SSE41 + ROUNDSD xmmreg,xmmrm,imm SSE41 + ROUNDSS xmmreg,xmmrm,imm SSE41 + + +File: nasm.info, Node: Section B.1.19, Next: Section B.1.20, Prev: Section B.1.18, Up: Section B.1 + +B.1.19. Nehalem New Instructions (SSE4.2) +----------------------------------------- + + CRC32 reg32,rm8 SSE42 + CRC32 reg32,rm16 SSE42 + CRC32 reg32,rm32 SSE42 + CRC32 reg64,rm8 SSE42,X64 + CRC32 reg64,rm64 SSE42,X64 + PCMPESTRI xmmreg,xmmrm,imm SSE42 + PCMPESTRM xmmreg,xmmrm,imm SSE42 + PCMPISTRI xmmreg,xmmrm,imm SSE42 + PCMPISTRM xmmreg,xmmrm,imm SSE42 + PCMPGTQ xmmreg,xmmrm SSE42 + POPCNT reg16,rm16 NEHALEM,SW + POPCNT reg32,rm32 NEHALEM,SD + POPCNT reg64,rm64 NEHALEM,X64 + + +File: nasm.info, Node: Section B.1.20, Next: Section B.1.21, Prev: Section B.1.19, Up: Section B.1 + +B.1.20. Intel SMX +----------------- + + GETSEC KATMAI + + +File: nasm.info, Node: Section B.1.21, Next: Section B.1.22, Prev: Section B.1.20, Up: Section B.1 + +B.1.21. Geode (Cyrix) 3DNow! additions +-------------------------------------- + + PFRCPV mmxreg,mmxrm PENT,3DNOW,CYRIX + PFRSQRTV mmxreg,mmxrm PENT,3DNOW,CYRIX + + +File: nasm.info, Node: Section B.1.22, Next: Section B.1.23, Prev: Section B.1.21, Up: Section B.1 + +B.1.22. Intel new instructions in ??? +------------------------------------- + + MOVBE reg16,mem16 NEHALEM + MOVBE reg32,mem32 NEHALEM + MOVBE reg64,mem64 NEHALEM + MOVBE mem16,reg16 NEHALEM + MOVBE mem32,reg32 NEHALEM + MOVBE mem64,reg64 NEHALEM + + +File: nasm.info, Node: Section B.1.23, Next: Section B.1.24, Prev: Section B.1.22, Up: Section B.1 + +B.1.23. Intel AES instructions +------------------------------ + + AESENC xmmreg,xmmrm128 SSE,WESTMERE + AESENCLAST xmmreg,xmmrm128 SSE,WESTMERE + AESDEC xmmreg,xmmrm128 SSE,WESTMERE + AESDECLAST xmmreg,xmmrm128 SSE,WESTMERE + AESIMC xmmreg,xmmrm128 SSE,WESTMERE + AESKEYGENASSIST xmmreg,xmmrm128,imm8 SSE,WESTMERE + + +File: nasm.info, Node: Section B.1.24, Next: Section B.1.25, Prev: Section B.1.23, Up: Section B.1 + +B.1.24. Intel AVX AES instructions +---------------------------------- + + VAESENC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESENCLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESDEC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESDECLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESIMC xmmreg,xmmrm128 AVX,SANDYBRIDGE + VAESKEYGENASSIST xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + + +File: nasm.info, Node: Section B.1.25, Next: Section B.1.26, Prev: Section B.1.24, Up: Section B.1 + +B.1.25. Intel AVX instructions +------------------------------ + + VADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VADDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VADDSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDNPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDNPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDNPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDNPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VBLENDVPD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VBLENDVPD xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE + VBLENDVPS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VBLENDVPS xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE + VBLENDVPS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE + VBROADCASTSS xmmreg,mem32 AVX,SANDYBRIDGE + VBROADCASTSS ymmreg,mem32 AVX,SANDYBRIDGE + VBROADCASTSD ymmreg,mem64 AVX,SANDYBRIDGE + VBROADCASTF128 ymmreg,mem128 AVX,SANDYBRIDGE + VCMPEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VCMPEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VCMPEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPFALSESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPTRUESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE + VCMPEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPUNORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPFALSESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPTRUESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE + VCVTDQ2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCVTDQ2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTDQ2PS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTDQ2PS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTPD2PS xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTPD2PS xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTPD2PS xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTPD2PS xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTPS2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCVTPS2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE + VCVTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG + VCVTSD2SS xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCVTSI2SD xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD + VCVTSI2SD xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD + VCVTSI2SD xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG + VCVTSI2SS xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD + VCVTSI2SS xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD + VCVTSI2SS xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG + VCVTSS2SD xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCVTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE + VCVTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG + VCVTTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE + VCVTTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG + VCVTTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE + VCVTTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG + VDIVPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VDIVPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VDIVPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VDIVPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VDIVSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VDIVSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VDPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VDPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VDPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VEXTRACTF128 xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VEXTRACTPS rm32,xmmreg,imm8 AVX,SANDYBRIDGE + VHADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VINSERTF128 ymmreg,ymmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VLDDQU xmmreg,mem128 AVX,SANDYBRIDGE + VLDQQU ymmreg,mem256 AVX,SANDYBRIDGE + VLDDQU ymmreg,mem256 AVX,SANDYBRIDGE + VLDMXCSR mem32 AVX,SANDYBRIDGE + VMASKMOVDQU xmmreg,xmmreg AVX,SANDYBRIDGE + VMASKMOVPS xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE + VMASKMOVPS ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE + VMASKMOVPS mem128,xmmreg,xmmreg AVX,SANDYBRIDGE,SO + VMASKMOVPS mem256,xmmreg,xmmreg AVX,SANDYBRIDGE,SY + VMASKMOVPD xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE + VMASKMOVPD ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE + VMASKMOVPD mem128,xmmreg,xmmreg AVX,SANDYBRIDGE + VMASKMOVPD mem256,ymmreg,ymmreg AVX,SANDYBRIDGE + VMAXPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMAXPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMAXPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMAXPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMAXSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMAXSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VMINPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMINPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMINPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMINPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMINSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMINSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VMOVAPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVAPD xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVAPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVAPD ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVAPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVAPS xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVAPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVAPS ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VMOVQ xmmrm64,xmmreg AVX,SANDYBRIDGE + VMOVQ xmmreg,rm64 AVX,SANDYBRIDGE,LONG + VMOVQ rm64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVD xmmreg,rm32 AVX,SANDYBRIDGE + VMOVD rm32,xmmreg AVX,SANDYBRIDGE + VMOVDDUP xmmreg,xmmrm64 AVX,SANDYBRIDGE + VMOVDDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVDQA xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVDQA xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVQQA ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVQQA ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQA ymmreg,ymmrm AVX,SANDYBRIDGE + VMOVDQA ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQU xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVDQU xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVQQU ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVQQU ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQU ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVDQU ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVHLPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVHPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVHPD mem64,xmmreg AVX,SANDYBRIDGE + VMOVHPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVHPS mem64,xmmreg AVX,SANDYBRIDGE + VMOVLHPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVLPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVLPD mem64,xmmreg AVX,SANDYBRIDGE + VMOVLPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVLPS mem64,xmmreg AVX,SANDYBRIDGE + VMOVMSKPD reg64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPD reg32,xmmreg AVX,SANDYBRIDGE + VMOVMSKPD reg64,ymmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPD reg32,ymmreg AVX,SANDYBRIDGE + VMOVMSKPS reg64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPS reg32,xmmreg AVX,SANDYBRIDGE + VMOVMSKPS reg64,ymmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPS reg32,ymmreg AVX,SANDYBRIDGE + VMOVNTDQ mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTQQ mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTDQ mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTDQA xmmreg,mem128 AVX,SANDYBRIDGE + VMOVNTPD mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTPD mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTPS mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTPS mem128,ymmreg AVX,SANDYBRIDGE + VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSD xmmreg,mem64 AVX,SANDYBRIDGE + VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSD mem64,xmmreg AVX,SANDYBRIDGE + VMOVSHDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVSHDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVSLDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVSLDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSS xmmreg,mem64 AVX,SANDYBRIDGE + VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSS mem64,xmmreg AVX,SANDYBRIDGE + VMOVUPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVUPD xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVUPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVUPD ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVUPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVUPS xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVUPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVUPS ymmrm256,ymmreg AVX,SANDYBRIDGE + VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VMULPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMULPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMULPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMULPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMULSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMULSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VPABSB xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPABSW xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPABSD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPACKSSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKSSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKUSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKUSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VPAND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPANDN xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPAVGB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPAVGW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPESTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPESTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPISTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPISTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPEQB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPERMILPD xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILPD ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMILPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILTD2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILTD2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILTD2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILTD2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMO2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMO2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMO2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMO2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMZ2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMZ2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMZ2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMZ2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMIL2PD xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PD xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMIL2PD ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PD ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILPS xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILPS ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMILPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILTD2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILTD2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILTD2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILTD2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMO2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMO2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMO2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMO2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMZ2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMZ2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMZ2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMZ2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMIL2PS xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PS xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMIL2PS ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PS ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERM2F128 ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPEXTRB reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRB reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRB mem8,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRD reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRD rm32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRQ rm64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPHADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHMINPOSUW xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPHSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,mem8,imm8 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,rm8,imm8 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,mem16,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,rm16,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE + VPINSRD xmmreg,xmmreg*,mem32,imm8 AVX,SANDYBRIDGE + VPINSRD xmmreg,xmmreg*,rm32,imm8 AVX,SANDYBRIDGE + VPINSRQ xmmreg,xmmreg*,mem64,imm8 AVX,SANDYBRIDGE,LONG + VPINSRQ xmmreg,xmmreg*,rm64,imm8 AVX,SANDYBRIDGE,LONG + VPMADDWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMADDUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMOVMSKB reg64,xmmreg AVX,SANDYBRIDGE,LONG + VPMOVMSKB reg32,xmmreg AVX,SANDYBRIDGE + VPMOVSXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVSXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVSXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE + VPMOVSXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVSXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVSXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVZXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE + VPMOVZXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVZXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMULHUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULHRSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULHW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULUDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSADBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSHUFB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSHUFD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSHUFHW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSHUFLW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSIGNB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSIGNW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSIGND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRAW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRAW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRAD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRAD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPTEST xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPTEST ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPSUBB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPXOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VRCPPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VRCPPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VRCPSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VRSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VRSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VRSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VROUNDPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VROUNDPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VROUNDPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VROUNDPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE + VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VSQRTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VSQRTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VSQRTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VSTMXCSR mem32 AVX,SANDYBRIDGE + VSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VSUBSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VSUBSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VTESTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VTESTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VTESTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VTESTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VUCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VUCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE + VUNPCKHPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKHPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKHPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKHPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKLPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKLPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKLPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKLPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VXORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VXORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VXORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VXORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VZEROALL AVX,SANDYBRIDGE + VZEROUPPER AVX,SANDYBRIDGE + + +File: nasm.info, Node: Section B.1.26, Next: Section B.1.27, Prev: Section B.1.25, Up: Section B.1 + +B.1.26. Intel Carry-Less Multiplication instructions (CLMUL) +------------------------------------------------------------ + + PCLMULLQLQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULHQLQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULLQHQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULHQHQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULQDQ xmmreg,xmmrm128,imm8 SSE,WESTMERE + + +File: nasm.info, Node: Section B.1.27, Next: Section B.1.28, Prev: Section B.1.26, Up: Section B.1 + +B.1.27. Intel AVX Carry-Less Multiplication instructions (CLMUL) +---------------------------------------------------------------- + + VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + + +File: nasm.info, Node: Section B.1.28, Next: Section B.1.29, Prev: Section B.1.27, Up: Section B.1 + +B.1.28. Intel Fused Multiply-Add instructions (FMA) +--------------------------------------------------- + + VFMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + + +File: nasm.info, Node: Section B.1.29, Next: Section B.1.30, Prev: Section B.1.28, Up: Section B.1 + +B.1.29. VIA (Centaur) security instructions +------------------------------------------- + + XSTORE PENT,CYRIX + XCRYPTECB PENT,CYRIX + XCRYPTCBC PENT,CYRIX + XCRYPTCTR PENT,CYRIX + XCRYPTCFB PENT,CYRIX + XCRYPTOFB PENT,CYRIX + MONTMUL PENT,CYRIX + XSHA1 PENT,CYRIX + XSHA256 PENT,CYRIX + + +File: nasm.info, Node: Section B.1.30, Next: Section B.1.31, Prev: Section B.1.29, Up: Section B.1 + +B.1.30. AMD Lightweight Profiling (LWP) instructions +---------------------------------------------------- + + LLWPCB reg16 AMD + LLWPCB reg32 AMD,386 + LLWPCB reg64 AMD,X64 + SLWPCB reg16 AMD + SLWPCB reg32 AMD,386 + SLWPCB reg64 AMD,X64 + LWPVAL reg16,rm32,imm16 AMD,386 + LWPVAL reg32,rm32,imm32 AMD,386 + LWPVAL reg64,rm32,imm32 AMD,X64 + LWPINS reg16,rm32,imm16 AMD,386 + LWPINS reg32,rm32,imm32 AMD,386 + LWPINS reg64,rm32,imm32 AMD,X64 + + +File: nasm.info, Node: Section B.1.31, Next: Section B.1.32, Prev: Section B.1.30, Up: Section B.1 + +B.1.31. AMD XOP, FMA4 and CVT16 instructions (SSE5) +--------------------------------------------------- + + VCVTPH2PS xmmreg,xmmrm64*,imm8 AMD,SSE5 + VCVTPH2PS ymmreg,xmmrm128,imm8 AMD,SSE5 + VCVTPH2PS ymmreg,ymmrm128*,imm8 AMD,SSE5 + VCVTPS2PH xmmrm64,xmmreg*,imm8 AMD,SSE5 + VCVTPS2PH xmmrm128,ymmreg,imm8 AMD,SSE5 + VCVTPS2PH ymmrm128,ymmreg*,imm8 AMD,SSE5 + VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFRCZPD xmmreg,xmmrm128* AMD,SSE5 + VFRCZPD ymmreg,ymmrm256* AMD,SSE5 + VFRCZPS xmmreg,xmmrm128* AMD,SSE5 + VFRCZPS ymmreg,ymmrm256* AMD,SSE5 + VFRCZSD xmmreg,xmmrm64* AMD,SSE5 + VFRCZSS xmmreg,xmmrm32* AMD,SSE5 + VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPHADDBD xmmreg,xmmrm128* AMD,SSE5 + VPHADDBQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDBW xmmreg,xmmrm128* AMD,SSE5 + VPHADDDQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBD xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBW xmmreg,xmmrm128* AMD,SSE5 + VPHADDUDQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUWD xmmreg,xmmrm128* AMD,SSE5 + VPHADDUWQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDWD xmmreg,xmmrm128* AMD,SSE5 + VPHADDWQ xmmreg,xmmrm128* AMD,SSE5 + VPHSUBBW xmmreg,xmmrm128* AMD,SSE5 + VPHSUBDQ xmmreg,xmmrm128* AMD,SSE5 + VPHSUBWD xmmreg,xmmrm128* AMD,SSE5 + VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPROTB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTB xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTD xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTQ xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTW xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPSHAB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + + +File: nasm.info, Node: Section B.1.32, Next: Appendix C, Prev: Section B.1.31, Up: Section B.1 + +B.1.32. Systematic names for the hinting nop instructions +--------------------------------------------------------- + + HINT_NOP0 rm16 P6,UNDOC + HINT_NOP0 rm32 P6,UNDOC + HINT_NOP0 rm64 X64,UNDOC + HINT_NOP1 rm16 P6,UNDOC + HINT_NOP1 rm32 P6,UNDOC + HINT_NOP1 rm64 X64,UNDOC + HINT_NOP2 rm16 P6,UNDOC + HINT_NOP2 rm32 P6,UNDOC + HINT_NOP2 rm64 X64,UNDOC + HINT_NOP3 rm16 P6,UNDOC + HINT_NOP3 rm32 P6,UNDOC + HINT_NOP3 rm64 X64,UNDOC + HINT_NOP4 rm16 P6,UNDOC + HINT_NOP4 rm32 P6,UNDOC + HINT_NOP4 rm64 X64,UNDOC + HINT_NOP5 rm16 P6,UNDOC + HINT_NOP5 rm32 P6,UNDOC + HINT_NOP5 rm64 X64,UNDOC + HINT_NOP6 rm16 P6,UNDOC + HINT_NOP6 rm32 P6,UNDOC + HINT_NOP6 rm64 X64,UNDOC + HINT_NOP7 rm16 P6,UNDOC + HINT_NOP7 rm32 P6,UNDOC + HINT_NOP7 rm64 X64,UNDOC + HINT_NOP8 rm16 P6,UNDOC + HINT_NOP8 rm32 P6,UNDOC + HINT_NOP8 rm64 X64,UNDOC + HINT_NOP9 rm16 P6,UNDOC + HINT_NOP9 rm32 P6,UNDOC + HINT_NOP9 rm64 X64,UNDOC + HINT_NOP10 rm16 P6,UNDOC + HINT_NOP10 rm32 P6,UNDOC + HINT_NOP10 rm64 X64,UNDOC + HINT_NOP11 rm16 P6,UNDOC + HINT_NOP11 rm32 P6,UNDOC + HINT_NOP11 rm64 X64,UNDOC + HINT_NOP12 rm16 P6,UNDOC + HINT_NOP12 rm32 P6,UNDOC + HINT_NOP12 rm64 X64,UNDOC + HINT_NOP13 rm16 P6,UNDOC + HINT_NOP13 rm32 P6,UNDOC + HINT_NOP13 rm64 X64,UNDOC + HINT_NOP14 rm16 P6,UNDOC + HINT_NOP14 rm32 P6,UNDOC + HINT_NOP14 rm64 X64,UNDOC + HINT_NOP15 rm16 P6,UNDOC + HINT_NOP15 rm32 P6,UNDOC + HINT_NOP15 rm64 X64,UNDOC + HINT_NOP16 rm16 P6,UNDOC + HINT_NOP16 rm32 P6,UNDOC + HINT_NOP16 rm64 X64,UNDOC + HINT_NOP17 rm16 P6,UNDOC + HINT_NOP17 rm32 P6,UNDOC + HINT_NOP17 rm64 X64,UNDOC + HINT_NOP18 rm16 P6,UNDOC + HINT_NOP18 rm32 P6,UNDOC + HINT_NOP18 rm64 X64,UNDOC + HINT_NOP19 rm16 P6,UNDOC + HINT_NOP19 rm32 P6,UNDOC + HINT_NOP19 rm64 X64,UNDOC + HINT_NOP20 rm16 P6,UNDOC + HINT_NOP20 rm32 P6,UNDOC + HINT_NOP20 rm64 X64,UNDOC + HINT_NOP21 rm16 P6,UNDOC + HINT_NOP21 rm32 P6,UNDOC + HINT_NOP21 rm64 X64,UNDOC + HINT_NOP22 rm16 P6,UNDOC + HINT_NOP22 rm32 P6,UNDOC + HINT_NOP22 rm64 X64,UNDOC + HINT_NOP23 rm16 P6,UNDOC + HINT_NOP23 rm32 P6,UNDOC + HINT_NOP23 rm64 X64,UNDOC + HINT_NOP24 rm16 P6,UNDOC + HINT_NOP24 rm32 P6,UNDOC + HINT_NOP24 rm64 X64,UNDOC + HINT_NOP25 rm16 P6,UNDOC + HINT_NOP25 rm32 P6,UNDOC + HINT_NOP25 rm64 X64,UNDOC + HINT_NOP26 rm16 P6,UNDOC + HINT_NOP26 rm32 P6,UNDOC + HINT_NOP26 rm64 X64,UNDOC + HINT_NOP27 rm16 P6,UNDOC + HINT_NOP27 rm32 P6,UNDOC + HINT_NOP27 rm64 X64,UNDOC + HINT_NOP28 rm16 P6,UNDOC + HINT_NOP28 rm32 P6,UNDOC + HINT_NOP28 rm64 X64,UNDOC + HINT_NOP29 rm16 P6,UNDOC + HINT_NOP29 rm32 P6,UNDOC + HINT_NOP29 rm64 X64,UNDOC + HINT_NOP30 rm16 P6,UNDOC + HINT_NOP30 rm32 P6,UNDOC + HINT_NOP30 rm64 X64,UNDOC + HINT_NOP31 rm16 P6,UNDOC + HINT_NOP31 rm32 P6,UNDOC + HINT_NOP31 rm64 X64,UNDOC + HINT_NOP32 rm16 P6,UNDOC + HINT_NOP32 rm32 P6,UNDOC + HINT_NOP32 rm64 X64,UNDOC + HINT_NOP33 rm16 P6,UNDOC + HINT_NOP33 rm32 P6,UNDOC + HINT_NOP33 rm64 X64,UNDOC + HINT_NOP34 rm16 P6,UNDOC + HINT_NOP34 rm32 P6,UNDOC + HINT_NOP34 rm64 X64,UNDOC + HINT_NOP35 rm16 P6,UNDOC + HINT_NOP35 rm32 P6,UNDOC + HINT_NOP35 rm64 X64,UNDOC + HINT_NOP36 rm16 P6,UNDOC + HINT_NOP36 rm32 P6,UNDOC + HINT_NOP36 rm64 X64,UNDOC + HINT_NOP37 rm16 P6,UNDOC + HINT_NOP37 rm32 P6,UNDOC + HINT_NOP37 rm64 X64,UNDOC + HINT_NOP38 rm16 P6,UNDOC + HINT_NOP38 rm32 P6,UNDOC + HINT_NOP38 rm64 X64,UNDOC + HINT_NOP39 rm16 P6,UNDOC + HINT_NOP39 rm32 P6,UNDOC + HINT_NOP39 rm64 X64,UNDOC + HINT_NOP40 rm16 P6,UNDOC + HINT_NOP40 rm32 P6,UNDOC + HINT_NOP40 rm64 X64,UNDOC + HINT_NOP41 rm16 P6,UNDOC + HINT_NOP41 rm32 P6,UNDOC + HINT_NOP41 rm64 X64,UNDOC + HINT_NOP42 rm16 P6,UNDOC + HINT_NOP42 rm32 P6,UNDOC + HINT_NOP42 rm64 X64,UNDOC + HINT_NOP43 rm16 P6,UNDOC + HINT_NOP43 rm32 P6,UNDOC + HINT_NOP43 rm64 X64,UNDOC + HINT_NOP44 rm16 P6,UNDOC + HINT_NOP44 rm32 P6,UNDOC + HINT_NOP44 rm64 X64,UNDOC + HINT_NOP45 rm16 P6,UNDOC + HINT_NOP45 rm32 P6,UNDOC + HINT_NOP45 rm64 X64,UNDOC + HINT_NOP46 rm16 P6,UNDOC + HINT_NOP46 rm32 P6,UNDOC + HINT_NOP46 rm64 X64,UNDOC + HINT_NOP47 rm16 P6,UNDOC + HINT_NOP47 rm32 P6,UNDOC + HINT_NOP47 rm64 X64,UNDOC + HINT_NOP48 rm16 P6,UNDOC + HINT_NOP48 rm32 P6,UNDOC + HINT_NOP48 rm64 X64,UNDOC + HINT_NOP49 rm16 P6,UNDOC + HINT_NOP49 rm32 P6,UNDOC + HINT_NOP49 rm64 X64,UNDOC + HINT_NOP50 rm16 P6,UNDOC + HINT_NOP50 rm32 P6,UNDOC + HINT_NOP50 rm64 X64,UNDOC + HINT_NOP51 rm16 P6,UNDOC + HINT_NOP51 rm32 P6,UNDOC + HINT_NOP51 rm64 X64,UNDOC + HINT_NOP52 rm16 P6,UNDOC + HINT_NOP52 rm32 P6,UNDOC + HINT_NOP52 rm64 X64,UNDOC + HINT_NOP53 rm16 P6,UNDOC + HINT_NOP53 rm32 P6,UNDOC + HINT_NOP53 rm64 X64,UNDOC + HINT_NOP54 rm16 P6,UNDOC + HINT_NOP54 rm32 P6,UNDOC + HINT_NOP54 rm64 X64,UNDOC + HINT_NOP55 rm16 P6,UNDOC + HINT_NOP55 rm32 P6,UNDOC + HINT_NOP55 rm64 X64,UNDOC + HINT_NOP56 rm16 P6,UNDOC + HINT_NOP56 rm32 P6,UNDOC + HINT_NOP56 rm64 X64,UNDOC + HINT_NOP57 rm16 P6,UNDOC + HINT_NOP57 rm32 P6,UNDOC + HINT_NOP57 rm64 X64,UNDOC + HINT_NOP58 rm16 P6,UNDOC + HINT_NOP58 rm32 P6,UNDOC + HINT_NOP58 rm64 X64,UNDOC + HINT_NOP59 rm16 P6,UNDOC + HINT_NOP59 rm32 P6,UNDOC + HINT_NOP59 rm64 X64,UNDOC + HINT_NOP60 rm16 P6,UNDOC + HINT_NOP60 rm32 P6,UNDOC + HINT_NOP60 rm64 X64,UNDOC + HINT_NOP61 rm16 P6,UNDOC + HINT_NOP61 rm32 P6,UNDOC + HINT_NOP61 rm64 X64,UNDOC + HINT_NOP62 rm16 P6,UNDOC + HINT_NOP62 rm32 P6,UNDOC + HINT_NOP62 rm64 X64,UNDOC + HINT_NOP63 rm16 P6,UNDOC + HINT_NOP63 rm32 P6,UNDOC + HINT_NOP63 rm64 X64,UNDOC + + +File: nasm.info, Node: Appendix C, Next: Section C.1, Prev: Section B.1.32, Up: Top + +Appendix C: NASM Version History +******************************** + +* Menu: + +* Section C.1:: NASM 2 Series +* Section C.2:: NASM 0.98 Series +* Section C.3:: NASM 0.9 Series + + +File: nasm.info, Node: Section C.1, Next: Section C.1.1, Prev: Appendix C, Up: Appendix C + +C.1. NASM 2 Series +================== + +The NASM 2 series support x86-64, and is the production version of NASM +since 2007. + +* Menu: + +* Section C.1.1:: Version 2.08 +* Section C.1.2:: Version 2.07 +* Section C.1.3:: Version 2.06 +* Section C.1.4:: Version 2.05.01 +* Section C.1.5:: Version 2.05 +* Section C.1.6:: Version 2.04 +* Section C.1.7:: Version 2.03.01 +* Section C.1.8:: Version 2.03 +* Section C.1.9:: Version 2.02 +* Section C.1.10:: Version 2.01 +* Section C.1.11:: Version 2.00 + + +File: nasm.info, Node: Section C.1.1, Next: Section C.1.2, Prev: Section C.1, Up: Section C.1 + +C.1.1. Version 2.08 +------------------- + + * A number of enhancements/fixes in macros area. + + * Support for arbitrarily terminating macro expansions `%exitmacro'. + See *note Section 4.3.12::. + + * Support for recursive macro expansion `%rmacro/irmacro'. See *note + Section 4.3.1::. + + * Support for converting strings to tokens. See *note Section + 4.1.9::. + + * Fuzzy operand size logic introduced. + + * Fix COFF stack overrun on too long export identifiers. + + * Fix Macho-O alignment bug. + + * Fix crashes with -fwin32 on file with many exports. + + * Fix stack overrun for too long [DEBUG id]. + + * Fix incorrect sbyte usage in IMUL (hit only if optimization flag + passed). + + * Append ending token for `.stabs' records in the ELF output format. + + * New NSIS script which uses ModernUI and MultiUser approach. + + * Visual Studio 2008 NASM integration (rules file). + + * Warn a user if a constant is too long (and as result will be + stripped). + + * The obsoleted pre-XOP AMD SSE5 instruction set which was never + actualized was removed. + + * Fix stack overrun on too long error file name passed from the + command line. + + * Bind symbols to the .text section by default (ie in case if SECTION + directive was omitted) in the ELF output format. + + * Fix sync points array index wrapping. + + * A few fixes for FMA4 and XOP instruction templates. + + * Add AMD Lightweight Profiling (LWP) instructions. + + +File: nasm.info, Node: Section C.1.2, Next: Section C.1.3, Prev: Section C.1.1, Up: Section C.1 + +C.1.2. Version 2.07 +------------------- + + * NASM is now under the 2-clause BSD license. See *note Section + 1.1.2::. + + * Fix the section type for the `.strtab' section in the `elf64' + output format. + + * Fix the handling of `COMMON' directives in the `obj' output format. + + * New `ith' and `srec' output formats; these are variants of the + `bin' output format which output Intel hex and Motorola S-records, + respectively. See *note Section 7.2:: and *note Section 7.3::. + + * `rdf2ihx' replaced with an enhanced `rdf2bin', which can output + binary, COM, Intel hex or Motorola S-records. + + * The Windows installer now puts the NASM directory first in the + `PATH' of the "NASM Shell". + + * Revert the early expansion behavior of `%+' to pre-2.06 behavior: + `%+' is only expanded late. + + * Yet another Mach-O alignment fix. + + * Don't delete the list file on errors. Also, include error and + warning information in the list file. + + * Support for 64-bit Mach-O output, see *note Section 7.8::. + + * Fix assert failure on certain operations that involve strings with + high-bit bytes. + + +File: nasm.info, Node: Section C.1.3, Next: Section C.1.4, Prev: Section C.1.2, Up: Section C.1 + +C.1.3. Version 2.06 +------------------- + + * This release is dedicated to the memory of Charles A. Crayne, long + time NASM developer as well as moderator of `comp.lang.asm.x86' + and author of the book _Serious Assembler_. We miss you, Chuck. + + * Support for indirect macro expansion (`%[...]'). See *note Section + 4.1.3::. + + * `%pop' can now take an argument, see *note Section 4.7.1::. + + * The argument to `%use' is no longer macro-expanded. Use `%[...]' + if macro expansion is desired. + + * Support for thread-local storage in ELF32 and ELF64. See *note + Section 7.9.4::. + + * Fix crash on `%ifmacro' without an argument. + + * Correct the arguments to the `POPCNT' instruction. + + * Fix section alignment in the Mach-O format. + + * Update AVX support to version 5 of the Intel specification. + + * Fix the handling of accesses to context-local macros from higher + levels in the context stack. + + * Treat `WAIT' as a prefix rather than as an instruction, thereby + allowing constructs like `O16 FSAVE' to work correctly. + + * Support for structures with a non-zero base offset. See *note + Section 4.11.10::. + + * Correctly handle preprocessor token concatenation (see *note + Section 4.3.8::) involving floating-point numbers. + + * The `PINSR' series of instructions have been corrected and + rationalized. + + * Removed AMD SSE5, replaced with the new XOP/FMA4/CVT16 (rev 3.03) + spec. + + * The ELF backends no longer automatically generate a `.comment' + section. + + * Add additional "well-known" ELF sections with default attributes. + See *note Section 7.9.2::. + + +File: nasm.info, Node: Section C.1.4, Next: Section C.1.5, Prev: Section C.1.3, Up: Section C.1 + +C.1.4. Version 2.05.01 +---------------------- + + * Fix the `-w'/`-W' option parsing, which was broken in NASM 2.05. + + +File: nasm.info, Node: Section C.1.5, Next: Section C.1.6, Prev: Section C.1.4, Up: Section C.1 + +C.1.5. Version 2.05 +------------------- + + * Fix redundant REX.W prefix on `JMP reg64'. + + * Make the behaviour of `-O0' match NASM 0.98 legacy behavior. See + *note Section 2.1.22::. + + * `-w-user' can be used to suppress the output of `%warning' + directives. See *note Section 2.1.24::. + + * Fix bug where `ALIGN' would issue a full alignment datum instead of + zero bytes. + + * Fix offsets in list files. + + * Fix `%include' inside multi-line macros or loops. + + * Fix error where NASM would generate a spurious warning on valid + optimizations of immediate values. + + * Fix arguments to a number of the `CVT' SSE instructions. + + * Fix RIP-relative offsets when the instruction carries an immediate. + + * Massive overhaul of the ELF64 backend for spec compliance. + + * Fix the Geode `PFRCPV' and `PFRSQRTV' instruction. + + * Fix the SSE 4.2 `CRC32' instruction. + + +File: nasm.info, Node: Section C.1.6, Next: Section C.1.7, Prev: Section C.1.5, Up: Section C.1 + +C.1.6. Version 2.04 +------------------- + + * Sanitize macro handing in the `%error' directive. + + * New `%warning' directive to issue user-controlled warnings. + + * `%error' directives are now deferred to the final assembly phase. + + * New `%fatal' directive to immediately terminate assembly. + + * New `%strcat' directive to join quoted strings together. + + * New `%use' macro directive to support standard macro directives. + See *note Section 4.6.4::. + + * Excess default parameters to `%macro' now issues a warning by + default. See *note Section 4.3::. + + * Fix `%ifn' and `%elifn'. + + * Fix nested `%else' clauses. + + * Correct the handling of nested `%rep's. + + * New `%unmacro' directive to undeclare a multi-line macro. See + *note Section 4.3.11::. + + * Builtin macro `__PASS__' which expands to the current assembly + pass. See *note Section 4.11.9::. + + * `__utf16__' and `__utf32__' operators to generate UTF-16 and UTF- + 32 strings. See *note Section 3.4.5::. + + * Fix bug in case-insensitive matching when compiled on platforms + that don't use the `configure' script. Of the official release + binaries, that only affected the OS/2 binary. + + * Support for x87 packed BCD constants. See *note Section 3.4.7::. + + * Correct the `LTR' and `SLDT' instructions in 64-bit mode. + + * Fix unnecessary REX.W prefix on indirect jumps in 64-bit mode. + + * Add AVX versions of the AES instructions (`VAES'...). + + * Fix the 256-bit FMA instructions. + + * Add 256-bit AVX stores per the latest AVX spec. + + * VIA XCRYPT instructions can now be written either with or without + `REP', apparently different versions of the VIA spec wrote them + differently. + + * Add missing 64-bit `MOVNTI' instruction. + + * Fix the operand size of `VMREAD' and `VMWRITE'. + + * Numerous bug fixes, especially to the AES, AVX and VTX + instructions. + + * The optimizer now always runs until it converges. It also runs + even when disabled, but doesn't optimize. This allows most forward + references to be resolved properly. + + * `%push' no longer needs a context identifier; omitting the context + identifier results in an anonymous context. + + +File: nasm.info, Node: Section C.1.7, Next: Section C.1.8, Prev: Section C.1.6, Up: Section C.1 + +C.1.7. Version 2.03.01 +---------------------- + + * Fix buffer overflow in the listing module. + + * Fix the handling of hexadecimal escape codes in `...` strings. + + * The Postscript/PDF documentation has been reformatted. + + * The `-F' option now implies `-g'. + + +File: nasm.info, Node: Section C.1.8, Next: Section C.1.9, Prev: Section C.1.7, Up: Section C.1 + +C.1.8. Version 2.03 +------------------- + + * Add support for Intel AVX, CLMUL and FMA instructions, including + YMM registers. + + * `dy', `resy' and `yword' for 32-byte operands. + + * Fix some SSE5 instructions. + + * Intel `INVEPT', `INVVPID' and `MOVBE' instructions. + + * Fix checking for critical expressions when the optimizer is + enabled. + + * Support the DWARF debugging format for ELF targets. + + * Fix optimizations of signed bytes. + + * Fix operation on bigendian machines. + + * Fix buffer overflow in the preprocessor. + + * `SAFESEH' support for Win32, `IMAGEREL' for Win64 (SEH). + + * `%?' and `%??' to refer to the name of a macro itself. In + particular, `%idefine keyword $%?' can be used to make a keyword + "disappear". + + * New options for dependency generation: `-MD', `-MF', `-MP', `-MT', + `-MQ'. + + * New preprocessor directives `%pathsearch' and `%depend'; INCBIN + reimplemented as a macro. + + * `%include' now resolves macros in a sane manner. + + * `%substr' can now be used to get other than one-character + substrings. + + * New type of character/string constants, using backquotes (``...`'), + which support C-style escape sequences. + + * `%defstr' and `%idefstr' to stringize macro definitions before + creation. + + * Fix forward references used in `EQU' statements. + + +File: nasm.info, Node: Section C.1.9, Next: Section C.1.10, Prev: Section C.1.8, Up: Section C.1 + +C.1.9. Version 2.02 +------------------- + + * Additional fixes for MMX operands with explicit `qword', as well as + (hopefully) SSE operands with `oword'. + + * Fix handling of truncated strings with `DO'. + + * Fix segfaults due to memory overwrites when floating-point + constants were used. + + * Fix segfaults due to missing include files. + + * Fix OpenWatcom Makefiles for DOS and OS/2. + + * Add autogenerated instruction list back into the documentation. + + * ELF: Fix segfault when generating stabs, and no symbols have been + defined. + + * ELF: Experimental support for DWARF debugging information. + + * New compile date and time standard macros. + + * `%ifnum' now returns true for negative numbers. + + * New `%iftoken' test for a single token. + + * New `%ifempty' test for empty expansion. + + * Add support for the `XSAVE' instruction group. + + * Makefile for Netware/gcc. + + * Fix issue with some warnings getting emitted way too many times. + + * Autogenerated instruction list added to the documentation. + + +File: nasm.info, Node: Section C.1.10, Next: Section C.1.11, Prev: Section C.1.9, Up: Section C.1 + +C.1.10. Version 2.01 +-------------------- + + * Fix the handling of MMX registers with explicit `qword' tags on + memory (broken in 2.00 due to 64-bit changes.) + + * Fix the PREFETCH instructions. + + * Fix the documentation. + + * Fix debugging info when using `-f elf' (backwards compatibility + alias for `-f elf32'). + + * Man pages for rdoff tools (from the Debian project.) + + * ELF: handle large numbers of sections. + + * Fix corrupt output when the optimizer runs out of passes. + + +File: nasm.info, Node: Section C.1.11, Next: Section C.2, Prev: Section C.1.10, Up: Section C.1 + +C.1.11. Version 2.00 +-------------------- + + * Added c99 data-type compliance. + + * Added general x86-64 support. + + * Added win64 (x86-64 COFF) output format. + + * Added `__BITS__' standard macro. + + * Renamed the `elf' output format to `elf32' for clarity. + + * Added `elf64' and `macho' (MacOS X) output formats. + + * Added Numeric constants in `dq' directive. + + * Added `oword', `do' and `reso' pseudo operands. + + * Allow underscores in numbers. + + * Added 8-, 16- and 128-bit floating-point formats. + + * Added binary, octal and hexadecimal floating-point. + + * Correct the generation of floating-point constants. + + * Added floating-point option control. + + * Added Infinity and NaN floating point support. + + * Added ELF Symbol Visibility support. + + * Added setting OSABI value in ELF header directive. + + * Added Generate Makefile Dependencies option. + + * Added Unlimited Optimization Passes option. + + * Added `%IFN' and `%ELIFN' support. + + * Added Logical Negation Operator. + + * Enhanced Stack Relative Preprocessor Directives. + + * Enhanced ELF Debug Formats. + + * Enhanced Send Errors to a File option. + + * Added SSSE3, SSE4.1, SSE4.2, SSE5 support. + + * Added a large number of additional instructions. + + * Significant performance improvements. + + * `-w+warning' and `-w-warning' can now be written as -Wwarning and + -Wno-warning, respectively. See *note Section 2.1.24::. + + * Add `-w+error' to treat warnings as errors. See *note Section + 2.1.24::. + + * Add `-w+all' and `-w-all' to enable or disable all suppressible + warnings. See *note Section 2.1.24::. + + +File: nasm.info, Node: Section C.2, Next: Section C.2.1, Prev: Section C.1.11, Up: Appendix C + +C.2. NASM 0.98 Series +===================== + +The 0.98 series was the production versions of NASM from 1999 to 2007. + +* Menu: + +* Section C.2.1:: Version 0.98.39 +* Section C.2.2:: Version 0.98.38 +* Section C.2.3:: Version 0.98.37 +* Section C.2.4:: Version 0.98.36 +* Section C.2.5:: Version 0.98.35 +* Section C.2.6:: Version 0.98.34 +* Section C.2.7:: Version 0.98.33 +* Section C.2.8:: Version 0.98.32 +* Section C.2.9:: Version 0.98.31 +* Section C.2.10:: Version 0.98.30 +* Section C.2.11:: Version 0.98.28 +* Section C.2.12:: Version 0.98.26 +* Section C.2.13:: Version 0.98.25alt +* Section C.2.14:: Version 0.98.25 +* Section C.2.15:: Version 0.98.24p1 +* Section C.2.16:: Version 0.98.24 +* Section C.2.17:: Version 0.98.23 +* Section C.2.18:: Version 0.98.22 +* Section C.2.19:: Version 0.98.21 +* Section C.2.20:: Version 0.98.20 +* Section C.2.21:: Version 0.98.19 +* Section C.2.22:: Version 0.98.18 +* Section C.2.23:: Version 0.98.17 +* Section C.2.24:: Version 0.98.16 +* Section C.2.25:: Version 0.98.15 +* Section C.2.26:: Version 0.98.14 +* Section C.2.27:: Version 0.98.13 +* Section C.2.28:: Version 0.98.12 +* Section C.2.29:: Version 0.98.11 +* Section C.2.30:: Version 0.98.10 +* Section C.2.31:: Version 0.98.09 +* Section C.2.32:: Version 0.98.08 +* Section C.2.33:: Version 0.98.09b with John Coffman patches released 28-Oct-2001 +* Section C.2.34:: Version 0.98.07 released 01/28/01 +* Section C.2.35:: Version 0.98.06f released 01/18/01 +* Section C.2.36:: Version 0.98.06e released 01/09/01 +* Section C.2.37:: Version 0.98p1 +* Section C.2.38:: Version 0.98bf (bug-fixed) +* Section C.2.39:: Version 0.98.03 with John Coffman's changes released 27-Jul-2000 +* Section C.2.40:: Version 0.98.03 +* Section C.2.41:: Version 0.98 +* Section C.2.42:: Version 0.98p9 +* Section C.2.43:: Version 0.98p8 +* Section C.2.44:: Version 0.98p7 +* Section C.2.45:: Version 0.98p6 +* Section C.2.46:: Version 0.98p3.7 +* Section C.2.47:: Version 0.98p3.6 +* Section C.2.48:: Version 0.98p3.5 +* Section C.2.49:: Version 0.98p3.4 +* Section C.2.50:: Version 0.98p3.3 +* Section C.2.51:: Version 0.98p3.2 +* Section C.2.52:: Version 0.98p3-hpa +* Section C.2.53:: Version 0.98 pre-release 3 +* Section C.2.54:: Version 0.98 pre-release 2 +* Section C.2.55:: Version 0.98 pre-release 1 + + +File: nasm.info, Node: Section C.2.1, Next: Section C.2.2, Prev: Section C.2, Up: Section C.2 + +C.2.1. Version 0.98.39 +---------------------- + + * fix buffer overflow + + * fix outas86's `.bss' handling + + * "make spotless" no longer deletes config.h.in. + + * `%(el)if(n)idn' insensitivity to string quotes difference + (#809300). + + * (nasm.c)`__OUTPUT_FORMAT__' changed to string value instead of + symbol. + + +File: nasm.info, Node: Section C.2.2, Next: Section C.2.3, Prev: Section C.2.1, Up: Section C.2 + +C.2.2. Version 0.98.38 +---------------------- + + * Add Makefile for 16-bit DOS binaries under OpenWatcom, and modify + `mkdep.pl' to be able to generate completely pathless + dependencies, as required by OpenWatcom wmake (it supports path + searches, but not explicit paths.) + + * Fix the `STR' instruction. + + * Fix the ELF output format, which was broken under certain + circumstances due to the addition of stabs support. + + * Quick-fix Borland format debug-info for `-f obj' + + * Fix for `%rep' with no arguments (#560568) + + * Fix concatenation of preprocessor function call (#794686) + + * Fix long label causes coredump (#677841) + + * Use autoheader as well as autoconf to keep configure from + generating ridiculously long command lines. + + * Make sure that all of the formats which support debugging output + actually will suppress debugging output when `-g' not specified. + + +File: nasm.info, Node: Section C.2.3, Next: Section C.2.4, Prev: Section C.2.2, Up: Section C.2 + +C.2.3. Version 0.98.37 +---------------------- + + * Paths given in `-I' switch searched for `incbin'-ed as well as + `%include'-ed files. + + * Added stabs debugging for the ELF output format, patch from Martin + Wawro. + + * Fix `output/outbin.c' to allow origin > 80000000h. + + * Make `-U' switch work. + + * Fix the use of relative offsets with explicit prefixes, e.g. `a32 + loop foo'. + + * Remove `backslash()'. + + * Fix the `SMSW' and `SLDT' instructions. + + * `-O2' and `-O3' are no longer aliases for `-O10' and `-O15'. If + you mean the latter, please say so! :) + + +File: nasm.info, Node: Section C.2.4, Next: Section C.2.5, Prev: Section C.2.3, Up: Section C.2 + +C.2.4. Version 0.98.36 +---------------------- + + * Update rdoff - librarian/archiver - common rec - docs! + + * Fix signed/unsigned problems. + + * Fix `JMP FAR label' and `CALL FAR label'. + + * Add new multisection support - map files - fix align bug + + * Fix sysexit, movhps/movlps reg,reg bugs in insns.dat + + * `Q' or `O' suffixes indicate octal + + * Support Prescott new instructions (PNI). + + * Cyrix `XSTORE' instruction. + + +File: nasm.info, Node: Section C.2.5, Next: Section C.2.6, Prev: Section C.2.4, Up: Section C.2 + +C.2.5. Version 0.98.35 +---------------------- + + * Fix build failure on 16-bit DOS (Makefile.bc3 workaround for + compiler bug.) + + * Fix dependencies and compiler warnings. + + * Add "const" in a number of places. + + * Add -X option to specify error reporting format (use -Xvc to + integrate with Microsoft Visual Studio.) + + * Minor changes for code legibility. + + * Drop use of tmpnam() in rdoff (security fix.) + + +File: nasm.info, Node: Section C.2.6, Next: Section C.2.7, Prev: Section C.2.5, Up: Section C.2 + +C.2.6. Version 0.98.34 +---------------------- + + * Correct additional address-size vs. operand-size confusions. + + * Generate dependencies for all Makefiles automatically. + + * Add support for unimplemented (but theoretically available) + registers such as tr0 and cr5. Segment registers 6 and 7 are + called segr6 and segr7 for the operations which they can be + represented. + + * Correct some disassembler bugs related to redundant address-size + prefixes. Some work still remains in this area. + + * Correctly generate an error for things like "SEG eax". + + * Add the JMPE instruction, enabled by "CPU IA64". + + * Correct compilation on newer gcc/glibc platforms. + + * Issue an error on things like "jmp far eax". + + +File: nasm.info, Node: Section C.2.7, Next: Section C.2.8, Prev: Section C.2.6, Up: Section C.2 + +C.2.7. Version 0.98.33 +---------------------- + + * New __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ standard macros to + round out the version-query macros. version.pl now understands + X.YYplWW or X.YY.ZZplWW as a version number, equivalent to + X.YY.ZZ.WW (or X.YY.0.WW, as appropriate). + + * New keyword "strict" to disable the optimization of specific + operands. + + * Fix the handing of size overrides with JMP instructions + (instructions such as "jmp dword foo".) + + * Fix the handling of "ABSOLUTE label", where "label" points into a + relocatable segment. + + * Fix OBJ output format with lots of externs. + + * More documentation updates. + + * Add -Ov option to get verbose information about optimizations. + + * Undo a braindead change which broke `%elif' directives. + + * Makefile updates. + + +File: nasm.info, Node: Section C.2.8, Next: Section C.2.9, Prev: Section C.2.7, Up: Section C.2 + +C.2.8. Version 0.98.32 +---------------------- + + * Fix NASM crashing when `%macro' directives were left unterminated. + + * Lots of documentation updates. + + * Complete rewrite of the PostScript/PDF documentation generator. + + * The MS Visual C++ Makefile was updated and corrected. + + * Recognize .rodata as a standard section name in ELF. + + * Fix some obsolete Perl4-isms in Perl scripts. + + * Fix configure.in to work with autoconf 2.5x. + + * Fix a couple of "make cleaner" misses. + + * Make the normal "./configure && make" work with Cygwin. + + +File: nasm.info, Node: Section C.2.9, Next: Section C.2.10, Prev: Section C.2.8, Up: Section C.2 + +C.2.9. Version 0.98.31 +---------------------- + + * Correctly build in a separate object directory again. + + * Derive all references to the version number from the version file. + + * New standard macros __NASM_SUBMINOR__ and __NASM_VER__ macros. + + * Lots of Makefile updates and bug fixes. + + * New `%ifmacro' directive to test for multiline macros. + + * Documentation updates. + + * Fixes for 16-bit OBJ format output. + + * Changed the NASM environment variable to NASMENV. + + +File: nasm.info, Node: Section C.2.10, Next: Section C.2.11, Prev: Section C.2.9, Up: Section C.2 + +C.2.10. Version 0.98.30 +----------------------- + + * Changed doc files a lot: completely removed old READMExx and + Wishlist files, incorporating all information in CHANGES and TODO. + + * I waited a long time to rename zoutieee.c to (original) outieee.c + + * moved all output modules to output/ subdirectory. + + * Added 'make strip' target to strip debug info from nasm & ndisasm. + + * Added INSTALL file with installation instructions. + + * Added -v option description to nasm man. + + * Added dist makefile target to produce source distributions. + + * 16-bit support for ELF output format (GNU extension, but useful.) + + +File: nasm.info, Node: Section C.2.11, Next: Section C.2.12, Prev: Section C.2.10, Up: Section C.2 + +C.2.11. Version 0.98.28 +----------------------- + + * Fastcooked this for Debian's Woody release: Frank applied the + INCBIN bug patch to 0.98.25alt and called it 0.98.28 to not + confuse poor little apt- get. + + +File: nasm.info, Node: Section C.2.12, Next: Section C.2.13, Prev: Section C.2.11, Up: Section C.2 + +C.2.12. Version 0.98.26 +----------------------- + + * Reorganised files even better from 0.98.25alt + + +File: nasm.info, Node: Section C.2.13, Next: Section C.2.14, Prev: Section C.2.12, Up: Section C.2 + +C.2.13. Version 0.98.25alt +-------------------------- + + * Prettified the source tree. Moved files to more reasonable places. + + * Added findleak.pl script to misc/ directory. + + * Attempted to fix doc. + + +File: nasm.info, Node: Section C.2.14, Next: Section C.2.15, Prev: Section C.2.13, Up: Section C.2 + +C.2.14. Version 0.98.25 +----------------------- + + * Line continuation character `\'. + + * Docs inadvertantly reverted - "dos packaging". + + +File: nasm.info, Node: Section C.2.15, Next: Section C.2.16, Prev: Section C.2.14, Up: Section C.2 + +C.2.15. Version 0.98.24p1 +------------------------- + + * FIXME: Someone, document this please. + + +File: nasm.info, Node: Section C.2.16, Next: Section C.2.17, Prev: Section C.2.15, Up: Section C.2 + +C.2.16. Version 0.98.24 +----------------------- + + * Documentation - Ndisasm doc added to Nasm.doc. + + +File: nasm.info, Node: Section C.2.17, Next: Section C.2.18, Prev: Section C.2.16, Up: Section C.2 + +C.2.17. Version 0.98.23 +----------------------- + + * Attempted to remove rdoff version1 + + * Lino Mastrodomenico's patches to preproc.c (%$$ bug?). + + +File: nasm.info, Node: Section C.2.18, Next: Section C.2.19, Prev: Section C.2.17, Up: Section C.2 + +C.2.18. Version 0.98.22 +----------------------- + + * Update rdoff2 - attempt to remove v1. + + +File: nasm.info, Node: Section C.2.19, Next: Section C.2.20, Prev: Section C.2.18, Up: Section C.2 + +C.2.19. Version 0.98.21 +----------------------- + + * Optimization fixes. + + +File: nasm.info, Node: Section C.2.20, Next: Section C.2.21, Prev: Section C.2.19, Up: Section C.2 + +C.2.20. Version 0.98.20 +----------------------- + + * Optimization fixes. + + +File: nasm.info, Node: Section C.2.21, Next: Section C.2.22, Prev: Section C.2.20, Up: Section C.2 + +C.2.21. Version 0.98.19 +----------------------- + + * H. J. Lu's patch back out. + + +File: nasm.info, Node: Section C.2.22, Next: Section C.2.23, Prev: Section C.2.21, Up: Section C.2 + +C.2.22. Version 0.98.18 +----------------------- + + * Added ".rdata" to "-f win32". + + +File: nasm.info, Node: Section C.2.23, Next: Section C.2.24, Prev: Section C.2.22, Up: Section C.2 + +C.2.23. Version 0.98.17 +----------------------- + + * H. J. Lu's "bogus elf" patch. (Red Hat problem?) + + +File: nasm.info, Node: Section C.2.24, Next: Section C.2.25, Prev: Section C.2.23, Up: Section C.2 + +C.2.24. Version 0.98.16 +----------------------- + + * Fix whitespace before "[section ..." bug. + + +File: nasm.info, Node: Section C.2.25, Next: Section C.2.26, Prev: Section C.2.24, Up: Section C.2 + +C.2.25. Version 0.98.15 +----------------------- + + * Rdoff changes (?). + + * Fix fixes to memory leaks. + + +File: nasm.info, Node: Section C.2.26, Next: Section C.2.27, Prev: Section C.2.25, Up: Section C.2 + +C.2.26. Version 0.98.14 +----------------------- + + * Fix memory leaks. + + +File: nasm.info, Node: Section C.2.27, Next: Section C.2.28, Prev: Section C.2.26, Up: Section C.2 + +C.2.27. Version 0.98.13 +----------------------- + + * There was no 0.98.13 + + +File: nasm.info, Node: Section C.2.28, Next: Section C.2.29, Prev: Section C.2.27, Up: Section C.2 + +C.2.28. Version 0.98.12 +----------------------- + + * Update optimization (new function of "-O1") + + * Changes to test/bintest.asm (?). + + +File: nasm.info, Node: Section C.2.29, Next: Section C.2.30, Prev: Section C.2.28, Up: Section C.2 + +C.2.29. Version 0.98.11 +----------------------- + + * Optimization changes. + + * Ndisasm fixed. + + +File: nasm.info, Node: Section C.2.30, Next: Section C.2.31, Prev: Section C.2.29, Up: Section C.2 + +C.2.30. Version 0.98.10 +----------------------- + + * There was no 0.98.10 + + +File: nasm.info, Node: Section C.2.31, Next: Section C.2.32, Prev: Section C.2.30, Up: Section C.2 + +C.2.31. Version 0.98.09 +----------------------- + + * Add multiple sections support to "-f bin". + + * Changed GLOBAL_TEMP_BASE in outelf.c from 6 to 15. + + * Add "-v" as an alias to the "-r" switch. + + * Remove "#ifdef" from Tasm compatibility options. + + * Remove redundant size-overrides on "mov ds, ex", etc. + + * Fixes to SSE2, other insns.dat (?). + + * Enable uppercase "I" and "P" switches. + + * Case insinsitive "seg" and "wrt". + + * Update install.sh (?). + + * Allocate tokens in blocks. + + * Improve "invalid effective address" messages. + + +File: nasm.info, Node: Section C.2.32, Next: Section C.2.33, Prev: Section C.2.31, Up: Section C.2 + +C.2.32. Version 0.98.08 +----------------------- + + * Add "`%strlen'" and "`%substr'" macro operators + + * Fixed broken c16.mac. + + * Unterminated string error reported. + + * Fixed bugs as per 0.98bf + + +File: nasm.info, Node: Section C.2.33, Next: Section C.2.34, Prev: Section C.2.32, Up: Section C.2 + +C.2.33. Version 0.98.09b with John Coffman patches released 28-Oct-2001 +----------------------------------------------------------------------- + +Changes from 0.98.07 release to 98.09b as of 28-Oct-2001 + + * More closely compatible with 0.98 when -O0 is implied or + specified. Not strictly identical, since backward branches in + range of short offsets are recognized, and signed byte values with + no explicit size specification will be assembled as a single byte. + + * More forgiving with the PUSH instruction. 0.98 requires a size to + be specified always. 0.98.09b will imply the size from the current + BITS setting (16 or 32). + + * Changed definition of the optimization flag: + + -O0 strict two-pass assembly, JMP and Jcc are handled more like 0.98, +except that back- ward JMPs are short, if possible. + + -O1 strict two-pass assembly, but forward branches are assembled +with code guaranteed to reach; may produce larger code than -O0, but +will produce successful assembly more often if branch offset sizes are +not specified. + + -O2 multi-pass optimization, minimize branch offsets; also will +minimize signed immed- iate bytes, overriding size specification. + + -O3 like -O2, but more passes taken, if needed + + +File: nasm.info, Node: Section C.2.34, Next: Section C.2.35, Prev: Section C.2.33, Up: Section C.2 + +C.2.34. Version 0.98.07 released 01/28/01 +----------------------------------------- + + * Added Stepane Denis' SSE2 instructions to a *working* version of + the code - some earlier versions were based on broken code - sorry + 'bout that. version "0.98.07" + + 01/28/01 + + * Cosmetic modifications to nasm.c, nasm.h, AUTHORS, MODIFIED + + +File: nasm.info, Node: Section C.2.35, Next: Section C.2.36, Prev: Section C.2.34, Up: Section C.2 + +C.2.35. Version 0.98.06f released 01/18/01 +------------------------------------------ + + * - Add "metalbrain"s jecxz bug fix in insns.dat - alter nasmdoc.src + to match - version "0.98.06f" + + +File: nasm.info, Node: Section C.2.36, Next: Section C.2.37, Prev: Section C.2.35, Up: Section C.2 + +C.2.36. Version 0.98.06e released 01/09/01 +------------------------------------------ + + * Removed the "outforms.h" file - it appears to be someone's old + backup of "outform.h". version "0.98.06e" + + 01/09/01 + + * fbk - finally added the fix for the "multiple %includes bug", + known since 7/27/99 - reported originally (?) and sent to us by + Austin Lunnen - he reports that John Fine had a fix within the + day. Here it is... + + * Nelson Rush resigns from the group. Big thanks to Nelson for his + leadership and enthusiasm in getting these changes incorporated + into Nasm! + + * fbk - [list +], [list -] directives - ineptly implemented, should + be re- written or removed, perhaps. + + * Brian Raiter / fbk - "elfso bug" fix - applied to aoutb format as + well - testing might be desirable... + + 08/07/00 + + * James Seter - -postfix, -prefix command line switches. + + * Yuri Zaporogets - rdoff utility changes. + + +File: nasm.info, Node: Section C.2.37, Next: Section C.2.38, Prev: Section C.2.36, Up: Section C.2 + +C.2.37. Version 0.98p1 +---------------------- + + * GAS-like palign (Panos Minos) + + * FIXME: Someone, fill this in with details + + +File: nasm.info, Node: Section C.2.38, Next: Section C.2.39, Prev: Section C.2.37, Up: Section C.2 + +C.2.38. Version 0.98bf (bug-fixed) +---------------------------------- + + * Fixed - elf and aoutb bug - shared libraries - multiple "%include" + bug in "-f obj" - jcxz, jecxz bug - unrecognized option bug in + ndisasm + + +File: nasm.info, Node: Section C.2.39, Next: Section C.2.40, Prev: Section C.2.38, Up: Section C.2 + +C.2.39. Version 0.98.03 with John Coffman's changes released 27-Jul-2000 +------------------------------------------------------------------------ + + * Added signed byte optimizations for the 0x81/0x83 class of + instructions: ADC, ADD, AND, CMP, OR, SBB, SUB, XOR: when used as + 'ADD reg16,imm' or 'ADD reg32,imm.' Also optimization of signed + byte form of 'PUSH imm' and 'IMUL reg,imm'/'IMUL reg,reg,imm.' No + size specification is needed. + + * Added multi-pass JMP and Jcc offset optimization. Offsets on + forward references will preferentially use the short form, without + the need to code a specific size (short or near) for the branch. + Added instructions for 'Jcc label' to use the form 'Jnotcc $+3/JMP + label', in cases where a short offset is out of bounds. If + compiling for a 386 or higher CPU, then the 386 form of Jcc will + be used instead. + + This feature is controlled by a new command-line switch: "O", (upper +case letter O). "-O0" reverts the assembler to no extra optimization +passes, "- O1" allows up to 5 extra passes, and "-O2"(default), allows +up to 10 extra optimization passes. + + * Added a new directive: 'cpu XXX', where XXX is any of: 8086, 186, + 286, 386, 486, 586, pentium, 686, PPro, P2, P3 or Katmai. All are + case insensitive. All instructions will be selected only if they + apply to the selected cpu or lower. Corrected a couple of bugs in + cpu-dependence in 'insns.dat'. + + * Added to 'standard.mac', the "use16" and "use32" forms of the + "bits 16/32" directive. This is nothing new, just conforms to a + lot of other assemblers. (minor) + + * Changed label allocation from 320/32 (10000 labels @ 200K+) to + 32/37 (1000 labels); makes running under DOS much easier. Since + additional label space is allocated dynamically, this should have + no effect on large programs with lots of labels. The 37 is a + prime, believed to be better for hashing. (minor) + + +File: nasm.info, Node: Section C.2.40, Next: Section C.2.41, Prev: Section C.2.39, Up: Section C.2 + +C.2.40. Version 0.98.03 +----------------------- + +"Integrated patchfile 0.98-0.98.01. I call this version 0.98.03 for +historical reasons: 0.98.02 was trashed." ---John Coffman +<johninsd@san.rr.com>, 27-Jul-2000 + + * Kendall Bennett's SciTech MGL changes + + * Note that you must define "TASM_COMPAT" at compile-time to get the + Tasm Ideal Mode compatibility. + + * All changes can be compiled in and out using the TASM_COMPAT + macros, and when compiled without TASM_COMPAT defined we get the + exact same binary as the unmodified 0.98 sources. + + * standard.mac, macros.c: Added macros to ignore TASM directives + before first include + + * nasm.h: Added extern declaration for tasm_compatible_mode + + * nasm.c: Added global variable tasm_compatible_mode + + * Added command line switch for TASM compatible mode (-t) + + * Changed version command line to reflect when compiled with TASM + additions + + * Added response file processing to allow all arguments on a single + line (response file is @resp rather than -@resp for NASM format). + + * labels.c: Changes islocal() macro to support TASM style @@local + labels. + + * Added islocalchar() macro to support TASM style @@local labels. + + * parser.c: Added support for TASM style memory references (ie: mov + [DWORD eax],10 rather than the NASM style mov DWORD [eax],10). + + * preproc.c: Added new directives, `%arg', `%local', `%stacksize' to + directives table + + * Added support for TASM style directives without a leading % symbol. + + * Integrated a block of changes from Andrew Zabolotny + <bit@eltech.ru>: + + * A new keyword `%xdefine' and its case-insensitive counterpart + `%ixdefine'. They work almost the same way as `%define' and + `%idefine' but expand the definition immediately, not on the + invocation. Something like a cross between `%define' and + `%assign'. The "x" suffix stands for "eXpand", so "xdefine" can be + deciphered as "expand-and-define". Thus you can do things like + this: + + %assign ofs 0 + + %macro arg 1 + %xdefine %1 dword [esp+ofs] + %assign ofs ofs+4 + %endmacro + + * Changed the place where the expansion of %$name macros are + expanded. Now they are converted into ..@ctxnum.name form when + detokenizing, so there are no quirks as before when using %$name + arguments to macros, in macros etc. For example: + + %macro abc 1 + %define %1 hello + %endm + + abc %$here + %$here + + Now last line will be expanded into "hello" as expected. This also +allows for lots of goodies, a good example are extended "proc" macros +included in this archive. + + * Added a check for "cstk" in smacro_defined() before calling + get_ctx() - this allows for things like: + + %ifdef %$abc + %endif + + to work without warnings even in no context. + + * Added a check for "cstk" in %if*ctx and %elif*ctx directives - + this allows to use `%ifctx' without excessive warnings. If there + is no active context, `%ifctx' goes through "false" branch. + + * Removed "user error: " prefix with `%error' directive: it just + clobbers the output and has absolutely no functionality. Besides, + this allows to write macros that does not differ from built-in + functions in any way. + + * Added expansion of string that is output by `%error' directive. Now + you can do things like: + + %define hello(x) Hello, x! + + %define %$name andy + %error "hello(%$name)" + + Same happened with `%include' directive. + + * Now all directives that expect an identifier will try to expand and + concatenate everything without whitespaces in between before + usage. For example, with "unfixed" nasm the commands + + %define %$abc hello + %define __%$abc goodbye + __%$abc + + would produce "incorrect" output: last line will expand to + + hello goodbyehello + + Not quite what you expected, eh? :-) The answer is that preprocessor +treats the `%define' construct as if it would be + + %define __ %$abc goodbye + + (note the white space between __ and %$abc). After my "fix" it will +"correctly" expand into + + goodbye + + as expected. Note that I use quotes around words "correct", +"incorrect" etc because this is rather a feature not a bug; however +current behaviour is more logical (and allows more advanced macro usage +:-). + + Same change was applied to: +`%push',`%macro',`%imacro',`%define',`%idefine',`%xdefine',`%ixdefine', +`%assign',`%iassign',`%undef' + + * A new directive [WARNING {+|-}warning-id] have been added. It + works only if the assembly phase is enabled (i.e. it doesn't work + with nasm -e). + + * A new warning type: macro-selfref. By default this warning is + disabled; when enabled NASM warns when a macro self-references + itself; for example the following source: + + [WARNING macro-selfref] + + %macro push 1-* + %rep %0 + push %1 + %rotate 1 + %endrep + %endmacro + + push eax,ebx,ecx + + will produce a warning, but if we remove the first line we won't see +it anymore (which is The Right Thing To Do {tm} IMHO since C +preprocessor eats such constructs without warnings at all). + + * Added a "error" routine to preprocessor which always will set + ERR_PASS1 bit in severity_code. This removes annoying repeated + errors on first and second passes from preprocessor. + + * Added the %+ operator in single-line macros for concatenating two + identifiers. Usage example: + + %define _myfunc _otherfunc + %define cextern(x) _ %+ x + cextern (myfunc) + + After first expansion, third line will become "_myfunc". After this +expansion is performed again so it becomes "_otherunc". + + * Now if preprocessor is in a non-emitting state, no warning or + error will be emitted. Example: + + %if 1 + mov eax,ebx + %else + put anything you want between these two brackets, + even macro-parameter references %1 or local + labels %$zz or macro-local labels %%zz - no + warning will be emitted. + %endif + + * Context-local variables on expansion as a last resort are looked + up in outer contexts. For example, the following piece: + + %push outer + %define %$a [esp] + + %push inner + %$a + %pop + %pop + + will expand correctly the fourth line to [esp]; if we'll define +another %$a inside the "inner" context, it will take precedence over +outer definition. However, this modification has been applied only to +expand_smacro and not to smacro_define: as a consequence expansion +looks in outer contexts, but `%ifdef' won't look in outer contexts. + + This behaviour is needed because we don't want nested contexts to +act on already defined local macros. Example: + + %define %$arg1 [esp+4] + test eax,eax + if nz + mov eax,%$arg1 + endif + + In this example the "if" mmacro enters into the "if" context, so +%$arg1 is not valid anymore inside "if". Of course it could be worked +around by using explicitely %$$arg1 but this is ugly IMHO. + + * Fixed memory leak in `%undef'. The origline wasn't freed before + exiting on success. + + * Fixed trap in preprocessor when line expanded to empty set of + tokens. This happens, for example, in the following case: + + #define SOMETHING + SOMETHING + + +File: nasm.info, Node: Section C.2.41, Next: Section C.2.42, Prev: Section C.2.40, Up: Section C.2 + +C.2.41. Version 0.98 +-------------------- + +All changes since NASM 0.98p3 have been produced by H. Peter Anvin +<hpa@zytor.com>. + + * The documentation comment delimiter is + + * Allow EQU definitions to refer to external labels; reported by + Pedro Gimeno. + + * Re-enable support for RDOFF v1; reported by Pedro Gimeno. + + * Updated License file per OK from Simon and Julian. + + +File: nasm.info, Node: Section C.2.42, Next: Section C.2.43, Prev: Section C.2.41, Up: Section C.2 + +C.2.42. Version 0.98p9 +---------------------- + + * Update documentation (although the instruction set reference will + have to wait; I don't want to hold up the 0.98 release for it.) + + * Verified that the NASM implementation of the PEXTRW and PMOVMSKB + instructions is correct. The encoding differs from what the Intel + manuals document, but the Pentium III behaviour matches NASM, not + the Intel manuals. + + * Fix handling of implicit sizes in PSHUFW and PINSRW, reported by + Stefan Hoffmeister. + + * Resurrect the -s option, which was removed when changing the + diagnostic output to stdout. + + +File: nasm.info, Node: Section C.2.43, Next: Section C.2.44, Prev: Section C.2.42, Up: Section C.2 + +C.2.43. Version 0.98p8 +---------------------- + + * Fix for "DB" when NASM is running on a bigendian machine. + + * Invoke insns.pl once for each output script, making Makefile.in + legal for "make -j". + + * Improve the Unix configure-based makefiles to make package + creation easier. + + * Included an RPM .spec file for building RPM (RedHat Package + Manager) packages on Linux or Unix systems. + + * Fix Makefile dependency problems. + + * Change src/rdsrc.pl to include sectioning information in info + output; required for install-info to work. + + * Updated the RDOFF distribution to version 2 from Jules; minor + massaging to make it compile in my environment. + + * Split doc files that can be built by anyone with a Perl + interpreter off into a separate archive. + + * "Dress rehearsal" release! + + +File: nasm.info, Node: Section C.2.44, Next: Section C.2.45, Prev: Section C.2.43, Up: Section C.2 + +C.2.44. Version 0.98p7 +---------------------- + + * Fixed opcodes with a third byte-sized immediate argument to not + complain if given "byte" on the immediate. + + * Allow `%undef' to remove single-line macros with arguments. This + matches the behaviour of #undef in the C preprocessor. + + * Allow -d, -u, -i and -p to be specified as -D, -U, -I and -P for + compatibility with most C compilers and preprocessors. This allows + Makefile options to be shared between cc and nasm, for example. + + * Minor cleanups. + + * Went through the list of Katmai instructions and hopefully fixed + the (rather few) mistakes in it. + + * (Hopefully) fixed a number of disassembler bugs related to + ambiguous instructions (disambiguated by -p) and SSE instructions + with REP. + + * Fix for bug reported by Mark Junger: "call dword 0x12345678" + should work and may add an OSP (affected CALL, JMP, Jcc). + + * Fix for environments when "stderr" isn't a compile-time constant. + + +File: nasm.info, Node: Section C.2.45, Next: Section C.2.46, Prev: Section C.2.44, Up: Section C.2 + +C.2.45. Version 0.98p6 +---------------------- + + * Took officially over coordination of the 0.98 release; so drop the + p3.x notation. Skipped p4 and p5 to avoid confusion with John + Fine's J4 and J5 releases. + + * Update the documentation; however, it still doesn't include + documentation for the various new instructions. I somehow wonder + if it makes sense to have an instruction set reference in the + assembler manual when Intel et al have PDF versions of their + manuals online. + + * Recognize "idt" or "centaur" for the -p option to ndisasm. + + * Changed error messages back to stderr where they belong, but add + an -E option to redirect them elsewhere (the DOS shell cannot + redirect stderr.) + + * -M option to generate Makefile dependencies (based on code from + Alex Verstak.) + + * `%undef' preprocessor directive, and -u option, that undefines a + single-line macro. + + * OS/2 Makefile (Mkfiles/Makefile.os2) for Borland under OS/2; from + Chuck Crayne. + + * Various minor bugfixes (reported by): - Dangling `%s' in preproc.c + (Martin Junker) + + * THERE ARE KNOWN BUGS IN SSE AND THE OTHER KATMAI INSTRUCTIONS. I + am on a trip and didn't bring the Katmai instruction reference, so + I can't work on them right now. + + * Updated the License file per agreement with Simon and Jules to + include a GPL distribution clause. + + +File: nasm.info, Node: Section C.2.46, Next: Section C.2.47, Prev: Section C.2.45, Up: Section C.2 + +C.2.46. Version 0.98p3.7 +------------------------ + + * (Hopefully) fixed the canned Makefiles to include the outrdf2 and + zoutieee modules. + + * Renamed changes.asm to changed.asm. + + +File: nasm.info, Node: Section C.2.47, Next: Section C.2.48, Prev: Section C.2.46, Up: Section C.2 + +C.2.47. Version 0.98p3.6 +------------------------ + + * Fixed a bunch of instructions that were added in 0.98p3.5 which + had memory operands, and the address-size prefix was missing from + the instruction pattern. + + +File: nasm.info, Node: Section C.2.48, Next: Section C.2.49, Prev: Section C.2.47, Up: Section C.2 + +C.2.48. Version 0.98p3.5 +------------------------ + + * Merged in changes from John S. Fine's 0.98-J5 release. John's + based 0.98-J5 on my 0.98p3.3 release; this merges the changes. + + * Expanded the instructions flag field to a long so we can fit more + flags; mark SSE (KNI) and AMD or Katmai-specific instructions as + such. + + * Fix the "PRIV" flag on a bunch of instructions, and create new + "PROT" flag for protected-mode-only instructions (orthogonal to if + the instruction is privileged!) and new "SMM" flag for SMM-only + instructions. + + * Added AMD-only SYSCALL and SYSRET instructions. + + * Make SSE actually work, and add new Katmai MMX instructions. + + * Added a -p (preferred vendor) option to ndisasm so that it can + distinguish e.g. Cyrix opcodes also used in SSE. For example: + + ndisasm -p cyrix aliased.bin + 00000000 670F514310 paddsiw mm0,[ebx+0x10] + 00000005 670F514320 paddsiw mm0,[ebx+0x20] + ndisasm -p intel aliased.bin + 00000000 670F514310 sqrtps xmm0,[ebx+0x10] + 00000005 670F514320 sqrtps xmm0,[ebx+0x20] + + * Added a bunch of Cyrix-specific instructions. + + +File: nasm.info, Node: Section C.2.49, Next: Section C.2.50, Prev: Section C.2.48, Up: Section C.2 + +C.2.49. Version 0.98p3.4 +------------------------ + + * Made at least an attempt to modify all the additional Makefiles + (in the Mkfiles directory). I can't test it, but this was the best + I could do. + + * DOS DJGPP+"Opus Make" Makefile from John S. Fine. + + * changes.asm changes from John S. Fine. + + +File: nasm.info, Node: Section C.2.50, Next: Section C.2.51, Prev: Section C.2.49, Up: Section C.2 + +C.2.50. Version 0.98p3.3 +------------------------ + + * Patch from Conan Brink to allow nesting of `%rep' directives. + + * If we're going to allow INT01 as an alias for INT1/ICEBP (one of + Jules 0.98p3 changes), then we should allow INT03 as an alias for + INT3 as well. + + * Updated changes.asm to include the latest changes. + + * Tried to clean up the <CR>s that had snuck in from a DOS/Windows + environment into my Unix environment, and try to make sure than + DOS/Windows users get them back. + + * We would silently generate broken tools if insns.dat wasn't sorted + properly. Change insns.pl so that the order doesn't matter. + + * Fix bug in insns.pl (introduced by me) which would cause + conditional instructions to have an extra "cc" in disassembly, + e.g. "jnz" disassembled as "jccnz". + + +File: nasm.info, Node: Section C.2.51, Next: Section C.2.52, Prev: Section C.2.50, Up: Section C.2 + +C.2.51. Version 0.98p3.2 +------------------------ + + * Merged in John S. Fine's changes from his 0.98-J4 prerelease; see + http://www.csoft.net/cz/johnfine/ + + * Changed previous "spotless" Makefile target (appropriate for + distribution) to "distclean", and added "cleaner" target which is + same as "clean" except deletes files generated by Perl scripts; + "spotless" is union. + + * Removed BASIC programs from distribution. Get a Perl interpreter + instead (see below.) + + * Calling this "pre-release 3.2" rather than "p3-hpa2" because of + John's contributions. + + * Actually link in the IEEE output format (zoutieee.c); fix a bunch + of compiler warnings in that file. Note I don't know what IEEE + output is supposed to look like, so these changes were made + "blind". + + +File: nasm.info, Node: Section C.2.52, Next: Section C.2.53, Prev: Section C.2.51, Up: Section C.2 + +C.2.52. Version 0.98p3-hpa +-------------------------- + + * Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully + buildable version for Unix systems (Makefile.in updates, etc.) + + * Changed insns.pl to create the instruction tables in nasm.h and + names.c, so that a new instruction can be added by adding it + *only* to insns.dat. + + * Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE, + FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel + guarantee will never be used; one of them is documented as UD2 in + Intel documentation, the other one just as "Undefined Opcode" --- + calling it UD1 seemed to make sense.) + + * MAX_SYMBOL was defined to be 9, but LOADALL286 and LOADALL386 are + 10 characters long. Now MAX_SYMBOL is derived from insns.dat. + + * A note on the BASIC programs included: forget them. insns.bas is + already out of date. Get yourself a Perl interpreter for your + platform of choice at http://www.cpan.org/ports/index.html. + + +File: nasm.info, Node: Section C.2.53, Next: Section C.2.54, Prev: Section C.2.52, Up: Section C.2 + +C.2.53. Version 0.98 pre-release 3 +---------------------------------- + + * added response file support, improved command line handling, new + layout help screen + + * fixed limit checking bug, 'OUT byte nn, reg' bug, and a couple of + rdoff related bugs, updated Wishlist; 0.98 Prerelease 3. + + +File: nasm.info, Node: Section C.2.54, Next: Section C.2.55, Prev: Section C.2.53, Up: Section C.2 + +C.2.54. Version 0.98 pre-release 2 +---------------------------------- + + * fixed bug in outcoff.c to do with truncating section names longer + than 8 characters, referencing beyond end of string; 0.98 + pre-release 2 + + +File: nasm.info, Node: Section C.2.55, Next: Section C.3, Prev: Section C.2.54, Up: Section C.2 + +C.2.55. Version 0.98 pre-release 1 +---------------------------------- + + * Fixed a bug whereby STRUC didn't work at all in RDF. + + * Fixed a problem with group specification in PUBDEFs in OBJ. + + * Improved ease of adding new output formats. Contribution due to + Fox Cutter. + + * Fixed a bug in relocations in the `bin' format: was showing up + when a relocatable reference crossed an 8192-byte boundary in any + output section. + + * Fixed a bug in local labels: local-label lookups were inconsistent + between passes one and two if an EQU occurred between the + definition of a global label and the subsequent use of a local + label local to that global. + + * Fixed a seg-fault in the preprocessor (again) which happened when + you use a blank line as the first line of a multi-line macro + definition and then defined a label on the same line as a call to + that macro. + + * Fixed a stale-pointer bug in the handling of the NASM environment + variable. Thanks to Thomas McWilliams. + + * ELF had a hard limit on the number of sections which caused + segfaults when transgressed. Fixed. + + * Added ability for ndisasm to read from stdin by using `-' as the + filename. + + * ndisasm wasn't outputting the TO keyword. Fixed. + + * Fixed error cascade on bogus expression in `%if' - an error in + evaluation was causing the entire `%if' to be discarded, thus + creating trouble later when the `%else' or `%endif' was + encountered. + + * Forward reference tracking was instruction-granular not operand- + granular, which was causing 286-specific code to be generated + needlessly on code of the form `shr word [forwardref],1'. Thanks + to Jim Hague for sending a patch. + + * All messages now appear on stdout, as sending them to stderr + serves no useful purpose other than to make redirection difficult. + + * Fixed the problem with EQUs pointing to an external symbol - this + now generates an error message. + + * Allowed multiple size prefixes to an operand, of which only the + first is taken into account. + + * Incorporated John Fine's changes, including fixes of a large + number of preprocessor bugs, some small problems in OBJ, and a + reworking of label handling to define labels before their line is + assembled, rather than after. + + * Reformatted a lot of the source code to be more readable. Included + 'coding.txt' as a guideline for how to format code for + contributors. + + * Stopped nested `%reps' causing a panic - they now cause a slightly + more friendly error message instead. + + * Fixed floating point constant problems (patch by Pedro Gimeno) + + * Fixed the return value of insn_size() not being checked for -1, + indicating an error. + + * Incorporated 3Dnow! instructions. + + * Fixed the 'mov eax, eax + ebx' bug. + + * Fixed the GLOBAL EQU bug in ELF. Released developers release 3. + + * Incorporated John Fine's command line parsing changes + + * Incorporated David Lindauer's OMF debug support + + * Made changes for LCC 4.0 support (`__NASM_CDecl__', removed + register size specification warning when sizes agree). + + +File: nasm.info, Node: Section C.3, Next: Section C.3.1, Prev: Section C.2.55, Up: Appendix C + +C.3. NASM 0.9 Series +==================== + +Revisions before 0.98. + +* Menu: + +* Section C.3.1:: Version 0.97 released December 1997 +* Section C.3.2:: Version 0.96 released November 1997 +* Section C.3.3:: Version 0.95 released July 1997 +* Section C.3.4:: Version 0.94 released April 1997 +* Section C.3.5:: Version 0.93 released January 1997 +* Section C.3.6:: Version 0.92 released January 1997 +* Section C.3.7:: Version 0.91 released November 1996 +* Section C.3.8:: Version 0.90 released October 1996 + + +File: nasm.info, Node: Section C.3.1, Next: Section C.3.2, Prev: Section C.3, Up: Section C.3 + +C.3.1. Version 0.97 released December 1997 +------------------------------------------ + + * This was entirely a bug-fix release to 0.96, which seems to have + got cursed. Silly me. + + * Fixed stupid mistake in OBJ which caused `MOV EAX,<constant>' to + fail. Caused by an error in the `MOV EAX,<segment>' support. + + * ndisasm hung at EOF when compiled with lcc on Linux because lcc on + Linux somehow breaks feof(). ndisasm now does not rely on feof(). + + * A heading in the documentation was missing due to a markup error + in the indexing. Fixed. + + * Fixed failure to update all pointers on realloc() within extended- + operand code in parser.c. Was causing wrong behaviour and seg + faults on lines such as `dd 0.0,0.0,0.0,0.0,...' + + * Fixed a subtle preprocessor bug whereby invoking one multi-line + macro on the first line of the expansion of another, when the + second had been invoked with a label defined before it, didn't + expand the inner macro. + + * Added internal.doc back in to the distribution archives - it was + missing in 0.96 *blush* + + * Fixed bug causing 0.96 to be unable to assemble its own test files, + specifically objtest.asm. *blush again* + + * Fixed seg-faults and bogus error messages caused by mismatching + `%rep' and `%endrep' within multi-line macro definitions. + + * Fixed a problem with buffer overrun in OBJ, which was causing + corruption at ends of long PUBDEF records. + + * Separated DOS archives into main-program and documentation to + reduce download size. + + +File: nasm.info, Node: Section C.3.2, Next: Section C.3.3, Prev: Section C.3.1, Up: Section C.3 + +C.3.2. Version 0.96 released November 1997 +------------------------------------------ + + * Fixed a bug whereby, if `nasm sourcefile' would cause a filename + collision warning and put output into `nasm.out', then `nasm + sourcefile -o outputfile' still gave the warning even though the + `-o' was honoured. Fixed name pollution under Digital UNIX: one of + its header files defined R_SP, which broke the enum in nasm.h. + + * Fixed minor instruction table problems: FUCOM and FUCOMP didn't + have two- operand forms; NDISASM didn't recognise the longer + register forms of PUSH and POP (eg FF F3 for PUSH BX); TEST + mem,imm32 was flagged as undocumented; the 32-bit forms of CMOV + had 16-bit operand size prefixes; `AAD imm' and `AAM imm' are no + longer flagged as undocumented because the Intel Architecture + reference documents them. + + * Fixed a problem with the local-label mechanism, whereby strange + types of symbol (EQUs, auto-defined OBJ segment base symbols) + interfered with the `previous global label' value and screwed up + local labels. + + * Fixed a bug whereby the stub preprocessor didn't communicate with + the listing file generator, so that the -a and -l options in + conjunction would produce a useless listing file. + + * Merged `os2' object file format back into `obj', after discovering + that `obj' _also_ shouldn't have a link pass separator in a module + containing a non-trivial MODEND. Flat segments are now declared + using the FLAT attribute. `os2' is no longer a valid object format + name: use `obj'. + + * Removed the fixed-size temporary storage in the evaluator. Very + very long expressions (like `mov ax,1+1+1+1+...' for two hundred + 1s or so) should now no longer crash NASM. + + * Fixed a bug involving segfaults on disassembly of MMX + instructions, by changing the meaning of one of the operand-type + flags in nasm.h. This may cause other apparently unrelated MMX + problems; it needs to be tested thoroughly. + + * Fixed some buffer overrun problems with large OBJ output files. + Thanks to DJ Delorie for the bug report and fix. + + * Made preprocess-only mode actually listen to the `%line' markers + as it prints them, so that it can report errors more sanely. + + * Re-designed the evaluator to keep more sensible track of + expressions involving forward references: can now cope with + previously-nightmare situations such as: + + mov ax,foo | bar + foo equ 1 + bar equ 2 + + * Added the ALIGN and ALIGNB standard macros. + + * Added PIC support in ELF: use of WRT to obtain the four extra + relocation types needed. + + * Added the ability for output file formats to define their own + extensions to the GLOBAL, COMMON and EXTERN directives. + + * Implemented common-variable alignment, and global-symbol type and + size declarations, in ELF. + + * Implemented NEAR and FAR keywords for common variables, plus + far-common element size specification, in OBJ. + + * Added a feature whereby EXTERNs and COMMONs in OBJ can be given a + default WRT specification (either a segment or a group). + + * Transformed the Unix NASM archive into an auto-configuring package. + + * Added a sanity-check for people applying SEG to things which are + already segment bases: this previously went unnoticed by the SEG + processing and caused OBJ-driver panics later. + + * Added the ability, in OBJ format, to deal with `MOV EAX,<segment>' + type references: OBJ doesn't directly support dword-size segment + base fixups, but as long as the low two bytes of the constant term + are zero, a word-size fixup can be generated instead and it will + work. + + * Added the ability to specify sections' alignment requirements in + Win32 object files and pure binary files. + + * Added preprocess-time expression evaluation: the `%assign' (and + `%iassign') directive and the bare `%if' (and `%elif') + conditional. Added relational operators to the evaluator, for use + only in `%if' constructs: the standard relationals = < > <= >= <> + (and C-like synonyms == and !=) plus low-precedence logical + operators &&, ^^ and ||. + + * Added a preprocessor repeat construct: `%rep' / `%exitrep' / + `%endrep'. + + * Added the __FILE__ and __LINE__ standard macros. + + * Added a sanity check for number constants being greater than + 0xFFFFFFFF. The warning can be disabled. + + * Added the %0 token whereby a variadic multi-line macro can tell + how many parameters it's been given in a specific invocation. + + * Added `%rotate', allowing multi-line macro parameters to be cycled. + + * Added the `*' option for the maximum parameter count on multi-line + macros, allowing them to take arbitrarily many parameters. + + * Added the ability for the user-level forms of EXTERN, GLOBAL and + COMMON to take more than one argument. + + * Added the IMPORT and EXPORT directives in OBJ format, to deal with + Windows DLLs. + + * Added some more preprocessor `%if' constructs: `%ifidn' / + `%ifidni' (exact textual identity), and `%ifid' / `%ifnum' / + `%ifstr' (token type testing). + + * Added the ability to distinguish SHL AX,1 (the 8086 version) from + SHL AX,BYTE 1 (the 286-and-upwards version whose constant happens + to be 1). + + * Added NetBSD/FreeBSD/OpenBSD's variant of a.out format, complete + with PIC shared library features. + + * Changed NASM's idiosyncratic handling of FCLEX, FDISI, FENI, + FINIT, FSAVE, FSTCW, FSTENV, and FSTSW to bring it into line with + the otherwise accepted standard. The previous behaviour, though it + was a deliberate feature, was a deliberate feature based on a + misunderstanding. Apologies for the inconvenience. + + * Improved the flexibility of ABSOLUTE: you can now give it an + expression rather than being restricted to a constant, and it can + take relocatable arguments as well. + + * Added the ability for a variable to be declared as EXTERN multiple + times, and the subsequent definitions are just ignored. + + * We now allow instruction prefixes (CS, DS, LOCK, REPZ etc) to be + alone on a line (without a following instruction). + + * Improved sanity checks on whether the arguments to EXTERN, GLOBAL + and COMMON are valid identifiers. + + * Added misc/exebin.mac to allow direct generation of .EXE files by + hacking up an EXE header using DB and DW; also added + test/binexe.asm to demonstrate the use of this. Thanks to Yann + Guidon for contributing the EXE header code. + + * ndisasm forgot to check whether the input file had been + successfully opened. Now it does. Doh! + + * Added the Cyrix extensions to the MMX instruction set. + + * Added a hinting mechanism to allow [EAX+EBX] and [EBX+EAX] to be + assembled differently. This is important since [ESI+EBP] and + [EBP+ESI] have different default base segment registers. + + * Added support for the PharLap OMF extension for 4096-byte segment + alignment. + diff --git a/doc/info/nasm.info-3 b/doc/info/nasm.info-3 new file mode 100644 index 0000000..f70d131 --- /dev/null +++ b/doc/info/nasm.info-3 @@ -0,0 +1,1284 @@ +This is nasm.info, produced by makeinfo version 4.13 from nasmdoc.texi. + +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* NASM: (nasm). The Netwide Assembler for x86. +END-INFO-DIR-ENTRY + + This file documents NASM, the Netwide Assembler: an assembler +targetting the Intel x86 series of processors, with portable source. + + Copyright 1996-2009 The NASM Development Team + + This document is redistributable under the license given in the file +"COPYING" distributed in the NASM archive. + + +File: nasm.info, Node: Section C.3.3, Next: Section C.3.4, Prev: Section C.3.2, Up: Section C.3 + +C.3.3. Version 0.95 released July 1997 +-------------------------------------- + + * Fixed yet another ELF bug. This one manifested if the user relied + on the default segment, and attempted to define global symbols + without first explicitly declaring the target segment. + + * Added makefiles (for NASM and the RDF tools) to build Win32 + console apps under Symantec C++. Donated by Mark Junker. + + * Added `macros.bas' and `insns.bas', QBasic versions of the Perl + scripts that convert `standard.mac' to `macros.c' and convert + `insns.dat' to `insnsa.c' and `insnsd.c'. Also thanks to Mark + Junker. + + * Changed the diassembled forms of the conditional instructions so + that JB is now emitted as JC, and other similar changes. Suggested + list by Ulrich Doewich. + + * Added `@' to the list of valid characters to begin an identifier + with. + + * Documentary changes, notably the addition of the `Common Problems' + section in nasm.doc. + + * Fixed a bug relating to 32-bit PC-relative fixups in OBJ. + + * Fixed a bug in perm_copy() in labels.c which was causing + exceptions in cleanup_labels() on some systems. + + * Positivity sanity check in TIMES argument changed from a warning + to an error following a further complaint. + + * Changed the acceptable limits on byte and word operands to allow + things like `~10111001b' to work. + + * Fixed a major problem in the preprocessor which caused seg-faults + if macro definitions contained blank lines or comment-only lines. + + * Fixed inadequate error checking on the commas separating the + arguments to `db', `dw' etc. + + * Fixed a crippling bug in the handling of macros with operand + counts defined with a `+' modifier. + + * Fixed a bug whereby object file formats which stored the input + file name in the output file (such as OBJ and COFF) weren't doing + so correctly when the output file name was specified on the + command line. + + * Removed [INC] and [INCLUDE] support for good, since they were + obsolete anyway. + + * Fixed a bug in OBJ which caused all fixups to be output in 16-bit + (old- format) FIXUPP records, rather than putting the 32-bit ones + in FIXUPP32 (new-format) records. + + * Added, tentatively, OS/2 object file support (as a minor variant + on OBJ). + + * Updates to Fox Cutter's Borland C makefile, Makefile.bc2. + + * Removed a spurious second fclose() on the output file. + + * Added the `-s' command line option to redirect all messages which + would go to stderr (errors, help text) to stdout instead. + + * Added the `-w' command line option to selectively suppress some + classes of assembly warning messages. + + * Added the `-p' pre-include and `-d' pre-define command-line + options. + + * Added an include file search path: the `-i' command line option. + + * Fixed a silly little preprocessor bug whereby starting a line with + a `%!' environment-variable reference caused an `unknown + directive' error. + + * Added the long-awaited listing file support: the `-l' command line + option. + + * Fixed a problem with OBJ format whereby, in the absence of any + explicit segment definition, non-global symbols declared in the + implicit default segment generated spurious EXTDEF records in the + output. + + * Added the NASM environment variable. + + * From this version forward, Win32 console-mode binaries will be + included in the DOS distribution in addition to the 16-bit + binaries. Added Makefile.vc for this purpose. + + * Added `return 0;' to test/objlink.c to prevent compiler warnings. + + * Added the __NASM_MAJOR__ and __NASM_MINOR__ standard defines. + + * Added an alternative memory-reference syntax in which prefixing an + operand with `&' is equivalent to enclosing it in square brackets, + at the request of Fox Cutter. + + * Errors in pass two now cause the program to return a non-zero + error code, which they didn't before. + + * Fixed the single-line macro cycle detection, which didn't work at + all on macros with no parameters (caused an infinite loop). Also + changed the behaviour of single-line macro cycle detection to work + like cpp, so that macros like `extrn' as given in the + documentation can be implemented. + + * Fixed the implementation of WRT, which was too restrictive in that + you couldn't do `mov ax,[di+abc wrt dgroup]' because (di+abc) + wasn't a relocatable reference. + + +File: nasm.info, Node: Section C.3.4, Next: Section C.3.5, Prev: Section C.3.3, Up: Section C.3 + +C.3.4. Version 0.94 released April 1997 +--------------------------------------- + + * Major item: added the macro processor. + + * Added undocumented instructions SMI, IBTS, XBTS and LOADALL286. + Also reorganised CMPXCHG instruction into early-486 and Pentium + forms. Thanks to Thobias Jones for the information. + + * Fixed two more stupid bugs in ELF, which were causing `ld' to + continue to seg-fault in a lot of non-trivial cases. + + * Fixed a seg-fault in the label manager. + + * Stopped FBLD and FBSTP from _requiring_ the TWORD keyword, which + is the only option for BCD loads/stores in any case. + + * Ensured FLDCW, FSTCW and FSTSW can cope with the WORD keyword, if + anyone bothers to provide it. Previously they complained unless no + keyword at all was present. + + * Some forms of FDIV/FDIVR and FSUB/FSUBR were still inverted: a + vestige of a bug that I thought had been fixed in 0.92. This was + fixed, hopefully for good this time... + + * Another minor phase error (insofar as a phase error can _ever_ be + minor) fixed, this one occurring in code of the form + + rol ax,forward_reference + forward_reference equ 1 + + * The number supplied to TIMES is now sanity-checked for positivity, + and also may be greater than 64K (which previously didn't work on + 16-bit systems). + + * Added Watcom C makefiles, and misc/pmw.bat, donated by Dominik + Behr. + + * Added the INCBIN pseudo-opcode. + + * Due to the advent of the preprocessor, the [INCLUDE] and [INC] + directives have become obsolete. They are still supported in this + version, with a warning, but won't be in the next. + + * Fixed a bug in OBJ format, which caused incorrect object records + to be output when absolute labels were made global. + + * Updates to RDOFF subdirectory, and changes to outrdf.c. + + +File: nasm.info, Node: Section C.3.5, Next: Section C.3.6, Prev: Section C.3.4, Up: Section C.3 + +C.3.5. Version 0.93 released January 1997 +----------------------------------------- + +This release went out in a great hurry after semi-crippling bugs were +found in 0.92. + + * Really _did_ fix the stack overflows this time. *blush* + + * Had problems with EA instruction sizes changing between passes, + when an offset contained a forward reference and so 4 bytes were + allocated for the offset in pass one; by pass two the symbol had + been defined and happened to be a small absolute value, so only 1 + byte got allocated, causing instruction size mismatch between + passes and hence incorrect address calculations. Fixed. + + * Stupid bug in the revised ELF section generation fixed (associated + string- table section for .symtab was hard-coded as 7, even when + this didn't fit with the real section table). Was causing `ld' to + seg-fault under Linux. + + * Included a new Borland C makefile, Makefile.bc2, donated by Fox + Cutter <lmb@comtch.iea.com>. + + +File: nasm.info, Node: Section C.3.6, Next: Section C.3.7, Prev: Section C.3.5, Up: Section C.3 + +C.3.6. Version 0.92 released January 1997 +----------------------------------------- + + * The FDIVP/FDIVRP and FSUBP/FSUBRP pairs had been inverted: this + was fixed. This also affected the LCC driver. + + * Fixed a bug regarding 32-bit effective addresses of the form + `[other_register+ESP]'. + + * Documentary changes, notably documentation of the fact that + Borland Win32 compilers use `obj' rather than `win32' object + format. + + * Fixed the COMENT record in OBJ files, which was formatted + incorrectly. + + * Fixed a bug causing segfaults in large RDF files. + + * OBJ format now strips initial periods from segment and group + definitions, in order to avoid complications with the local label + syntax. + + * Fixed a bug in disassembling far calls and jumps in NDISASM. + + * Added support for user-defined sections in COFF and ELF files. + + * Compiled the DOS binaries with a sensible amount of stack, to + prevent stack overflows on any arithmetic expression containing + parentheses. + + * Fixed a bug in handling of files that do not terminate in a + newline. + + +File: nasm.info, Node: Section C.3.7, Next: Section C.3.8, Prev: Section C.3.6, Up: Section C.3 + +C.3.7. Version 0.91 released November 1996 +------------------------------------------ + + * Loads of bug fixes. + + * Support for RDF added. + + * Support for DBG debugging format added. + + * Support for 32-bit extensions to Microsoft OBJ format added. + + * Revised for Borland C: some variable names changed, makefile added. + + * LCC support revised to actually work. + + * JMP/CALL NEAR/FAR notation added. + + * `a16', `o16', `a32' and `o32' prefixes added. + + * Range checking on short jumps implemented. + + * MMX instruction support added. + + * Negative floating point constant support added. + + * Memory handling improved to bypass 64K barrier under DOS. + + * `$' prefix to force treatment of reserved words as identifiers + added. + + * Default-size mechanism for object formats added. + + * Compile-time configurability added. + + * `#', `@', `~' and c{?} are now valid characters in labels. + + * `-e' and `-k' options in NDISASM added. + + +File: nasm.info, Node: Section C.3.8, Prev: Section C.3.7, Up: Section C.3 + +C.3.8. Version 0.90 released October 1996 +----------------------------------------- + +First release version. First support for object file output. Other +changes from previous version (0.3x) too numerous to document. + + +File: nasm.info, Node: Index, Up: Top + +Index +***** + +* Menu: + +* `!' operator, unary (1): Section 3.5.7. +* `!=' operator (1): Section 4.4.4. +* `$$' token (1): Section 3.5. +* `$$' token (2): Section 7.9.3. +* `$', Here token (1): Section 3.5. +* `$', prefix (1): Section 3.1. +* `$', prefix (2): Section 3.4.1. +* `$', prefix (3): Section 7.13.2. +* `%' operator (1): Section 3.5.6. +* `%!' (1): Section 4.10.2. +* `%$' and `%$$' prefixes (1): Section 4.7.2. +* `%%' operator (1): Section 3.5.6. +* `%%' operator (2): Section 4.3.3. +* `%+' (1): Section 4.1.4. +* `%?' (1): Section 4.1.5. +* `%??' (1): Section 4.1.5. +* `%[' (1): Section 4.1.3. +* `&' operator (1): Section 3.5.3. +* `&&' operator (1): Section 4.4.4. +* `*' operator (1): Section 3.5.6. +* `+' modifier (1): Section 4.3.4. +* `+' operator, binary (1): Section 3.5.5. +* `+' operator, unary (1): Section 3.5.7. +* `-' operator, binary (1): Section 3.5.5. +* `-' operator, unary (1): Section 3.5.7. +* `..@' symbol prefix (1): Section 3.9. +* `..@' symbol prefix (2): Section 4.3.3. +* `/' operator (1): Section 3.5.6. +* `//' operator (1): Section 3.5.6. +* `<' operator (1): Section 4.4.4. +* `<<' operator (1): Section 3.5.4. +* `<=' operator (1): Section 4.4.4. +* `<>' operator (1): Section 4.4.4. +* `=' operator (1): Section 4.4.4. +* `==' operator (1): Section 4.4.4. +* `>' operator (1): Section 4.4.4. +* `>=' operator (1): Section 4.4.4. +* `>>' operator (1): Section 3.5.4. +* `?' MASM syntax (1): Section 3.2.2. +* `^' operator (1): Section 3.5.2. +* `^^' operator (1): Section 4.4.4. +* `|' operator (1): Section 3.5.1. +* `||' operator (1): Section 4.4.4. +* `~' operator (1): Section 3.5.7. +* `%0' parameter count (1): Section 4.3.5. +* `%0' parameter count (2): Section 4.3.6. +* `%+1' and `%-1' syntax (1): Section 4.3.9. +* 16-bit mode, versus 32-bit mode (1): Section 6.1. +* 64-bit displacement (1): Section 11.2. +* 64-bit immediate (1): Section 11.2. +* `-a' option (1): Section 2.1.21. +* `-a' option (2): Section A.3.3. +* `A16' (1): Section 3.1. +* `a16' (1): Section 10.3. +* `A32' (1): Section 3.1. +* `a32' (1): Section 10.3. +* `A64' (1): Section 3.1. +* `a64' (1): Section 10.3. +* `a86' (1): Section 1.1.1. +* `a86' (2): Section 2.2. +* `a86' (3): Section 2.2.2. +* `a86' (4): Section 2.2.6. +* `ABS' (1): Section 3.3. +* `ABSOLUTE' (1): Section 6.4. +* `ABSOLUTE' (2): Section 7.4.1. +* addition (1): Section 3.5.5. +* addressing, mixed-size (1): Section 10.2. +* address-size prefixes (1): Section 3.1. +* algebra (1): Section 3.3. +* `ALIGN' (1): Section 4.11.12. +* `ALIGN' (2): Section 5.2. +* `ALIGN' (3): Section 7.1.2. +* `ALIGN' (4): Section 7.4.1. +* `ALIGN', smart (1): Section 5.2. +* `ALIGNB' (1): Section 4.11.12. +* alignment, in `bin' sections (1): Section 7.1.2. +* alignment, in `elf' sections (1): Section 7.9.2. +* alignment, in `obj' sections (1): Section 7.4.1. +* alignment, in `win32' sections (1): Section 7.5.1. +* alignment, of `elf' common variables (1): Section 7.9.6. +* `ALIGNMODE' (1): Section 5.2. +* `__ALIGNMODE__' (1): Section 5.2. +* `ALINK' (1): Section 8.1.1. +* `alink.sourceforge.net' (1): Section 8.1.1. +* `all' (1): Section 2.1.24. +* `alloc' (1): Section 7.9.2. +* alternate register names (1): Section 5.1. +* `alt.lang.asm' (1): Section 1.1.1. +* `altreg' (1): Section 5.1. +* ambiguity (1): Section 2.2.3. +* `a.out', BSD version (1): Section 7.11. +* `a.out', Linux version (1): Section 7.10. +* `aout' (1): Section 7.10. +* `aoutb' (1): Section 7.11. +* `aoutb' (2): Section 9.2. +* `%arg' (1): Section 4.8.1. +* `arg' (1): Section 8.4.5. +* `arg' (2): Section 9.1.4. +* `as86' (1): Section 1.1.1. +* `as86' (2): Section 7.12. +* assembler directives (1): Chapter 6. +* assembly-time options (1): Section 2.1.18. +* `%assign' (1): Section 4.1.7. +* `ASSUME' (1): Section 2.2.4. +* `AT' (1): Section 4.11.11. +* Autoconf (1): Section 1.3.2. +* `autoexec.bat' (1): Section 1.3.1. +* `auto-sync' (1): Section A.3.3. +* `-b' (1): Section A.3. +* bin (1): Section 2.1.2. +* bin (2): Section 7.1. +* bin, multisection (1): Section 7.1.3. +* binary (1): Section 3.4.1. +* binary files (1): Section 3.2.3. +* bit shift (1): Section 3.5.4. +* `BITS' (1): Section 6.1. +* `BITS' (2): Section 7.1. +* `__BITS__' (1): Section 4.11.5. +* bitwise AND (1): Section 3.5.3. +* bitwise OR (1): Section 3.5.1. +* bitwise XOR (1): Section 3.5.2. +* block IFs (1): Section 4.7.5. +* boot loader (1): Section 7.1. +* boot sector (1): Section 12.1.3. +* Borland, Pascal (1): Section 8.5. +* Borland, Win32 compilers (1): Section 7.4. +* braces, after `%' sign (1): Section 4.3.8. +* braces, around macro parameters (1): Section 4.3. +* BSD (1): Section 9.2. +* `.bss' (1): Section 7.9.2. +* `.bss' (2): Section 7.10. +* `.bss' (3): Section 7.11. +* `.bss' (4): Section 7.12. +* `.bss' (5): Section 7.13. +* bugs (1): Section 12.2. +* `bugtracker' (1): Section 12.2. +* `BYTE' (1): Section 12.1.1. +* C calling convention (1): Section 8.4.3. +* C calling convention (2): Section 9.1.2. +* C symbol names (1): Section 8.4.1. +* `c16.mac' (1): Section 8.4.5. +* `c16.mac' (2): Section 8.5.3. +* `c32.mac' (1): Section 9.1.4. +* `CALL FAR' (1): Section 3.6. +* case sensitivity (1): Section 2.2.1. +* case sensitivity (2): Section 4.1.1. +* case sensitivity (3): Section 4.1.2. +* case sensitivity (4): Section 4.1.7. +* case sensitivity (5): Section 4.3. +* case sensitivity (6): Section 4.3.1. +* case sensitivity (7): Section 4.4.5. +* case sensitivity (8): Section 7.4.3. +* changing sections (1): Section 6.3. +* character constant (1): Section 3.2.1. +* character constant (2): Section 3.4.3. +* character strings (1): Section 3.4.2. +* circular references (1): Section 4.1.1. +* `CLASS' (1): Section 7.4.1. +* `%clear' (1): Section 4.11. +* `coff' (1): Section 7.7. +* colon (1): Section 3.1. +* `.COM' (1): Section 7.1. +* `.COM' (2): Section 8.2. +* command-line (1): Section 2.1. +* command-line (2): Chapter 7. +* commas in macro parameters (1): Section 4.3.4. +* `.comment' (1): Section 7.9.2. +* `COMMON' (1): Section 6.7. +* `COMMON' (2): Section 7.4.1. +* `COMMON', `elf' extensions to (1): Section 7.9.6. +* `COMMON', `obj' extensions to (1): Section 7.4.8. +* Common Object File Format (1): Section 7.7. +* common variables (1): Section 6.7. +* common variables, alignment in `elf' (1): Section 7.9.6. +* common variables, element size (1): Section 7.4.8. +* `comp.lang.asm.x86' (1): Section 1.1.1. +* `comp.lang.asm.x86' (2): Section 1.2. +* `comp.os.msdos.programmer' (1): Section 8.3. +* concatenating macro parameters (1): Section 4.3.8. +* concatenating strings (1): Section 4.2.1. +* condition codes as macro parameters (1): Section 4.3.9. +* conditional assembly (1): Section 4.4. +* conditional jumps (1): Section 12.1.2. +* conditional-return macro (1): Section 4.3.9. +* `configure' (1): Section 1.3.2. +* constants (1): Section 3.4. +* context stack (1): Section 4.7. +* context stack (2): Section 4.7.5. +* context-local labels (1): Section 4.7.2. +* context-local single-line macros (1): Section 4.7.3. +* counting macro parameters (1): Section 4.3.6. +* `CPU' (1): Section 6.8. +* `CPUID' (1): Section 3.4.3. +* creating contexts (1): Section 4.7.1. +* critical expression (1): Section 3.2.2. +* critical expression (2): Section 3.8. +* critical expression (3): Section 4.1.7. +* critical expression (4): Section 6.4. +* `-D' option (1): Section 2.1.18. +* `-d' option (1): Section 2.1.18. +* daily development snapshots (1): Section 1.2. +* `.data' (1): Section 7.9.2. +* `.data' (2): Section 7.10. +* `.data' (3): Section 7.11. +* `.data' (4): Section 7.12. +* `.data' (5): Section 7.13. +* `_DATA' (1): Section 8.4.2. +* `data' (1): Section 7.9.5. +* `data' (2): Section 7.13.3. +* data structure (1): Section 8.4.4. +* data structure (2): Section 9.1.3. +* `__DATE__' (1): Section 4.11.7. +* `__DATE_NUM__' (1): Section 4.11.7. +* `DB' (1): Section 3.2. +* `DB' (2): Section 3.2.1. +* `DB' (3): Section 3.4.4. +* `DB' (4): Section 3.4.6. +* `dbg' (1): Section 7.14. +* `DD' (1): Section 3.2. +* `DD' (2): Section 3.2.1. +* `DD' (3): Section 3.4.4. +* `DD' (4): Section 3.4.6. +* debug information (1): Section 2.1.12. +* debug information format (1): Section 2.1.11. +* declaring structures (1): Section 4.11.10. +* `DEFAULT' (1): Section 6.2. +* `default' (1): Section 7.9.5. +* default macro parameters (1): Section 4.3.5. +* default name (1): Chapter 7. +* default-`WRT' mechanism (1): Section 7.4.7. +* `%define' (1): Section 2.1.18. +* `%define' (2): Section 4.1.1. +* defining sections (1): Section 6.3. +* `%defstr' (1): Section 4.1.8. +* `%deftok' (1): Section 4.1.9. +* `%depend' (1): Section 4.6.3. +* design goals (1): Section 2.2.2. +* DevPac (1): Section 3.2.3. +* DevPac (2): Section 3.9. +* disabling listing expansion (1): Section 4.3.10. +* division (1): Section 3.5.6. +* DJGPP (1): Section 7.7. +* DJGPP (2): Chapter 9. +* `djlink' (1): Section 8.1.1. +* DLL symbols, exporting (1): Section 7.4.5. +* DLL symbols, importing (1): Section 7.4.4. +* `DO' (1): Section 3.2. +* `DO' (2): Section 3.2.1. +* `DO' (3): Section 3.4.4. +* `DO' (4): Section 3.4.6. +* DOS (1): Section 1.3.1. +* DOS (2): Section 2.1.14. +* DOS (3): Section 2.1.15. +* DOS source archive (1): Section 1.3.1. +* `DQ' (1): Section 3.2. +* `DQ' (2): Section 3.2.1. +* `DQ' (3): Section 3.4.4. +* `DQ' (4): Section 3.4.6. +* `.drectve' (1): Section 7.5.1. +* `DT' (1): Section 3.2. +* `DT' (2): Section 3.2.1. +* `DT' (3): Section 3.4.4. +* `DT' (4): Section 3.4.6. +* `DUP' (1): Section 2.2.7. +* `DUP' (2): Section 3.2.5. +* `DW' (1): Section 3.2. +* `DW' (2): Section 3.2.1. +* `DW' (3): Section 3.4.4. +* `DW' (4): Section 3.4.6. +* `DWORD' (1): Section 3.1. +* `DY' (1): Section 3.2. +* `DY' (2): Section 3.2.1. +* `DY' (3): Section 3.4.4. +* `-E' option (1): Section 2.1.20. +* `-e' option (1): Section 2.1.20. +* `-e' option (2): Section A.3.4. +* effective addresses (1): Section 3.1. +* effective addresses (2): Section 3.3. +* element size, in common variables (1): Section 7.4.8. +* ELF (1): Section 7.9. +* ELF, shared libraries (1): Section 7.9.3. +* ELF, 16-bit code and (1): Section 7.9.7. +* elf, debug formats and (1): Section 7.9.8. +* `elf32' (1): Section 7.9. +* `elf64' (1): Section 7.9. +* `%elif' (1): Section 4.4. +* `%elif' (2): Section 4.4.4. +* `%elifctx' (1): Section 4.4.3. +* `%elifdef' (1): Section 4.4.1. +* `%elifempty' (1): Section 4.4.8. +* `%elifid' (1): Section 4.4.6. +* `%elifidn' (1): Section 4.4.5. +* `%elifidni' (1): Section 4.4.5. +* `%elifmacro' (1): Section 4.4.2. +* `%elifn' (1): Section 4.4. +* `%elifn' (2): Section 4.4.4. +* `%elifnctx' (1): Section 4.4.3. +* `%elifndef' (1): Section 4.4.1. +* `%elifnempty' (1): Section 4.4.8. +* `%elifnid' (1): Section 4.4.6. +* `%elifnidn' (1): Section 4.4.5. +* `%elifnidni' (1): Section 4.4.5. +* `%elifnmacro' (1): Section 4.4.2. +* `%elifnnum' (1): Section 4.4.6. +* `%elifnstr' (1): Section 4.4.6. +* `%elifntoken' (1): Section 4.4.7. +* `%elifnum' (1): Section 4.4.6. +* `%elifstr' (1): Section 4.4.6. +* `%eliftoken' (1): Section 4.4.7. +* `%else' (1): Section 4.4. +* `endproc' (1): Section 8.4.5. +* `endproc' (2): Section 9.1.4. +* `%endrep' (1): Section 4.5. +* `ENDSTRUC' (1): Section 4.11.10. +* `ENDSTRUC' (2): Section 6.4. +* environment (1): Section 2.1.28. +* `EQU' (1): Section 3.2. +* `EQU' (2): Section 3.2.4. +* `%error' (1): Section 4.9. +* `error' (1): Section 2.1.24. +* error messages (1): Section 2.1.14. +* error messages (2): Section 2.1.15. +* error reporting format (1): Section 2.1.13. +* escape sequences (1): Section 3.4.2. +* `EVEN' (1): Section 4.11.12. +* exact matches (1): Section 4.3.11. +* `.EXE' (1): Section 7.4. +* `.EXE' (2): Section 8.1. +* `EXE2BIN' (1): Section 8.2.2. +* `EXE_begin' (1): Section 8.1.2. +* `exebin.mac' (1): Section 8.1.2. +* `exec' (1): Section 7.9.2. +* Executable and Linkable Format (1): Section 7.9. +* `EXE_end' (1): Section 8.1.2. +* `EXE_stack' (1): Section 8.1.2. +* `%exitmacro' (1): Section 4.3.12. +* `%exitrep' (1): Section 4.5. +* `EXPORT' (1): Section 7.4.5. +* `export' (1): Section 7.13.3. +* exporting symbols (1): Section 6.6. +* expressions (1): Section 2.1.20. +* expressions (2): Section 3.5. +* extension (1): Section 2.1.1. +* extension (2): Chapter 7. +* `EXTERN' (1): Section 6.5. +* `EXTERN', `obj' extensions to (1): Section 7.4.7. +* `EXTERN', `rdf' extensions to (1): Section 7.13.4. +* extracting substrings (1): Section 4.2.3. +* `-F' option (1): Section 2.1.11. +* `-f' option (1): Section 2.1.2. +* `-f' option (2): Chapter 7. +* far call (1): Section 2.2.5. +* far common variables (1): Section 7.4.8. +* far pointer (1): Section 3.6. +* `FARCODE' (1): Section 8.4.5. +* `FARCODE' (2): Section 8.5.3. +* `%fatal' (1): Section 4.9. +* `__FILE__' (1): Section 4.11.4. +* `FLAT' (1): Section 7.4.1. +* flat memory model (1): Chapter 9. +* flat-form binary (1): Section 7.1. +* `FLOAT' (1): Section 6.9. +* `__FLOAT__' (1): Section 6.9. +* `__float128h__' (1): Section 3.4.6. +* `__float128l__' (1): Section 3.4.6. +* `__float16__' (1): Section 3.4.6. +* `__float32__' (1): Section 3.4.6. +* `__float64__' (1): Section 3.4.6. +* `__float8__' (1): Section 3.4.6. +* `__float80e__' (1): Section 3.4.6. +* `__float80m__' (1): Section 3.4.6. +* `__FLOAT_DAZ__' (1): Section 6.9. +* `float-denorm' (1): Section 2.1.24. +* floating-point, constants (1): Section 3.4.6. +* floating-point, constants (2): Section 6.9. +* floating-point, packed BCD constants (1): Section 3.4.7. +* floating-point (1): Section 2.2.6. +* floating-point (2): Section 3.1. +* floating-point (3): Section 3.2.1. +* floating-point (4): Section 3.4.6. +* `float-overflow' (1): Section 2.1.24. +* `__FLOAT_ROUND__' (1): Section 6.9. +* `float-toolong' (1): Section 2.1.24. +* `float-underflow' (1): Section 2.1.24. +* `follows=' (1): Section 7.1.3. +* format-specific directives (1): Chapter 6. +* frame pointer (1): Section 8.4.3. +* frame pointer (2): Section 8.5.1. +* frame pointer (3): Section 9.1.2. +* FreeBSD (1): Section 7.11. +* FreeBSD (2): Section 9.2. +* FreeLink (1): Section 8.1.1. +* `ftp.simtel.net' (1): Section 8.1.1. +* `function' (1): Section 7.9.5. +* `function' (2): Section 7.13.3. +* functions, C calling convention (1): Section 8.4.3. +* functions, C calling convention (2): Section 9.1.2. +* functions, Pascal calling convention (1): Section 8.5.1. +* `-g' option (1): Section 2.1.12. +* `gas' (1): Section 1.1.1. +* `gcc' (1): Section 1.1.1. +* `GLOBAL' (1): Section 6.6. +* `GLOBAL', `aoutb' extensions to (1): Section 7.9.5. +* `GLOBAL', `elf' extensions to (1): Section 7.9.5. +* `GLOBAL', `rdf' extensions to (1): Section 7.13.3. +* global offset table (1): Section 9.2. +* `_GLOBAL_OFFSET_TABLE_' (1): Section 7.9.3. +* `gnu-elf-extensions' (1): Section 2.1.24. +* `..got' (1): Section 7.9.3. +* `GOT' relocations (1): Section 9.2.3. +* GOT (1): Section 7.9.3. +* GOT (2): Section 9.2. +* `..gotoff' (1): Section 7.9.3. +* `GOTOFF' relocations (1): Section 9.2.2. +* `..gotpc' (1): Section 7.9.3. +* `GOTPC' relocations (1): Section 9.2.1. +* `..gottpoff' (1): Section 7.9.4. +* graphics (1): Section 3.2.3. +* greedy macro parameters (1): Section 4.3.4. +* `GROUP' (1): Section 7.4.2. +* groups (1): Section 3.6. +* `-h' (1): Section A.3. +* hexadecimal (1): Section 3.4.1. +* `hidden' (1): Section 7.9.5. +* hybrid syntaxes (1): Section 2.2.2. +* `-I' option (1): Section 2.1.16. +* `-i' option (1): Section 2.1.16. +* `-i' option (2): Section A.3.3. +* `%iassign' (1): Section 4.1.7. +* `%idefine' (1): Section 4.1.1. +* `%idefstr' (1): Section 4.1.8. +* `%ideftok' (1): Section 4.1.9. +* `IEND' (1): Section 4.11.11. +* `%if' (1): Section 4.4. +* `%if' (2): Section 4.4.4. +* `%ifctx' (1): Section 4.4.3. +* `%ifctx' (2): Section 4.7.5. +* `%ifdef' (1): Section 4.4.1. +* `%ifempty' (1): Section 4.4.8. +* `%ifid' (1): Section 4.4.6. +* `%ifidn' (1): Section 4.4.5. +* `%ifidni' (1): Section 4.4.5. +* `%ifmacro' (1): Section 4.4.2. +* `%ifn' (1): Section 4.4. +* `%ifn' (2): Section 4.4.4. +* `%ifnctx' (1): Section 4.4.3. +* `%ifndef' (1): Section 4.4.1. +* `%ifnempty' (1): Section 4.4.8. +* `%ifnid' (1): Section 4.4.6. +* `%ifnidn' (1): Section 4.4.5. +* `%ifnidni' (1): Section 4.4.5. +* `%ifnmacro' (1): Section 4.4.2. +* `%ifnnum' (1): Section 4.4.6. +* `%ifnstr' (1): Section 4.4.6. +* `%ifntoken' (1): Section 4.4.7. +* `%ifnum' (1): Section 4.4.6. +* `%ifstr' (1): Section 4.4.6. +* `%iftoken' (1): Section 4.4.7. +* `%imacro' (1): Section 4.3. +* `IMPORT' (1): Section 7.4.4. +* import library (1): Section 7.4.4. +* importing symbols (1): Section 6.5. +* `INCBIN' (1): Section 3.2. +* `INCBIN' (2): Section 3.2.3. +* `INCBIN' (3): Section 3.4.4. +* `%include' (1): Section 2.1.16. +* `%include' (2): Section 2.1.17. +* `%include' (3): Section 4.6.1. +* include search path (1): Section 2.1.16. +* including other files (1): Section 4.6.1. +* inefficient code (1): Section 12.1.1. +* infinite loop (1): Section 3.5. +* `__Infinity__' (1): Section 3.4.6. +* infinity (1): Section 3.4.6. +* informational section (1): Section 7.5.1. +* `INSTALL' (1): Section 1.3.2. +* installing (1): Section 1.3.1. +* instances of structures (1): Section 4.11.11. +* instruction list (1): Appendix B. +* intel hex (1): Section 7.2. +* Intel number formats (1): Section 3.4.6. +* `internal' (1): Section 7.9.5. +* `%irmacro' (1): Section 4.3.1. +* `ISTRUC' (1): Section 4.11.11. +* iterating over macro parameters (1): Section 4.3.7. +* `ith' (1): Section 7.2. +* `%ixdefine' (1): Section 4.1.2. +* `Jcc NEAR' (1): Section 12.1.2. +* `JMP DWORD' (1): Section 10.1. +* jumps, mixed-size (1): Section 10.1. +* `-k' (1): Section A.3.4. +* `-l' option (1): Section 2.1.3. +* label prefix (1): Section 3.9. +* `.lbss' (1): Section 7.9.2. +* `ld86' (1): Section 7.12. +* `.ldata' (1): Section 7.9.2. +* `LIBRARY' (1): Section 7.13.1. +* license (1): Section 1.1.2. +* `%line' (1): Section 4.10.1. +* `__LINE__' (1): Section 4.11.4. +* linker, free (1): Section 8.1.1. +* Linux, `a.out' (1): Section 7.10. +* Linux, `as86' (1): Section 7.12. +* Linux, ELF (1): Section 7.9. +* listing file (1): Section 2.1.3. +* little-endian (1): Section 3.4.3. +* `%local' (1): Section 4.8.3. +* local labels (1): Section 3.9. +* logical AND (1): Section 4.4.4. +* logical negation (1): Section 3.5.7. +* logical OR (1): Section 4.4.4. +* logical XOR (1): Section 4.4.4. +* `.lrodata' (1): Section 7.9.2. +* `-M' option (1): Section 2.1.4. +* Mach, object file format (1): Section 7.8. +* Mach-O (1): Section 7.8. +* `macho' (1): Section 7.8. +* `macho32' (1): Section 7.8. +* `macho64' (1): Section 7.8. +* MacOS X (1): Section 7.8. +* `%macro' (1): Section 4.3. +* macro indirection (1): Section 4.1.3. +* macro library (1): Section 2.1.16. +* macro processor (1): Chapter 4. +* `macro-defaults' (1): Section 2.1.24. +* macro-local labels (1): Section 4.3.3. +* `macro-params' (1): Section 2.1.24. +* macros (1): Section 3.2.5. +* `macro-selfref' (1): Section 2.1.24. +* `make' (1): Section 1.3.2. +* makefile dependencies (1): Section 2.1.4. +* makefile dependencies (2): Section 2.1.5. +* makefiles (1): Section 1.3.1. +* makefiles (2): Section 1.3.2. +* man pages (1): Section 1.3.2. +* map files (1): Section 7.1.4. +* `MASM' (1): Section 1.1.1. +* MASM (1): Section 2.2. +* MASM (2): Section 3.2.5. +* MASM (3): Section 7.4. +* `-MD' option (1): Section 2.1.7. +* memory models (1): Section 2.2.5. +* memory models (2): Section 8.4.2. +* memory operand (1): Section 3.1. +* memory references (1): Section 2.2.2. +* memory references (2): Section 3.3. +* `-MF' option (1): Section 2.1.6. +* `-MG' option (1): Section 2.1.5. +* Microsoft OMF (1): Section 7.4. +* minifloat (1): Section 3.4.6. +* Minix (1): Section 7.12. +* `misc' subdirectory (1): Section 8.1.2. +* `misc' subdirectory (2): Section 8.4.5. +* `misc' subdirectory (3): Section 9.1.4. +* mixed-language program (1): Section 8.4. +* mixed-size addressing (1): Section 10.2. +* mixed-size instruction (1): Section 10.1. +* `MODULE' (1): Section 7.13.2. +* modulo operators (1): Section 3.5.6. +* motorola s-records (1): Section 7.3. +* `-MP' option (1): Section 2.1.10. +* `-MQ' option (1): Section 2.1.9. +* MS-DOS (1): Section 7.1. +* MS-DOS device drivers (1): Section 8.3. +* `-MT' option (1): Section 2.1.8. +* multi-line macros (1): Section 2.1.24. +* multi-line macros (2): Section 4.3. +* multipass optimization (1): Section 2.1.22. +* multiple section names (1): Section 7.1. +* multiplication (1): Section 3.5.6. +* `multipush' macro (1): Section 4.3.7. +* multisection (1): Section 7.1.3. +* `__NaN__' (1): Section 3.4.6. +* NaN (1): Section 3.4.6. +* NASM version (1): Section 4.11.1. +* nasm version history (1): Appendix C. +* nasm version id (1): Section 4.11.2. +* nasm version string (1): Section 4.11.3. +* `nasm.1' (1): Section 1.3.2. +* `__NASMDEFSEG' (1): Section 7.4. +* `nasm-devel' (1): Section 1.2. +* `NASMENV' (1): Section 2.1.28. +* `nasm.exe' (1): Section 1.3.1. +* `nasm -hf' (1): Section 2.1.2. +* `__NASM_MAJOR__' (1): Section 4.11.1. +* `__NASM_MINOR__' (1): Section 4.11.1. +* `nasm.out' (1): Section 2.1.1. +* `___NASM_PATCHLEVEL__' (1): Section 4.11.1. +* `__NASM_SNAPSHOT__' (1): Section 4.11.1. +* `__NASM_SUBMINOR__' (1): Section 4.11.1. +* `__NASM_VER__' (1): Section 4.11.3. +* `__NASM_VERSION_ID__' (1): Section 4.11.2. +* `nasm-XXX-dos.zip' (1): Section 1.3.1. +* `nasm-XXX.tar.gz' (1): Section 1.3.2. +* `nasm-XXX-win32.zip' (1): Section 1.3.1. +* `nasm-XXX.zip' (1): Section 1.3.1. +* ndisasm (1): Appendix A. +* `ndisasm.1' (1): Section 1.3.2. +* `ndisasm.exe' (1): Section 1.3.1. +* near call (1): Section 2.2.5. +* near common variables (1): Section 7.4.8. +* NetBSD (1): Section 7.11. +* NetBSD (2): Section 9.2. +* new releases (1): Section 1.2. +* `noalloc' (1): Section 7.9.2. +* `nobits' (1): Section 7.1.3. +* `nobits' (2): Section 7.9.2. +* `noexec' (1): Section 7.9.2. +* `.nolist' (1): Section 4.3.10. +* `nowait' (1): Section 2.2.6. +* `nowrite' (1): Section 7.9.2. +* `number-overflow' (1): Section 2.1.24. +* numeric constants (1): Section 3.2.1. +* numeric constants (2): Section 3.4.1. +* `-O' option (1): Section 2.1.22. +* `-o' option (1): Section 2.1.1. +* `-o' option (2): Section A.3.1. +* `O16' (1): Section 3.1. +* `o16' (1): Section 10.3. +* `O32' (1): Section 3.1. +* `o32' (1): Section 10.3. +* `O64' (1): Section 3.1. +* `.OBJ' (1): Section 8.1. +* `obj' (1): Section 7.4. +* `object' (1): Section 7.9.5. +* `object' (2): Section 7.13.3. +* octal (1): Section 3.4.1. +* `OF_DBG' (1): Section 7.14. +* `OF_DEFAULT' (1): Section 2.1.2. +* `OFFSET' (1): Section 2.2.2. +* OMF (1): Section 7.4. +* omitted parameters (1): Section 4.3.5. +* one's complement (1): Section 3.5.7. +* OpenBSD (1): Section 7.11. +* OpenBSD (2): Section 9.2. +* operands (1): Section 3.1. +* operand-size prefixes (1): Section 3.1. +* operating system (1): Section 7.1. +* operating system, writing (1): Section 10.1. +* operators (1): Section 3.5. +* `ORG' (1): Section 7.1.1. +* `ORG' (2): Section 8.2.1. +* `ORG' (3): Section 8.2.2. +* `ORG' (4): Section 12.1.3. +* `orphan-labels' (1): Section 2.1.24. +* `orphan-labels' (2): Section 3.1. +* OS/2 (1): Section 7.4. +* OS/2 (2): Section 7.4.1. +* `osabi' (1): Section 7.9.1. +* other preprocessor directives (1): Section 4.10. +* out of range, jumps (1): Section 12.1.2. +* output file format (1): Section 2.1.2. +* output formats (1): Chapter 7. +* `__OUTPUT_FORMAT__' (1): Section 4.11.6. +* overlapping segments (1): Section 3.6. +* `OVERLAY' (1): Section 7.4.1. +* overloading, multi-line macros (1): Section 4.3.2. +* overloading, single-line macros (1): Section 4.1.1. +* `-P' option (1): Section 2.1.17. +* `-p' option (1): Section 2.1.17. +* `-p' option (2): Section 4.6.1. +* paradox (1): Section 3.8. +* `PASCAL' (1): Section 8.5.3. +* Pascal calling convention (1): Section 8.5.1. +* `__PASS__' (1): Section 4.11.9. +* `PATH' (1): Section 1.3.1. +* `%pathsearch' (1): Section 2.1.16. +* `%pathsearch' (2): Section 4.6.2. +* period (1): Section 3.9. +* Perl (1): Section 1.3.1. +* perverse (1): Section 2.1.16. +* PharLap (1): Section 7.4.1. +* PIC (1): Section 7.9.3. +* PIC (2): Section 7.11. +* PIC (3): Section 9.2. +* `..plt' (1): Section 7.9.3. +* `PLT' relocations (1): Section 7.9.3. +* `PLT' relocations (2): Section 9.2.4. +* `PLT' relocations (3): Section 9.2.5. +* plt relocations (1): Section 9.2.5. +* `%pop' (1): Section 4.7. +* `%pop' (2): Section 4.7.1. +* position-independent code (1): Section 7.9.3. +* position-independent code (2): Section 7.11. +* position-independent code (3): Section 9.2. +* `--postfix' (1): Section 2.1.27. +* precedence (1): Section 3.5. +* pre-defining macros (1): Section 2.1.18. +* pre-defining macros (2): Section 4.1.1. +* preferred (1): Section 3.6. +* `--prefix' (1): Section 2.1.27. +* pre-including files (1): Section 2.1.17. +* preprocess-only mode (1): Section 2.1.20. +* preprocessor (1): Section 2.1.20. +* preprocessor (2): Section 2.1.21. +* preprocessor (3): Section 3.2.4. +* preprocessor (4): Section 3.5.6. +* preprocessor (5): Chapter 4. +* preprocessor expressions (1): Section 2.1.20. +* preprocessor loops (1): Section 4.5. +* preprocessor variables (1): Section 4.1.7. +* primitive directives (1): Chapter 6. +* `PRIVATE' (1): Section 7.4.1. +* `proc' (1): Section 7.13.3. +* `proc' (2): Section 8.4.5. +* `proc' (3): Section 9.1.4. +* procedure linkage table (1): Section 7.9.3. +* procedure linkage table (2): Section 9.2.4. +* procedure linkage table (3): Section 9.2.5. +* processor mode (1): Section 6.1. +* `progbits' (1): Section 7.1.3. +* `progbits' (2): Section 7.9.2. +* program entry point (1): Section 7.4.6. +* program entry point (2): Section 8.1.1. +* program origin (1): Section 7.1.1. +* `protected' (1): Section 7.9.5. +* pseudo-instructions (1): Section 3.2. +* `PUBLIC' (1): Section 6.6. +* `PUBLIC' (2): Section 7.4.1. +* pure binary (1): Section 7.1. +* `%push' (1): Section 4.7. +* `%push' (2): Section 4.7.1. +* `__QNaN__' (1): Section 3.4.6. +* quick start (1): Section 2.2. +* `QWORD' (1): Section 3.1. +* `-r' (1): Section A.3. +* `rdf' (1): Section 7.13. +* `rdoff' subdirectory (1): Section 1.3.2. +* `rdoff' subdirectory (2): Section 7.13. +* recursive multi-line macros (1): Section 4.3.1. +* redirecting errors (1): Section 2.1.14. +* `REL' (1): Section 3.3. +* `REL' (2): Section 6.2. +* relational operators (1): Section 4.4.4. +* release candidates (1): Section 1.2. +* Relocatable Dynamic Object File Format (1): Section 7.13. +* relocations, PIC-specific (1): Section 7.9.3. +* removing contexts (1): Section 4.7.1. +* renaming contexts (1): Section 4.7.4. +* `%rep' (1): Section 3.2.5. +* `%rep' (2): Section 4.5. +* repeating (1): Section 3.2.5. +* repeating (2): Section 4.5. +* `%repl' (1): Section 4.7.4. +* reporting bugs (1): Section 12.2. +* `RESB' (1): Section 2.2.7. +* `RESB' (2): Section 3.2. +* `RESB' (3): Section 3.2.2. +* `RESD' (1): Section 3.2. +* `RESD' (2): Section 3.2.2. +* `RESO' (1): Section 3.2. +* `RESO' (2): Section 3.2.2. +* `RESQ' (1): Section 3.2. +* `RESQ' (2): Section 3.2.2. +* `REST' (1): Section 3.2. +* `REST' (2): Section 3.2.2. +* `RESW' (1): Section 3.2. +* `RESW' (2): Section 3.2.2. +* `RESY' (1): Section 3.2. +* `RESY' (2): Section 3.2.2. +* `%rmacro' (1): Section 4.3.1. +* `.rodata' (1): Section 7.9.2. +* `%rotate' (1): Section 4.3.7. +* rotating macro parameters (1): Section 4.3.7. +* `-s' option (1): Section 2.1.15. +* `-s' option (2): Section A.3.2. +* searching for include files (1): Section 4.6.1. +* `__SECT__' (1): Section 6.3.1. +* `__SECT__' (2): Section 6.4. +* `SECTION' (1): Section 6.3. +* `SECTION', `elf' extensions to (1): Section 7.9.2. +* `SECTION', `win32' extensions to (1): Section 7.5.1. +* section alignment, in `bin' (1): Section 7.1.2. +* section alignment, in `elf' (1): Section 7.9.2. +* section alignment, in `obj' (1): Section 7.4.1. +* section alignment, in `win32' (1): Section 7.5.1. +* section, bin extensions to (1): Section 7.1.2. +* `SEG' (1): Section 3.5.7. +* `SEG' (2): Section 3.6. +* `SEG' (3): Section 7.4. +* `SEGMENT' (1): Section 6.3. +* `SEGMENT', `elf' extensions to (1): Section 7.4.1. +* segment address (1): Section 3.5.7. +* segment address (2): Section 3.6. +* segment alignment, in `bin' (1): Section 7.1.2. +* segment alignment, in `obj' (1): Section 7.4.1. +* segment names, Borland Pascal (1): Section 8.5.2. +* segment override (1): Section 2.2.4. +* segment override (2): Section 3.1. +* segments (1): Section 3.6. +* segments, groups of (1): Section 7.4.2. +* separator character (1): Section 2.1.28. +* shared libraries (1): Section 7.11. +* shared libraries (2): Section 9.2. +* shared library (1): Section 7.9.5. +* `shift' command (1): Section 4.3.7. +* signed division (1): Section 3.5.6. +* signed modulo (1): Section 3.5.6. +* single-line macros (1): Section 4.1. +* size, of symbols (1): Section 7.9.5. +* `smartalign' (1): Section 5.2. +* `__SNaN__' (1): Section 3.4.6. +* snapshots, daily development (1): Section 1.2. +* Solaris x86 (1): Section 7.9. +* `-soname' (1): Section 9.2.6. +* sound (1): Section 3.2.3. +* source code (1): Section 1.3.1. +* source-listing file (1): Section 2.1.3. +* square brackets (1): Section 2.2.2. +* square brackets (2): Section 3.3. +* `srec' (1): Section 7.3. +* `STACK' (1): Section 7.4.1. +* stack relative preprocessor directives (1): Section 4.8. +* `%stacksize' (1): Section 4.8.2. +* standard macro packages (1): Chapter 5. +* standard macros (1): Section 4.11. +* standardized section names (1): Section 6.3. +* standardized section names (2): Section 7.5.1. +* standardized section names (3): Section 7.9.2. +* standardized section names (4): Section 7.10. +* standardized section names (5): Section 7.11. +* standardized section names (6): Section 7.12. +* standardized section names (7): Section 7.13. +* `..start' (1): Section 7.4.6. +* `..start' (2): Section 8.1.1. +* `start=' (1): Section 7.1.3. +* `stderr' (1): Section 2.1.14. +* `stdout' (1): Section 2.1.15. +* `%strcat' (1): Section 4.2.1. +* `STRICT' (1): Section 3.7. +* string constant (1): Section 3.2.1. +* string constants (1): Section 3.4.4. +* string length (1): Section 4.2.2. +* string manipulation in macros (1): Section 4.2. +* strings (1): Section 3.4.2. +* `%strlen' (1): Section 4.2.2. +* `STRUC' (1): Section 4.11.10. +* `STRUC' (2): Section 6.4. +* `STRUC' (3): Section 8.4.4. +* `STRUC' (4): Section 9.1.3. +* stub preprocessor (1): Section 2.1.21. +* `%substr' (1): Section 4.2.3. +* subtraction (1): Section 3.5.5. +* suppressible warning (1): Section 2.1.24. +* suppressing preprocessing (1): Section 2.1.21. +* switching between sections (1): Section 6.3. +* `..sym' (1): Section 7.9.3. +* symbol sizes, specifying (1): Section 7.9.5. +* symbol types, specifying (1): Section 7.9.5. +* symbols, exporting from DLLs (1): Section 7.4.5. +* symbols, importing from DLLs (1): Section 7.4.4. +* `synchronisation' (1): Section A.3.2. +* `.SYS' (1): Section 7.1. +* `.SYS' (2): Section 8.3. +* `-t' (1): Section 2.1.23. +* `TASM' (1): Section 1.1.1. +* `TASM' (2): Section 2.1.23. +* tasm (1): Section 2.2. +* tasm (2): Section 7.4. +* `.tbss' (1): Section 7.9.2. +* `TBYTE' (1): Section 2.2.7. +* `.tdata' (1): Section 7.9.2. +* `test' subdirectory (1): Section 8.1.1. +* testing, arbitrary numeric expressions (1): Section 4.4.4. +* testing, context stack (1): Section 4.4.3. +* testing, exact text identity (1): Section 4.4.5. +* testing, multi-line macro existence (1): Section 4.4.2. +* testing, single-line macro existence (1): Section 4.4.1. +* testing, token types (1): Section 4.4.6. +* `.text' (1): Section 7.9.2. +* `.text' (2): Section 7.10. +* `.text' (3): Section 7.11. +* `.text' (4): Section 7.12. +* `.text' (5): Section 7.13. +* `_TEXT' (1): Section 8.4.2. +* thread local storage (1): Section 7.9.4. +* `__TIME__' (1): Section 4.11.7. +* `__TIME_NUM__' (1): Section 4.11.7. +* `TIMES' (1): Section 3.2. +* `TIMES' (2): Section 3.2.5. +* `TIMES' (3): Section 3.8. +* `TIMES' (4): Section 12.1.3. +* `TIMES' (5): Section 12.1.4. +* `TLINK' (1): Section 8.2.2. +* `tls' (1): Section 7.9.2. +* `tls' (2): Section 7.9.4. +* `..tlsie' (1): Section 7.9.4. +* trailing colon (1): Section 3.1. +* `TWORD' (1): Section 2.2.7. +* `TWORD' (2): Section 3.1. +* type, of symbols (1): Section 7.9.5. +* `-U' option (1): Section 2.1.19. +* `-u' option (1): Section 2.1.19. +* `-u' option (2): Section A.3. +* unary operators (1): Section 3.5.7. +* `%undef' (1): Section 2.1.19. +* `%undef' (2): Section 4.1.6. +* undefining macros (1): Section 2.1.19. +* underscore, in C symbols (1): Section 8.4.1. +* Unicode (1): Section 3.4.2. +* Unicode (2): Section 3.4.5. +* uninitialized (1): Section 3.2. +* uninitialized (2): Section 3.2.2. +* uninitialized storage (1): Section 2.2.7. +* Unix (1): Section 1.3.2. +* Unix, SCO (1): Section 7.9. +* Unix, source archive (1): Section 1.3.2. +* Unix, System V (1): Section 7.9. +* UnixWare (1): Section 7.9. +* `%unmacro' (1): Section 4.3.11. +* unrolled loops (1): Section 3.2.5. +* unsigned division (1): Section 3.5.6. +* unsigned modulo (1): Section 3.5.6. +* `UPPERCASE' (1): Section 2.2.1. +* `UPPERCASE' (2): Section 7.4.3. +* `%use' (1): Section 4.6.4. +* `%use' (2): Chapter 5. +* `__USE_*__' (1): Section 4.11.8. +* `USE16' (1): Section 6.1.1. +* `USE16' (2): Section 7.4.1. +* `USE32' (1): Section 6.1.1. +* `USE32' (2): Section 7.4.1. +* `user' (1): Section 2.1.24. +* user-defined errors (1): Section 4.9. +* user-level assembler directives (1): Section 4.11. +* user-level directives (1): Chapter 6. +* `__UTC_DATE__' (1): Section 4.11.7. +* `__UTC_DATE_NUM__' (1): Section 4.11.7. +* `__UTC_TIME__' (1): Section 4.11.7. +* `__UTC_TIME_NUM__' (1): Section 4.11.7. +* UTF-16 (1): Section 3.4.5. +* UTF-32 (1): Section 3.4.5. +* UTF-8 (1): Section 3.4.2. +* `__utf16__' (1): Section 3.4.5. +* `__utf32__' (1): Section 3.4.5. +* `-v' option (1): Section 2.1.25. +* VAL (1): Section 8.1.1. +* valid characters (1): Section 3.1. +* variable types (1): Section 2.2.3. +* version (1): Section 2.1.25. +* version number of NASM (1): Section 4.11.1. +* `vfollows=' (1): Section 7.1.3. +* Visual C++ (1): Section 7.5. +* `vstart=' (1): Section 7.1.3. +* `-W' option (1): Section 2.1.24. +* `-w' option (1): Section 2.1.24. +* `%warning' (1): Section 4.9. +* warnings (1): Section 2.1.24. +* `[warning *warning-name]' (1): Section 2.1.24. +* `[warning +warning-name]' (1): Section 2.1.24. +* `[warning -warning-name]' (1): Section 2.1.24. +* website (1): Section 1.2. +* `win64' (1): Section 7.6. +* `win64' (2): Chapter 11. +* Win64 (1): Section 7.4. +* Win64 (2): Section 7.5. +* Win64 (3): Chapter 9. +* Windows (1): Section 8.1. +* `write' (1): Section 7.9.2. +* writing operating systems (1): Section 10.1. +* `WRT' (1): Section 3.6. +* `WRT' (2): Section 7.4. +* `WRT' (3): Section 7.9.3. +* `WRT' (4): Section 7.9.4. +* `WRT' (5): Section 7.11. +* `WRT ..got' (1): Section 9.2.3. +* `WRT ..gotoff' (1): Section 9.2.2. +* `WRT ..gotpc' (1): Section 9.2.1. +* `WRT ..plt' (1): Section 9.2.5. +* `WRT ..sym' (1): Section 9.2.4. +* `www.cpan.org' (1): Section 1.3.1. +* `www.delorie.com' (1): Section 8.1.1. +* `www.pcorner.com' (1): Section 8.1.1. +* `-X' option (1): Section 2.1.13. +* `x2ftp.oulu.fi' (1): Section 8.1.1. +* `%xdefine' (1): Section 4.1.2. +* `-y' option (1): Section 2.1.26. +* `-Z' option (1): Section 2.1.14. + + diff --git a/doc/inslist.src b/doc/inslist.src new file mode 100644 index 0000000..a5c7155 --- /dev/null +++ b/doc/inslist.src @@ -0,0 +1,3130 @@ + +\S{} Special instructions... + +\c DB +\c DW +\c DD +\c DQ +\c DT +\c DO +\c DY +\c RESB imm 8086 +\c RESW +\c RESD +\c RESQ +\c REST +\c RESO +\c RESY + +\S{} Conventional instructions + +\c AAA 8086,NOLONG +\c AAD 8086,NOLONG +\c AAD imm 8086,NOLONG +\c AAM 8086,NOLONG +\c AAM imm 8086,NOLONG +\c AAS 8086,NOLONG +\c ADC mem,reg8 8086 +\c ADC reg8,reg8 8086 +\c ADC mem,reg16 8086 +\c ADC reg16,reg16 8086 +\c ADC mem,reg32 386 +\c ADC reg32,reg32 386 +\c ADC mem,reg64 X64 +\c ADC reg64,reg64 X64 +\c ADC reg8,mem 8086 +\c ADC reg8,reg8 8086 +\c ADC reg16,mem 8086 +\c ADC reg16,reg16 8086 +\c ADC reg32,mem 386 +\c ADC reg32,reg32 386 +\c ADC reg64,mem X64 +\c ADC reg64,reg64 X64 +\c ADC rm16,imm8 8086 +\c ADC rm32,imm8 386 +\c ADC rm64,imm8 X64 +\c ADC reg_al,imm 8086 +\c ADC reg_ax,sbyte16 8086 +\c ADC reg_ax,imm 8086 +\c ADC reg_eax,sbyte32 386 +\c ADC reg_eax,imm 386 +\c ADC reg_rax,sbyte64 X64 +\c ADC reg_rax,imm X64 +\c ADC rm8,imm 8086 +\c ADC rm16,imm 8086 +\c ADC rm32,imm 386 +\c ADC rm64,imm X64 +\c ADC mem,imm8 8086 +\c ADC mem,imm16 8086 +\c ADC mem,imm32 386 +\c ADD mem,reg8 8086 +\c ADD reg8,reg8 8086 +\c ADD mem,reg16 8086 +\c ADD reg16,reg16 8086 +\c ADD mem,reg32 386 +\c ADD reg32,reg32 386 +\c ADD mem,reg64 X64 +\c ADD reg64,reg64 X64 +\c ADD reg8,mem 8086 +\c ADD reg8,reg8 8086 +\c ADD reg16,mem 8086 +\c ADD reg16,reg16 8086 +\c ADD reg32,mem 386 +\c ADD reg32,reg32 386 +\c ADD reg64,mem X64 +\c ADD reg64,reg64 X64 +\c ADD rm16,imm8 8086 +\c ADD rm32,imm8 386 +\c ADD rm64,imm8 X64 +\c ADD reg_al,imm 8086 +\c ADD reg_ax,sbyte16 8086 +\c ADD reg_ax,imm 8086 +\c ADD reg_eax,sbyte32 386 +\c ADD reg_eax,imm 386 +\c ADD reg_rax,sbyte64 X64 +\c ADD reg_rax,imm X64 +\c ADD rm8,imm 8086 +\c ADD rm16,imm 8086 +\c ADD rm32,imm 386 +\c ADD rm64,imm X64 +\c ADD mem,imm8 8086 +\c ADD mem,imm16 8086 +\c ADD mem,imm32 386 +\c AND mem,reg8 8086 +\c AND reg8,reg8 8086 +\c AND mem,reg16 8086 +\c AND reg16,reg16 8086 +\c AND mem,reg32 386 +\c AND reg32,reg32 386 +\c AND mem,reg64 X64 +\c AND reg64,reg64 X64 +\c AND reg8,mem 8086 +\c AND reg8,reg8 8086 +\c AND reg16,mem 8086 +\c AND reg16,reg16 8086 +\c AND reg32,mem 386 +\c AND reg32,reg32 386 +\c AND reg64,mem X64 +\c AND reg64,reg64 X64 +\c AND rm16,imm8 8086 +\c AND rm32,imm8 386 +\c AND rm64,imm8 X64 +\c AND reg_al,imm 8086 +\c AND reg_ax,sbyte16 8086 +\c AND reg_ax,imm 8086 +\c AND reg_eax,sbyte32 386 +\c AND reg_eax,imm 386 +\c AND reg_rax,sbyte64 X64 +\c AND reg_rax,imm X64 +\c AND rm8,imm 8086 +\c AND rm16,imm 8086 +\c AND rm32,imm 386 +\c AND rm64,imm X64 +\c AND mem,imm8 8086 +\c AND mem,imm16 8086 +\c AND mem,imm32 386 +\c ARPL mem,reg16 286,PROT,NOLONG +\c ARPL reg16,reg16 286,PROT,NOLONG +\c BB0_RESET PENT,CYRIX,ND +\c BB1_RESET PENT,CYRIX,ND +\c BOUND reg16,mem 186,NOLONG +\c BOUND reg32,mem 386,NOLONG +\c BSF reg16,mem 386 +\c BSF reg16,reg16 386 +\c BSF reg32,mem 386 +\c BSF reg32,reg32 386 +\c BSF reg64,mem X64 +\c BSF reg64,reg64 X64 +\c BSR reg16,mem 386 +\c BSR reg16,reg16 386 +\c BSR reg32,mem 386 +\c BSR reg32,reg32 386 +\c BSR reg64,mem X64 +\c BSR reg64,reg64 X64 +\c BSWAP reg32 486 +\c BSWAP reg64 X64 +\c BT mem,reg16 386 +\c BT reg16,reg16 386 +\c BT mem,reg32 386 +\c BT reg32,reg32 386 +\c BT mem,reg64 X64 +\c BT reg64,reg64 X64 +\c BT rm16,imm 386 +\c BT rm32,imm 386 +\c BT rm64,imm X64 +\c BTC mem,reg16 386 +\c BTC reg16,reg16 386 +\c BTC mem,reg32 386 +\c BTC reg32,reg32 386 +\c BTC mem,reg64 X64 +\c BTC reg64,reg64 X64 +\c BTC rm16,imm 386 +\c BTC rm32,imm 386 +\c BTC rm64,imm X64 +\c BTR mem,reg16 386 +\c BTR reg16,reg16 386 +\c BTR mem,reg32 386 +\c BTR reg32,reg32 386 +\c BTR mem,reg64 X64 +\c BTR reg64,reg64 X64 +\c BTR rm16,imm 386 +\c BTR rm32,imm 386 +\c BTR rm64,imm X64 +\c BTS mem,reg16 386 +\c BTS reg16,reg16 386 +\c BTS mem,reg32 386 +\c BTS reg32,reg32 386 +\c BTS mem,reg64 X64 +\c BTS reg64,reg64 X64 +\c BTS rm16,imm 386 +\c BTS rm32,imm 386 +\c BTS rm64,imm X64 +\c CALL imm 8086 +\c CALL imm|near 8086 +\c CALL imm|far 8086,ND,NOLONG +\c CALL imm16 8086 +\c CALL imm16|near 8086 +\c CALL imm16|far 8086,ND,NOLONG +\c CALL imm32 386 +\c CALL imm32|near 386 +\c CALL imm32|far 386,ND,NOLONG +\c CALL imm:imm 8086,NOLONG +\c CALL imm16:imm 8086,NOLONG +\c CALL imm:imm16 8086,NOLONG +\c CALL imm32:imm 386,NOLONG +\c CALL imm:imm32 386,NOLONG +\c CALL mem|far 8086,NOLONG +\c CALL mem|far X64 +\c CALL mem16|far 8086 +\c CALL mem32|far 386 +\c CALL mem64|far X64 +\c CALL mem|near 8086 +\c CALL mem16|near 8086 +\c CALL mem32|near 386,NOLONG +\c CALL mem64|near X64 +\c CALL reg16 8086 +\c CALL reg32 386,NOLONG +\c CALL reg64 X64 +\c CALL mem 8086 +\c CALL mem16 8086 +\c CALL mem32 386,NOLONG +\c CALL mem64 X64 +\c CBW 8086 +\c CDQ 386 +\c CDQE X64 +\c CLC 8086 +\c CLD 8086 +\c CLGI X64,AMD +\c CLI 8086 +\c CLTS 286,PRIV +\c CMC 8086 +\c CMP mem,reg8 8086 +\c CMP reg8,reg8 8086 +\c CMP mem,reg16 8086 +\c CMP reg16,reg16 8086 +\c CMP mem,reg32 386 +\c CMP reg32,reg32 386 +\c CMP mem,reg64 X64 +\c CMP reg64,reg64 X64 +\c CMP reg8,mem 8086 +\c CMP reg8,reg8 8086 +\c CMP reg16,mem 8086 +\c CMP reg16,reg16 8086 +\c CMP reg32,mem 386 +\c CMP reg32,reg32 386 +\c CMP reg64,mem X64 +\c CMP reg64,reg64 X64 +\c CMP rm16,imm8 8086 +\c CMP rm32,imm8 386 +\c CMP rm64,imm8 X64 +\c CMP reg_al,imm 8086 +\c CMP reg_ax,sbyte16 8086 +\c CMP reg_ax,imm 8086 +\c CMP reg_eax,sbyte32 386 +\c CMP reg_eax,imm 386 +\c CMP reg_rax,sbyte64 X64 +\c CMP reg_rax,imm X64 +\c CMP rm8,imm 8086 +\c CMP rm16,imm 8086 +\c CMP rm32,imm 386 +\c CMP rm64,imm X64 +\c CMP mem,imm8 8086 +\c CMP mem,imm16 8086 +\c CMP mem,imm32 386 +\c CMPSB 8086 +\c CMPSD 386 +\c CMPSQ X64 +\c CMPSW 8086 +\c CMPXCHG mem,reg8 PENT +\c CMPXCHG reg8,reg8 PENT +\c CMPXCHG mem,reg16 PENT +\c CMPXCHG reg16,reg16 PENT +\c CMPXCHG mem,reg32 PENT +\c CMPXCHG reg32,reg32 PENT +\c CMPXCHG mem,reg64 X64 +\c CMPXCHG reg64,reg64 X64 +\c CMPXCHG486 mem,reg8 486,UNDOC,ND +\c CMPXCHG486 reg8,reg8 486,UNDOC,ND +\c CMPXCHG486 mem,reg16 486,UNDOC,ND +\c CMPXCHG486 reg16,reg16 486,UNDOC,ND +\c CMPXCHG486 mem,reg32 486,UNDOC,ND +\c CMPXCHG486 reg32,reg32 486,UNDOC,ND +\c CMPXCHG8B mem PENT +\c CMPXCHG16B mem X64 +\c CPUID PENT +\c CPU_READ PENT,CYRIX +\c CPU_WRITE PENT,CYRIX +\c CQO X64 +\c CWD 8086 +\c CWDE 386 +\c DAA 8086,NOLONG +\c DAS 8086,NOLONG +\c DEC reg16 8086,NOLONG +\c DEC reg32 386,NOLONG +\c DEC rm8 8086 +\c DEC rm16 8086 +\c DEC rm32 386 +\c DEC rm64 X64 +\c DIV rm8 8086 +\c DIV rm16 8086 +\c DIV rm32 386 +\c DIV rm64 X64 +\c DMINT P6,CYRIX +\c EMMS PENT,MMX +\c ENTER imm,imm 186 +\c EQU imm 8086 +\c EQU imm:imm 8086 +\c F2XM1 8086,FPU +\c FABS 8086,FPU +\c FADD mem32 8086,FPU +\c FADD mem64 8086,FPU +\c FADD fpureg|to 8086,FPU +\c FADD fpureg 8086,FPU +\c FADD fpureg,fpu0 8086,FPU +\c FADD fpu0,fpureg 8086,FPU +\c FADD 8086,FPU,ND +\c FADDP fpureg 8086,FPU +\c FADDP fpureg,fpu0 8086,FPU +\c FADDP 8086,FPU,ND +\c FBLD mem80 8086,FPU +\c FBLD mem 8086,FPU +\c FBSTP mem80 8086,FPU +\c FBSTP mem 8086,FPU +\c FCHS 8086,FPU +\c FCLEX 8086,FPU +\c FCMOVB fpureg P6,FPU +\c FCMOVB fpu0,fpureg P6,FPU +\c FCMOVB P6,FPU,ND +\c FCMOVBE fpureg P6,FPU +\c FCMOVBE fpu0,fpureg P6,FPU +\c FCMOVBE P6,FPU,ND +\c FCMOVE fpureg P6,FPU +\c FCMOVE fpu0,fpureg P6,FPU +\c FCMOVE P6,FPU,ND +\c FCMOVNB fpureg P6,FPU +\c FCMOVNB fpu0,fpureg P6,FPU +\c FCMOVNB P6,FPU,ND +\c FCMOVNBE fpureg P6,FPU +\c FCMOVNBE fpu0,fpureg P6,FPU +\c FCMOVNBE P6,FPU,ND +\c FCMOVNE fpureg P6,FPU +\c FCMOVNE fpu0,fpureg P6,FPU +\c FCMOVNE P6,FPU,ND +\c FCMOVNU fpureg P6,FPU +\c FCMOVNU fpu0,fpureg P6,FPU +\c FCMOVNU P6,FPU,ND +\c FCMOVU fpureg P6,FPU +\c FCMOVU fpu0,fpureg P6,FPU +\c FCMOVU P6,FPU,ND +\c FCOM mem32 8086,FPU +\c FCOM mem64 8086,FPU +\c FCOM fpureg 8086,FPU +\c FCOM fpu0,fpureg 8086,FPU +\c FCOM 8086,FPU,ND +\c FCOMI fpureg P6,FPU +\c FCOMI fpu0,fpureg P6,FPU +\c FCOMI P6,FPU,ND +\c FCOMIP fpureg P6,FPU +\c FCOMIP fpu0,fpureg P6,FPU +\c FCOMIP P6,FPU,ND +\c FCOMP mem32 8086,FPU +\c FCOMP mem64 8086,FPU +\c FCOMP fpureg 8086,FPU +\c FCOMP fpu0,fpureg 8086,FPU +\c FCOMP 8086,FPU,ND +\c FCOMPP 8086,FPU +\c FCOS 386,FPU +\c FDECSTP 8086,FPU +\c FDISI 8086,FPU +\c FDIV mem32 8086,FPU +\c FDIV mem64 8086,FPU +\c FDIV fpureg|to 8086,FPU +\c FDIV fpureg 8086,FPU +\c FDIV fpureg,fpu0 8086,FPU +\c FDIV fpu0,fpureg 8086,FPU +\c FDIV 8086,FPU,ND +\c FDIVP fpureg 8086,FPU +\c FDIVP fpureg,fpu0 8086,FPU +\c FDIVP 8086,FPU,ND +\c FDIVR mem32 8086,FPU +\c FDIVR mem64 8086,FPU +\c FDIVR fpureg|to 8086,FPU +\c FDIVR fpureg,fpu0 8086,FPU +\c FDIVR fpureg 8086,FPU +\c FDIVR fpu0,fpureg 8086,FPU +\c FDIVR 8086,FPU,ND +\c FDIVRP fpureg 8086,FPU +\c FDIVRP fpureg,fpu0 8086,FPU +\c FDIVRP 8086,FPU,ND +\c FEMMS PENT,3DNOW +\c FENI 8086,FPU +\c FFREE fpureg 8086,FPU +\c FFREE 8086,FPU +\c FFREEP fpureg 286,FPU,UNDOC +\c FFREEP 286,FPU,UNDOC +\c FIADD mem32 8086,FPU +\c FIADD mem16 8086,FPU +\c FICOM mem32 8086,FPU +\c FICOM mem16 8086,FPU +\c FICOMP mem32 8086,FPU +\c FICOMP mem16 8086,FPU +\c FIDIV mem32 8086,FPU +\c FIDIV mem16 8086,FPU +\c FIDIVR mem32 8086,FPU +\c FIDIVR mem16 8086,FPU +\c FILD mem32 8086,FPU +\c FILD mem16 8086,FPU +\c FILD mem64 8086,FPU +\c FIMUL mem32 8086,FPU +\c FIMUL mem16 8086,FPU +\c FINCSTP 8086,FPU +\c FINIT 8086,FPU +\c FIST mem32 8086,FPU +\c FIST mem16 8086,FPU +\c FISTP mem32 8086,FPU +\c FISTP mem16 8086,FPU +\c FISTP mem64 8086,FPU +\c FISTTP mem16 PRESCOTT,FPU +\c FISTTP mem32 PRESCOTT,FPU +\c FISTTP mem64 PRESCOTT,FPU +\c FISUB mem32 8086,FPU +\c FISUB mem16 8086,FPU +\c FISUBR mem32 8086,FPU +\c FISUBR mem16 8086,FPU +\c FLD mem32 8086,FPU +\c FLD mem64 8086,FPU +\c FLD mem80 8086,FPU +\c FLD fpureg 8086,FPU +\c FLD 8086,FPU,ND +\c FLD1 8086,FPU +\c FLDCW mem 8086,FPU,SW +\c FLDENV mem 8086,FPU +\c FLDL2E 8086,FPU +\c FLDL2T 8086,FPU +\c FLDLG2 8086,FPU +\c FLDLN2 8086,FPU +\c FLDPI 8086,FPU +\c FLDZ 8086,FPU +\c FMUL mem32 8086,FPU +\c FMUL mem64 8086,FPU +\c FMUL fpureg|to 8086,FPU +\c FMUL fpureg,fpu0 8086,FPU +\c FMUL fpureg 8086,FPU +\c FMUL fpu0,fpureg 8086,FPU +\c FMUL 8086,FPU,ND +\c FMULP fpureg 8086,FPU +\c FMULP fpureg,fpu0 8086,FPU +\c FMULP 8086,FPU,ND +\c FNCLEX 8086,FPU +\c FNDISI 8086,FPU +\c FNENI 8086,FPU +\c FNINIT 8086,FPU +\c FNOP 8086,FPU +\c FNSAVE mem 8086,FPU +\c FNSTCW mem 8086,FPU,SW +\c FNSTENV mem 8086,FPU +\c FNSTSW mem 8086,FPU,SW +\c FNSTSW reg_ax 286,FPU +\c FPATAN 8086,FPU +\c FPREM 8086,FPU +\c FPREM1 386,FPU +\c FPTAN 8086,FPU +\c FRNDINT 8086,FPU +\c FRSTOR mem 8086,FPU +\c FSAVE mem 8086,FPU +\c FSCALE 8086,FPU +\c FSETPM 286,FPU +\c FSIN 386,FPU +\c FSINCOS 386,FPU +\c FSQRT 8086,FPU +\c FST mem32 8086,FPU +\c FST mem64 8086,FPU +\c FST fpureg 8086,FPU +\c FST 8086,FPU,ND +\c FSTCW mem 8086,FPU,SW +\c FSTENV mem 8086,FPU +\c FSTP mem32 8086,FPU +\c FSTP mem64 8086,FPU +\c FSTP mem80 8086,FPU +\c FSTP fpureg 8086,FPU +\c FSTP 8086,FPU,ND +\c FSTSW mem 8086,FPU,SW +\c FSTSW reg_ax 286,FPU +\c FSUB mem32 8086,FPU +\c FSUB mem64 8086,FPU +\c FSUB fpureg|to 8086,FPU +\c FSUB fpureg,fpu0 8086,FPU +\c FSUB fpureg 8086,FPU +\c FSUB fpu0,fpureg 8086,FPU +\c FSUB 8086,FPU,ND +\c FSUBP fpureg 8086,FPU +\c FSUBP fpureg,fpu0 8086,FPU +\c FSUBP 8086,FPU,ND +\c FSUBR mem32 8086,FPU +\c FSUBR mem64 8086,FPU +\c FSUBR fpureg|to 8086,FPU +\c FSUBR fpureg,fpu0 8086,FPU +\c FSUBR fpureg 8086,FPU +\c FSUBR fpu0,fpureg 8086,FPU +\c FSUBR 8086,FPU,ND +\c FSUBRP fpureg 8086,FPU +\c FSUBRP fpureg,fpu0 8086,FPU +\c FSUBRP 8086,FPU,ND +\c FTST 8086,FPU +\c FUCOM fpureg 386,FPU +\c FUCOM fpu0,fpureg 386,FPU +\c FUCOM 386,FPU,ND +\c FUCOMI fpureg P6,FPU +\c FUCOMI fpu0,fpureg P6,FPU +\c FUCOMI P6,FPU,ND +\c FUCOMIP fpureg P6,FPU +\c FUCOMIP fpu0,fpureg P6,FPU +\c FUCOMIP P6,FPU,ND +\c FUCOMP fpureg 386,FPU +\c FUCOMP fpu0,fpureg 386,FPU +\c FUCOMP 386,FPU,ND +\c FUCOMPP 386,FPU +\c FXAM 8086,FPU +\c FXCH fpureg 8086,FPU +\c FXCH fpureg,fpu0 8086,FPU +\c FXCH fpu0,fpureg 8086,FPU +\c FXCH 8086,FPU,ND +\c FXTRACT 8086,FPU +\c FYL2X 8086,FPU +\c FYL2XP1 8086,FPU +\c HLT 8086,PRIV +\c IBTS mem,reg16 386,SW,UNDOC,ND +\c IBTS reg16,reg16 386,UNDOC,ND +\c IBTS mem,reg32 386,SD,UNDOC,ND +\c IBTS reg32,reg32 386,UNDOC,ND +\c ICEBP 386,ND +\c IDIV rm8 8086 +\c IDIV rm16 8086 +\c IDIV rm32 386 +\c IDIV rm64 X64 +\c IMUL rm8 8086 +\c IMUL rm16 8086 +\c IMUL rm32 386 +\c IMUL rm64 X64 +\c IMUL reg16,mem 386 +\c IMUL reg16,reg16 386 +\c IMUL reg32,mem 386 +\c IMUL reg32,reg32 386 +\c IMUL reg64,mem X64 +\c IMUL reg64,reg64 X64 +\c IMUL reg16,mem,imm8 186 +\c IMUL reg16,mem,sbyte16 186,ND +\c IMUL reg16,mem,imm16 186 +\c IMUL reg16,mem,imm 186,ND +\c IMUL reg16,reg16,imm8 186 +\c IMUL reg16,reg16,sbyte16 186,ND +\c IMUL reg16,reg16,imm16 186 +\c IMUL reg16,reg16,imm 186,ND +\c IMUL reg32,mem,imm8 386 +\c IMUL reg32,mem,sbyte32 386,ND +\c IMUL reg32,mem,imm32 386 +\c IMUL reg32,mem,imm 386,ND +\c IMUL reg32,reg32,imm8 386 +\c IMUL reg32,reg32,sbyte32 386,ND +\c IMUL reg32,reg32,imm32 386 +\c IMUL reg32,reg32,imm 386,ND +\c IMUL reg64,mem,imm8 X64 +\c IMUL reg64,mem,sbyte64 X64,ND +\c IMUL reg64,mem,imm32 X64 +\c IMUL reg64,mem,imm X64,ND +\c IMUL reg64,reg64,imm8 X64 +\c IMUL reg64,reg64,sbyte64 X64,ND +\c IMUL reg64,reg64,imm32 X64 +\c IMUL reg64,reg64,imm X64,ND +\c IMUL reg16,imm8 186 +\c IMUL reg16,sbyte16 186,ND +\c IMUL reg16,imm16 186 +\c IMUL reg16,imm 186,ND +\c IMUL reg32,imm8 386 +\c IMUL reg32,sbyte32 386,ND +\c IMUL reg32,imm32 386 +\c IMUL reg32,imm 386,ND +\c IMUL reg64,imm8 X64 +\c IMUL reg64,sbyte64 X64,ND +\c IMUL reg64,imm32 X64 +\c IMUL reg64,imm X64,ND +\c IN reg_al,imm 8086 +\c IN reg_ax,imm 8086 +\c IN reg_eax,imm 386 +\c IN reg_al,reg_dx 8086 +\c IN reg_ax,reg_dx 8086 +\c IN reg_eax,reg_dx 386 +\c INC reg16 8086,NOLONG +\c INC reg32 386,NOLONG +\c INC rm8 8086 +\c INC rm16 8086 +\c INC rm32 386 +\c INC rm64 X64 +\c INCBIN +\c INSB 186 +\c INSD 386 +\c INSW 186 +\c INT imm 8086 +\c INT01 386,ND +\c INT1 386 +\c INT03 8086,ND +\c INT3 8086 +\c INTO 8086,NOLONG +\c INVD 486,PRIV +\c INVLPG mem 486,PRIV +\c INVLPGA reg_ax,reg_ecx X86_64,AMD,NOLONG +\c INVLPGA reg_eax,reg_ecx X86_64,AMD +\c INVLPGA reg_rax,reg_ecx X64,AMD +\c INVLPGA X86_64,AMD +\c IRET 8086 +\c IRETD 386 +\c IRETQ X64 +\c IRETW 8086 +\c JCXZ imm 8086,NOLONG +\c JECXZ imm 386 +\c JRCXZ imm X64 +\c JMP imm|short 8086 +\c JMP imm 8086,ND +\c JMP imm 8086 +\c JMP imm|near 8086,ND +\c JMP imm|far 8086,ND,NOLONG +\c JMP imm16 8086 +\c JMP imm16|near 8086,ND +\c JMP imm16|far 8086,ND,NOLONG +\c JMP imm32 386 +\c JMP imm32|near 386,ND +\c JMP imm32|far 386,ND,NOLONG +\c JMP imm:imm 8086,NOLONG +\c JMP imm16:imm 8086,NOLONG +\c JMP imm:imm16 8086,NOLONG +\c JMP imm32:imm 386,NOLONG +\c JMP imm:imm32 386,NOLONG +\c JMP mem|far 8086,NOLONG +\c JMP mem|far X64 +\c JMP mem16|far 8086 +\c JMP mem32|far 386 +\c JMP mem64|far X64 +\c JMP mem|near 8086 +\c JMP mem16|near 8086 +\c JMP mem32|near 386,NOLONG +\c JMP mem64|near X64 +\c JMP reg16 8086 +\c JMP reg32 386,NOLONG +\c JMP reg64 X64 +\c JMP mem 8086 +\c JMP mem16 8086 +\c JMP mem32 386,NOLONG +\c JMP mem64 X64 +\c JMPE imm IA64 +\c JMPE imm16 IA64 +\c JMPE imm32 IA64 +\c JMPE rm16 IA64 +\c JMPE rm32 IA64 +\c LAHF 8086 +\c LAR reg16,mem 286,PROT,SW +\c LAR reg16,reg16 286,PROT +\c LAR reg16,reg32 386,PROT +\c LAR reg16,reg64 X64,PROT,ND +\c LAR reg32,mem 386,PROT,SW +\c LAR reg32,reg16 386,PROT +\c LAR reg32,reg32 386,PROT +\c LAR reg32,reg64 X64,PROT,ND +\c LAR reg64,mem X64,PROT,SW +\c LAR reg64,reg16 X64,PROT +\c LAR reg64,reg32 X64,PROT +\c LAR reg64,reg64 X64,PROT +\c LDS reg16,mem 8086,NOLONG +\c LDS reg32,mem 386,NOLONG +\c LEA reg16,mem 8086 +\c LEA reg32,mem 386 +\c LEA reg64,mem X64 +\c LEAVE 186 +\c LES reg16,mem 8086,NOLONG +\c LES reg32,mem 386,NOLONG +\c LFENCE X64,AMD +\c LFS reg16,mem 386 +\c LFS reg32,mem 386 +\c LGDT mem 286,PRIV +\c LGS reg16,mem 386 +\c LGS reg32,mem 386 +\c LIDT mem 286,PRIV +\c LLDT mem 286,PROT,PRIV +\c LLDT mem16 286,PROT,PRIV +\c LLDT reg16 286,PROT,PRIV +\c LMSW mem 286,PRIV +\c LMSW mem16 286,PRIV +\c LMSW reg16 286,PRIV +\c LOADALL 386,UNDOC +\c LOADALL286 286,UNDOC +\c LODSB 8086 +\c LODSD 386 +\c LODSQ X64 +\c LODSW 8086 +\c LOOP imm 8086 +\c LOOP imm,reg_cx 8086,NOLONG +\c LOOP imm,reg_ecx 386 +\c LOOP imm,reg_rcx X64 +\c LOOPE imm 8086 +\c LOOPE imm,reg_cx 8086,NOLONG +\c LOOPE imm,reg_ecx 386 +\c LOOPE imm,reg_rcx X64 +\c LOOPNE imm 8086 +\c LOOPNE imm,reg_cx 8086,NOLONG +\c LOOPNE imm,reg_ecx 386 +\c LOOPNE imm,reg_rcx X64 +\c LOOPNZ imm 8086 +\c LOOPNZ imm,reg_cx 8086,NOLONG +\c LOOPNZ imm,reg_ecx 386 +\c LOOPNZ imm,reg_rcx X64 +\c LOOPZ imm 8086 +\c LOOPZ imm,reg_cx 8086,NOLONG +\c LOOPZ imm,reg_ecx 386 +\c LOOPZ imm,reg_rcx X64 +\c LSL reg16,mem 286,PROT,SW +\c LSL reg16,reg16 286,PROT +\c LSL reg16,reg32 386,PROT +\c LSL reg16,reg64 X64,PROT,ND +\c LSL reg32,mem 386,PROT,SW +\c LSL reg32,reg16 386,PROT +\c LSL reg32,reg32 386,PROT +\c LSL reg32,reg64 X64,PROT,ND +\c LSL reg64,mem X64,PROT,SW +\c LSL reg64,reg16 X64,PROT +\c LSL reg64,reg32 X64,PROT +\c LSL reg64,reg64 X64,PROT +\c LSS reg16,mem 386 +\c LSS reg32,mem 386 +\c LTR mem 286,PROT,PRIV +\c LTR mem16 286,PROT,PRIV +\c LTR reg16 286,PROT,PRIV +\c MFENCE X64,AMD +\c MONITOR PRESCOTT +\c MONITOR reg_eax,reg_ecx,reg_edx PRESCOTT,ND +\c MONITOR reg_rax,reg_ecx,reg_edx X64,ND +\c MOV mem,reg_sreg 8086 +\c MOV reg16,reg_sreg 8086 +\c MOV reg32,reg_sreg 386 +\c MOV reg_sreg,mem 8086 +\c MOV reg_sreg,reg16 8086 +\c MOV reg_sreg,reg32 386 +\c MOV reg_al,mem_offs 8086 +\c MOV reg_ax,mem_offs 8086 +\c MOV reg_eax,mem_offs 386 +\c MOV reg_rax,mem_offs X64 +\c MOV mem_offs,reg_al 8086 +\c MOV mem_offs,reg_ax 8086 +\c MOV mem_offs,reg_eax 386 +\c MOV mem_offs,reg_rax X64 +\c MOV reg32,reg_creg 386,PRIV,NOLONG +\c MOV reg64,reg_creg X64,PRIV +\c MOV reg_creg,reg32 386,PRIV,NOLONG +\c MOV reg_creg,reg64 X64,PRIV +\c MOV reg32,reg_dreg 386,PRIV,NOLONG +\c MOV reg64,reg_dreg X64,PRIV +\c MOV reg_dreg,reg32 386,PRIV,NOLONG +\c MOV reg_dreg,reg64 X64,PRIV +\c MOV reg32,reg_treg 386,NOLONG,ND +\c MOV reg_treg,reg32 386,NOLONG,ND +\c MOV mem,reg8 8086 +\c MOV reg8,reg8 8086 +\c MOV mem,reg16 8086 +\c MOV reg16,reg16 8086 +\c MOV mem,reg32 386 +\c MOV reg32,reg32 386 +\c MOV mem,reg64 X64 +\c MOV reg64,reg64 X64 +\c MOV reg8,mem 8086 +\c MOV reg8,reg8 8086 +\c MOV reg16,mem 8086 +\c MOV reg16,reg16 8086 +\c MOV reg32,mem 386 +\c MOV reg32,reg32 386 +\c MOV reg64,mem X64 +\c MOV reg64,reg64 X64 +\c MOV reg8,imm 8086 +\c MOV reg16,imm 8086 +\c MOV reg32,imm 386 +\c MOV reg64,imm X64 +\c MOV reg64,imm32 X64 +\c MOV rm8,imm 8086 +\c MOV rm16,imm 8086 +\c MOV rm32,imm 386 +\c MOV rm64,imm X64 +\c MOV mem,imm8 8086 +\c MOV mem,imm16 8086 +\c MOV mem,imm32 386 +\c MOVD mmxreg,mem PENT,MMX,SD +\c MOVD mmxreg,reg32 PENT,MMX +\c MOVD mem,mmxreg PENT,MMX,SD +\c MOVD reg32,mmxreg PENT,MMX +\c MOVD xmmreg,mem X64,SD +\c MOVD xmmreg,reg32 X64 +\c MOVD mem,xmmreg X64,SD +\c MOVD reg32,xmmreg X64,SSE +\c MOVQ mmxreg,mmxrm PENT,MMX +\c MOVQ mmxrm,mmxreg PENT,MMX +\c MOVQ mmxreg,rm64 X64,MMX +\c MOVQ rm64,mmxreg X64,MMX +\c MOVSB 8086 +\c MOVSD 386 +\c MOVSQ X64 +\c MOVSW 8086 +\c MOVSX reg16,mem 386 +\c MOVSX reg16,reg8 386 +\c MOVSX reg32,rm8 386 +\c MOVSX reg32,rm16 386 +\c MOVSX reg64,rm8 X64 +\c MOVSX reg64,rm16 X64 +\c MOVSXD reg64,rm32 X64 +\c MOVSX reg64,rm32 X64,ND +\c MOVZX reg16,mem 386 +\c MOVZX reg16,reg8 386 +\c MOVZX reg32,rm8 386 +\c MOVZX reg32,rm16 386 +\c MOVZX reg64,rm8 X64 +\c MOVZX reg64,rm16 X64 +\c MUL rm8 8086 +\c MUL rm16 8086 +\c MUL rm32 386 +\c MUL rm64 X64 +\c MWAIT PRESCOTT +\c MWAIT reg_eax,reg_ecx PRESCOTT,ND +\c NEG rm8 8086 +\c NEG rm16 8086 +\c NEG rm32 386 +\c NEG rm64 X64 +\c NOP 8086 +\c NOP rm16 P6 +\c NOP rm32 P6 +\c NOP rm64 X64 +\c NOT rm8 8086 +\c NOT rm16 8086 +\c NOT rm32 386 +\c NOT rm64 X64 +\c OR mem,reg8 8086 +\c OR reg8,reg8 8086 +\c OR mem,reg16 8086 +\c OR reg16,reg16 8086 +\c OR mem,reg32 386 +\c OR reg32,reg32 386 +\c OR mem,reg64 X64 +\c OR reg64,reg64 X64 +\c OR reg8,mem 8086 +\c OR reg8,reg8 8086 +\c OR reg16,mem 8086 +\c OR reg16,reg16 8086 +\c OR reg32,mem 386 +\c OR reg32,reg32 386 +\c OR reg64,mem X64 +\c OR reg64,reg64 X64 +\c OR rm16,imm8 8086 +\c OR rm32,imm8 386 +\c OR rm64,imm8 X64 +\c OR reg_al,imm 8086 +\c OR reg_ax,sbyte16 8086 +\c OR reg_ax,imm 8086 +\c OR reg_eax,sbyte32 386 +\c OR reg_eax,imm 386 +\c OR reg_rax,sbyte64 X64 +\c OR reg_rax,imm X64 +\c OR rm8,imm 8086 +\c OR rm16,imm 8086 +\c OR rm32,imm 386 +\c OR rm64,imm X64 +\c OR mem,imm8 8086 +\c OR mem,imm16 8086 +\c OR mem,imm32 386 +\c OUT imm,reg_al 8086 +\c OUT imm,reg_ax 8086 +\c OUT imm,reg_eax 386 +\c OUT reg_dx,reg_al 8086 +\c OUT reg_dx,reg_ax 8086 +\c OUT reg_dx,reg_eax 386 +\c OUTSB 186 +\c OUTSD 386 +\c OUTSW 186 +\c PACKSSDW mmxreg,mmxrm PENT,MMX +\c PACKSSWB mmxreg,mmxrm PENT,MMX +\c PACKUSWB mmxreg,mmxrm PENT,MMX +\c PADDB mmxreg,mmxrm PENT,MMX +\c PADDD mmxreg,mmxrm PENT,MMX +\c PADDSB mmxreg,mmxrm PENT,MMX +\c PADDSIW mmxreg,mmxrm PENT,MMX,CYRIX +\c PADDSW mmxreg,mmxrm PENT,MMX +\c PADDUSB mmxreg,mmxrm PENT,MMX +\c PADDUSW mmxreg,mmxrm PENT,MMX +\c PADDW mmxreg,mmxrm PENT,MMX +\c PAND mmxreg,mmxrm PENT,MMX +\c PANDN mmxreg,mmxrm PENT,MMX +\c PAUSE 8086 +\c PAVEB mmxreg,mmxrm PENT,MMX,CYRIX +\c PAVGUSB mmxreg,mmxrm PENT,3DNOW +\c PCMPEQB mmxreg,mmxrm PENT,MMX +\c PCMPEQD mmxreg,mmxrm PENT,MMX +\c PCMPEQW mmxreg,mmxrm PENT,MMX +\c PCMPGTB mmxreg,mmxrm PENT,MMX +\c PCMPGTD mmxreg,mmxrm PENT,MMX +\c PCMPGTW mmxreg,mmxrm PENT,MMX +\c PDISTIB mmxreg,mem PENT,MMX,CYRIX +\c PF2ID mmxreg,mmxrm PENT,3DNOW +\c PFACC mmxreg,mmxrm PENT,3DNOW +\c PFADD mmxreg,mmxrm PENT,3DNOW +\c PFCMPEQ mmxreg,mmxrm PENT,3DNOW +\c PFCMPGE mmxreg,mmxrm PENT,3DNOW +\c PFCMPGT mmxreg,mmxrm PENT,3DNOW +\c PFMAX mmxreg,mmxrm PENT,3DNOW +\c PFMIN mmxreg,mmxrm PENT,3DNOW +\c PFMUL mmxreg,mmxrm PENT,3DNOW +\c PFRCP mmxreg,mmxrm PENT,3DNOW +\c PFRCPIT1 mmxreg,mmxrm PENT,3DNOW +\c PFRCPIT2 mmxreg,mmxrm PENT,3DNOW +\c PFRSQIT1 mmxreg,mmxrm PENT,3DNOW +\c PFRSQRT mmxreg,mmxrm PENT,3DNOW +\c PFSUB mmxreg,mmxrm PENT,3DNOW +\c PFSUBR mmxreg,mmxrm PENT,3DNOW +\c PI2FD mmxreg,mmxrm PENT,3DNOW +\c PMACHRIW mmxreg,mem PENT,MMX,CYRIX +\c PMADDWD mmxreg,mmxrm PENT,MMX +\c PMAGW mmxreg,mmxrm PENT,MMX,CYRIX +\c PMULHRIW mmxreg,mmxrm PENT,MMX,CYRIX +\c PMULHRWA mmxreg,mmxrm PENT,3DNOW +\c PMULHRWC mmxreg,mmxrm PENT,MMX,CYRIX +\c PMULHW mmxreg,mmxrm PENT,MMX +\c PMULLW mmxreg,mmxrm PENT,MMX +\c PMVGEZB mmxreg,mem PENT,MMX,CYRIX +\c PMVLZB mmxreg,mem PENT,MMX,CYRIX +\c PMVNZB mmxreg,mem PENT,MMX,CYRIX +\c PMVZB mmxreg,mem PENT,MMX,CYRIX +\c POP reg16 8086 +\c POP reg32 386,NOLONG +\c POP reg64 X64 +\c POP rm16 8086 +\c POP rm32 386,NOLONG +\c POP rm64 X64 +\c POP reg_cs 8086,UNDOC,ND +\c POP reg_dess 8086,NOLONG +\c POP reg_fsgs 386 +\c POPA 186,NOLONG +\c POPAD 386,NOLONG +\c POPAW 186,NOLONG +\c POPF 8086 +\c POPFD 386,NOLONG +\c POPFQ X64 +\c POPFW 8086 +\c POR mmxreg,mmxrm PENT,MMX +\c PREFETCH mem PENT,3DNOW +\c PREFETCHW mem PENT,3DNOW +\c PSLLD mmxreg,mmxrm PENT,MMX +\c PSLLD mmxreg,imm PENT,MMX +\c PSLLQ mmxreg,mmxrm PENT,MMX +\c PSLLQ mmxreg,imm PENT,MMX +\c PSLLW mmxreg,mmxrm PENT,MMX +\c PSLLW mmxreg,imm PENT,MMX +\c PSRAD mmxreg,mmxrm PENT,MMX +\c PSRAD mmxreg,imm PENT,MMX +\c PSRAW mmxreg,mmxrm PENT,MMX +\c PSRAW mmxreg,imm PENT,MMX +\c PSRLD mmxreg,mmxrm PENT,MMX +\c PSRLD mmxreg,imm PENT,MMX +\c PSRLQ mmxreg,mmxrm PENT,MMX +\c PSRLQ mmxreg,imm PENT,MMX +\c PSRLW mmxreg,mmxrm PENT,MMX +\c PSRLW mmxreg,imm PENT,MMX +\c PSUBB mmxreg,mmxrm PENT,MMX +\c PSUBD mmxreg,mmxrm PENT,MMX +\c PSUBSB mmxreg,mmxrm PENT,MMX +\c PSUBSIW mmxreg,mmxrm PENT,MMX,CYRIX +\c PSUBSW mmxreg,mmxrm PENT,MMX +\c PSUBUSB mmxreg,mmxrm PENT,MMX +\c PSUBUSW mmxreg,mmxrm PENT,MMX +\c PSUBW mmxreg,mmxrm PENT,MMX +\c PUNPCKHBW mmxreg,mmxrm PENT,MMX +\c PUNPCKHDQ mmxreg,mmxrm PENT,MMX +\c PUNPCKHWD mmxreg,mmxrm PENT,MMX +\c PUNPCKLBW mmxreg,mmxrm PENT,MMX +\c PUNPCKLDQ mmxreg,mmxrm PENT,MMX +\c PUNPCKLWD mmxreg,mmxrm PENT,MMX +\c PUSH reg16 8086 +\c PUSH reg32 386,NOLONG +\c PUSH reg64 X64 +\c PUSH rm16 8086 +\c PUSH rm32 386,NOLONG +\c PUSH rm64 X64 +\c PUSH reg_cs 8086,NOLONG +\c PUSH reg_dess 8086,NOLONG +\c PUSH reg_fsgs 386 +\c PUSH imm8 186 +\c PUSH imm16 186,AR0,SZ +\c PUSH imm32 386,NOLONG,AR0,SZ +\c PUSH imm32 386,NOLONG,SD +\c PUSH imm64 X64,AR0,SZ +\c PUSHA 186,NOLONG +\c PUSHAD 386,NOLONG +\c PUSHAW 186,NOLONG +\c PUSHF 8086 +\c PUSHFD 386,NOLONG +\c PUSHFQ X64 +\c PUSHFW 8086 +\c PXOR mmxreg,mmxrm PENT,MMX +\c RCL rm8,unity 8086 +\c RCL rm8,reg_cl 8086 +\c RCL rm8,imm 186 +\c RCL rm16,unity 8086 +\c RCL rm16,reg_cl 8086 +\c RCL rm16,imm 186 +\c RCL rm32,unity 386 +\c RCL rm32,reg_cl 386 +\c RCL rm32,imm 386 +\c RCL rm64,unity X64 +\c RCL rm64,reg_cl X64 +\c RCL rm64,imm X64 +\c RCR rm8,unity 8086 +\c RCR rm8,reg_cl 8086 +\c RCR rm8,imm 186 +\c RCR rm16,unity 8086 +\c RCR rm16,reg_cl 8086 +\c RCR rm16,imm 186 +\c RCR rm32,unity 386 +\c RCR rm32,reg_cl 386 +\c RCR rm32,imm 386 +\c RCR rm64,unity X64 +\c RCR rm64,reg_cl X64 +\c RCR rm64,imm X64 +\c RDSHR rm32 P6,CYRIXM +\c RDMSR PENT,PRIV +\c RDPMC P6 +\c RDTSC PENT +\c RDTSCP X86_64 +\c RET 8086 +\c RET imm 8086,SW +\c RETF 8086 +\c RETF imm 8086,SW +\c RETN 8086 +\c RETN imm 8086,SW +\c ROL rm8,unity 8086 +\c ROL rm8,reg_cl 8086 +\c ROL rm8,imm 186 +\c ROL rm16,unity 8086 +\c ROL rm16,reg_cl 8086 +\c ROL rm16,imm 186 +\c ROL rm32,unity 386 +\c ROL rm32,reg_cl 386 +\c ROL rm32,imm 386 +\c ROL rm64,unity X64 +\c ROL rm64,reg_cl X64 +\c ROL rm64,imm X64 +\c ROR rm8,unity 8086 +\c ROR rm8,reg_cl 8086 +\c ROR rm8,imm 186 +\c ROR rm16,unity 8086 +\c ROR rm16,reg_cl 8086 +\c ROR rm16,imm 186 +\c ROR rm32,unity 386 +\c ROR rm32,reg_cl 386 +\c ROR rm32,imm 386 +\c ROR rm64,unity X64 +\c ROR rm64,reg_cl X64 +\c ROR rm64,imm X64 +\c RDM P6,CYRIX,ND +\c RSDC reg_sreg,mem80 486,CYRIXM +\c RSLDT mem80 486,CYRIXM +\c RSM PENTM +\c RSTS mem80 486,CYRIXM +\c SAHF 8086 +\c SAL rm8,unity 8086,ND +\c SAL rm8,reg_cl 8086,ND +\c SAL rm8,imm 186,ND +\c SAL rm16,unity 8086,ND +\c SAL rm16,reg_cl 8086,ND +\c SAL rm16,imm 186,ND +\c SAL rm32,unity 386,ND +\c SAL rm32,reg_cl 386,ND +\c SAL rm32,imm 386,ND +\c SAL rm64,unity X64,ND +\c SAL rm64,reg_cl X64,ND +\c SAL rm64,imm X64,ND +\c SALC 8086,UNDOC +\c SAR rm8,unity 8086 +\c SAR rm8,reg_cl 8086 +\c SAR rm8,imm 186 +\c SAR rm16,unity 8086 +\c SAR rm16,reg_cl 8086 +\c SAR rm16,imm 186 +\c SAR rm32,unity 386 +\c SAR rm32,reg_cl 386 +\c SAR rm32,imm 386 +\c SAR rm64,unity X64 +\c SAR rm64,reg_cl X64 +\c SAR rm64,imm X64 +\c SBB mem,reg8 8086 +\c SBB reg8,reg8 8086 +\c SBB mem,reg16 8086 +\c SBB reg16,reg16 8086 +\c SBB mem,reg32 386 +\c SBB reg32,reg32 386 +\c SBB mem,reg64 X64 +\c SBB reg64,reg64 X64 +\c SBB reg8,mem 8086 +\c SBB reg8,reg8 8086 +\c SBB reg16,mem 8086 +\c SBB reg16,reg16 8086 +\c SBB reg32,mem 386 +\c SBB reg32,reg32 386 +\c SBB reg64,mem X64 +\c SBB reg64,reg64 X64 +\c SBB rm16,imm8 8086 +\c SBB rm32,imm8 386 +\c SBB rm64,imm8 X64 +\c SBB reg_al,imm 8086 +\c SBB reg_ax,sbyte16 8086 +\c SBB reg_ax,imm 8086 +\c SBB reg_eax,sbyte32 386 +\c SBB reg_eax,imm 386 +\c SBB reg_rax,sbyte64 X64 +\c SBB reg_rax,imm X64 +\c SBB rm8,imm 8086 +\c SBB rm16,imm 8086 +\c SBB rm32,imm 386 +\c SBB rm64,imm X64 +\c SBB mem,imm8 8086 +\c SBB mem,imm16 8086 +\c SBB mem,imm32 386 +\c SCASB 8086 +\c SCASD 386 +\c SCASQ X64 +\c SCASW 8086 +\c SFENCE X64,AMD +\c SGDT mem 286 +\c SHL rm8,unity 8086 +\c SHL rm8,reg_cl 8086 +\c SHL rm8,imm 186 +\c SHL rm16,unity 8086 +\c SHL rm16,reg_cl 8086 +\c SHL rm16,imm 186 +\c SHL rm32,unity 386 +\c SHL rm32,reg_cl 386 +\c SHL rm32,imm 386 +\c SHL rm64,unity X64 +\c SHL rm64,reg_cl X64 +\c SHL rm64,imm X64 +\c SHLD mem,reg16,imm 3862 +\c SHLD reg16,reg16,imm 3862 +\c SHLD mem,reg32,imm 3862 +\c SHLD reg32,reg32,imm 3862 +\c SHLD mem,reg64,imm X642 +\c SHLD reg64,reg64,imm X642 +\c SHLD mem,reg16,reg_cl 386 +\c SHLD reg16,reg16,reg_cl 386 +\c SHLD mem,reg32,reg_cl 386 +\c SHLD reg32,reg32,reg_cl 386 +\c SHLD mem,reg64,reg_cl X64 +\c SHLD reg64,reg64,reg_cl X64 +\c SHR rm8,unity 8086 +\c SHR rm8,reg_cl 8086 +\c SHR rm8,imm 186 +\c SHR rm16,unity 8086 +\c SHR rm16,reg_cl 8086 +\c SHR rm16,imm 186 +\c SHR rm32,unity 386 +\c SHR rm32,reg_cl 386 +\c SHR rm32,imm 386 +\c SHR rm64,unity X64 +\c SHR rm64,reg_cl X64 +\c SHR rm64,imm X64 +\c SHRD mem,reg16,imm 3862 +\c SHRD reg16,reg16,imm 3862 +\c SHRD mem,reg32,imm 3862 +\c SHRD reg32,reg32,imm 3862 +\c SHRD mem,reg64,imm X642 +\c SHRD reg64,reg64,imm X642 +\c SHRD mem,reg16,reg_cl 386 +\c SHRD reg16,reg16,reg_cl 386 +\c SHRD mem,reg32,reg_cl 386 +\c SHRD reg32,reg32,reg_cl 386 +\c SHRD mem,reg64,reg_cl X64 +\c SHRD reg64,reg64,reg_cl X64 +\c SIDT mem 286 +\c SLDT mem 286 +\c SLDT mem16 286 +\c SLDT reg16 286 +\c SLDT reg32 386 +\c SLDT reg64 X64,ND +\c SLDT reg64 X64 +\c SKINIT X64 +\c SMI 386,UNDOC +\c SMINT P6,CYRIX,ND +\c SMINTOLD 486,CYRIX,ND +\c SMSW mem 286 +\c SMSW mem16 286 +\c SMSW reg16 286 +\c SMSW reg32 386 +\c STC 8086 +\c STD 8086 +\c STGI X64 +\c STI 8086 +\c STOSB 8086 +\c STOSD 386 +\c STOSQ X64 +\c STOSW 8086 +\c STR mem 286,PROT +\c STR mem16 286,PROT +\c STR reg16 286,PROT +\c STR reg32 386,PROT +\c STR reg64 X64 +\c SUB mem,reg8 8086 +\c SUB reg8,reg8 8086 +\c SUB mem,reg16 8086 +\c SUB reg16,reg16 8086 +\c SUB mem,reg32 386 +\c SUB reg32,reg32 386 +\c SUB mem,reg64 X64 +\c SUB reg64,reg64 X64 +\c SUB reg8,mem 8086 +\c SUB reg8,reg8 8086 +\c SUB reg16,mem 8086 +\c SUB reg16,reg16 8086 +\c SUB reg32,mem 386 +\c SUB reg32,reg32 386 +\c SUB reg64,mem X64 +\c SUB reg64,reg64 X64 +\c SUB rm16,imm8 8086 +\c SUB rm32,imm8 386 +\c SUB rm64,imm8 X64 +\c SUB reg_al,imm 8086 +\c SUB reg_ax,sbyte16 8086 +\c SUB reg_ax,imm 8086 +\c SUB reg_eax,sbyte32 386 +\c SUB reg_eax,imm 386 +\c SUB reg_rax,sbyte64 X64 +\c SUB reg_rax,imm X64 +\c SUB rm8,imm 8086 +\c SUB rm16,imm 8086 +\c SUB rm32,imm 386 +\c SUB rm64,imm X64 +\c SUB mem,imm8 8086 +\c SUB mem,imm16 8086 +\c SUB mem,imm32 386 +\c SVDC mem80,reg_sreg 486,CYRIXM +\c SVLDT mem80 486,CYRIXM,ND +\c SVTS mem80 486,CYRIXM +\c SWAPGS X64 +\c SYSCALL P6,AMD +\c SYSENTER P6 +\c SYSEXIT P6,PRIV +\c SYSRET P6,PRIV,AMD +\c TEST mem,reg8 8086 +\c TEST reg8,reg8 8086 +\c TEST mem,reg16 8086 +\c TEST reg16,reg16 8086 +\c TEST mem,reg32 386 +\c TEST reg32,reg32 386 +\c TEST mem,reg64 X64 +\c TEST reg64,reg64 X64 +\c TEST reg8,mem 8086 +\c TEST reg16,mem 8086 +\c TEST reg32,mem 386 +\c TEST reg64,mem X64 +\c TEST reg_al,imm 8086 +\c TEST reg_ax,imm 8086 +\c TEST reg_eax,imm 386 +\c TEST reg_rax,imm X64 +\c TEST rm8,imm 8086 +\c TEST rm16,imm 8086 +\c TEST rm32,imm 386 +\c TEST rm64,imm X64 +\c TEST mem,imm8 8086 +\c TEST mem,imm16 8086 +\c TEST mem,imm32 386 +\c UD0 186,UNDOC +\c UD1 186,UNDOC +\c UD2B 186,UNDOC,ND +\c UD2 186 +\c UD2A 186,ND +\c UMOV mem,reg8 386,UNDOC,ND +\c UMOV reg8,reg8 386,UNDOC,ND +\c UMOV mem,reg16 386,UNDOC,ND +\c UMOV reg16,reg16 386,UNDOC,ND +\c UMOV mem,reg32 386,UNDOC,ND +\c UMOV reg32,reg32 386,UNDOC,ND +\c UMOV reg8,mem 386,UNDOC,ND +\c UMOV reg8,reg8 386,UNDOC,ND +\c UMOV reg16,mem 386,UNDOC,ND +\c UMOV reg16,reg16 386,UNDOC,ND +\c UMOV reg32,mem 386,UNDOC,ND +\c UMOV reg32,reg32 386,UNDOC,ND +\c VERR mem 286,PROT +\c VERR mem16 286,PROT +\c VERR reg16 286,PROT +\c VERW mem 286,PROT +\c VERW mem16 286,PROT +\c VERW reg16 286,PROT +\c FWAIT 8086 +\c WBINVD 486,PRIV +\c WRSHR rm32 P6,CYRIXM +\c WRMSR PENT,PRIV +\c XADD mem,reg8 486 +\c XADD reg8,reg8 486 +\c XADD mem,reg16 486 +\c XADD reg16,reg16 486 +\c XADD mem,reg32 486 +\c XADD reg32,reg32 486 +\c XADD mem,reg64 X64 +\c XADD reg64,reg64 X64 +\c XBTS reg16,mem 386,SW,UNDOC,ND +\c XBTS reg16,reg16 386,UNDOC,ND +\c XBTS reg32,mem 386,SD,UNDOC,ND +\c XBTS reg32,reg32 386,UNDOC,ND +\c XCHG reg_ax,reg16 8086 +\c XCHG reg_eax,reg32na 386 +\c XCHG reg_rax,reg64 X64 +\c XCHG reg16,reg_ax 8086 +\c XCHG reg32na,reg_eax 386 +\c XCHG reg64,reg_rax X64 +\c XCHG reg_eax,reg_eax 386,NOLONG +\c XCHG reg8,mem 8086 +\c XCHG reg8,reg8 8086 +\c XCHG reg16,mem 8086 +\c XCHG reg16,reg16 8086 +\c XCHG reg32,mem 386 +\c XCHG reg32,reg32 386 +\c XCHG reg64,mem X64 +\c XCHG reg64,reg64 X64 +\c XCHG mem,reg8 8086 +\c XCHG reg8,reg8 8086 +\c XCHG mem,reg16 8086 +\c XCHG reg16,reg16 8086 +\c XCHG mem,reg32 386 +\c XCHG reg32,reg32 386 +\c XCHG mem,reg64 X64 +\c XCHG reg64,reg64 X64 +\c XLATB 8086 +\c XLAT 8086 +\c XOR mem,reg8 8086 +\c XOR reg8,reg8 8086 +\c XOR mem,reg16 8086 +\c XOR reg16,reg16 8086 +\c XOR mem,reg32 386 +\c XOR reg32,reg32 386 +\c XOR mem,reg64 X64 +\c XOR reg64,reg64 X64 +\c XOR reg8,mem 8086 +\c XOR reg8,reg8 8086 +\c XOR reg16,mem 8086 +\c XOR reg16,reg16 8086 +\c XOR reg32,mem 386 +\c XOR reg32,reg32 386 +\c XOR reg64,mem X64 +\c XOR reg64,reg64 X64 +\c XOR rm16,imm8 8086 +\c XOR rm32,imm8 386 +\c XOR rm64,imm8 X64 +\c XOR reg_al,imm 8086 +\c XOR reg_ax,sbyte16 8086 +\c XOR reg_ax,imm 8086 +\c XOR reg_eax,sbyte32 386 +\c XOR reg_eax,imm 386 +\c XOR reg_rax,sbyte64 X64 +\c XOR reg_rax,imm X64 +\c XOR rm8,imm 8086 +\c XOR rm16,imm 8086 +\c XOR rm32,imm 386 +\c XOR rm64,imm X64 +\c XOR mem,imm8 8086 +\c XOR mem,imm16 8086 +\c XOR mem,imm32 386 +\c CMOVcc reg16,mem P6 +\c CMOVcc reg16,reg16 P6 +\c CMOVcc reg32,mem P6 +\c CMOVcc reg32,reg32 P6 +\c CMOVcc reg64,mem X64 +\c CMOVcc reg64,reg64 X64 +\c Jcc imm|near 386 +\c Jcc imm16|near 386 +\c Jcc imm32|near 386 +\c Jcc imm|short 8086,ND +\c Jcc imm 8086,ND +\c Jcc imm 386,ND +\c Jcc imm 8086,ND +\c Jcc imm 8086 +\c SETcc mem 386 +\c SETcc reg8 386 + +\S{} Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2) + +\c ADDPS xmmreg,xmmrm KATMAI,SSE +\c ADDSS xmmreg,xmmrm KATMAI,SSE,SD +\c ANDNPS xmmreg,xmmrm KATMAI,SSE +\c ANDPS xmmreg,xmmrm KATMAI,SSE +\c CMPEQPS xmmreg,xmmrm KATMAI,SSE +\c CMPEQSS xmmreg,xmmrm KATMAI,SSE +\c CMPLEPS xmmreg,xmmrm KATMAI,SSE +\c CMPLESS xmmreg,xmmrm KATMAI,SSE +\c CMPLTPS xmmreg,xmmrm KATMAI,SSE +\c CMPLTSS xmmreg,xmmrm KATMAI,SSE +\c CMPNEQPS xmmreg,xmmrm KATMAI,SSE +\c CMPNEQSS xmmreg,xmmrm KATMAI,SSE +\c CMPNLEPS xmmreg,xmmrm KATMAI,SSE +\c CMPNLESS xmmreg,xmmrm KATMAI,SSE +\c CMPNLTPS xmmreg,xmmrm KATMAI,SSE +\c CMPNLTSS xmmreg,xmmrm KATMAI,SSE +\c CMPORDPS xmmreg,xmmrm KATMAI,SSE +\c CMPORDSS xmmreg,xmmrm KATMAI,SSE +\c CMPUNORDPS xmmreg,xmmrm KATMAI,SSE +\c CMPUNORDSS xmmreg,xmmrm KATMAI,SSE +\c CMPPS xmmreg,mem,imm KATMAI,SSE +\c CMPPS xmmreg,xmmreg,imm KATMAI,SSE +\c CMPSS xmmreg,mem,imm KATMAI,SSE +\c CMPSS xmmreg,xmmreg,imm KATMAI,SSE +\c COMISS xmmreg,xmmrm KATMAI,SSE +\c CVTPI2PS xmmreg,mmxrm KATMAI,SSE,MMX +\c CVTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX +\c CVTSI2SS xmmreg,mem KATMAI,SSE,SD,AR1,ND +\c CVTSI2SS xmmreg,rm32 KATMAI,SSE,SD,AR1 +\c CVTSI2SS xmmreg,rm64 X64,SSE,AR1 +\c CVTSS2SI reg32,xmmreg KATMAI,SSE,SD,AR1 +\c CVTSS2SI reg32,mem KATMAI,SSE,SD,AR1 +\c CVTSS2SI reg64,xmmreg X64,SSE,SD,AR1 +\c CVTSS2SI reg64,mem X64,SSE,SD,AR1 +\c CVTTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX +\c CVTTSS2SI reg32,xmmrm KATMAI,SSE,SD,AR1 +\c CVTTSS2SI reg64,xmmrm X64,SSE,SD,AR1 +\c DIVPS xmmreg,xmmrm KATMAI,SSE +\c DIVSS xmmreg,xmmrm KATMAI,SSE +\c LDMXCSR mem KATMAI,SSE,SD +\c MAXPS xmmreg,xmmrm KATMAI,SSE +\c MAXSS xmmreg,xmmrm KATMAI,SSE +\c MINPS xmmreg,xmmrm KATMAI,SSE +\c MINSS xmmreg,xmmrm KATMAI,SSE +\c MOVAPS xmmreg,mem KATMAI,SSE +\c MOVAPS mem,xmmreg KATMAI,SSE +\c MOVAPS xmmreg,xmmreg KATMAI,SSE +\c MOVAPS xmmreg,xmmreg KATMAI,SSE +\c MOVHPS xmmreg,mem KATMAI,SSE +\c MOVHPS mem,xmmreg KATMAI,SSE +\c MOVLHPS xmmreg,xmmreg KATMAI,SSE +\c MOVLPS xmmreg,mem KATMAI,SSE +\c MOVLPS mem,xmmreg KATMAI,SSE +\c MOVHLPS xmmreg,xmmreg KATMAI,SSE +\c MOVMSKPS reg32,xmmreg KATMAI,SSE +\c MOVMSKPS reg64,xmmreg X64,SSE +\c MOVNTPS mem,xmmreg KATMAI,SSE +\c MOVSS xmmreg,mem KATMAI,SSE +\c MOVSS mem,xmmreg KATMAI,SSE +\c MOVSS xmmreg,xmmreg KATMAI,SSE +\c MOVSS xmmreg,xmmreg KATMAI,SSE +\c MOVUPS xmmreg,mem KATMAI,SSE +\c MOVUPS mem,xmmreg KATMAI,SSE +\c MOVUPS xmmreg,xmmreg KATMAI,SSE +\c MOVUPS xmmreg,xmmreg KATMAI,SSE +\c MULPS xmmreg,xmmrm KATMAI,SSE +\c MULSS xmmreg,xmmrm KATMAI,SSE +\c ORPS xmmreg,xmmrm KATMAI,SSE +\c RCPPS xmmreg,xmmrm KATMAI,SSE +\c RCPSS xmmreg,xmmrm KATMAI,SSE +\c RSQRTPS xmmreg,xmmrm KATMAI,SSE +\c RSQRTSS xmmreg,xmmrm KATMAI,SSE +\c SHUFPS xmmreg,mem,imm KATMAI,SSE +\c SHUFPS xmmreg,xmmreg,imm KATMAI,SSE +\c SQRTPS xmmreg,xmmrm KATMAI,SSE +\c SQRTSS xmmreg,xmmrm KATMAI,SSE +\c STMXCSR mem KATMAI,SSE,SD +\c SUBPS xmmreg,xmmrm KATMAI,SSE +\c SUBSS xmmreg,xmmrm KATMAI,SSE +\c UCOMISS xmmreg,xmmrm KATMAI,SSE +\c UNPCKHPS xmmreg,xmmrm KATMAI,SSE +\c UNPCKLPS xmmreg,xmmrm KATMAI,SSE +\c XORPS xmmreg,xmmrm KATMAI,SSE + +\S{} Introduced in Deschutes but necessary for SSE support + +\c FXRSTOR mem P6,SSE,FPU +\c FXSAVE mem P6,SSE,FPU + +\S{} XSAVE group (AVX and extended state) + +\c XGETBV NEHALEM +\c XSETBV NEHALEM,PRIV +\c XSAVE mem NEHALEM +\c XRSTOR mem NEHALEM + +\S{} Generic memory operations + +\c PREFETCHNTA mem KATMAI +\c PREFETCHT0 mem KATMAI +\c PREFETCHT1 mem KATMAI +\c PREFETCHT2 mem KATMAI +\c SFENCE KATMAI + +\S{} New MMX instructions introduced in Katmai + +\c MASKMOVQ mmxreg,mmxreg KATMAI,MMX +\c MOVNTQ mem,mmxreg KATMAI,MMX +\c PAVGB mmxreg,mmxrm KATMAI,MMX +\c PAVGW mmxreg,mmxrm KATMAI,MMX +\c PEXTRW reg32,mmxreg,imm KATMAI,MMX +\c PINSRW mmxreg,mem,imm KATMAI,MMX +\c PINSRW mmxreg,rm16,imm KATMAI,MMX +\c PINSRW mmxreg,reg32,imm KATMAI,MMX +\c PMAXSW mmxreg,mmxrm KATMAI,MMX +\c PMAXUB mmxreg,mmxrm KATMAI,MMX +\c PMINSW mmxreg,mmxrm KATMAI,MMX +\c PMINUB mmxreg,mmxrm KATMAI,MMX +\c PMOVMSKB reg32,mmxreg KATMAI,MMX +\c PMULHUW mmxreg,mmxrm KATMAI,MMX +\c PSADBW mmxreg,mmxrm KATMAI,MMX +\c PSHUFW mmxreg,mmxrm,imm KATMAI,MMX2 + +\S{} AMD Enhanced 3DNow! (Athlon) instructions + +\c PF2IW mmxreg,mmxrm PENT,3DNOW +\c PFNACC mmxreg,mmxrm PENT,3DNOW +\c PFPNACC mmxreg,mmxrm PENT,3DNOW +\c PI2FW mmxreg,mmxrm PENT,3DNOW +\c PSWAPD mmxreg,mmxrm PENT,3DNOW + +\S{} Willamette SSE2 Cacheability Instructions + +\c MASKMOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +\c CLFLUSH mem WILLAMETTE,SSE2 +\c MOVNTDQ mem,xmmreg WILLAMETTE,SSE2,SO +\c MOVNTI mem,reg32 WILLAMETTE,SD +\c MOVNTI mem,reg64 X64 +\c MOVNTPD mem,xmmreg WILLAMETTE,SSE2,SO +\c LFENCE WILLAMETTE,SSE2 +\c MFENCE WILLAMETTE,SSE2 + +\S{} Willamette MMX instructions (SSE2 SIMD Integer Instructions) + +\c MOVD mem,xmmreg WILLAMETTE,SSE2,SD +\c MOVD xmmreg,mem WILLAMETTE,SSE2,SD +\c MOVD xmmreg,rm32 WILLAMETTE,SSE2 +\c MOVD rm32,xmmreg WILLAMETTE,SSE2 +\c MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVDQA mem,xmmreg WILLAMETTE,SSE2,SO +\c MOVDQA xmmreg,mem WILLAMETTE,SSE2,SO +\c MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVDQU mem,xmmreg WILLAMETTE,SSE2,SO +\c MOVDQU xmmreg,mem WILLAMETTE,SSE2,SO +\c MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVDQ2Q mmxreg,xmmreg WILLAMETTE,SSE2 +\c MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVQ mem,xmmreg WILLAMETTE,SSE2 +\c MOVQ xmmreg,mem WILLAMETTE,SSE2 +\c MOVQ xmmreg,rm64 X64,SSE2 +\c MOVQ rm64,xmmreg X64,SSE2 +\c MOVQ2DQ xmmreg,mmxreg WILLAMETTE,SSE2 +\c PACKSSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PACKSSDW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PACKUSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDQ mmxreg,mmxrm WILLAMETTE,MMX +\c PADDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PADDUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PAND xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PANDN xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PAVGB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PAVGW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPEQB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPEQW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPEQD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPGTB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPGTW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PCMPGTD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PEXTRW reg32,xmmreg,imm WILLAMETTE,SSE2 +\c PINSRW xmmreg,reg16,imm WILLAMETTE,SSE2 +\c PINSRW xmmreg,reg32,imm WILLAMETTE,SSE2,ND +\c PINSRW xmmreg,mem,imm WILLAMETTE,SSE2 +\c PINSRW xmmreg,mem16,imm WILLAMETTE,SSE2 +\c PMADDWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMAXSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMAXUB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMINSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMINUB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMOVMSKB reg32,xmmreg WILLAMETTE,SSE2 +\c PMULHUW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMULHW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMULLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PMULUDQ mmxreg,mmxrm WILLAMETTE,SSE2,SO +\c PMULUDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c POR xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSADBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSHUFD xmmreg,xmmreg,imm WILLAMETTE,SSE2 +\c PSHUFD xmmreg,mem,imm WILLAMETTE,SSE22 +\c PSHUFHW xmmreg,xmmreg,imm WILLAMETTE,SSE2 +\c PSHUFHW xmmreg,mem,imm WILLAMETTE,SSE22 +\c PSHUFLW xmmreg,xmmreg,imm WILLAMETTE,SSE2 +\c PSHUFLW xmmreg,mem,imm WILLAMETTE,SSE22 +\c PSLLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSLLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSLLW xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSLLD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSLLD xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSLLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSLLQ xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRAW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSRAW xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRAD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSRAD xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRLW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSRLW xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRLD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSRLD xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSRLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSRLQ xmmreg,imm WILLAMETTE,SSE2,AR1 +\c PSUBB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBQ mmxreg,mmxrm WILLAMETTE,SSE2,SO +\c PSUBQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PSUBUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKHBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKHWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKHDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKHQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKLBW xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKLWD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKLDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PUNPCKLQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c PXOR xmmreg,xmmrm WILLAMETTE,SSE2,SO + +\S{} Willamette Streaming SIMD instructions (SSE2) + +\c ADDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c ADDSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c ANDNPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c ANDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPEQSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPLESD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPLTSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPNEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPNEQSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPNLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPNLESD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPNLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPNLTSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPORDSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPUNORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CMPUNORDSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CMPPD xmmreg,xmmrm,imm WILLAMETTE,SSE22 +\c CMPSD xmmreg,xmmrm,imm WILLAMETTE,SSE2 +\c COMISD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CVTDQ2PD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CVTDQ2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTPD2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTPI2PD xmmreg,mmxrm WILLAMETTE,SSE2 +\c CVTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTPS2PD xmmreg,xmmrm WILLAMETTE,SSE2 +\c CVTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 +\c CVTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 +\c CVTSD2SI reg64,xmmreg X64,SSE2,AR1 +\c CVTSD2SI reg64,mem X64,SSE2,AR1 +\c CVTSD2SS xmmreg,xmmrm WILLAMETTE,SSE2 +\c CVTSI2SD xmmreg,mem WILLAMETTE,SSE2,SD,AR1,ND +\c CVTSI2SD xmmreg,rm32 WILLAMETTE,SSE2,SD,AR1 +\c CVTSI2SD xmmreg,rm64 X64,SSE2,AR1 +\c CVTSS2SD xmmreg,xmmrm WILLAMETTE,SSE2,SD +\c CVTTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c CVTTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 +\c CVTTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 +\c CVTTSD2SI reg64,xmmreg X64,SSE2,AR1 +\c CVTTSD2SI reg64,mem X64,SSE2,AR1 +\c DIVPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c DIVSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c MAXPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c MAXSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c MINPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c MINSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVAPD mem,xmmreg WILLAMETTE,SSE2,SO +\c MOVAPD xmmreg,mem WILLAMETTE,SSE2,SO +\c MOVHPD mem,xmmreg WILLAMETTE,SSE2 +\c MOVHPD xmmreg,mem WILLAMETTE,SSE2 +\c MOVLPD mem,xmmreg WILLAMETTE,SSE2 +\c MOVLPD xmmreg,mem WILLAMETTE,SSE2 +\c MOVMSKPD reg32,xmmreg WILLAMETTE,SSE2 +\c MOVMSKPD reg64,xmmreg X64,SSE2 +\c MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVSD mem,xmmreg WILLAMETTE,SSE2 +\c MOVSD xmmreg,mem WILLAMETTE,SSE2 +\c MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 +\c MOVUPD mem,xmmreg WILLAMETTE,SSE2,SO +\c MOVUPD xmmreg,mem WILLAMETTE,SSE2,SO +\c MULPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c MULSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c ORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c SHUFPD xmmreg,xmmreg,imm WILLAMETTE,SSE2 +\c SHUFPD xmmreg,mem,imm WILLAMETTE,SSE2 +\c SQRTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c SQRTSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c SUBPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c SUBSD xmmreg,xmmrm WILLAMETTE,SSE2 +\c UCOMISD xmmreg,xmmrm WILLAMETTE,SSE2 +\c UNPCKHPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c UNPCKLPD xmmreg,xmmrm WILLAMETTE,SSE2,SO +\c XORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + +\S{} Prescott New Instructions (SSE3) + +\c ADDSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO +\c ADDSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO +\c HADDPD xmmreg,xmmrm PRESCOTT,SSE3,SO +\c HADDPS xmmreg,xmmrm PRESCOTT,SSE3,SO +\c HSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO +\c HSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO +\c LDDQU xmmreg,mem PRESCOTT,SSE3,SO +\c MOVDDUP xmmreg,xmmrm PRESCOTT,SSE3 +\c MOVSHDUP xmmreg,xmmrm PRESCOTT,SSE3 +\c MOVSLDUP xmmreg,xmmrm PRESCOTT,SSE3 + +\S{} VMX Instructions + +\c VMCALL VMX +\c VMCLEAR mem VMX +\c VMLAUNCH VMX +\c VMLOAD X64,VMX +\c VMMCALL X64,VMX +\c VMPTRLD mem VMX +\c VMPTRST mem VMX +\c VMREAD rm32,reg32 VMX,NOLONG,SD +\c VMREAD rm64,reg64 X64,VMX +\c VMRESUME VMX +\c VMRUN X64,VMX +\c VMSAVE X64,VMX +\c VMWRITE reg32,rm32 VMX,NOLONG,SD +\c VMWRITE reg64,rm64 X64,VMX +\c VMXOFF VMX +\c VMXON mem VMX + +\S{} Extended Page Tables VMX instructions + +\c INVEPT reg32,mem VMX,SO,NOLONG +\c INVEPT reg64,mem VMX,SO,LONG +\c INVVPID reg32,mem VMX,SO,NOLONG +\c INVVPID reg64,mem VMX,SO,LONG + +\S{} Tejas New Instructions (SSSE3) + +\c PABSB mmxreg,mmxrm SSSE3,MMX +\c PABSB xmmreg,xmmrm SSSE3 +\c PABSW mmxreg,mmxrm SSSE3,MMX +\c PABSW xmmreg,xmmrm SSSE3 +\c PABSD mmxreg,mmxrm SSSE3,MMX +\c PABSD xmmreg,xmmrm SSSE3 +\c PALIGNR mmxreg,mmxrm,imm SSSE3,MMX +\c PALIGNR xmmreg,xmmrm,imm SSSE3 +\c PHADDW mmxreg,mmxrm SSSE3,MMX +\c PHADDW xmmreg,xmmrm SSSE3 +\c PHADDD mmxreg,mmxrm SSSE3,MMX +\c PHADDD xmmreg,xmmrm SSSE3 +\c PHADDSW mmxreg,mmxrm SSSE3,MMX +\c PHADDSW xmmreg,xmmrm SSSE3 +\c PHSUBW mmxreg,mmxrm SSSE3,MMX +\c PHSUBW xmmreg,xmmrm SSSE3 +\c PHSUBD mmxreg,mmxrm SSSE3,MMX +\c PHSUBD xmmreg,xmmrm SSSE3 +\c PHSUBSW mmxreg,mmxrm SSSE3,MMX +\c PHSUBSW xmmreg,xmmrm SSSE3 +\c PMADDUBSW mmxreg,mmxrm SSSE3,MMX +\c PMADDUBSW xmmreg,xmmrm SSSE3 +\c PMULHRSW mmxreg,mmxrm SSSE3,MMX +\c PMULHRSW xmmreg,xmmrm SSSE3 +\c PSHUFB mmxreg,mmxrm SSSE3,MMX +\c PSHUFB xmmreg,xmmrm SSSE3 +\c PSIGNB mmxreg,mmxrm SSSE3,MMX +\c PSIGNB xmmreg,xmmrm SSSE3 +\c PSIGNW mmxreg,mmxrm SSSE3,MMX +\c PSIGNW xmmreg,xmmrm SSSE3 +\c PSIGND mmxreg,mmxrm SSSE3,MMX +\c PSIGND xmmreg,xmmrm SSSE3 + +\S{} AMD SSE4A + +\c EXTRQ xmmreg,imm,imm SSE4A,AMD +\c EXTRQ xmmreg,xmmreg SSE4A,AMD +\c INSERTQ xmmreg,xmmreg,imm,imm SSE4A,AMD +\c INSERTQ xmmreg,xmmreg SSE4A,AMD +\c MOVNTSD mem,xmmreg SSE4A,AMD +\c MOVNTSS mem,xmmreg SSE4A,AMD,SD + +\S{} New instructions in Barcelona + +\c LZCNT reg16,rm16 P6,AMD +\c LZCNT reg32,rm32 P6,AMD +\c LZCNT reg64,rm64 X64,AMD + +\S{} Penryn New Instructions (SSE4.1) + +\c BLENDPD xmmreg,xmmrm,imm SSE41 +\c BLENDPS xmmreg,xmmrm,imm SSE41 +\c BLENDVPD xmmreg,xmmrm,xmm0 SSE41 +\c BLENDVPS xmmreg,xmmrm,xmm0 SSE41 +\c DPPD xmmreg,xmmrm,imm SSE41 +\c DPPS xmmreg,xmmrm,imm SSE41 +\c EXTRACTPS rm32,xmmreg,imm SSE41 +\c EXTRACTPS reg64,xmmreg,imm SSE41,X64 +\c INSERTPS xmmreg,xmmrm,imm SSE41,SD +\c MOVNTDQA xmmreg,mem SSE41 +\c MPSADBW xmmreg,xmmrm,imm SSE41 +\c PACKUSDW xmmreg,xmmrm SSE41 +\c PBLENDVB xmmreg,xmmrm,xmm0 SSE41 +\c PBLENDW xmmreg,xmmrm,imm SSE41 +\c PCMPEQQ xmmreg,xmmrm SSE41 +\c PEXTRB reg32,xmmreg,imm SSE41 +\c PEXTRB mem8,xmmreg,imm SSE41 +\c PEXTRB reg64,xmmreg,imm SSE41,X64 +\c PEXTRD rm32,xmmreg,imm SSE41 +\c PEXTRQ rm64,xmmreg,imm SSE41,X64 +\c PEXTRW reg32,xmmreg,imm SSE41 +\c PEXTRW mem16,xmmreg,imm SSE41 +\c PEXTRW reg64,xmmreg,imm SSE41,X64 +\c PHMINPOSUW xmmreg,xmmrm SSE41 +\c PINSRB xmmreg,mem,imm SSE41 +\c PINSRB xmmreg,rm8,imm SSE41 +\c PINSRB xmmreg,reg32,imm SSE41 +\c PINSRD xmmreg,mem,imm SSE41 +\c PINSRD xmmreg,rm32,imm SSE41 +\c PINSRQ xmmreg,mem,imm SSE41,X64 +\c PINSRQ xmmreg,rm64,imm SSE41,X64 +\c PMAXSB xmmreg,xmmrm SSE41 +\c PMAXSD xmmreg,xmmrm SSE41 +\c PMAXUD xmmreg,xmmrm SSE41 +\c PMAXUW xmmreg,xmmrm SSE41 +\c PMINSB xmmreg,xmmrm SSE41 +\c PMINSD xmmreg,xmmrm SSE41 +\c PMINUD xmmreg,xmmrm SSE41 +\c PMINUW xmmreg,xmmrm SSE41 +\c PMOVSXBW xmmreg,xmmrm SSE41 +\c PMOVSXBD xmmreg,xmmrm SSE41,SD +\c PMOVSXBQ xmmreg,xmmrm SSE41,SW +\c PMOVSXWD xmmreg,xmmrm SSE41 +\c PMOVSXWQ xmmreg,xmmrm SSE41,SD +\c PMOVSXDQ xmmreg,xmmrm SSE41 +\c PMOVZXBW xmmreg,xmmrm SSE41 +\c PMOVZXBD xmmreg,xmmrm SSE41,SD +\c PMOVZXBQ xmmreg,xmmrm SSE41,SW +\c PMOVZXWD xmmreg,xmmrm SSE41 +\c PMOVZXWQ xmmreg,xmmrm SSE41,SD +\c PMOVZXDQ xmmreg,xmmrm SSE41 +\c PMULDQ xmmreg,xmmrm SSE41 +\c PMULLD xmmreg,xmmrm SSE41 +\c PTEST xmmreg,xmmrm SSE41 +\c ROUNDPD xmmreg,xmmrm,imm SSE41 +\c ROUNDPS xmmreg,xmmrm,imm SSE41 +\c ROUNDSD xmmreg,xmmrm,imm SSE41 +\c ROUNDSS xmmreg,xmmrm,imm SSE41 + +\S{} Nehalem New Instructions (SSE4.2) + +\c CRC32 reg32,rm8 SSE42 +\c CRC32 reg32,rm16 SSE42 +\c CRC32 reg32,rm32 SSE42 +\c CRC32 reg64,rm8 SSE42,X64 +\c CRC32 reg64,rm64 SSE42,X64 +\c PCMPESTRI xmmreg,xmmrm,imm SSE42 +\c PCMPESTRM xmmreg,xmmrm,imm SSE42 +\c PCMPISTRI xmmreg,xmmrm,imm SSE42 +\c PCMPISTRM xmmreg,xmmrm,imm SSE42 +\c PCMPGTQ xmmreg,xmmrm SSE42 +\c POPCNT reg16,rm16 NEHALEM,SW +\c POPCNT reg32,rm32 NEHALEM,SD +\c POPCNT reg64,rm64 NEHALEM,X64 + +\S{} Intel SMX + +\c GETSEC KATMAI + +\S{} Geode (Cyrix) 3DNow! additions + +\c PFRCPV mmxreg,mmxrm PENT,3DNOW,CYRIX +\c PFRSQRTV mmxreg,mmxrm PENT,3DNOW,CYRIX + +\S{} Intel new instructions in ??? + +\c MOVBE reg16,mem16 NEHALEM +\c MOVBE reg32,mem32 NEHALEM +\c MOVBE reg64,mem64 NEHALEM +\c MOVBE mem16,reg16 NEHALEM +\c MOVBE mem32,reg32 NEHALEM +\c MOVBE mem64,reg64 NEHALEM + +\S{} Intel AES instructions + +\c AESENC xmmreg,xmmrm128 SSE,WESTMERE +\c AESENCLAST xmmreg,xmmrm128 SSE,WESTMERE +\c AESDEC xmmreg,xmmrm128 SSE,WESTMERE +\c AESDECLAST xmmreg,xmmrm128 SSE,WESTMERE +\c AESIMC xmmreg,xmmrm128 SSE,WESTMERE +\c AESKEYGENASSIST xmmreg,xmmrm128,imm8 SSE,WESTMERE + +\S{} Intel AVX AES instructions + +\c VAESENC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VAESENCLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VAESDEC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VAESDECLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VAESIMC xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VAESKEYGENASSIST xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + +\S{} Intel AVX instructions + +\c VADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VADDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VADDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VADDSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VADDSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VADDSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VADDSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VANDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VANDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VANDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VANDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VANDNPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VANDNPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VANDNPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VANDNPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VBLENDVPD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VBLENDVPD xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE +\c VBLENDVPD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE +\c VBLENDVPS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VBLENDVPS xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE +\c VBLENDVPS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE +\c VBROADCASTSS xmmreg,mem32 AVX,SANDYBRIDGE +\c VBROADCASTSS ymmreg,mem32 AVX,SANDYBRIDGE +\c VBROADCASTSD ymmreg,mem64 AVX,SANDYBRIDGE +\c VBROADCASTF128 ymmreg,mem128 AVX,SANDYBRIDGE +\c VCMPEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VCMPEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VCMPEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPFALSESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPTRUESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE +\c VCMPEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPUNORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPFALSESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPTRUESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPLT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPLE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPGE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPGT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCMPSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +\c VCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VCVTDQ2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VCVTDQ2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE +\c VCVTDQ2PS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VCVTDQ2PS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VCVTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE +\c VCVTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO +\c VCVTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE +\c VCVTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY +\c VCVTPD2PS xmmreg,xmmreg AVX,SANDYBRIDGE +\c VCVTPD2PS xmmreg,mem128 AVX,SANDYBRIDGE,SO +\c VCVTPD2PS xmmreg,ymmreg AVX,SANDYBRIDGE +\c VCVTPD2PS xmmreg,mem256 AVX,SANDYBRIDGE,SY +\c VCVTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VCVTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VCVTPS2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VCVTPS2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE +\c VCVTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE +\c VCVTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG +\c VCVTSD2SS xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VCVTSI2SD xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD +\c VCVTSI2SD xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD +\c VCVTSI2SD xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG +\c VCVTSI2SS xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD +\c VCVTSI2SS xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD +\c VCVTSI2SS xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG +\c VCVTSS2SD xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VCVTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE +\c VCVTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG +\c VCVTTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE +\c VCVTTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO +\c VCVTTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE +\c VCVTTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY +\c VCVTTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VCVTTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VCVTTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE +\c VCVTTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG +\c VCVTTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE +\c VCVTTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG +\c VDIVPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VDIVPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VDIVPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VDIVPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VDIVSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VDIVSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VDPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VDPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VDPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VEXTRACTF128 xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +\c VEXTRACTPS rm32,xmmreg,imm8 AVX,SANDYBRIDGE +\c VHADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VHADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VHADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VHADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VHSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VHSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VHSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VHSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VINSERTF128 ymmreg,ymmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +\c VLDDQU xmmreg,mem128 AVX,SANDYBRIDGE +\c VLDQQU ymmreg,mem256 AVX,SANDYBRIDGE +\c VLDDQU ymmreg,mem256 AVX,SANDYBRIDGE +\c VLDMXCSR mem32 AVX,SANDYBRIDGE +\c VMASKMOVDQU xmmreg,xmmreg AVX,SANDYBRIDGE +\c VMASKMOVPS xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE +\c VMASKMOVPS ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE +\c VMASKMOVPS mem128,xmmreg,xmmreg AVX,SANDYBRIDGE,SO +\c VMASKMOVPS mem256,xmmreg,xmmreg AVX,SANDYBRIDGE,SY +\c VMASKMOVPD xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE +\c VMASKMOVPD ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE +\c VMASKMOVPD mem128,xmmreg,xmmreg AVX,SANDYBRIDGE +\c VMASKMOVPD mem256,ymmreg,ymmreg AVX,SANDYBRIDGE +\c VMAXPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMAXPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMAXPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMAXPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMAXSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VMAXSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VMINPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMINPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMINPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMINPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMINSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VMINSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VMOVAPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVAPD xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVAPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVAPD ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVAPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVAPS xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVAPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVAPS ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VMOVQ xmmrm64,xmmreg AVX,SANDYBRIDGE +\c VMOVQ xmmreg,rm64 AVX,SANDYBRIDGE,LONG +\c VMOVQ rm64,xmmreg AVX,SANDYBRIDGE,LONG +\c VMOVD xmmreg,rm32 AVX,SANDYBRIDGE +\c VMOVD rm32,xmmreg AVX,SANDYBRIDGE +\c VMOVDDUP xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VMOVDDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVDQA xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVDQA xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVQQA ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVQQA ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVDQA ymmreg,ymmrm AVX,SANDYBRIDGE +\c VMOVDQA ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVDQU xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVDQU xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVQQU ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVQQU ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVDQU ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVDQU ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVHLPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVHPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +\c VMOVHPD mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVHPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +\c VMOVHPS mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVLHPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVLPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +\c VMOVLPD mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVLPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE +\c VMOVLPS mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVMSKPD reg64,xmmreg AVX,SANDYBRIDGE,LONG +\c VMOVMSKPD reg32,xmmreg AVX,SANDYBRIDGE +\c VMOVMSKPD reg64,ymmreg AVX,SANDYBRIDGE,LONG +\c VMOVMSKPD reg32,ymmreg AVX,SANDYBRIDGE +\c VMOVMSKPS reg64,xmmreg AVX,SANDYBRIDGE,LONG +\c VMOVMSKPS reg32,xmmreg AVX,SANDYBRIDGE +\c VMOVMSKPS reg64,ymmreg AVX,SANDYBRIDGE,LONG +\c VMOVMSKPS reg32,ymmreg AVX,SANDYBRIDGE +\c VMOVNTDQ mem128,xmmreg AVX,SANDYBRIDGE +\c VMOVNTQQ mem256,ymmreg AVX,SANDYBRIDGE +\c VMOVNTDQ mem256,ymmreg AVX,SANDYBRIDGE +\c VMOVNTDQA xmmreg,mem128 AVX,SANDYBRIDGE +\c VMOVNTPD mem128,xmmreg AVX,SANDYBRIDGE +\c VMOVNTPD mem256,ymmreg AVX,SANDYBRIDGE +\c VMOVNTPS mem128,xmmreg AVX,SANDYBRIDGE +\c VMOVNTPS mem128,ymmreg AVX,SANDYBRIDGE +\c VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVSD xmmreg,mem64 AVX,SANDYBRIDGE +\c VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVSD mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVSHDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVSHDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVSLDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVSLDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVSS xmmreg,mem64 AVX,SANDYBRIDGE +\c VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE +\c VMOVSS mem64,xmmreg AVX,SANDYBRIDGE +\c VMOVUPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVUPD xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVUPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVUPD ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMOVUPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VMOVUPS xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VMOVUPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VMOVUPS ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VMULPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMULPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMULPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VMULPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VMULSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VMULSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VPABSB xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPABSW xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPABSD xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPACKSSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPACKSSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPACKUSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPACKUSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPADDUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPAND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPANDN xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPAVGB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPAVGW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPCMPESTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPCMPESTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPCMPISTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPCMPISTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPCMPEQB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPEQW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPEQD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPEQQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPGTB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPGTW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPGTD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCMPGTQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILPD xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILPD ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPERMILPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VPERMILTD2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILTD2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILTD2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILTD2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILMO2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILMO2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILMO2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILMO2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILMZ2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILMZ2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILMZ2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILMZ2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMIL2PD xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PD xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PD ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PD ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VPERMILPS xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILPS ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPERMILPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VPERMILTD2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILTD2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILTD2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILTD2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILMO2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILMO2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILMO2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILMO2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMILMZ2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE +\c VPERMILMZ2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPERMILMZ2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE +\c VPERMILMZ2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPERMIL2PS xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PS xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PS ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE +\c VPERMIL2PS ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VPERM2F128 ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VPEXTRB reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +\c VPEXTRB reg32,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRB mem8,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +\c VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +\c VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRD reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +\c VPEXTRD rm32,xmmreg,imm8 AVX,SANDYBRIDGE +\c VPEXTRQ rm64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG +\c VPHADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPHADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPHADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPHMINPOSUW xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPHSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPHSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPHSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPINSRB xmmreg,xmmreg*,mem8,imm8 AVX,SANDYBRIDGE +\c VPINSRB xmmreg,xmmreg*,rm8,imm8 AVX,SANDYBRIDGE +\c VPINSRB xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE +\c VPINSRW xmmreg,xmmreg*,mem16,imm8 AVX,SANDYBRIDGE +\c VPINSRW xmmreg,xmmreg*,rm16,imm8 AVX,SANDYBRIDGE +\c VPINSRW xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE +\c VPINSRD xmmreg,xmmreg*,mem32,imm8 AVX,SANDYBRIDGE +\c VPINSRD xmmreg,xmmreg*,rm32,imm8 AVX,SANDYBRIDGE +\c VPINSRQ xmmreg,xmmreg*,mem64,imm8 AVX,SANDYBRIDGE,LONG +\c VPINSRQ xmmreg,xmmreg*,rm64,imm8 AVX,SANDYBRIDGE,LONG +\c VPMADDWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMADDUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMAXUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMINUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMOVMSKB reg64,xmmreg AVX,SANDYBRIDGE,LONG +\c VPMOVMSKB reg32,xmmreg AVX,SANDYBRIDGE +\c VPMOVSXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMOVSXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VPMOVSXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE +\c VPMOVSXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMOVSXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VPMOVSXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMOVZXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMOVZXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VPMOVZXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE +\c VPMOVZXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMOVZXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VPMOVZXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VPMULHUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULHRSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULHW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULUDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPMULDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSADBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSHUFB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSHUFD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPSHUFHW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPSHUFLW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VPSIGNB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSIGNW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSIGND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSLLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSLLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSLLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSLLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSLLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSLLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSLLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRAW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSRAW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRAD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSRAD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSRLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSRLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPSRLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSRLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE +\c VPTEST xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VPTEST ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VPSUBB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPSUBUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPXOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VRCPPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VRCPPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VRCPSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VRSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VRSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VRSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VROUNDPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VROUNDPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VROUNDPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VROUNDPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE +\c VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE +\c VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE +\c VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE +\c VSQRTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VSQRTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VSQRTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VSTMXCSR mem32 AVX,SANDYBRIDGE +\c VSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VSUBSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE +\c VSUBSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE +\c VTESTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VTESTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VTESTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE +\c VTESTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE +\c VUCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE +\c VUCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE +\c VUNPCKHPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VUNPCKHPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VUNPCKHPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VUNPCKHPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VUNPCKLPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VUNPCKLPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VUNPCKLPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VUNPCKLPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VXORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VXORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VXORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VXORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE +\c VZEROALL AVX,SANDYBRIDGE +\c VZEROUPPER AVX,SANDYBRIDGE + +\S{} Intel Carry-Less Multiplication instructions (CLMUL) + +\c PCLMULLQLQDQ xmmreg,xmmrm128 SSE,WESTMERE +\c PCLMULHQLQDQ xmmreg,xmmrm128 SSE,WESTMERE +\c PCLMULLQHQDQ xmmreg,xmmrm128 SSE,WESTMERE +\c PCLMULHQHQDQ xmmreg,xmmrm128 SSE,WESTMERE +\c PCLMULQDQ xmmreg,xmmrm128,imm8 SSE,WESTMERE + +\S{} Intel AVX Carry-Less Multiplication instructions (CLMUL) + +\c VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE +\c VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + +\S{} Intel Fused Multiply-Add instructions (FMA) + +\c VFMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFNMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE +\c VFNMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE +\c VFMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE +\c VFNMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE +\c VFNMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + +\S{} VIA (Centaur) security instructions + +\c XSTORE PENT,CYRIX +\c XCRYPTECB PENT,CYRIX +\c XCRYPTCBC PENT,CYRIX +\c XCRYPTCTR PENT,CYRIX +\c XCRYPTCFB PENT,CYRIX +\c XCRYPTOFB PENT,CYRIX +\c MONTMUL PENT,CYRIX +\c XSHA1 PENT,CYRIX +\c XSHA256 PENT,CYRIX + +\S{} AMD Lightweight Profiling (LWP) instructions + +\c LLWPCB reg16 AMD +\c LLWPCB reg32 AMD,386 +\c LLWPCB reg64 AMD,X64 +\c SLWPCB reg16 AMD +\c SLWPCB reg32 AMD,386 +\c SLWPCB reg64 AMD,X64 +\c LWPVAL reg16,rm32,imm16 AMD,386 +\c LWPVAL reg32,rm32,imm32 AMD,386 +\c LWPVAL reg64,rm32,imm32 AMD,X64 +\c LWPINS reg16,rm32,imm16 AMD,386 +\c LWPINS reg32,rm32,imm32 AMD,386 +\c LWPINS reg64,rm32,imm32 AMD,X64 + +\S{} AMD XOP, FMA4 and CVT16 instructions (SSE5) + +\c VCVTPH2PS xmmreg,xmmrm64*,imm8 AMD,SSE5 +\c VCVTPH2PS ymmreg,xmmrm128,imm8 AMD,SSE5 +\c VCVTPH2PS ymmreg,ymmrm128*,imm8 AMD,SSE5 +\c VCVTPS2PH xmmrm64,xmmreg*,imm8 AMD,SSE5 +\c VCVTPS2PH xmmrm128,ymmreg,imm8 AMD,SSE5 +\c VCVTPS2PH ymmrm128,ymmreg*,imm8 AMD,SSE5 +\c VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +\c VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +\c VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +\c VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +\c VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +\c VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +\c VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +\c VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +\c VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +\c VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +\c VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +\c VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +\c VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 +\c VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 +\c VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 +\c VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 +\c VFRCZPD xmmreg,xmmrm128* AMD,SSE5 +\c VFRCZPD ymmreg,ymmrm256* AMD,SSE5 +\c VFRCZPS xmmreg,xmmrm128* AMD,SSE5 +\c VFRCZPS ymmreg,ymmrm256* AMD,SSE5 +\c VFRCZSD xmmreg,xmmrm64* AMD,SSE5 +\c VFRCZSS xmmreg,xmmrm32* AMD,SSE5 +\c VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 +\c VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 +\c VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 +\c VPHADDBD xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDBQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDBW xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDDQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUBD xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUBQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUBW xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUDQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUWD xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDUWQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDWD xmmreg,xmmrm128* AMD,SSE5 +\c VPHADDWQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHSUBBW xmmreg,xmmrm128* AMD,SSE5 +\c VPHSUBDQ xmmreg,xmmrm128* AMD,SSE5 +\c VPHSUBWD xmmreg,xmmrm128* AMD,SSE5 +\c VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 +\c VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 +\c VPROTB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPROTB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPROTB xmmreg,xmmrm128*,imm8 AMD,SSE5 +\c VPROTD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPROTD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPROTD xmmreg,xmmrm128*,imm8 AMD,SSE5 +\c VPROTQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPROTQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPROTQ xmmreg,xmmrm128*,imm8 AMD,SSE5 +\c VPROTW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPROTW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPROTW xmmreg,xmmrm128*,imm8 AMD,SSE5 +\c VPSHAB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHAB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHAD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHAD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHAQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHAQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHAW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHAW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHLB xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHLB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHLD xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHLD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHLQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHLQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 +\c VPSHLW xmmreg,xmmrm128*,xmmreg AMD,SSE5 +\c VPSHLW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + +\S{} Systematic names for the hinting nop instructions + +\c HINT_NOP0 rm16 P6,UNDOC +\c HINT_NOP0 rm32 P6,UNDOC +\c HINT_NOP0 rm64 X64,UNDOC +\c HINT_NOP1 rm16 P6,UNDOC +\c HINT_NOP1 rm32 P6,UNDOC +\c HINT_NOP1 rm64 X64,UNDOC +\c HINT_NOP2 rm16 P6,UNDOC +\c HINT_NOP2 rm32 P6,UNDOC +\c HINT_NOP2 rm64 X64,UNDOC +\c HINT_NOP3 rm16 P6,UNDOC +\c HINT_NOP3 rm32 P6,UNDOC +\c HINT_NOP3 rm64 X64,UNDOC +\c HINT_NOP4 rm16 P6,UNDOC +\c HINT_NOP4 rm32 P6,UNDOC +\c HINT_NOP4 rm64 X64,UNDOC +\c HINT_NOP5 rm16 P6,UNDOC +\c HINT_NOP5 rm32 P6,UNDOC +\c HINT_NOP5 rm64 X64,UNDOC +\c HINT_NOP6 rm16 P6,UNDOC +\c HINT_NOP6 rm32 P6,UNDOC +\c HINT_NOP6 rm64 X64,UNDOC +\c HINT_NOP7 rm16 P6,UNDOC +\c HINT_NOP7 rm32 P6,UNDOC +\c HINT_NOP7 rm64 X64,UNDOC +\c HINT_NOP8 rm16 P6,UNDOC +\c HINT_NOP8 rm32 P6,UNDOC +\c HINT_NOP8 rm64 X64,UNDOC +\c HINT_NOP9 rm16 P6,UNDOC +\c HINT_NOP9 rm32 P6,UNDOC +\c HINT_NOP9 rm64 X64,UNDOC +\c HINT_NOP10 rm16 P6,UNDOC +\c HINT_NOP10 rm32 P6,UNDOC +\c HINT_NOP10 rm64 X64,UNDOC +\c HINT_NOP11 rm16 P6,UNDOC +\c HINT_NOP11 rm32 P6,UNDOC +\c HINT_NOP11 rm64 X64,UNDOC +\c HINT_NOP12 rm16 P6,UNDOC +\c HINT_NOP12 rm32 P6,UNDOC +\c HINT_NOP12 rm64 X64,UNDOC +\c HINT_NOP13 rm16 P6,UNDOC +\c HINT_NOP13 rm32 P6,UNDOC +\c HINT_NOP13 rm64 X64,UNDOC +\c HINT_NOP14 rm16 P6,UNDOC +\c HINT_NOP14 rm32 P6,UNDOC +\c HINT_NOP14 rm64 X64,UNDOC +\c HINT_NOP15 rm16 P6,UNDOC +\c HINT_NOP15 rm32 P6,UNDOC +\c HINT_NOP15 rm64 X64,UNDOC +\c HINT_NOP16 rm16 P6,UNDOC +\c HINT_NOP16 rm32 P6,UNDOC +\c HINT_NOP16 rm64 X64,UNDOC +\c HINT_NOP17 rm16 P6,UNDOC +\c HINT_NOP17 rm32 P6,UNDOC +\c HINT_NOP17 rm64 X64,UNDOC +\c HINT_NOP18 rm16 P6,UNDOC +\c HINT_NOP18 rm32 P6,UNDOC +\c HINT_NOP18 rm64 X64,UNDOC +\c HINT_NOP19 rm16 P6,UNDOC +\c HINT_NOP19 rm32 P6,UNDOC +\c HINT_NOP19 rm64 X64,UNDOC +\c HINT_NOP20 rm16 P6,UNDOC +\c HINT_NOP20 rm32 P6,UNDOC +\c HINT_NOP20 rm64 X64,UNDOC +\c HINT_NOP21 rm16 P6,UNDOC +\c HINT_NOP21 rm32 P6,UNDOC +\c HINT_NOP21 rm64 X64,UNDOC +\c HINT_NOP22 rm16 P6,UNDOC +\c HINT_NOP22 rm32 P6,UNDOC +\c HINT_NOP22 rm64 X64,UNDOC +\c HINT_NOP23 rm16 P6,UNDOC +\c HINT_NOP23 rm32 P6,UNDOC +\c HINT_NOP23 rm64 X64,UNDOC +\c HINT_NOP24 rm16 P6,UNDOC +\c HINT_NOP24 rm32 P6,UNDOC +\c HINT_NOP24 rm64 X64,UNDOC +\c HINT_NOP25 rm16 P6,UNDOC +\c HINT_NOP25 rm32 P6,UNDOC +\c HINT_NOP25 rm64 X64,UNDOC +\c HINT_NOP26 rm16 P6,UNDOC +\c HINT_NOP26 rm32 P6,UNDOC +\c HINT_NOP26 rm64 X64,UNDOC +\c HINT_NOP27 rm16 P6,UNDOC +\c HINT_NOP27 rm32 P6,UNDOC +\c HINT_NOP27 rm64 X64,UNDOC +\c HINT_NOP28 rm16 P6,UNDOC +\c HINT_NOP28 rm32 P6,UNDOC +\c HINT_NOP28 rm64 X64,UNDOC +\c HINT_NOP29 rm16 P6,UNDOC +\c HINT_NOP29 rm32 P6,UNDOC +\c HINT_NOP29 rm64 X64,UNDOC +\c HINT_NOP30 rm16 P6,UNDOC +\c HINT_NOP30 rm32 P6,UNDOC +\c HINT_NOP30 rm64 X64,UNDOC +\c HINT_NOP31 rm16 P6,UNDOC +\c HINT_NOP31 rm32 P6,UNDOC +\c HINT_NOP31 rm64 X64,UNDOC +\c HINT_NOP32 rm16 P6,UNDOC +\c HINT_NOP32 rm32 P6,UNDOC +\c HINT_NOP32 rm64 X64,UNDOC +\c HINT_NOP33 rm16 P6,UNDOC +\c HINT_NOP33 rm32 P6,UNDOC +\c HINT_NOP33 rm64 X64,UNDOC +\c HINT_NOP34 rm16 P6,UNDOC +\c HINT_NOP34 rm32 P6,UNDOC +\c HINT_NOP34 rm64 X64,UNDOC +\c HINT_NOP35 rm16 P6,UNDOC +\c HINT_NOP35 rm32 P6,UNDOC +\c HINT_NOP35 rm64 X64,UNDOC +\c HINT_NOP36 rm16 P6,UNDOC +\c HINT_NOP36 rm32 P6,UNDOC +\c HINT_NOP36 rm64 X64,UNDOC +\c HINT_NOP37 rm16 P6,UNDOC +\c HINT_NOP37 rm32 P6,UNDOC +\c HINT_NOP37 rm64 X64,UNDOC +\c HINT_NOP38 rm16 P6,UNDOC +\c HINT_NOP38 rm32 P6,UNDOC +\c HINT_NOP38 rm64 X64,UNDOC +\c HINT_NOP39 rm16 P6,UNDOC +\c HINT_NOP39 rm32 P6,UNDOC +\c HINT_NOP39 rm64 X64,UNDOC +\c HINT_NOP40 rm16 P6,UNDOC +\c HINT_NOP40 rm32 P6,UNDOC +\c HINT_NOP40 rm64 X64,UNDOC +\c HINT_NOP41 rm16 P6,UNDOC +\c HINT_NOP41 rm32 P6,UNDOC +\c HINT_NOP41 rm64 X64,UNDOC +\c HINT_NOP42 rm16 P6,UNDOC +\c HINT_NOP42 rm32 P6,UNDOC +\c HINT_NOP42 rm64 X64,UNDOC +\c HINT_NOP43 rm16 P6,UNDOC +\c HINT_NOP43 rm32 P6,UNDOC +\c HINT_NOP43 rm64 X64,UNDOC +\c HINT_NOP44 rm16 P6,UNDOC +\c HINT_NOP44 rm32 P6,UNDOC +\c HINT_NOP44 rm64 X64,UNDOC +\c HINT_NOP45 rm16 P6,UNDOC +\c HINT_NOP45 rm32 P6,UNDOC +\c HINT_NOP45 rm64 X64,UNDOC +\c HINT_NOP46 rm16 P6,UNDOC +\c HINT_NOP46 rm32 P6,UNDOC +\c HINT_NOP46 rm64 X64,UNDOC +\c HINT_NOP47 rm16 P6,UNDOC +\c HINT_NOP47 rm32 P6,UNDOC +\c HINT_NOP47 rm64 X64,UNDOC +\c HINT_NOP48 rm16 P6,UNDOC +\c HINT_NOP48 rm32 P6,UNDOC +\c HINT_NOP48 rm64 X64,UNDOC +\c HINT_NOP49 rm16 P6,UNDOC +\c HINT_NOP49 rm32 P6,UNDOC +\c HINT_NOP49 rm64 X64,UNDOC +\c HINT_NOP50 rm16 P6,UNDOC +\c HINT_NOP50 rm32 P6,UNDOC +\c HINT_NOP50 rm64 X64,UNDOC +\c HINT_NOP51 rm16 P6,UNDOC +\c HINT_NOP51 rm32 P6,UNDOC +\c HINT_NOP51 rm64 X64,UNDOC +\c HINT_NOP52 rm16 P6,UNDOC +\c HINT_NOP52 rm32 P6,UNDOC +\c HINT_NOP52 rm64 X64,UNDOC +\c HINT_NOP53 rm16 P6,UNDOC +\c HINT_NOP53 rm32 P6,UNDOC +\c HINT_NOP53 rm64 X64,UNDOC +\c HINT_NOP54 rm16 P6,UNDOC +\c HINT_NOP54 rm32 P6,UNDOC +\c HINT_NOP54 rm64 X64,UNDOC +\c HINT_NOP55 rm16 P6,UNDOC +\c HINT_NOP55 rm32 P6,UNDOC +\c HINT_NOP55 rm64 X64,UNDOC +\c HINT_NOP56 rm16 P6,UNDOC +\c HINT_NOP56 rm32 P6,UNDOC +\c HINT_NOP56 rm64 X64,UNDOC +\c HINT_NOP57 rm16 P6,UNDOC +\c HINT_NOP57 rm32 P6,UNDOC +\c HINT_NOP57 rm64 X64,UNDOC +\c HINT_NOP58 rm16 P6,UNDOC +\c HINT_NOP58 rm32 P6,UNDOC +\c HINT_NOP58 rm64 X64,UNDOC +\c HINT_NOP59 rm16 P6,UNDOC +\c HINT_NOP59 rm32 P6,UNDOC +\c HINT_NOP59 rm64 X64,UNDOC +\c HINT_NOP60 rm16 P6,UNDOC +\c HINT_NOP60 rm32 P6,UNDOC +\c HINT_NOP60 rm64 X64,UNDOC +\c HINT_NOP61 rm16 P6,UNDOC +\c HINT_NOP61 rm32 P6,UNDOC +\c HINT_NOP61 rm64 X64,UNDOC +\c HINT_NOP62 rm16 P6,UNDOC +\c HINT_NOP62 rm32 P6,UNDOC +\c HINT_NOP62 rm64 X64,UNDOC +\c HINT_NOP63 rm16 P6,UNDOC +\c HINT_NOP63 rm32 P6,UNDOC +\c HINT_NOP63 rm64 X64,UNDOC + diff --git a/doc/nasmdoc.pdf b/doc/nasmdoc.pdf Binary files differnew file mode 100644 index 0000000..0dbf46a --- /dev/null +++ b/doc/nasmdoc.pdf diff --git a/doc/nasmdoc.ps b/doc/nasmdoc.ps new file mode 100644 index 0000000..e7d0040 --- /dev/null +++ b/doc/nasmdoc.ps @@ -0,0 +1,12251 @@ +%!PS-Adobe-3.0 +%%Pages: 213 +%%BoundingBox: 0 0 595 792 +%%Creator: (NASM psflow.pl) +%%DocumentData: Clean7Bit +%%DocumentFonts: Times-Italic Times-Bold Courier Times-Roman Courier-Bold Times-BoldItalic +%%DocumentNeededFonts: Times-Italic Times-Bold Courier Times-Roman Courier-Bold Times-BoldItalic +%%Orientation: Portrait +%%PageOrder: Ascend +%%EndComments +%%BeginProlog +/tocind 12 def +/pymarg 50 def +/idxindent 24 def +/pageheight 792 def +/pagewidth 595 def +/idxcolumns 2 def +/tocpnz 24 def +/bulladj 12 def +/plmarg 50 def +/idxgutter 24 def +/lmarg 100 def +/topmarg 100 def +/botmarg 100 def +/prmarg 0 def +/startcopyright 75 def +/tocdots 8 def +/rmarg 50 def +/idxspace 24 def +/colorlinks false def +/NASMEncoding [ /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute + /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring + /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclam + /quotedbl /numbersign /dollar /percent /ampersand /quoteright + /parenleft /parenright /asterisk /plus /comma /minus /period /slash + /zero /one /two /three /four /five /six /seven /eight /nine /colon + /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H + /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft + /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c + /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z + /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef + /quotesinglbase /florin /quotedblbase /ellipsis /dagger /dbldagger + /circumflex /perthousand /Scaron /guilsinglleft /OE /.notdef /Zcaron + /.notdef /.notdef /grave /quotesingle /quotedblleft /quotedblright + /bullet /endash /emdash /tilde /trademark /scaron /guilsignlright /oe + /.notdef /zcaron /Ydieresis /space /exclamdown /cent /sterling + /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine + /guillemotleft /logicalnot /hyphen /registered /macron /degree + /plusminus /twosuperior /threesuperior /acute /mu /paragraph + /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright + /onequarter /onehalf /threequarters /questiondown /Agrave /Aacute + /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute + /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth + /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply + /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn + /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae + /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute + /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex + /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex + /udieresis /yacute /thorn /ydieresis ] def +/nasmenc { + findfont dup length dict begin + { 1 index /FID ne {def}{pop pop} ifelse } forall + /Encoding NASMEncoding def + currentdict + end + definefont pop +} def +/Times-Italic-NASM /Times-Italic nasmenc +/Times-Bold-NASM /Times-Bold nasmenc +/Courier-NASM /Courier nasmenc +/Times-Roman-NASM /Times-Roman nasmenc +/Courier-Bold-NASM /Courier-Bold nasmenc +/Times-BoldItalic-NASM /Times-BoldItalic nasmenc +/tfont0 /Times-Bold-NASM findfont 20 scalefont def +/tfont1 /Times-BoldItalic-NASM findfont 20 scalefont def +/tfont2 /Courier-Bold-NASM findfont 20 scalefont def +/tfont [tfont0 tfont1 tfont2] def +/cfont0 /Times-Bold-NASM findfont 18 scalefont def +/cfont1 /Times-BoldItalic-NASM findfont 18 scalefont def +/cfont2 /Courier-Bold-NASM findfont 18 scalefont def +/cfont [cfont0 cfont1 cfont2] def +/hfont0 /Times-Bold-NASM findfont 14 scalefont def +/hfont1 /Times-BoldItalic-NASM findfont 14 scalefont def +/hfont2 /Courier-Bold-NASM findfont 14 scalefont def +/hfont [hfont0 hfont1 hfont2] def +/sfont0 /Times-Bold-NASM findfont 12 scalefont def +/sfont1 /Times-BoldItalic-NASM findfont 12 scalefont def +/sfont2 /Courier-Bold-NASM findfont 12 scalefont def +/sfont [sfont0 sfont1 sfont2] def +/bfont0 /Times-Roman-NASM findfont 10 scalefont def +/bfont1 /Times-Italic-NASM findfont 10 scalefont def +/bfont2 /Courier-NASM findfont 10 scalefont def +/bfont [bfont0 bfont1 bfont2] def +/bullet [(\225)] def +% +% PostScript header for NASM documentation +% + +% Avoid barfing on old PS implementations +/pdfmark where +{pop} {userdict /pdfmark /cleartomark load put} ifelse +/setpagedevice where +{pop} {userdict /setpagedevice /pop load put} ifelse + +% Useful definition +/space 32 def + +% +% This asks the PostScript interpreter for the proper size paper +% +/setpagesize { + 1 dict dup /PageSize [pagewidth pageheight] put setpagedevice +} def + +% +% Code to handle links +% +/min { 2 copy gt { exch } if pop } def +/max { 2 copy lt { exch } if pop } def + +/lkbegun 0 def +/lktype null def +/lkury 0 def +/lkurx 0 def +/lklly 0 def +/lkllx 0 def +/lkxmarg 1 def % Extra space for link in x dir +/lkymarg 1 def % Extra space for link in y dir +/lktarget () def + +% target type -- +/linkbegin { + userdict begin + /lkbegun 1 def + /lktype exch def + /lktarget exch def + colorlinks { 0 0 0.4 setrgbcolor } if + end +} def + +% target -- +/linkbegindest { + /Dest linkbegin +} def + +% uristring -- +/linkbeginuri { + /URI linkbegin +} def + +% pageno -- +/linkbeginpage { + /Page linkbegin +} def + +% string spacepadding -- +/linkshow { + userdict begin + /lspad exch def /lss exch def + lkbegun 0 ne { + gsave lss true charpath flattenpath pathbbox grestore + lkbegun 1 eq { + /lkury exch def + lss spacecount lspad mul add /lkurx exch def + /lklly exch def + /lkllx exch def + /lkbegun 2 def + } { + lkury max /lkury exch def + lss spacecount lspad mul add lkurx max /lkurx exch def + lklly min /lklly exch def + lkllx min /lkllx exch def + } ifelse + } if + lspad 0 space lss widthshow + end +} def + +% -- +/linkend { + userdict begin + [ lktype /URI eq { + /Action 2 dict dup /Subtype /URI put dup /URI lktarget put + } { + /Dest lktarget + } ifelse + /Border [0 0 0] + /Rect [ lkllx lkxmarg sub + lklly lkymarg sub + lkurx lkxmarg add + lkury lkymarg add ] + /Subtype /Link + /ANN pdfmark + /lkbegun 0 def + colorlinks { 0 setgray } if + end +} def + +% targetname -- +/linkdest { + [ /Dest 3 -1 roll + /View [ /XYZ currentpoint null ] + /DEST pdfmark +} def + +% A "fontset" is an array of fonts; a "stream" is an array of strings +% and numbers or procedures: +% [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ] +% A number choses a font from the current fontset. +% A procedure is invoked as-is when printing the stream. +% +% When printing justified, an equal amount of space is added in +% between each string. + +% string -- spacecount +% Count space characters in a string +/spacecount { + 0 exch { + space eq { 1 add } if + } forall +} def + +% stream fontset -- spacecount width +% Get the width of a stream in the given fontset, and the +% number of space characters in the stream +/streamwidth { + gsave + 6 dict begin + /f exch def + /w 0 def + /s 0 def + f 0 get setfont + /integertype { + f exch get setfont + } def + /stringtype { + dup stringwidth pop w add /w exch def + spacecount s add /s exch def + } def + /arraytype { pop } def + % The input stream is on the top of the stack now + { + dup type exec + } forall + s w + end + grestore +} def + +% stream fontset spacer -- +% Show the stream in the given fontset, but add a certain amount +% of space to each space character +/showstreamspc { + 5 dict begin + /spc exch def + /f exch def + f 0 get setfont + /integertype { + f exch get setfont + } def + /stringtype { + spc linkshow + } def + /arraytype { + exec + } def + % Now stream is on the top of the stack + { + dup type exec + } forall + end +} def + +% stream fontset -- +% Show the stream in the given fontset, with no extra spacing +/showstream { + 0 showstreamspc +} def + +% stream fontset totalspace -- +% Show the stream justified to fit into a certain number of pixels +/showstreamjust { + userdict begin + /ts exch def /fs exch def /st exch def + st fs + st fs streamwidth ts exch sub exch + dup 0 gt { div } { pop } ifelse + showstreamspc + end +} def + +/bullmarg lmarg bulladj add def +/lwidth pagewidth lmarg sub rmarg sub def +/bwidth lwidth bulladj sub def + +% +% The various paragraph types +% The number at the end indicates start (1) of para, end (2) of para +% +/chapline { + currentpoint exch pop 10 sub lmarg exch moveto + 0 setlinecap 3 setlinewidth + lwidth 0 rlineto stroke +} def + +/chap0 { lmarg exch moveto cfont lwidth showstreamjust } def +/chap1 { lmarg exch moveto cfont lwidth showstreamjust } def +/chap2 { lmarg exch moveto cfont showstream chapline } def +/chap3 { lmarg exch moveto cfont showstream chapline } def + +/appn0 {chap0} def +/appn1 {chap1} def +/appn2 {chap2} def +/appn3 {chap3} def + +% lbl ypos fontset -- ypos +/headlbl { + 3 -1 roll [exch ( )] exch % ypos strm fontset + 2 copy % ypos strm fontset strm fontset + streamwidth % ypos strm fontset spccount width + lmarg exch sub % ypos strm fontset spccount xpos + 4 index % ypos strm fontset spccount xpos ypos + moveto % ypos strm fontset spccount + pop % ypos strm fontset spccount + showstream % ypos +} def + +/head0 { lmarg exch moveto hfont lwidth showstreamjust } def +/head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def +/head2 { lmarg exch moveto hfont showstream } def +/head3 { hfont headlbl lmarg exch moveto hfont showstream } def + +/subh0 { lmarg exch moveto sfont lwidth showstreamjust } def +/subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def +/subh2 { lmarg exch moveto sfont showstream } def +/subh3 { sfont headlbl lmarg exch moveto sfont showstream } def + +/norm0 { lmarg exch moveto bfont lwidth showstreamjust } def +/norm1 { lmarg exch moveto bfont lwidth showstreamjust } def +/norm2 { lmarg exch moveto bfont showstream } def +/norm3 { lmarg exch moveto bfont showstream } def + +/code0 { lmarg exch moveto bfont showstream } def +/code1 { lmarg exch moveto bfont showstream } def +/code2 { lmarg exch moveto bfont showstream } def +/code3 { lmarg exch moveto bfont showstream } def + +/bull0 { bullmarg exch moveto bfont bwidth showstreamjust } def +/bull1 { dup lmarg exch moveto bullet bfont showstream + bullmarg exch moveto bfont bwidth showstreamjust } def +/bull2 { bullmarg exch moveto bfont showstream } def +/bull3 { dup lmarg exch moveto bullet bfont showstream + bullmarg exch moveto bfont showstream } def + +/tocw0 lwidth tocpnz sub def +/tocw1 tocw0 tocind sub def +/tocw2 tocw1 tocind sub def + +/tocx0 lmarg def +/tocx1 tocx0 tocind add def +/tocx2 tocx1 tocind add def + +/tocpn { + bfont0 setfont + 3 dict begin + /s exch def + /x s stringwidth pop pagewidth rmarg sub exch sub def + currentpoint /y exch def + lmarg sub tocdots div ceiling tocdots mul lmarg add + tocdots x { + y moveto (.) 0 linkshow + } for + x y moveto s 0 linkshow + end + linkend +} def + +/toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def +/toc01 { tocx0 exch moveto + linkbegindest bfont0 setfont 0 linkshow bfont showstream } def +/toc02 { tocx0 exch moveto 3 1 roll + 0 rmoveto bfont showstream tocpn } def +/toc03 { tocx0 exch moveto 4 1 roll + linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def + +/toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def +/toc11 { tocx1 exch moveto + linkbegindest bfont0 setfont 0 linkshow bfont showstream } def +/toc12 { tocx1 exch moveto 3 1 roll + 0 rmoveto bfont showstream tocpn } def +/toc13 { tocx1 exch moveto 4 1 roll + linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def + +/toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def +/toc21 { tocx2 exch moveto + linkbegindest bfont0 setfont 0 linkshow bfont showstream } def +/toc22 { tocx2 exch moveto 3 1 roll + 0 rmoveto bfont showstream tocpn } def +/toc23 { tocx2 exch moveto 4 1 roll + linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def + +% Spacing between index columns +/indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def +% Width of an individual index column +/indexcolwid indexcolumn idxgutter sub def + +/idx03 { + 2 dict begin + indexcolumn mul lmarg add + /x exch def /y exch def x y moveto + exch bfont showstream + dup bfont streamwidth + x indexcolwid add exch sub exch pop y moveto + bfont showstream + end +} def +/idx00 {idx03} def +/idx01 {idx03} def +/idx02 {idx03} def + +/idx13 { + 2 dict begin + indexcolumn mul lmarg add idxindent add + /x exch def /y exch def x y moveto + exch bfont showstream + dup bfont streamwidth + x indexcolwid idxindent sub add exch sub exch pop y moveto + bfont showstream + end +} def +/idx10 {idx13} def +/idx11 {idx13} def +/idx12 {idx13} def + +% +% Page numbers +% +/pagey botmarg pymarg sub def +/pagel lmarg plmarg sub def +/pager pagewidth rmarg sub prmarg add def + +/pageeven { pagel pagey moveto bfont1 setfont show } def +/pageodd { bfont1 setfont dup stringwidth pop pager exch sub + pagey moveto show } def + +% +% Functions invoked during parsing +% +/xa { linkdest } def +/pa { 0 pageheight moveto linkdest } def +/xl { linkbegindest } def +/wl { linkbeginuri } def +/pl { linkbeginpage } def +/el { linkend } def + +% +% PDF viewer options +% +[/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks + +% +% Functions to include EPS +% +/BeginEPSF { + /Before_EPSF_State save def + /dict_count countdictstack def + /op_count count 1 sub def + userdict begin + /showpage {} def + 0 setgray 0 setlinecap + 1 setlinewidth 0 setlinejoin + 10 setmiterlimit [ ] 0 setdash newpath + /languagelevel where + { + pop languagelevel + 1 ne { + false setstrokeadjust false setoverprint + } if + } if +} bind def +/EndEPSF { + count op_count sub {pop} repeat + countdictstack dict_count sub {end} repeat + Before_EPSF_State restore +} bind def +%%EndProlog +%%BeginSetup +[/Title (Title) +/Dest /title /OUT pdfmark +[/Title (Contents) +/Dest /contents /OUT pdfmark +[/Title (Introduction) +/Count -3 /Dest /chapter-1 /OUT pdfmark +[/Title (What Is NASM?) +/Count -2 /Dest /section-1.1 /OUT pdfmark +[/Title (Why Yet Another Assembler?) +/Dest /section-1.1.1 /OUT pdfmark +[/Title (License Conditions) +/Dest /section-1.1.2 /OUT pdfmark +[/Title (Contact Information) +/Dest /section-1.2 /OUT pdfmark +[/Title (Installation) +/Count -2 /Dest /section-1.3 /OUT pdfmark +[/Title (Installing NASM under MS-DOS or Windows) +/Dest /section-1.3.1 /OUT pdfmark +[/Title (Installing NASM under Unix) +/Dest /section-1.3.2 /OUT pdfmark +[/Title (Running NASM) +/Count -2 /Dest /chapter-2 /OUT pdfmark +[/Title (NASM Command-Line Syntax) +/Count -28 /Dest /section-2.1 /OUT pdfmark +[/Title (The -o Option: Specifying the Output File Name) +/Dest /section-2.1.1 /OUT pdfmark +[/Title (The -f Option: Specifying the Output File Format) +/Dest /section-2.1.2 /OUT pdfmark +[/Title (The -l Option: Generating a Listing File) +/Dest /section-2.1.3 /OUT pdfmark +[/Title (The -M Option: Generate Makefile Dependencies) +/Dest /section-2.1.4 /OUT pdfmark +[/Title (The -MG Option: Generate Makefile Dependencies) +/Dest /section-2.1.5 /OUT pdfmark +[/Title (The -MF Option: Set Makefile Dependency File) +/Dest /section-2.1.6 /OUT pdfmark +[/Title (The -MD Option: Assemble and Generate Dependencies) +/Dest /section-2.1.7 /OUT pdfmark +[/Title (The -MT Option: Dependency Target Name) +/Dest /section-2.1.8 /OUT pdfmark +[/Title (The -MQ Option: Dependency Target Name \(Quoted\)) +/Dest /section-2.1.9 /OUT pdfmark +[/Title (The -MP Option: Emit phony targets) +/Dest /section-2.1.10 /OUT pdfmark +[/Title (The -F Option: Selecting a Debug Information Format) +/Dest /section-2.1.11 /OUT pdfmark +[/Title (The -g Option: Enabling Debug Information.) +/Dest /section-2.1.12 /OUT pdfmark +[/Title (The -X Option: Selecting an Error Reporting Format) +/Dest /section-2.1.13 /OUT pdfmark +[/Title (The -Z Option: Send Errors to a File) +/Dest /section-2.1.14 /OUT pdfmark +[/Title (The -s Option: Send Errors to stdout) +/Dest /section-2.1.15 /OUT pdfmark +[/Title (The -i Option: Include File Search Directories) +/Dest /section-2.1.16 /OUT pdfmark +[/Title (The -p Option: Pre-Include a File) +/Dest /section-2.1.17 /OUT pdfmark +[/Title (The -d Option: Pre-Define a Macro) +/Dest /section-2.1.18 /OUT pdfmark +[/Title (The -u Option: Undefine a Macro) +/Dest /section-2.1.19 /OUT pdfmark +[/Title (The -E Option: Preprocess Only) +/Dest /section-2.1.20 /OUT pdfmark +[/Title (The -a Option: Don't Preprocess At All) +/Dest /section-2.1.21 /OUT pdfmark +[/Title (The -O Option: Specifying Multipass Optimization) +/Dest /section-2.1.22 /OUT pdfmark +[/Title (The -t Option: Enable TASM Compatibility Mode) +/Dest /section-2.1.23 /OUT pdfmark +[/Title (The -w and -W Options: Enable or Disable Assembly Warnings) +/Dest /section-2.1.24 /OUT pdfmark +[/Title (The -v Option: Display Version Info) +/Dest /section-2.1.25 /OUT pdfmark +[/Title (The -y Option: Display Available Debug Info Formats) +/Dest /section-2.1.26 /OUT pdfmark +[/Title (The --prefix and --postfix Options.) +/Dest /section-2.1.27 /OUT pdfmark +[/Title (The NASMENV Environment Variable) +/Dest /section-2.1.28 /OUT pdfmark +[/Title (Quick Start for MASM Users) +/Count -7 /Dest /section-2.2 /OUT pdfmark +[/Title (NASM Is Case-Sensitive) +/Dest /section-2.2.1 /OUT pdfmark +[/Title (NASM Requires Square Brackets For Memory References) +/Dest /section-2.2.2 /OUT pdfmark +[/Title (NASM Doesn't Store Variable Types) +/Dest /section-2.2.3 /OUT pdfmark +[/Title (NASM Doesn't ASSUME) +/Dest /section-2.2.4 /OUT pdfmark +[/Title (NASM Doesn't Support Memory Models) +/Dest /section-2.2.5 /OUT pdfmark +[/Title (Floating-Point Differences) +/Dest /section-2.2.6 /OUT pdfmark +[/Title (Other Differences) +/Dest /section-2.2.7 /OUT pdfmark +[/Title (The NASM Language) +/Count -9 /Dest /chapter-3 /OUT pdfmark +[/Title (Layout of a NASM Source Line) +/Dest /section-3.1 /OUT pdfmark +[/Title (Pseudo-Instructions) +/Count -5 /Dest /section-3.2 /OUT pdfmark +[/Title (DB and Friends: Declaring Initialized Data) +/Dest /section-3.2.1 /OUT pdfmark +[/Title (RESB and Friends: Declaring Uninitialized Data) +/Dest /section-3.2.2 /OUT pdfmark +[/Title (INCBIN: Including External Binary Files) +/Dest /section-3.2.3 /OUT pdfmark +[/Title (EQU: Defining Constants) +/Dest /section-3.2.4 /OUT pdfmark +[/Title (TIMES: Repeating Instructions or Data) +/Dest /section-3.2.5 /OUT pdfmark +[/Title (Effective Addresses) +/Dest /section-3.3 /OUT pdfmark +[/Title (Constants) +/Count -7 /Dest /section-3.4 /OUT pdfmark +[/Title (Numeric Constants) +/Dest /section-3.4.1 /OUT pdfmark +[/Title (Character Strings) +/Dest /section-3.4.2 /OUT pdfmark +[/Title (Character Constants) +/Dest /section-3.4.3 /OUT pdfmark +[/Title (String Constants) +/Dest /section-3.4.4 /OUT pdfmark +[/Title (Unicode Strings) +/Dest /section-3.4.5 /OUT pdfmark +[/Title (Floating-Point Constants) +/Dest /section-3.4.6 /OUT pdfmark +[/Title (Packed BCD Constants) +/Dest /section-3.4.7 /OUT pdfmark +[/Title (Expressions) +/Count -7 /Dest /section-3.5 /OUT pdfmark +[/Title (|: Bitwise OR Operator) +/Dest /section-3.5.1 /OUT pdfmark +[/Title (^: Bitwise XOR Operator) +/Dest /section-3.5.2 /OUT pdfmark +[/Title (&: Bitwise AND Operator) +/Dest /section-3.5.3 /OUT pdfmark +[/Title (<< and >>: Bit Shift Operators) +/Dest /section-3.5.4 /OUT pdfmark +[/Title (+ and -: Addition and Subtraction Operators) +/Dest /section-3.5.5 /OUT pdfmark +[/Title (*, /, //, % and %%: Multiplication and Division) +/Dest /section-3.5.6 /OUT pdfmark +[/Title (Unary Operators: +, -, ~, ! and SEG) +/Dest /section-3.5.7 /OUT pdfmark +[/Title (SEG and WRT) +/Dest /section-3.6 /OUT pdfmark +[/Title (STRICT: Inhibiting Optimization) +/Dest /section-3.7 /OUT pdfmark +[/Title (Critical Expressions) +/Dest /section-3.8 /OUT pdfmark +[/Title (Local Labels) +/Dest /section-3.9 /OUT pdfmark +[/Title (The NASM Preprocessor) +/Count -11 /Dest /chapter-4 /OUT pdfmark +[/Title (Single-Line Macros) +/Count -9 /Dest /section-4.1 /OUT pdfmark +[/Title (The Normal Way: %define) +/Dest /section-4.1.1 /OUT pdfmark +[/Title (Resolving %define: %xdefine) +/Dest /section-4.1.2 /OUT pdfmark +[/Title (Macro Indirection: %[...]) +/Dest /section-4.1.3 /OUT pdfmark +[/Title (Concatenating Single Line Macro Tokens: %+) +/Dest /section-4.1.4 /OUT pdfmark +[/Title (The Macro Name Itself: %? and %??) +/Dest /section-4.1.5 /OUT pdfmark +[/Title (Undefining Single-Line Macros: %undef) +/Dest /section-4.1.6 /OUT pdfmark +[/Title (Preprocessor Variables: %assign) +/Dest /section-4.1.7 /OUT pdfmark +[/Title (Defining Strings: %defstr) +/Dest /section-4.1.8 /OUT pdfmark +[/Title (Defining Tokens: %deftok) +/Dest /section-4.1.9 /OUT pdfmark +[/Title (String Manipulation in Macros) +/Count -3 /Dest /section-4.2 /OUT pdfmark +[/Title (Concatenating Strings: %strcat) +/Dest /section-4.2.1 /OUT pdfmark +[/Title (String Length: %strlen) +/Dest /section-4.2.2 /OUT pdfmark +[/Title (Extracting Substrings: %substr) +/Dest /section-4.2.3 /OUT pdfmark +[/Title (Multi-Line Macros: %macro) +/Count -12 /Dest /section-4.3 /OUT pdfmark +[/Title (Recursive Multi-Line Macros: %rmacro) +/Dest /section-4.3.1 /OUT pdfmark +[/Title (Overloading Multi-Line Macros) +/Dest /section-4.3.2 /OUT pdfmark +[/Title (Macro-Local Labels) +/Dest /section-4.3.3 /OUT pdfmark +[/Title (Greedy Macro Parameters) +/Dest /section-4.3.4 /OUT pdfmark +[/Title (Default Macro Parameters) +/Dest /section-4.3.5 /OUT pdfmark +[/Title (%0: Macro Parameter Counter) +/Dest /section-4.3.6 /OUT pdfmark +[/Title (%rotate: Rotating Macro Parameters) +/Dest /section-4.3.7 /OUT pdfmark +[/Title (Concatenating Macro Parameters) +/Dest /section-4.3.8 /OUT pdfmark +[/Title (Condition Codes as Macro Parameters) +/Dest /section-4.3.9 /OUT pdfmark +[/Title (Disabling Listing Expansion) +/Dest /section-4.3.10 /OUT pdfmark +[/Title (Undefining Multi-Line Macros: %unmacro) +/Dest /section-4.3.11 /OUT pdfmark +[/Title (Exiting Multi-Line Macros: %exitmacro) +/Dest /section-4.3.12 /OUT pdfmark +[/Title (Conditional Assembly) +/Count -8 /Dest /section-4.4 /OUT pdfmark +[/Title (%ifdef: Testing Single-Line Macro Existence) +/Dest /section-4.4.1 /OUT pdfmark +[/Title (%ifmacro: Testing Multi-Line Macro Existence) +/Dest /section-4.4.2 /OUT pdfmark +[/Title (%ifctx: Testing the Context Stack) +/Dest /section-4.4.3 /OUT pdfmark +[/Title (%if: Testing Arbitrary Numeric Expressions) +/Dest /section-4.4.4 /OUT pdfmark +[/Title (%ifidn and %ifidni: Testing Exact Text Identity) +/Dest /section-4.4.5 /OUT pdfmark +[/Title (%ifid, %ifnum, %ifstr: Testing Token Types) +/Dest /section-4.4.6 /OUT pdfmark +[/Title (%iftoken: Test for a Single Token) +/Dest /section-4.4.7 /OUT pdfmark +[/Title (%ifempty: Test for Empty Expansion) +/Dest /section-4.4.8 /OUT pdfmark +[/Title (Preprocessor Loops: %rep) +/Dest /section-4.5 /OUT pdfmark +[/Title (Source Files and Dependencies) +/Count -4 /Dest /section-4.6 /OUT pdfmark +[/Title (%include: Including Other Files) +/Dest /section-4.6.1 /OUT pdfmark +[/Title (%pathsearch: Search the Include Path) +/Dest /section-4.6.2 /OUT pdfmark +[/Title (%depend: Add Dependent Files) +/Dest /section-4.6.3 /OUT pdfmark +[/Title (%use: Include Standard Macro Package) +/Dest /section-4.6.4 /OUT pdfmark +[/Title (The Context Stack) +/Count -5 /Dest /section-4.7 /OUT pdfmark +[/Title (%push and %pop: Creating and Removing Contexts) +/Dest /section-4.7.1 /OUT pdfmark +[/Title (Context-Local Labels) +/Dest /section-4.7.2 /OUT pdfmark +[/Title (Context-Local Single-Line Macros) +/Dest /section-4.7.3 /OUT pdfmark +[/Title (%repl: Renaming a Context) +/Dest /section-4.7.4 /OUT pdfmark +[/Title (Example Use of the Context Stack: Block IFs) +/Dest /section-4.7.5 /OUT pdfmark +[/Title (Stack Relative Preprocessor Directives) +/Count -3 /Dest /section-4.8 /OUT pdfmark +[/Title (%arg Directive) +/Dest /section-4.8.1 /OUT pdfmark +[/Title (%stacksize Directive) +/Dest /section-4.8.2 /OUT pdfmark +[/Title (%local Directive) +/Dest /section-4.8.3 /OUT pdfmark +[/Title (Reporting User-Defined Errors: %error, %warning, %fatal) +/Dest /section-4.9 /OUT pdfmark +[/Title (Other Preprocessor Directives) +/Count -2 /Dest /section-4.10 /OUT pdfmark +[/Title (%line Directive) +/Dest /section-4.10.1 /OUT pdfmark +[/Title (%!<env>: Read an environment variable.) +/Dest /section-4.10.2 /OUT pdfmark +[/Title (Standard Macros) +/Count -12 /Dest /section-4.11 /OUT pdfmark +[/Title (NASM Version Macros) +/Dest /section-4.11.1 /OUT pdfmark +[/Title (__NASM_VERSION_ID__: NASM Version ID) +/Dest /section-4.11.2 /OUT pdfmark +[/Title (__NASM_VER__: NASM Version string) +/Dest /section-4.11.3 /OUT pdfmark +[/Title (__FILE__ and __LINE__: File Name and Line Number) +/Dest /section-4.11.4 /OUT pdfmark +[/Title (__BITS__: Current BITS Mode) +/Dest /section-4.11.5 /OUT pdfmark +[/Title (__OUTPUT_FORMAT__: Current Output Format) +/Dest /section-4.11.6 /OUT pdfmark +[/Title (Assembly Date and Time Macros) +/Dest /section-4.11.7 /OUT pdfmark +[/Title (__USE_package__: Package Include Test) +/Dest /section-4.11.8 /OUT pdfmark +[/Title (__PASS__: Assembly Pass) +/Dest /section-4.11.9 /OUT pdfmark +[/Title (STRUC and ENDSTRUC: Declaring Structure Data Types) +/Dest /section-4.11.10 /OUT pdfmark +[/Title (ISTRUC, AT and IEND: Declaring Instances of Structures) +/Dest /section-4.11.11 /OUT pdfmark +[/Title (ALIGN and ALIGNB: Data Alignment) +/Dest /section-4.11.12 /OUT pdfmark +[/Title (Standard Macro Packages) +/Count -2 /Dest /chapter-5 /OUT pdfmark +[/Title (altreg: Alternate Register Names) +/Dest /section-5.1 /OUT pdfmark +[/Title (smartalign: Smart ALIGN Macro) +/Dest /section-5.2 /OUT pdfmark +[/Title (Assembler Directives) +/Count -9 /Dest /chapter-6 /OUT pdfmark +[/Title (BITS: Specifying Target Processor Mode) +/Count -1 /Dest /section-6.1 /OUT pdfmark +[/Title (USE16 & USE32: Aliases for BITS) +/Dest /section-6.1.1 /OUT pdfmark +[/Title (DEFAULT: Change the assembler defaults) +/Dest /section-6.2 /OUT pdfmark +[/Title (SECTION or SEGMENT: Changing and Defining Sections) +/Count -1 /Dest /section-6.3 /OUT pdfmark +[/Title (The __SECT__ Macro) +/Dest /section-6.3.1 /OUT pdfmark +[/Title (ABSOLUTE: Defining Absolute Labels) +/Dest /section-6.4 /OUT pdfmark +[/Title (EXTERN: Importing Symbols from Other Modules) +/Dest /section-6.5 /OUT pdfmark +[/Title (GLOBAL: Exporting Symbols to Other Modules) +/Dest /section-6.6 /OUT pdfmark +[/Title (COMMON: Defining Common Data Areas) +/Dest /section-6.7 /OUT pdfmark +[/Title (CPU: Defining CPU Dependencies) +/Dest /section-6.8 /OUT pdfmark +[/Title (FLOAT: Handling of floating-point constants) +/Dest /section-6.9 /OUT pdfmark +[/Title (Output Formats) +/Count -14 /Dest /chapter-7 /OUT pdfmark +[/Title (bin: Flat-Form Binary Output) +/Count -4 /Dest /section-7.1 /OUT pdfmark +[/Title (ORG: Binary File Program Origin) +/Dest /section-7.1.1 /OUT pdfmark +[/Title (bin Extensions to the SECTION Directive) +/Dest /section-7.1.2 /OUT pdfmark +[/Title (Multisection Support for the bin Format) +/Dest /section-7.1.3 /OUT pdfmark +[/Title (Map Files) +/Dest /section-7.1.4 /OUT pdfmark +[/Title (ith: Intel Hex Output) +/Dest /section-7.2 /OUT pdfmark +[/Title (srec: Motorola S-Records Output) +/Dest /section-7.3 /OUT pdfmark +[/Title (obj: Microsoft OMF Object Files) +/Count -8 /Dest /section-7.4 /OUT pdfmark +[/Title (obj Extensions to the SEGMENT Directive) +/Dest /section-7.4.1 /OUT pdfmark +[/Title (GROUP: Defining Groups of Segments) +/Dest /section-7.4.2 /OUT pdfmark +[/Title (UPPERCASE: Disabling Case Sensitivity in Output) +/Dest /section-7.4.3 /OUT pdfmark +[/Title (IMPORT: Importing DLL Symbols) +/Dest /section-7.4.4 /OUT pdfmark +[/Title (EXPORT: Exporting DLL Symbols) +/Dest /section-7.4.5 /OUT pdfmark +[/Title (..start: Defining the Program Entry Point) +/Dest /section-7.4.6 /OUT pdfmark +[/Title (obj Extensions to the EXTERN Directive) +/Dest /section-7.4.7 /OUT pdfmark +[/Title (obj Extensions to the COMMON Directive) +/Dest /section-7.4.8 /OUT pdfmark +[/Title (win32: Microsoft Win32 Object Files) +/Count -2 /Dest /section-7.5 /OUT pdfmark +[/Title (win32 Extensions to the SECTION Directive) +/Dest /section-7.5.1 /OUT pdfmark +[/Title (win32: Safe Structured Exception Handling) +/Dest /section-7.5.2 /OUT pdfmark +[/Title (win64: Microsoft Win64 Object Files) +/Count -2 /Dest /section-7.6 /OUT pdfmark +[/Title (win64: Writing Position-Independent Code) +/Dest /section-7.6.1 /OUT pdfmark +[/Title (win64: Structured Exception Handling) +/Dest /section-7.6.2 /OUT pdfmark +[/Title (coff: Common Object File Format) +/Dest /section-7.7 /OUT pdfmark +[/Title (macho32 and macho64: Mach Object File Format) +/Dest /section-7.8 /OUT pdfmark +[/Title (elf32 and elf64: Executable and Linkable Format Object Files) +/Count -8 /Dest /section-7.9 /OUT pdfmark +[/Title (ELF specific directive osabi) +/Dest /section-7.9.1 /OUT pdfmark +[/Title (elf Extensions to the SECTION Directive) +/Dest /section-7.9.2 /OUT pdfmark +[/Title (Position-Independent Code: elf Special Symbols and WRT) +/Dest /section-7.9.3 /OUT pdfmark +[/Title (Thread Local Storage: elf Special Symbols and WRT) +/Dest /section-7.9.4 /OUT pdfmark +[/Title (elf Extensions to the GLOBAL Directive) +/Dest /section-7.9.5 /OUT pdfmark +[/Title (elf Extensions to the COMMON Directive ) +/Dest /section-7.9.6 /OUT pdfmark +[/Title (16-bit code and ELF ) +/Dest /section-7.9.7 /OUT pdfmark +[/Title (Debug formats and ELF ) +/Dest /section-7.9.8 /OUT pdfmark +[/Title (aout: Linux a.out Object Files) +/Dest /section-7.10 /OUT pdfmark +[/Title (aoutb: NetBSD/FreeBSD/OpenBSD a.out Object Files) +/Dest /section-7.11 /OUT pdfmark +[/Title (as86: Minix/Linux as86 Object Files) +/Dest /section-7.12 /OUT pdfmark +[/Title (rdf: Relocatable Dynamic Object File Format) +/Count -4 /Dest /section-7.13 /OUT pdfmark +[/Title (Requiring a Library: The LIBRARY Directive) +/Dest /section-7.13.1 /OUT pdfmark +[/Title (Specifying a Module Name: The MODULE Directive) +/Dest /section-7.13.2 /OUT pdfmark +[/Title (rdf Extensions to the GLOBAL Directive) +/Dest /section-7.13.3 /OUT pdfmark +[/Title (rdf Extensions to the EXTERN Directive) +/Dest /section-7.13.4 /OUT pdfmark +[/Title (dbg: Debugging Format) +/Dest /section-7.14 /OUT pdfmark +[/Title (Writing 16-bit Code \(DOS, Windows 3/3.1\)) +/Count -5 /Dest /chapter-8 /OUT pdfmark +[/Title (Producing .EXE Files) +/Count -2 /Dest /section-8.1 /OUT pdfmark +[/Title (Using the obj Format To Generate .EXE Files) +/Dest /section-8.1.1 /OUT pdfmark +[/Title (Using the bin Format To Generate .EXE Files) +/Dest /section-8.1.2 /OUT pdfmark +[/Title (Producing .COM Files) +/Count -2 /Dest /section-8.2 /OUT pdfmark +[/Title (Using the bin Format To Generate .COM Files) +/Dest /section-8.2.1 /OUT pdfmark +[/Title (Using the obj Format To Generate .COM Files) +/Dest /section-8.2.2 /OUT pdfmark +[/Title (Producing .SYS Files) +/Dest /section-8.3 /OUT pdfmark +[/Title (Interfacing to 16-bit C Programs) +/Count -5 /Dest /section-8.4 /OUT pdfmark +[/Title (External Symbol Names) +/Dest /section-8.4.1 /OUT pdfmark +[/Title (Memory Models) +/Dest /section-8.4.2 /OUT pdfmark +[/Title (Function Definitions and Function Calls) +/Dest /section-8.4.3 /OUT pdfmark +[/Title (Accessing Data Items) +/Dest /section-8.4.4 /OUT pdfmark +[/Title (c16.mac: Helper Macros for the 16-bit C Interface) +/Dest /section-8.4.5 /OUT pdfmark +[/Title (Interfacing to Borland Pascal Programs) +/Count -3 /Dest /section-8.5 /OUT pdfmark +[/Title (The Pascal Calling Convention) +/Dest /section-8.5.1 /OUT pdfmark +[/Title (Borland Pascal Segment Name Restrictions) +/Dest /section-8.5.2 /OUT pdfmark +[/Title (Using c16.mac With Pascal Programs) +/Dest /section-8.5.3 /OUT pdfmark +[/Title (Writing 32-bit Code \(Unix, Win32, DJGPP\)) +/Count -2 /Dest /chapter-9 /OUT pdfmark +[/Title (Interfacing to 32-bit C Programs) +/Count -4 /Dest /section-9.1 /OUT pdfmark +[/Title (External Symbol Names) +/Dest /section-9.1.1 /OUT pdfmark +[/Title (Function Definitions and Function Calls) +/Dest /section-9.1.2 /OUT pdfmark +[/Title (Accessing Data Items) +/Dest /section-9.1.3 /OUT pdfmark +[/Title (c32.mac: Helper Macros for the 32-bit C Interface) +/Dest /section-9.1.4 /OUT pdfmark +[/Title (Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries) +/Count -6 /Dest /section-9.2 /OUT pdfmark +[/Title (Obtaining the Address of the GOT) +/Dest /section-9.2.1 /OUT pdfmark +[/Title (Finding Your Local Data Items) +/Dest /section-9.2.2 /OUT pdfmark +[/Title (Finding External and Common Data Items) +/Dest /section-9.2.3 /OUT pdfmark +[/Title (Exporting Symbols to the Library User) +/Dest /section-9.2.4 /OUT pdfmark +[/Title (Calling Procedures Outside the Library) +/Dest /section-9.2.5 /OUT pdfmark +[/Title (Generating the Library File) +/Dest /section-9.2.6 /OUT pdfmark +[/Title (Mixing 16 and 32 Bit Code) +/Count -3 /Dest /chapter-10 /OUT pdfmark +[/Title (Mixed-Size Jumps) +/Dest /section-10.1 /OUT pdfmark +[/Title (Addressing Between Different-Size Segments) +/Dest /section-10.2 /OUT pdfmark +[/Title (Other Mixed-Size Instructions) +/Dest /section-10.3 /OUT pdfmark +[/Title (Writing 64-bit Code \(Unix, Win64\)) +/Count -4 /Dest /chapter-11 /OUT pdfmark +[/Title (Register Names in 64-bit Mode) +/Dest /section-11.1 /OUT pdfmark +[/Title (Immediates and Displacements in 64-bit Mode) +/Dest /section-11.2 /OUT pdfmark +[/Title (Interfacing to 64-bit C Programs \(Unix\)) +/Dest /section-11.3 /OUT pdfmark +[/Title (Interfacing to 64-bit C Programs \(Win64\)) +/Dest /section-11.4 /OUT pdfmark +[/Title (Troubleshooting) +/Count -2 /Dest /chapter-12 /OUT pdfmark +[/Title (Common Problems) +/Count -4 /Dest /section-12.1 /OUT pdfmark +[/Title (NASM Generates Inefficient Code) +/Dest /section-12.1.1 /OUT pdfmark +[/Title (My Jumps are Out of Range) +/Dest /section-12.1.2 /OUT pdfmark +[/Title (ORG Doesn't Work) +/Dest /section-12.1.3 /OUT pdfmark +[/Title (TIMES Doesn't Work) +/Dest /section-12.1.4 /OUT pdfmark +[/Title (Bugs) +/Dest /section-12.2 /OUT pdfmark +[/Title (Ndisasm) +/Count -4 /Dest /appendix-A /OUT pdfmark +[/Title (Introduction) +/Dest /section-A.1 /OUT pdfmark +[/Title (Getting Started: Installation) +/Dest /section-A.2 /OUT pdfmark +[/Title (Running NDISASM) +/Count -4 /Dest /section-A.3 /OUT pdfmark +[/Title (COM Files: Specifying an Origin) +/Dest /section-A.3.1 /OUT pdfmark +[/Title (Code Following Data: Synchronisation) +/Dest /section-A.3.2 /OUT pdfmark +[/Title (Mixed Code and Data: Automatic \(Intelligent\) Synchronisation ) +/Dest /section-A.3.3 /OUT pdfmark +[/Title (Other Options) +/Dest /section-A.3.4 /OUT pdfmark +[/Title (Bugs and Improvements) +/Dest /section-A.4 /OUT pdfmark +[/Title (Instruction List) +/Count -1 /Dest /appendix-B /OUT pdfmark +[/Title (Introduction) +/Count -32 /Dest /section-B.1 /OUT pdfmark +[/Title (Special instructions...) +/Dest /section-B.1.1 /OUT pdfmark +[/Title (Conventional instructions) +/Dest /section-B.1.2 /OUT pdfmark +[/Title (Katmai Streaming SIMD instructions \(SSE \226\226 a.k.a. KNI, XMM, MMX2\)) +/Dest /section-B.1.3 /OUT pdfmark +[/Title (Introduced in Deschutes but necessary for SSE support) +/Dest /section-B.1.4 /OUT pdfmark +[/Title (XSAVE group \(AVX and extended state\)) +/Dest /section-B.1.5 /OUT pdfmark +[/Title (Generic memory operations) +/Dest /section-B.1.6 /OUT pdfmark +[/Title (New MMX instructions introduced in Katmai) +/Dest /section-B.1.7 /OUT pdfmark +[/Title (AMD Enhanced 3DNow! \(Athlon\) instructions) +/Dest /section-B.1.8 /OUT pdfmark +[/Title (Willamette SSE2 Cacheability Instructions) +/Dest /section-B.1.9 /OUT pdfmark +[/Title (Willamette MMX instructions \(SSE2 SIMD Integer Instructions\)) +/Dest /section-B.1.10 /OUT pdfmark +[/Title (Willamette Streaming SIMD instructions \(SSE2\)) +/Dest /section-B.1.11 /OUT pdfmark +[/Title (Prescott New Instructions \(SSE3\)) +/Dest /section-B.1.12 /OUT pdfmark +[/Title (VMX Instructions) +/Dest /section-B.1.13 /OUT pdfmark +[/Title (Extended Page Tables VMX instructions) +/Dest /section-B.1.14 /OUT pdfmark +[/Title (Tejas New Instructions \(SSSE3\)) +/Dest /section-B.1.15 /OUT pdfmark +[/Title (AMD SSE4A) +/Dest /section-B.1.16 /OUT pdfmark +[/Title (New instructions in Barcelona) +/Dest /section-B.1.17 /OUT pdfmark +[/Title (Penryn New Instructions \(SSE4.1\)) +/Dest /section-B.1.18 /OUT pdfmark +[/Title (Nehalem New Instructions \(SSE4.2\)) +/Dest /section-B.1.19 /OUT pdfmark +[/Title (Intel SMX) +/Dest /section-B.1.20 /OUT pdfmark +[/Title (Geode \(Cyrix\) 3DNow! additions) +/Dest /section-B.1.21 /OUT pdfmark +[/Title (Intel new instructions in ???) +/Dest /section-B.1.22 /OUT pdfmark +[/Title (Intel AES instructions) +/Dest /section-B.1.23 /OUT pdfmark +[/Title (Intel AVX AES instructions) +/Dest /section-B.1.24 /OUT pdfmark +[/Title (Intel AVX instructions) +/Dest /section-B.1.25 /OUT pdfmark +[/Title (Intel Carry-Less Multiplication instructions \(CLMUL\)) +/Dest /section-B.1.26 /OUT pdfmark +[/Title (Intel AVX Carry-Less Multiplication instructions \(CLMUL\)) +/Dest /section-B.1.27 /OUT pdfmark +[/Title (Intel Fused Multiply-Add instructions \(FMA\)) +/Dest /section-B.1.28 /OUT pdfmark +[/Title (VIA \(Centaur\) security instructions) +/Dest /section-B.1.29 /OUT pdfmark +[/Title (AMD Lightweight Profiling \(LWP\) instructions) +/Dest /section-B.1.30 /OUT pdfmark +[/Title (AMD XOP, FMA4 and CVT16 instructions \(SSE5\)) +/Dest /section-B.1.31 /OUT pdfmark +[/Title (Systematic names for the hinting nop instructions) +/Dest /section-B.1.32 /OUT pdfmark +[/Title (NASM Version History) +/Count -3 /Dest /appendix-C /OUT pdfmark +[/Title (NASM 2 Series) +/Count -11 /Dest /section-C.1 /OUT pdfmark +[/Title (Version 2.08) +/Dest /section-C.1.1 /OUT pdfmark +[/Title (Version 2.07) +/Dest /section-C.1.2 /OUT pdfmark +[/Title (Version 2.06) +/Dest /section-C.1.3 /OUT pdfmark +[/Title (Version 2.05.01) +/Dest /section-C.1.4 /OUT pdfmark +[/Title (Version 2.05) +/Dest /section-C.1.5 /OUT pdfmark +[/Title (Version 2.04) +/Dest /section-C.1.6 /OUT pdfmark +[/Title (Version 2.03.01) +/Dest /section-C.1.7 /OUT pdfmark +[/Title (Version 2.03) +/Dest /section-C.1.8 /OUT pdfmark +[/Title (Version 2.02) +/Dest /section-C.1.9 /OUT pdfmark +[/Title (Version 2.01) +/Dest /section-C.1.10 /OUT pdfmark +[/Title (Version 2.00) +/Dest /section-C.1.11 /OUT pdfmark +[/Title (NASM 0.98 Series) +/Count -55 /Dest /section-C.2 /OUT pdfmark +[/Title (Version 0.98.39) +/Dest /section-C.2.1 /OUT pdfmark +[/Title (Version 0.98.38) +/Dest /section-C.2.2 /OUT pdfmark +[/Title (Version 0.98.37) +/Dest /section-C.2.3 /OUT pdfmark +[/Title (Version 0.98.36) +/Dest /section-C.2.4 /OUT pdfmark +[/Title (Version 0.98.35) +/Dest /section-C.2.5 /OUT pdfmark +[/Title (Version 0.98.34) +/Dest /section-C.2.6 /OUT pdfmark +[/Title (Version 0.98.33) +/Dest /section-C.2.7 /OUT pdfmark +[/Title (Version 0.98.32) +/Dest /section-C.2.8 /OUT pdfmark +[/Title (Version 0.98.31) +/Dest /section-C.2.9 /OUT pdfmark +[/Title (Version 0.98.30) +/Dest /section-C.2.10 /OUT pdfmark +[/Title (Version 0.98.28) +/Dest /section-C.2.11 /OUT pdfmark +[/Title (Version 0.98.26) +/Dest /section-C.2.12 /OUT pdfmark +[/Title (Version 0.98.25alt) +/Dest /section-C.2.13 /OUT pdfmark +[/Title (Version 0.98.25) +/Dest /section-C.2.14 /OUT pdfmark +[/Title (Version 0.98.24p1) +/Dest /section-C.2.15 /OUT pdfmark +[/Title (Version 0.98.24) +/Dest /section-C.2.16 /OUT pdfmark +[/Title (Version 0.98.23) +/Dest /section-C.2.17 /OUT pdfmark +[/Title (Version 0.98.22) +/Dest /section-C.2.18 /OUT pdfmark +[/Title (Version 0.98.21) +/Dest /section-C.2.19 /OUT pdfmark +[/Title (Version 0.98.20) +/Dest /section-C.2.20 /OUT pdfmark +[/Title (Version 0.98.19) +/Dest /section-C.2.21 /OUT pdfmark +[/Title (Version 0.98.18) +/Dest /section-C.2.22 /OUT pdfmark +[/Title (Version 0.98.17) +/Dest /section-C.2.23 /OUT pdfmark +[/Title (Version 0.98.16) +/Dest /section-C.2.24 /OUT pdfmark +[/Title (Version 0.98.15) +/Dest /section-C.2.25 /OUT pdfmark +[/Title (Version 0.98.14) +/Dest /section-C.2.26 /OUT pdfmark +[/Title (Version 0.98.13) +/Dest /section-C.2.27 /OUT pdfmark +[/Title (Version 0.98.12) +/Dest /section-C.2.28 /OUT pdfmark +[/Title (Version 0.98.11) +/Dest /section-C.2.29 /OUT pdfmark +[/Title (Version 0.98.10) +/Dest /section-C.2.30 /OUT pdfmark +[/Title (Version 0.98.09) +/Dest /section-C.2.31 /OUT pdfmark +[/Title (Version 0.98.08) +/Dest /section-C.2.32 /OUT pdfmark +[/Title (Version 0.98.09b with John Coffman patches released 28-Oct-2001) +/Dest /section-C.2.33 /OUT pdfmark +[/Title (Version 0.98.07 released 01/28/01) +/Dest /section-C.2.34 /OUT pdfmark +[/Title (Version 0.98.06f released 01/18/01) +/Dest /section-C.2.35 /OUT pdfmark +[/Title (Version 0.98.06e released 01/09/01) +/Dest /section-C.2.36 /OUT pdfmark +[/Title (Version 0.98p1) +/Dest /section-C.2.37 /OUT pdfmark +[/Title (Version 0.98bf \(bug-fixed\)) +/Dest /section-C.2.38 /OUT pdfmark +[/Title (Version 0.98.03 with John Coffman's changes released 27-Jul-2000) +/Dest /section-C.2.39 /OUT pdfmark +[/Title (Version 0.98.03) +/Dest /section-C.2.40 /OUT pdfmark +[/Title (Version 0.98) +/Dest /section-C.2.41 /OUT pdfmark +[/Title (Version 0.98p9) +/Dest /section-C.2.42 /OUT pdfmark +[/Title (Version 0.98p8) +/Dest /section-C.2.43 /OUT pdfmark +[/Title (Version 0.98p7) +/Dest /section-C.2.44 /OUT pdfmark +[/Title (Version 0.98p6) +/Dest /section-C.2.45 /OUT pdfmark +[/Title (Version 0.98p3.7) +/Dest /section-C.2.46 /OUT pdfmark +[/Title (Version 0.98p3.6) +/Dest /section-C.2.47 /OUT pdfmark +[/Title (Version 0.98p3.5) +/Dest /section-C.2.48 /OUT pdfmark +[/Title (Version 0.98p3.4) +/Dest /section-C.2.49 /OUT pdfmark +[/Title (Version 0.98p3.3) +/Dest /section-C.2.50 /OUT pdfmark +[/Title (Version 0.98p3.2) +/Dest /section-C.2.51 /OUT pdfmark +[/Title (Version 0.98p3-hpa) +/Dest /section-C.2.52 /OUT pdfmark +[/Title (Version 0.98 pre-release 3) +/Dest /section-C.2.53 /OUT pdfmark +[/Title (Version 0.98 pre-release 2) +/Dest /section-C.2.54 /OUT pdfmark +[/Title (Version 0.98 pre-release 1) +/Dest /section-C.2.55 /OUT pdfmark +[/Title (NASM 0.9 Series) +/Count -8 /Dest /section-C.3 /OUT pdfmark +[/Title (Version 0.97 released December 1997) +/Dest /section-C.3.1 /OUT pdfmark +[/Title (Version 0.96 released November 1997) +/Dest /section-C.3.2 /OUT pdfmark +[/Title (Version 0.95 released July 1997) +/Dest /section-C.3.3 /OUT pdfmark +[/Title (Version 0.94 released April 1997) +/Dest /section-C.3.4 /OUT pdfmark +[/Title (Version 0.93 released January 1997) +/Dest /section-C.3.5 /OUT pdfmark +[/Title (Version 0.92 released January 1997) +/Dest /section-C.3.6 /OUT pdfmark +[/Title (Version 0.91 released November 1996) +/Dest /section-C.3.7 /OUT pdfmark +[/Title (Version 0.90 released October 1996) +/Dest /section-C.3.8 /OUT pdfmark +[/Title (Index) +/Dest /index /OUT pdfmark +setpagesize +%%EndSetup +%%Page: 1 1 +%%BeginPageSetup +save +%%EndPageSetup +/1 pa +/ti (NASM \227 The Netwide Assembler) def +/sti (version\2402.08rc7) def +lmarg pageheight 2 mul 3 div moveto +tfont0 setfont +/title linkdest ti show +lmarg pageheight 2 mul 3 div 10 sub moveto +0 setlinecap 3 setlinewidth +pagewidth lmarg sub rmarg sub 0 rlineto currentpoint stroke moveto +hfont1 setfont sti stringwidth pop neg -15.4 rmoveto +sti show +BeginEPSF +154.5 363 translate +-99 -45 translate +99 45 moveto +385 45 lineto +385 111 lineto +99 111 lineto +99 45 lineto clip newpath +%%BeginDocument: (nasmlogo.eps) +%!PS-Adobe-3.0 EPSF-3.0 +%%BoundingBox: 99 45 385 111 +%%DocumentData: Clean7Bit +%%DocumentFonts: Courier-Bold +%%DocumentNeededFonts: Courier-Bold +%%Title: (NASM logo) +%%EndComments +%%Page 1 1 +%%BeginPageSetup +save +newpath +%%EndPageSetup +% x y pointsize -- +/nasmlogo { +gsave 1 dict begin +/sz exch def +/Courier-Bold findfont sz scalefont setfont +moveto +0.85 1.22 scale +[(-~~..~:#;L .-:#;L,.- .~:#:;.T -~~.~:;. .~:;. ) +( E8+U *T +U' *T# .97 *L E8+' *;T' *;, ) +( D97 `*L .97 '*L "T;E+:, D9 *L *L ) +( H7 I# T7 I# "*:. H7 I# I# ) +( U: :8 *#+ , :8 T, 79 U: :8 :8 ) +(,#B. .IE, "T;E* .IE, J *+;#:T*" ,#B. .IE, .IE,)] { +currentpoint 3 -1 roll +sz -0.10 mul 0 3 -1 roll ashow +sz 0.72 mul sub moveto +} forall +end grestore +} def +0.6 setgray 100 100 12 nasmlogo +%%PageTrailer +restore +%%EndDocument +EndEPSF +restore showpage +%%Page: 2 2 +%%BeginPageSetup +save +%%EndPageSetup +/2 pa +[(\251 1996-2009 The NASM Development Team \227 All Rights Reserved)]164 norm3 +[(This document is redistributable under the license given in the file "COPYING" distributed in the NASM)]147 norm1 +[(archive.)]136 norm2 +[(This release is dedicated to the memory of Charles A. Crayne. We miss you, Chuck.)]119 norm3 +restore showpage +%%Page: 3 3 +%%BeginPageSetup +save +%%EndPageSetup +/3 pa +[{/contents xa}(Contents)]642.8 chap3 +[(Introduction)](Chapter 1: )/chapter-1 (14)607.8 toc03 +[(What Is NASM?)](1.1 )/section-1.1 (14)590.8 toc13 +[(Why Yet Another Assembler?)](1.1.1 )/section-1.1.1 (14)573.8 toc23 +[(License Conditions)](1.1.2 )/section-1.1.2 (14)556.8 toc23 +[(Contact Information)](1.2 )/section-1.2 (15)539.8 toc13 +[(Installation)](1.3 )/section-1.3 (15)522.8 toc13 +[(Installing NASM under MS-DOS or Windows)](1.3.1 )/section-1.3.1 (15)505.8 toc23 +[(Installing NASM under Unix)](1.3.2 )/section-1.3.2 (16)488.8 toc23 +[(Running NASM)](Chapter 2: )/chapter-2 (17)471.8 toc03 +[(NASM Command-Line Syntax)](2.1 )/section-2.1 (17)454.8 toc13 +[(The )2(-o)0( Option: Specifying the Output File Name)](2.1.1 )/section-2.1.1 (17)437.8 toc23 +[(The )2(-f)0( Option: Specifying the Output File Format)](2.1.2 )/section-2.1.2 (18)420.8 toc23 +[(The )2(-l)0( Option: Generating a Listing File)](2.1.3 )/section-2.1.3 (18)403.8 toc23 +[(The )2(-M)0( Option: Generate Makefile Dependencies)](2.1.4 )/section-2.1.4 (18)386.8 toc23 +[(The )2(-MG)0( Option: Generate Makefile Dependencies)](2.1.5 )/section-2.1.5 (18)369.8 toc23 +[(The )2(-MF)0( Option: Set Makefile Dependency File)](2.1.6 )/section-2.1.6 (18)352.8 toc23 +[(The )2(-MD)0( Option: Assemble and Generate Dependencies)](2.1.7 )/section-2.1.7 (18)335.8 toc23 +[(The )2(-MT)0( Option: Dependency Target Name)](2.1.8 )/section-2.1.8 (19)318.8 toc23 +[(The )2(-MQ)0( Option: Dependency Target Name \(Quoted\))](2.1.9 )/section-2.1.9 (19)301.8 toc23 +[(The )2(-MP)0( Option: Emit phony targets)](2.1.10 )/section-2.1.10 (19)284.8 toc23 +[(The )2(-F)0( Option: Selecting a Debug Information Format)](2.1.11 )/section-2.1.11 (19)267.8 toc23 +[(The )2(-g)0( Option: Enabling Debug Information.)](2.1.12 )/section-2.1.12 (19)250.8 toc23 +[(The )2(-X)0( Option: Selecting an Error Reporting Format)](2.1.13 )/section-2.1.13 (19)233.8 toc23 +[(The )2(-Z)0( Option: Send Errors to a File)](2.1.14 )/section-2.1.14 (20)216.8 toc23 +[(The )2(-s)0( Option: Send Errors to )2(stdout)](2.1.15 )/section-2.1.15 (20)199.8 toc23 +[(The )2(-i)0( Option: Include File Search Directories)](2.1.16 )/section-2.1.16 (20)182.8 toc23 +[(The )2(-p)0( Option: Pre-Include a File)](2.1.17 )/section-2.1.17 (20)165.8 toc23 +[(The )2(-d)0( Option: Pre-Define a Macro)](2.1.18 )/section-2.1.18 (20)148.8 toc23 +[(The )2(-u)0( Option: Undefine a Macro)](2.1.19 )/section-2.1.19 (21)131.8 toc23 +[(The )2(-E)0( Option: Preprocess Only)](2.1.20 )/section-2.1.20 (21)114.8 toc23 +(3)pageodd +restore showpage +%%Page: 4 4 +%%BeginPageSetup +save +%%EndPageSetup +/4 pa +[(The )2(-a)0( Option: Don't Preprocess At All)](2.1.21 )/section-2.1.21 (21)681 toc23 +[(The )2(-O)0( Option: Specifying Multipass Optimization)](2.1.22 )/section-2.1.22 (21)664 toc23 +[(The )2(-t)0( Option: Enable TASM Compatibility Mode)](2.1.23 )/section-2.1.23 (22)647 toc23 +[(The )2(-w)0( and )2(-W)0( Options: Enable or Disable Assembly Warnings)](2.1.24 )/section-2.1.24 (22)630 toc23 +[(The )2(-v)0( Option: Display Version Info)](2.1.25 )/section-2.1.25 (23)613 toc23 +[(The )2(-y)0( Option: Display Available Debug Info Formats)](2.1.26 )/section-2.1.26 (23)596 toc23 +[(The )2(--prefix)0( and )2(--postfix)0( Options.)](2.1.27 )/section-2.1.27 (23)579 toc23 +[(The )2(NASMENV)0( Environment Variable)](2.1.28 )/section-2.1.28 (23)562 toc23 +[(Quick Start for MASM Users)](2.2 )/section-2.2 (24)545 toc13 +[(NASM Is Case-Sensitive)](2.2.1 )/section-2.2.1 (24)528 toc23 +[(NASM Requires Square Brackets For Memory References)](2.2.2 )/section-2.2.2 (24)511 toc23 +[(NASM Doesn't Store Variable Types)](2.2.3 )/section-2.2.3 (24)494 toc23 +[(NASM Doesn't )2(ASSUME)](2.2.4 )/section-2.2.4 (25)477 toc23 +[(NASM Doesn't Support Memory Models)](2.2.5 )/section-2.2.5 (25)460 toc23 +[(Floating-Point Differences)](2.2.6 )/section-2.2.6 (25)443 toc23 +[(Other Differences)](2.2.7 )/section-2.2.7 (25)426 toc23 +[(The NASM Language)](Chapter 3: )/chapter-3 (26)409 toc03 +[(Layout of a NASM Source Line)](3.1 )/section-3.1 (26)392 toc13 +[(Pseudo-Instructions)](3.2 )/section-3.2 (27)375 toc13 +[2(DB)0( and Friends: Declaring Initialized Data)](3.2.1 )/section-3.2.1 (27)358 toc23 +[2(RESB)0( and Friends: Declaring Uninitialized Data)](3.2.2 )/section-3.2.2 (27)341 toc23 +[2(INCBIN)0(: Including External Binary Files)](3.2.3 )/section-3.2.3 (27)324 toc23 +[2(EQU)0(: Defining Constants)](3.2.4 )/section-3.2.4 (28)307 toc23 +[2(TIMES)0(: Repeating Instructions or Data)](3.2.5 )/section-3.2.5 (28)290 toc23 +[(Effective Addresses)](3.3 )/section-3.3 (28)273 toc13 +[(Constants)](3.4 )/section-3.4 (29)256 toc13 +[(Numeric Constants)](3.4.1 )/section-3.4.1 (29)239 toc23 +[(Character Strings)](3.4.2 )/section-3.4.2 (30)222 toc23 +[(Character Constants)](3.4.3 )/section-3.4.3 (31)205 toc23 +[(String Constants)](3.4.4 )/section-3.4.4 (31)188 toc23 +[(Unicode Strings)](3.4.5 )/section-3.4.5 (31)171 toc23 +[(Floating-Point Constants)](3.4.6 )/section-3.4.6 (31)154 toc23 +[(Packed BCD Constants)](3.4.7 )/section-3.4.7 (33)137 toc23 +[(Expressions)](3.5 )/section-3.5 (33)120 toc13 +[2(|)0(: Bitwise OR Operator)](3.5.1 )/section-3.5.1 (33)103 toc23 +(4)pageeven +restore showpage +%%Page: 5 5 +%%BeginPageSetup +save +%%EndPageSetup +/5 pa +[2(^)0(: Bitwise XOR Operator)](3.5.2 )/section-3.5.2 (33)681 toc23 +[2(&)0(: Bitwise AND Operator)](3.5.3 )/section-3.5.3 (33)664 toc23 +[2(<<)0( and )2(>>)0(: Bit Shift Operators)](3.5.4 )/section-3.5.4 (33)647 toc23 +[2(+)0( and )2(-)0(: Addition and Subtraction Operators)](3.5.5 )/section-3.5.5 (33)630 toc23 +[2(*)0(, )2(/)0(, )2(//)0(, )2(%)0( and )2(%%)0(: Multiplication and Division)](3.5.6 )/section-3.5.6 (33)613 toc23 +[(Unary Operators: )2(+)0(, )2(-)0(, )2(~)0(, )2(!)0( and )2(SEG)](3.5.7 )/section-3.5.7 (34)596 toc23 +[2(SEG)0( and )2(WRT)](3.6 )/section-3.6 (34)579 toc13 +[2(STRICT)0(: Inhibiting Optimization)](3.7 )/section-3.7 (34)562 toc13 +[(Critical Expressions)](3.8 )/section-3.8 (35)545 toc13 +[(Local Labels)](3.9 )/section-3.9 (35)528 toc13 +[(The NASM Preprocessor)](Chapter 4: )/chapter-4 (37)511 toc03 +[(Single-Line Macros)](4.1 )/section-4.1 (37)494 toc13 +[(The Normal Way: )2(%define)](4.1.1 )/section-4.1.1 (37)477 toc23 +[(Resolving )2(%define)0(: )2(%xdefine)](4.1.2 )/section-4.1.2 (38)460 toc23 +[(Macro Indirection: )2(%[...])](4.1.3 )/section-4.1.3 (39)443 toc23 +[(Concatenating Single Line Macro Tokens: )2(%+)](4.1.4 )/section-4.1.4 (39)426 toc23 +[(The Macro Name Itself: )2(%?)0( and )2(%??)](4.1.5 )/section-4.1.5 (39)409 toc23 +[(Undefining Single-Line Macros: )2(%undef)](4.1.6 )/section-4.1.6 (40)392 toc23 +[(Preprocessor Variables: )2(%assign)](4.1.7 )/section-4.1.7 (40)375 toc23 +[(Defining Strings: )2(%defstr)](4.1.8 )/section-4.1.8 (41)358 toc23 +[(Defining Tokens: )2(%deftok)](4.1.9 )/section-4.1.9 (41)341 toc23 +[(String Manipulation in Macros)](4.2 )/section-4.2 (41)324 toc13 +[(Concatenating Strings: )2(%strcat)](4.2.1 )/section-4.2.1 (41)307 toc23 +[(String Length: )2(%strlen)](4.2.2 )/section-4.2.2 (41)290 toc23 +[(Extracting Substrings: )2(%substr)](4.2.3 )/section-4.2.3 (42)273 toc23 +[(Multi-Line Macros: )2(%macro)](4.3 )/section-4.3 (42)256 toc13 +[(Recursive Multi-Line Macros: )2(%rmacro)](4.3.1 )/section-4.3.1 (43)239 toc23 +[(Overloading Multi-Line Macros)](4.3.2 )/section-4.3.2 (43)222 toc23 +[(Macro-Local Labels)](4.3.3 )/section-4.3.3 (43)205 toc23 +[(Greedy Macro Parameters)](4.3.4 )/section-4.3.4 (44)188 toc23 +[(Default Macro Parameters)](4.3.5 )/section-4.3.5 (45)171 toc23 +[2(%0)0(: Macro Parameter Counter)](4.3.6 )/section-4.3.6 (45)154 toc23 +[2(%rotate)0(: Rotating Macro Parameters)](4.3.7 )/section-4.3.7 (46)137 toc23 +[(Concatenating Macro Parameters)](4.3.8 )/section-4.3.8 (46)120 toc23 +[(Condition Codes as Macro Parameters)](4.3.9 )/section-4.3.9 (47)103 toc23 +(5)pageodd +restore showpage +%%Page: 6 6 +%%BeginPageSetup +save +%%EndPageSetup +/6 pa +[(Disabling Listing Expansion)](4.3.10 )/section-4.3.10 (48)681 toc23 +[(Undefining Multi-Line Macros: )2(%unmacro)](4.3.11 )/section-4.3.11 (48)664 toc23 +[(Exiting Multi-Line Macros: )2(%exitmacro)](4.3.12 )/section-4.3.12 (48)647 toc23 +[(Conditional Assembly)](4.4 )/section-4.4 (49)630 toc13 +[2(%ifdef)0(: Testing Single-Line Macro Existence)](4.4.1 )/section-4.4.1 (49)613 toc23 +[2(%ifmacro)0(: Testing Multi-Line Macro Existence)](4.4.2 )/section-4.4.2 (49)596 toc23 +[2(%ifctx)0(: Testing the Context Stack)](4.4.3 )/section-4.4.3 (50)579 toc23 +[2(%if)0(: Testing Arbitrary Numeric Expressions)](4.4.4 )/section-4.4.4 (50)562 toc23 +[2(%ifidn)0( and )2(%ifidni)0(: Testing Exact Text Identity)](4.4.5 )/section-4.4.5 (50)545 toc23 +[2(%ifid)0(, )2(%ifnum)0(, )2(%ifstr)0(: Testing Token Types)](4.4.6 )/section-4.4.6 (51)528 toc23 +[2(%iftoken)0(: Test for a Single Token)](4.4.7 )/section-4.4.7 (52)511 toc23 +[2(%ifempty)0(: Test for Empty Expansion)](4.4.8 )/section-4.4.8 (52)494 toc23 +[(Preprocessor Loops: )2(%rep)](4.5 )/section-4.5 (52)477 toc13 +[(Source Files and Dependencies)](4.6 )/section-4.6 (53)460 toc13 +[2(%include)0(: Including Other Files)](4.6.1 )/section-4.6.1 (53)443 toc23 +[2(%pathsearch)0(: Search the Include Path)](4.6.2 )/section-4.6.2 (53)426 toc23 +[2(%depend)0(: Add Dependent Files)](4.6.3 )/section-4.6.3 (53)409 toc23 +[2(%use)0(: Include Standard Macro Package)](4.6.4 )/section-4.6.4 (54)392 toc23 +[(The Context Stack)](4.7 )/section-4.7 (54)375 toc13 +[2(%push)0( and )2(%pop)0(: Creating and Removing Contexts)](4.7.1 )/section-4.7.1 (54)358 toc23 +[(Context-Local Labels)](4.7.2 )/section-4.7.2 (54)341 toc23 +[(Context-Local Single-Line Macros)](4.7.3 )/section-4.7.3 (55)324 toc23 +[2(%repl)0(: Renaming a Context)](4.7.4 )/section-4.7.4 (55)307 toc23 +[(Example Use of the Context Stack: Block IFs)](4.7.5 )/section-4.7.5 (55)290 toc23 +[(Stack Relative Preprocessor Directives)](4.8 )/section-4.8 (57)273 toc13 +[2(%arg)0( Directive)](4.8.1 )/section-4.8.1 (57)256 toc23 +[2(%stacksize)0( Directive)](4.8.2 )/section-4.8.2 (57)239 toc23 +[2(%local)0( Directive)](4.8.3 )/section-4.8.3 (58)222 toc23 +[(Reporting User-Defined Errors: )2(%error)0(, )2(%warning)0(, )2(%fatal)](4.9 )/section-4.9 (58)205 toc13 +[(Other Preprocessor Directives)](4.10 )/section-4.10 (59)188 toc13 +[2(%line)0( Directive)](4.10.1 )/section-4.10.1 (59)171 toc23 +[2(%!<env>)0(: Read an environment variable.)](4.10.2 )/section-4.10.2 (60)154 toc23 +[(Standard Macros)](4.11 )/section-4.11 (60)137 toc13 +[(NASM Version Macros)](4.11.1 )/section-4.11.1 (60)120 toc23 +[2(__NASM_VERSION_ID__)0(: NASM Version ID)](4.11.2 )/section-4.11.2 (60)103 toc23 +(6)pageeven +restore showpage +%%Page: 7 7 +%%BeginPageSetup +save +%%EndPageSetup +/7 pa +[2(__NASM_VER__)0(: NASM Version string)](4.11.3 )/section-4.11.3 (60)681 toc23 +[2(__FILE__)0( and )2(__LINE__)0(: File Name and Line Number)](4.11.4 )/section-4.11.4 (61)664 toc23 +[2(__BITS__)0(: Current BITS Mode)](4.11.5 )/section-4.11.5 (61)647 toc23 +[2(__OUTPUT_FORMAT__)0(: Current Output Format)](4.11.6 )/section-4.11.6 (61)630 toc23 +[(Assembly Date and Time Macros)](4.11.7 )/section-4.11.7 (61)613 toc23 +[2(__USE_)1(package)2(__)0(: Package Include Test)](4.11.8 )/section-4.11.8 (62)596 toc23 +[2(__PASS__)0(: Assembly Pass)](4.11.9 )/section-4.11.9 (62)579 toc23 +[2(STRUC)0( and )2(ENDSTRUC)0(: Declaring Structure Data Types)](4.11.10 )/section-4.11.10 (62)562 toc23 +[2(ISTRUC)0(, )2(AT)0( and )2(IEND)0(: Declaring Instances of Structures)](4.11.11 )/section-4.11.11 (63)545 toc23 +[2(ALIGN)0( and )2(ALIGNB)0(: Data Alignment)](4.11.12 )/section-4.11.12 (64)528 toc23 +[(Standard Macro Packages)](Chapter 5: )/chapter-5 (66)511 toc03 +[2(altreg)0(: Alternate Register Names)](5.1 )/section-5.1 (66)494 toc13 +[2(smartalign)0(: Smart )2(ALIGN)0( Macro)](5.2 )/section-5.2 (66)477 toc13 +[(Assembler Directives)](Chapter 6: )/chapter-6 (67)460 toc03 +[2(BITS)0(: Specifying Target Processor Mode)](6.1 )/section-6.1 (67)443 toc13 +[2(USE16)0( & )2(USE32)0(: Aliases for BITS)](6.1.1 )/section-6.1.1 (68)426 toc23 +[2(DEFAULT)0(: Change the assembler defaults)](6.2 )/section-6.2 (68)409 toc13 +[2(SECTION)0( or )2(SEGMENT)0(: Changing and Defining Sections)](6.3 )/section-6.3 (68)392 toc13 +[(The )2(__SECT__)0( Macro)](6.3.1 )/section-6.3.1 (68)375 toc23 +[2(ABSOLUTE)0(: Defining Absolute Labels)](6.4 )/section-6.4 (69)358 toc13 +[2(EXTERN)0(: Importing Symbols from Other Modules)](6.5 )/section-6.5 (70)341 toc13 +[2(GLOBAL)0(: Exporting Symbols to Other Modules)](6.6 )/section-6.6 (70)324 toc13 +[2(COMMON)0(: Defining Common Data Areas)](6.7 )/section-6.7 (70)307 toc13 +[2(CPU)0(: Defining CPU Dependencies)](6.8 )/section-6.8 (71)290 toc13 +[2(FLOAT)0(: Handling of floating-point constants)](6.9 )/section-6.9 (71)273 toc13 +[(Output Formats)](Chapter 7: )/chapter-7 (73)256 toc03 +[2(bin)0(: Flat-Form Binary Output)](7.1 )/section-7.1 (73)239 toc13 +[2(ORG)0(: Binary File Program Origin)](7.1.1 )/section-7.1.1 (73)222 toc23 +[2(bin)0( Extensions to the )2(SECTION)0( Directive)](7.1.2 )/section-7.1.2 (73)205 toc23 +[(Multisection Support for the )2(bin)0( Format)](7.1.3 )/section-7.1.3 (74)188 toc23 +[(Map Files)](7.1.4 )/section-7.1.4 (74)171 toc23 +[2(ith)0(: Intel Hex Output)](7.2 )/section-7.2 (74)154 toc13 +[2(srec)0(: Motorola S-Records Output)](7.3 )/section-7.3 (74)137 toc13 +[2(obj)0(: Microsoft OMF Object Files)](7.4 )/section-7.4 (75)120 toc13 +[2(obj)0( Extensions to the )2(SEGMENT)0( Directive)](7.4.1 )/section-7.4.1 (75)103 toc23 +(7)pageodd +restore showpage +%%Page: 8 8 +%%BeginPageSetup +save +%%EndPageSetup +/8 pa +[2(GROUP)0(: Defining Groups of Segments)](7.4.2 )/section-7.4.2 (76)681 toc23 +[2(UPPERCASE)0(: Disabling Case Sensitivity in Output)](7.4.3 )/section-7.4.3 (77)664 toc23 +[2(IMPORT)0(: Importing DLL Symbols)](7.4.4 )/section-7.4.4 (77)647 toc23 +[2(EXPORT)0(: Exporting DLL Symbols)](7.4.5 )/section-7.4.5 (77)630 toc23 +[2(..start)0(: Defining the Program Entry Point)](7.4.6 )/section-7.4.6 (78)613 toc23 +[2(obj)0( Extensions to the )2(EXTERN)0( Directive)](7.4.7 )/section-7.4.7 (78)596 toc23 +[2(obj)0( Extensions to the )2(COMMON)0( Directive)](7.4.8 )/section-7.4.8 (78)579 toc23 +[2(win32)0(: Microsoft Win32 Object Files)](7.5 )/section-7.5 (79)562 toc13 +[2(win32)0( Extensions to the )2(SECTION)0( Directive)](7.5.1 )/section-7.5.1 (79)545 toc23 +[2(win32)0(: Safe Structured Exception Handling)](7.5.2 )/section-7.5.2 (80)528 toc23 +[2(win64)0(: Microsoft Win64 Object Files)](7.6 )/section-7.6 (81)511 toc13 +[2(win64)0(: Writing Position-Independent Code)](7.6.1 )/section-7.6.1 (81)494 toc23 +[2(win64)0(: Structured Exception Handling)](7.6.2 )/section-7.6.2 (82)477 toc23 +[2(coff)0(: Common Object File Format)](7.7 )/section-7.7 (85)460 toc13 +[2(macho32)0( and )2(macho64)0(: Mach Object File Format)](7.8 )/section-7.8 (85)443 toc13 +[2(elf32)0( and )2(elf64)0(: Executable and Linkable Format Object Files)](7.9 )/section-7.9 (85)426 toc13 +[(ELF specific directive )2(osabi)](7.9.1 )/section-7.9.1 (85)409 toc23 +[2(elf)0( Extensions to the )2(SECTION)0( Directive)](7.9.2 )/section-7.9.2 (85)392 toc23 +[(Position-Independent Code: )2(elf)0( Special Symbols and )2(WRT)](7.9.3 )/section-7.9.3 (86)375 toc23 +[(Thread Local Storage: )2(elf)0( Special Symbols and )2(WRT)](7.9.4 )/section-7.9.4 (87)358 toc23 +[2(elf)0( Extensions to the )2(GLOBAL)0( Directive)](7.9.5 )/section-7.9.5 (87)341 toc23 +[2(elf)0( Extensions to the )2(COMMON)0( Directive )](7.9.6 )/section-7.9.6 (87)324 toc23 +[(16-bit code and ELF )](7.9.7 )/section-7.9.7 (88)307 toc23 +[(Debug formats and ELF )](7.9.8 )/section-7.9.8 (88)290 toc23 +[2(aout)0(: Linux )2(a.out)0( Object Files)](7.10 )/section-7.10 (88)273 toc13 +[2(aoutb)0(: NetBSD/FreeBSD/OpenBSD )2(a.out)0( Object Files)](7.11 )/section-7.11 (88)256 toc13 +[2(as86)0(: Minix/Linux )2(as86)0( Object Files)](7.12 )/section-7.12 (88)239 toc13 +[2(rdf)0(: Relocatable Dynamic Object File Format)](7.13 )/section-7.13 (88)222 toc13 +[(Requiring a Library: The )2(LIBRARY)0( Directive)](7.13.1 )/section-7.13.1 (89)205 toc23 +[(Specifying a Module Name: The )2(MODULE)0( Directive)](7.13.2 )/section-7.13.2 (89)188 toc23 +[2(rdf)0( Extensions to the )2(GLOBAL)0( Directive)](7.13.3 )/section-7.13.3 (89)171 toc23 +[2(rdf)0( Extensions to the )2(EXTERN)0( Directive)](7.13.4 )/section-7.13.4 (89)154 toc23 +[2(dbg)0(: Debugging Format)](7.14 )/section-7.14 (90)137 toc13 +[(Writing 16-bit Code \(DOS, Windows 3/3.1\))](Chapter 8: )/chapter-8 (91)120 toc03 +[(Producing )2(.EXE)0( Files)](8.1 )/section-8.1 (91)103 toc13 +(8)pageeven +restore showpage +%%Page: 9 9 +%%BeginPageSetup +save +%%EndPageSetup +/9 pa +[(Using the )2(obj)0( Format To Generate )2(.EXE)0( Files)](8.1.1 )/section-8.1.1 (91)681 toc23 +[(Using the )2(bin)0( Format To Generate )2(.EXE)0( Files)](8.1.2 )/section-8.1.2 (92)664 toc23 +[(Producing )2(.COM)0( Files)](8.2 )/section-8.2 (93)647 toc13 +[(Using the )2(bin)0( Format To Generate )2(.COM)0( Files)](8.2.1 )/section-8.2.1 (93)630 toc23 +[(Using the )2(obj)0( Format To Generate )2(.COM)0( Files)](8.2.2 )/section-8.2.2 (93)613 toc23 +[(Producing )2(.SYS)0( Files)](8.3 )/section-8.3 (94)596 toc13 +[(Interfacing to 16-bit C Programs)](8.4 )/section-8.4 (94)579 toc13 +[(External Symbol Names)](8.4.1 )/section-8.4.1 (94)562 toc23 +[(Memory Models)](8.4.2 )/section-8.4.2 (95)545 toc23 +[(Function Definitions and Function Calls)](8.4.3 )/section-8.4.3 (96)528 toc23 +[(Accessing Data Items)](8.4.4 )/section-8.4.4 (98)511 toc23 +[2(c16.mac)0(: Helper Macros for the 16-bit C Interface)](8.4.5 )/section-8.4.5 (98)494 toc23 +[(Interfacing to Borland Pascal Programs)](8.5 )/section-8.5 (99)477 toc13 +[(The Pascal Calling Convention)](8.5.1 )/section-8.5.1 (100)460 toc23 +[(Borland Pascal Segment Name Restrictions)](8.5.2 )/section-8.5.2 (101)443 toc23 +[(Using )2(c16.mac)0( With Pascal Programs)](8.5.3 )/section-8.5.3 (101)426 toc23 +[(Writing 32-bit Code \(Unix, Win32, DJGPP\))](Chapter 9: )/chapter-9 (103)409 toc03 +[(Interfacing to 32-bit C Programs)](9.1 )/section-9.1 (103)392 toc13 +[(External Symbol Names)](9.1.1 )/section-9.1.1 (103)375 toc23 +[(Function Definitions and Function Calls)](9.1.2 )/section-9.1.2 (103)358 toc23 +[(Accessing Data Items)](9.1.3 )/section-9.1.3 (105)341 toc23 +[2(c32.mac)0(: Helper Macros for the 32-bit C Interface)](9.1.4 )/section-9.1.4 (105)324 toc23 +[(Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries)](9.2 )/section-9.2 (106)307 toc13 +[(Obtaining the Address of the GOT)](9.2.1 )/section-9.2.1 (106)290 toc23 +[(Finding Your Local Data Items)](9.2.2 )/section-9.2.2 (107)273 toc23 +[(Finding External and Common Data Items)](9.2.3 )/section-9.2.3 (107)256 toc23 +[(Exporting Symbols to the Library User)](9.2.4 )/section-9.2.4 (108)239 toc23 +[(Calling Procedures Outside the Library)](9.2.5 )/section-9.2.5 (109)222 toc23 +[(Generating the Library File)](9.2.6 )/section-9.2.6 (109)205 toc23 +[(Mixing 16 and 32 Bit Code)](Chapter 10: )/chapter-10 (110)188 toc03 +[(Mixed-Size Jumps)](10.1 )/section-10.1 (110)171 toc13 +[(Addressing Between Different-Size Segments)](10.2 )/section-10.2 (110)154 toc13 +[(Other Mixed-Size Instructions)](10.3 )/section-10.3 (111)137 toc13 +[(Writing 64-bit Code \(Unix, Win64\))](Chapter 11: )/chapter-11 (113)120 toc03 +[(Register Names in 64-bit Mode)](11.1 )/section-11.1 (113)103 toc13 +(9)pageodd +restore showpage +%%Page: 10 10 +%%BeginPageSetup +save +%%EndPageSetup +/10 pa +[(Immediates and Displacements in 64-bit Mode)](11.2 )/section-11.2 (113)681 toc13 +[(Interfacing to 64-bit C Programs \(Unix\))](11.3 )/section-11.3 (114)664 toc13 +[(Interfacing to 64-bit C Programs \(Win64\))](11.4 )/section-11.4 (114)647 toc13 +[(Troubleshooting)](Chapter 12: )/chapter-12 (116)630 toc03 +[(Common Problems)](12.1 )/section-12.1 (116)613 toc13 +[(NASM Generates Inefficient Code)](12.1.1 )/section-12.1.1 (116)596 toc23 +[(My Jumps are Out of Range)](12.1.2 )/section-12.1.2 (116)579 toc23 +[2(ORG)0( Doesn't Work)](12.1.3 )/section-12.1.3 (116)562 toc23 +[2(TIMES)0( Doesn't Work)](12.1.4 )/section-12.1.4 (117)545 toc23 +[(Bugs)](12.2 )/section-12.2 (117)528 toc13 +[(Ndisasm)](Appendix A: )/appendix-A (119)511 toc03 +[(Introduction)](A.1 )/section-A.1 (119)494 toc13 +[(Getting Started: Installation)](A.2 )/section-A.2 (119)477 toc13 +[(Running NDISASM)](A.3 )/section-A.3 (119)460 toc13 +[(COM Files: Specifying an Origin)](A.3.1 )/section-A.3.1 (119)443 toc23 +[(Code Following Data: Synchronisation)](A.3.2 )/section-A.3.2 (119)426 toc23 +[(Mixed Code and Data: Automatic \(Intelligent\) Synchronisation )](A.3.3 )/section-A.3.3 (120)409 toc23 +[(Other Options)](A.3.4 )/section-A.3.4 (121)392 toc23 +[(Bugs and Improvements)](A.4 )/section-A.4 (121)375 toc13 +[(Instruction List)](Appendix B: )/appendix-B (122)358 toc03 +[(Introduction)](B.1 )/section-B.1 (122)341 toc13 +[(Special instructions...)](B.1.1 )/section-B.1.1 (122)324 toc23 +[(Conventional instructions)](B.1.2 )/section-B.1.2 (122)307 toc23 +[(Katmai Streaming SIMD instructions \(SSE \226\226 a.k.a. KNI, XMM, MMX2\))](B.1.3 )/section-B.1.3 (148)290 toc23 +[(Introduced in Deschutes but necessary for SSE support)](B.1.4 )/section-B.1.4 (149)273 toc23 +[(XSAVE group \(AVX and extended state\))](B.1.5 )/section-B.1.5 (149)256 toc23 +[(Generic memory operations)](B.1.6 )/section-B.1.6 (149)239 toc23 +[(New MMX instructions introduced in Katmai)](B.1.7 )/section-B.1.7 (150)222 toc23 +[(AMD Enhanced 3DNow! \(Athlon\) instructions)](B.1.8 )/section-B.1.8 (150)205 toc23 +[(Willamette SSE2 Cacheability Instructions)](B.1.9 )/section-B.1.9 (150)188 toc23 +[(Willamette MMX instructions \(SSE2 SIMD Integer Instructions\))](B.1.10 )/section-B.1.10 (150)171 toc23 +[(Willamette Streaming SIMD instructions \(SSE2\))](B.1.11 )/section-B.1.11 (152)154 toc23 +[(Prescott New Instructions \(SSE3\))](B.1.12 )/section-B.1.12 (154)137 toc23 +[(VMX Instructions)](B.1.13 )/section-B.1.13 (154)120 toc23 +[(Extended Page Tables VMX instructions)](B.1.14 )/section-B.1.14 (154)103 toc23 +(10)pageeven +restore showpage +%%Page: 11 11 +%%BeginPageSetup +save +%%EndPageSetup +/11 pa +[(Tejas New Instructions \(SSSE3\))](B.1.15 )/section-B.1.15 (155)681 toc23 +[(AMD SSE4A)](B.1.16 )/section-B.1.16 (155)664 toc23 +[(New instructions in Barcelona)](B.1.17 )/section-B.1.17 (155)647 toc23 +[(Penryn New Instructions \(SSE4.1\))](B.1.18 )/section-B.1.18 (155)630 toc23 +[(Nehalem New Instructions \(SSE4.2\))](B.1.19 )/section-B.1.19 (157)613 toc23 +[(Intel SMX)](B.1.20 )/section-B.1.20 (157)596 toc23 +[(Geode \(Cyrix\) 3DNow! additions)](B.1.21 )/section-B.1.21 (157)579 toc23 +[(Intel new instructions in ???)](B.1.22 )/section-B.1.22 (157)562 toc23 +[(Intel AES instructions)](B.1.23 )/section-B.1.23 (157)545 toc23 +[(Intel AVX AES instructions)](B.1.24 )/section-B.1.24 (157)528 toc23 +[(Intel AVX instructions)](B.1.25 )/section-B.1.25 (158)511 toc23 +[(Intel Carry-Less Multiplication instructions \(CLMUL\))](B.1.26 )/section-B.1.26 (170)494 toc23 +[(Intel AVX Carry-Less Multiplication instructions \(CLMUL\))](B.1.27 )/section-B.1.27 (170)477 toc23 +[(Intel Fused Multiply-Add instructions \(FMA\))](B.1.28 )/section-B.1.28 (170)460 toc23 +[(VIA \(Centaur\) security instructions)](B.1.29 )/section-B.1.29 (174)443 toc23 +[(AMD Lightweight Profiling \(LWP\) instructions)](B.1.30 )/section-B.1.30 (174)426 toc23 +[(AMD XOP, FMA4 and CVT16 instructions \(SSE5\))](B.1.31 )/section-B.1.31 (174)409 toc23 +[(Systematic names for the hinting nop instructions)](B.1.32 )/section-B.1.32 (177)392 toc23 +[(NASM Version History)](Appendix C: )/appendix-C (181)375 toc03 +[(NASM 2 Series)](C.1 )/section-C.1 (181)358 toc13 +[(Version 2.08)](C.1.1 )/section-C.1.1 (181)341 toc23 +[(Version 2.07)](C.1.2 )/section-C.1.2 (181)324 toc23 +[(Version 2.06)](C.1.3 )/section-C.1.3 (182)307 toc23 +[(Version 2.05.01)](C.1.4 )/section-C.1.4 (182)290 toc23 +[(Version 2.05)](C.1.5 )/section-C.1.5 (182)273 toc23 +[(Version 2.04)](C.1.6 )/section-C.1.6 (183)256 toc23 +[(Version 2.03.01)](C.1.7 )/section-C.1.7 (184)239 toc23 +[(Version 2.03)](C.1.8 )/section-C.1.8 (184)222 toc23 +[(Version 2.02)](C.1.9 )/section-C.1.9 (184)205 toc23 +[(Version 2.01)](C.1.10 )/section-C.1.10 (185)188 toc23 +[(Version 2.00)](C.1.11 )/section-C.1.11 (185)171 toc23 +[(NASM 0.98 Series)](C.2 )/section-C.2 (186)154 toc13 +[(Version 0.98.39)](C.2.1 )/section-C.2.1 (186)137 toc23 +[(Version 0.98.38)](C.2.2 )/section-C.2.2 (186)120 toc23 +[(Version 0.98.37)](C.2.3 )/section-C.2.3 (187)103 toc23 +(11)pageodd +restore showpage +%%Page: 12 12 +%%BeginPageSetup +save +%%EndPageSetup +/12 pa +[(Version 0.98.36)](C.2.4 )/section-C.2.4 (187)681 toc23 +[(Version 0.98.35)](C.2.5 )/section-C.2.5 (187)664 toc23 +[(Version 0.98.34)](C.2.6 )/section-C.2.6 (187)647 toc23 +[(Version 0.98.33)](C.2.7 )/section-C.2.7 (188)630 toc23 +[(Version 0.98.32)](C.2.8 )/section-C.2.8 (188)613 toc23 +[(Version 0.98.31)](C.2.9 )/section-C.2.9 (188)596 toc23 +[(Version 0.98.30)](C.2.10 )/section-C.2.10 (189)579 toc23 +[(Version 0.98.28)](C.2.11 )/section-C.2.11 (189)562 toc23 +[(Version 0.98.26)](C.2.12 )/section-C.2.12 (189)545 toc23 +[(Version 0.98.25alt)](C.2.13 )/section-C.2.13 (189)528 toc23 +[(Version 0.98.25)](C.2.14 )/section-C.2.14 (189)511 toc23 +[(Version 0.98.24p1)](C.2.15 )/section-C.2.15 (189)494 toc23 +[(Version 0.98.24)](C.2.16 )/section-C.2.16 (189)477 toc23 +[(Version 0.98.23)](C.2.17 )/section-C.2.17 (189)460 toc23 +[(Version 0.98.22)](C.2.18 )/section-C.2.18 (189)443 toc23 +[(Version 0.98.21)](C.2.19 )/section-C.2.19 (189)426 toc23 +[(Version 0.98.20)](C.2.20 )/section-C.2.20 (190)409 toc23 +[(Version 0.98.19)](C.2.21 )/section-C.2.21 (190)392 toc23 +[(Version 0.98.18)](C.2.22 )/section-C.2.22 (190)375 toc23 +[(Version 0.98.17)](C.2.23 )/section-C.2.23 (190)358 toc23 +[(Version 0.98.16)](C.2.24 )/section-C.2.24 (190)341 toc23 +[(Version 0.98.15)](C.2.25 )/section-C.2.25 (190)324 toc23 +[(Version 0.98.14)](C.2.26 )/section-C.2.26 (190)307 toc23 +[(Version 0.98.13)](C.2.27 )/section-C.2.27 (190)290 toc23 +[(Version 0.98.12)](C.2.28 )/section-C.2.28 (190)273 toc23 +[(Version 0.98.11)](C.2.29 )/section-C.2.29 (190)256 toc23 +[(Version 0.98.10)](C.2.30 )/section-C.2.30 (190)239 toc23 +[(Version 0.98.09)](C.2.31 )/section-C.2.31 (190)222 toc23 +[(Version 0.98.08)](C.2.32 )/section-C.2.32 (191)205 toc23 +[(Version 0.98.09b with John Coffman patches released 28-Oct-2001)](C.2.33 )/section-C.2.33 (191)188 toc23 +[(Version 0.98.07 released 01/28/01)](C.2.34 )/section-C.2.34 (191)171 toc23 +[(Version 0.98.06f released 01/18/01)](C.2.35 )/section-C.2.35 (191)154 toc23 +[(Version 0.98.06e released 01/09/01)](C.2.36 )/section-C.2.36 (191)137 toc23 +[(Version 0.98p1)](C.2.37 )/section-C.2.37 (192)120 toc23 +[(Version 0.98bf \(bug-fixed\))](C.2.38 )/section-C.2.38 (192)103 toc23 +(12)pageeven +restore showpage +%%Page: 13 13 +%%BeginPageSetup +save +%%EndPageSetup +/13 pa +[(Version 0.98.03 with John Coffman's changes released 27-Jul-2000)](C.2.39 )/section-C.2.39 (192)681 toc23 +[(Version 0.98.03)](C.2.40 )/section-C.2.40 (192)664 toc23 +[(Version 0.98)](C.2.41 )/section-C.2.41 (195)647 toc23 +[(Version 0.98p9)](C.2.42 )/section-C.2.42 (196)630 toc23 +[(Version 0.98p8)](C.2.43 )/section-C.2.43 (196)613 toc23 +[(Version 0.98p7)](C.2.44 )/section-C.2.44 (196)596 toc23 +[(Version 0.98p6)](C.2.45 )/section-C.2.45 (197)579 toc23 +[(Version 0.98p3.7)](C.2.46 )/section-C.2.46 (197)562 toc23 +[(Version 0.98p3.6)](C.2.47 )/section-C.2.47 (197)545 toc23 +[(Version 0.98p3.5)](C.2.48 )/section-C.2.48 (197)528 toc23 +[(Version 0.98p3.4)](C.2.49 )/section-C.2.49 (198)511 toc23 +[(Version 0.98p3.3)](C.2.50 )/section-C.2.50 (198)494 toc23 +[(Version 0.98p3.2)](C.2.51 )/section-C.2.51 (198)477 toc23 +[(Version 0.98p3-hpa)](C.2.52 )/section-C.2.52 (198)460 toc23 +[(Version 0.98 pre-release 3)](C.2.53 )/section-C.2.53 (198)443 toc23 +[(Version 0.98 pre-release 2)](C.2.54 )/section-C.2.54 (199)426 toc23 +[(Version 0.98 pre-release 1)](C.2.55 )/section-C.2.55 (199)409 toc23 +[(NASM 0.9 Series)](C.3 )/section-C.3 (200)392 toc13 +[(Version 0.97 released December 1997)](C.3.1 )/section-C.3.1 (200)375 toc23 +[(Version 0.96 released November 1997)](C.3.2 )/section-C.3.2 (200)358 toc23 +[(Version 0.95 released July 1997)](C.3.3 )/section-C.3.3 (202)341 toc23 +[(Version 0.94 released April 1997)](C.3.4 )/section-C.3.4 (204)324 toc23 +[(Version 0.93 released January 1997)](C.3.5 )/section-C.3.5 (204)307 toc23 +[(Version 0.92 released January 1997)](C.3.6 )/section-C.3.6 (205)290 toc23 +[(Version 0.91 released November 1996)](C.3.7 )/section-C.3.7 (205)273 toc23 +[(Version 0.90 released October 1996)](C.3.8 )/section-C.3.8 (205)256 toc23 +(13)pageodd +restore showpage +%%Page: 14 14 +%%BeginPageSetup +save +%%EndPageSetup +/14 pa +[{/chapter-1 xa}(Chapter 1: Introduction)]642.8 chap3 +[{/section-1.1 xa}(What Is NASM?)](1.1)603.4 head3 +[(The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler designed for portability and modularity.)]586.4 norm1 +[(It supports a range of object file formats, including Linux and )2(*BSD)0( )2(a.out)0(, )2(ELF)0(, )2(COFF)0(, )2(Mach-O)0(,)]575.4 norm0 +[(Microsoft 16-bit )2(OBJ)0(, )2(Win32)0( and )2(Win64)0(. It will also output plain binary files. Its syntax is designed to be)]564.4 norm0 +[(simple and easy to understand, similar to Intel's but less complex. It supports all currently known x86)]553.4 norm0 +[(architectural extensions, and has strong support for macros.)]542.4 norm2 +[{/section-1.1.1 xa}(Why Yet Another Assembler?)](1.1.1)523.2 subh3 +[(The Netwide Assembler grew out of an idea on )2(comp.lang.asm.x86)0( \(or possibly )2(alt.lang.asm)0( \226 I)]506.2 norm1 +[(forget which\), which was essentially that there didn't seem to be a good )1(free)0( x86-series assembler around,)]495.2 norm0 +[(and that maybe someone ought to write one.)]484.2 norm2 +[2(a86)0( is good, but not free, and in particular you don't get any 32-bit capability until you pay. It's DOS)]467.2 bull1 +[(only, too.)]456.2 bull2 +[2(gas)0( is free, and ports over to DOS and Unix, but it's not very good, since it's designed to be a back end to)]439.2 bull1 +[2(gcc)0(, which always feeds it correct code. So its error checking is minimal. Also, its syntax is horrible, from)]428.2 bull0 +[(the point of view of anyone trying to actually )1(write)0( anything in it. Plus you can't write 16-bit code in it)]417.2 bull0 +[(\(properly.\))]406.2 bull2 +[2(as86)0( is specific to Minix and Linux, and \(my version at least\) doesn't seem to have much \(or any\))]389.2 bull1 +[(documentation.)]378.2 bull2 +[2(MASM)0( isn't very good, and it's \(was\) expensive, and it runs only under DOS.)]361.2 bull3 +[2(TASM)0( is better, but still strives for MASM compatibility, which means millions of directives and tons of)]344.2 bull1 +[(red tape. And its syntax is essentially MASM's, with the contradictions and quirks that entails \(although it)]333.2 bull0 +[(sorts out some of those by means of Ideal mode.\) It's expensive too. And it's DOS-only.)]322.2 bull2 +[(So here, for your coding pleasure, is NASM. At present it's still in prototype stage \226 we don't promise that it)]305.2 norm1 +[(can outperform any of these assemblers. But please, )1(please)0( send us bug reports, fixes, helpful information,)]294.2 norm0 +[(and anything else you can get your hands on \(and thanks to the many people who've done this already! You)]283.2 norm0 +[(all know who you are\), and we'll improve it out of all recognition. Again.)]272.2 norm2 +[{/section-1.1.2 xa}(License Conditions)](1.1.2)253 subh3 +[(Please see the file )2(LICENSE)0(, supplied as part of any NASM distribution archive, for the license conditions)]236 norm1 +[(under which you may use NASM. NASM is now under the so-called 2-clause BSD license, also known as)]225 norm0 +[(the simplified BSD license.)]214 norm2 +[(Copyright 1996-2009 the NASM Authors \226 All rights reserved.)]197 norm3 +[(Redistribution and use in source and binary forms, with or without modification, are permitted provided that)]180 norm1 +[(the following conditions are met:)]169 norm2 +[(Redistributions of source code must retain the above copyright notice, this list of conditions and the)]152 bull1 +[(following disclaimer.)]141 bull2 +[(Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the)]124 bull1 +[(following disclaimer in the documentation and/or other materials provided with the distribution.)]113 bull2 +(14)pageeven +restore showpage +%%Page: 15 15 +%%BeginPageSetup +save +%%EndPageSetup +/15 pa +[(THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS")]681 norm1 +[(AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE)]670 norm0 +[(IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE)]659 norm0 +[(ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE)]648 norm0 +[(LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR)]637 norm0 +[(CONSEQUENTIAL DAMAGES \(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF)]626 norm0 +[(SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS)]615 norm0 +[(INTERRUPTION\) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN)]604 norm0 +[(CONTRACT, STRICT LIABILITY, OR TORT \(INCLUDING NEGLIGENCE OR OTHERWISE\))]593 norm0 +[(ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE)]582 norm0 +[(POSSIBILITY OF SUCH DAMAGE.)]571 norm2 +[{/section-1.2 xa}(Contact Information)](1.2)549.6 head3 +[(The current version of NASM \(since about 0.98.08\) is maintained by a team of developers, accessible through)]532.6 norm1 +[(the )2(nasm-devel)0( mailing list \(see below for the link\). If you want to report a bug, please read ){/section-12.2 xl}(section 12.2){el}]521.6 norm0 +[(first.)]510.6 norm2 +[(NASM has a )(website at ){(http://www.nasm.us/)wl}2(http://www.nasm.us/){el}0(. If it's not there, google for us!)]493.6 norm3 +[(New releases, )(release candidates, and )(daily development snapshots of NASM are available from the official)]476.6 norm1 +[(web site.)]465.6 norm2 +[(Announcements are posted to ){(news:comp.lang.asm.x86)wl}2(comp.lang.asm.x86){el}0(, and to the web site)]448.6 norm1 +[{(http://www.freshmeat.net/)wl}2(http://www.freshmeat.net/){el}0(.)]437.6 norm2 +[(If you want information about the current development status, please subscribe to the )2(nasm-devel)0( email)]420.6 norm1 +[(list; see link from the website.)]409.6 norm2 +[{/section-1.3 xa}(Installation)](1.3)388.2 head3 +[{/section-1.3.1 xa}(Installing NASM under MS-)(DOS or Windows)](1.3.1)369 subh3 +[(Once you've obtained the appropriate archive for NASM, )2(nasm-XXX-dos.zip)0( or)]352 norm1 +[2(nasm-XXX-win32.zip)0( \(where )2(XXX)0( denotes the version number of NASM contained in the archive\),)]341 norm0 +[(unpack it into its own directory \(for example )2(c:\\nasm)0(\).)]330 norm2 +[(The archive will contain a set of executable files: the NASM executable file )2(nasm.exe)0(, the NDISASM)]313 norm1 +[(executable file )2(ndisasm.exe)0(, and possibly additional utilities to handle the RDOFF file format.)]302 norm2 +[(The only file NASM needs to run is its own executable, so copy )2(nasm.exe)0( to a directory on your PATH, or)]285 norm1 +[(alternatively edit )2(autoexec.bat)0( to add the )2(nasm)0( directory to your )2(PATH)0( \(to do that under Windows XP,)]274 norm0 +[(go to Start > Control Panel > System > Advanced > Environment Variables; these instructions may work)]263 norm0 +[(under other versions of Windows as well.\))]252 norm2 +[(That's it \226 NASM is installed. You don't need the nasm directory to be present to run NASM \(unless you've)]235 norm1 +[(added it to your )2(PATH)0(\), so you can delete it if you need to save space; however, you may want to keep the)]224 norm0 +[(documentation or test programs.)]213 norm2 +[(If you've downloaded the )(DOS source archive, )2(nasm-XXX.zip)0(, the )2(nasm)0( directory will also contain the)]196 norm1 +[(full NASM )(source code, and a selection of )(Makefiles you can \(hopefully\) use to rebuild your copy of NASM)]185 norm0 +[(from scratch. See the file )2(INSTALL)0( in the source archive.)]174 norm2 +[(Note that a number of files are generated from other files by Perl scripts. Although the NASM source)]157 norm1 +[(distribution includes these generated files, you will need to rebuild them \(and hence, will need a Perl)]146 norm0 +[(interpreter\) if you change insns.dat, standard.mac or the documentation. It is possible future source)]135 norm0 +[(distributions may not include these files at all. Ports of )(Perl for a variety of platforms, including DOS and)]124 norm0 +[(Windows, are available from ){(http://www.cpan.org/ports/)wl}(www.cpan.org){el}(.)]113 norm2 +(15)pageodd +restore showpage +%%Page: 16 16 +%%BeginPageSetup +save +%%EndPageSetup +/16 pa +[{/section-1.3.2 xa}(Installing NASM under )(Unix)](1.3.2)678.8 subh3 +[(Once you've obtained the )(Unix source archive for NASM, )2(nasm-XXX.tar.gz)0( \(where )2(XXX)0( denotes the)]661.8 norm1 +[(version number of NASM contained in the archive\), unpack it into a directory such as )2(/usr/local/src)0(.)]650.8 norm0 +[(The archive, when unpacked, will create its own subdirectory )2(nasm-XXX)0(.)]639.8 norm2 +[(NASM is an )(auto-configuring package: once you've unpacked it, )2(cd)0( to the directory it's been unpacked into)]622.8 norm1 +[(and type )2(./configure)0(. This shell script will find the best C compiler to use for building NASM and set up)]611.8 norm0 +[(Makefiles accordingly.)]600.8 norm2 +[(Once NASM has auto-configured, you can type )2(make)0( to build the )2(nasm)0( and )2(ndisasm)0( binaries, and then)]583.8 norm1 +[2(make install)0( to install them in )2(/usr/local/bin)0( and install the )(man pages )2(nasm.1)0( and)]572.8 norm0 +[2(ndisasm.1)0( in )2(/usr/local/man/man1)0(. Alternatively, you can give options such as )2(--prefix)0( to the)]561.8 norm0 +[(configure script \(see the file )2(INSTALL)0( for more details\), or install the programs yourself.)]550.8 norm2 +[(NASM also comes with a set of utilities for handling the )2(RDOFF)0( custom object-file format, which are in the)]533.8 norm1 +[2(rdoff)0( subdirectory of the NASM archive. You can build these with )2(make rdf)0( and install them with)]522.8 norm0 +[2(make rdf_install)0(, if you want them.)]511.8 norm2 +(16)pageeven +restore showpage +%%Page: 17 17 +%%BeginPageSetup +save +%%EndPageSetup +/17 pa +[{/chapter-2 xa}(Chapter 2: Running NASM)]642.8 chap3 +[{/section-2.1 xa}(NASM )(Command-Line Syntax)](2.1)603.4 head3 +[(To assemble a file, you issue a command of the form)]586.4 norm3 +[2(nasm -f <format> <filename> [-o <output>])]569.4 code3 +[(For example,)]552.4 norm3 +[2(nasm -f elf myfile.asm)]535.4 code3 +[(will assemble )2(myfile.asm)0( into an )2(ELF)0( object file )2(myfile.o)0(. And)]518.4 norm3 +[2(nasm -f bin myfile.asm -o myfile.com)]501.4 code3 +[(will assemble )2(myfile.asm)0( into a raw binary file )2(myfile.com)0(.)]484.4 norm3 +[(To produce a listing file, with the hex codes output from NASM displayed on the left of the original sources,)]467.4 norm1 +[(use the )2(-l)0( option to give a listing file name, for example:)]456.4 norm2 +[2(nasm -f coff myfile.asm -l myfile.lst)]439.4 code3 +[(To get further usage instructions from NASM, try typing)]422.4 norm3 +[2(nasm -h)]405.4 code3 +[(As )2(-hf)0(, this will also list the available output file formats, and what they are.)]388.4 norm3 +[(If you use Linux but aren't sure whether your system is )2(a.out)0( or )2(ELF)0(, type)]371.4 norm3 +[2(file nasm)]354.4 code3 +[(\(in the directory in which you put the NASM binary when you installed it\). If it says something like)]337.4 norm3 +[2(nasm: ELF 32-bit LSB executable i386 \(386 and up\) Version 1)]320.4 code3 +[(then your system is )2(ELF)0(, and you should use the option )2(-f elf)0( when you want NASM to produce Linux)]303.4 norm1 +[(object files. If it says)]292.4 norm2 +[2(nasm: Linux/i386 demand-paged executable \(QMAGIC\))]275.4 code3 +[(or something similar, your system is )2(a.out)0(, and you should use )2(-f aout)0( instead \(Linux )2(a.out)0( systems)]258.4 norm1 +[(have long been obsolete, and are rare these days.\))]247.4 norm2 +[(Like Unix compilers and assemblers, NASM is silent unless it goes wrong: you won't see any output at all,)]230.4 norm1 +[(unless it gives error messages.)]219.4 norm2 +[{/section-2.1.1 xa}(The )2(-o)0( Option: Specifying the Output File Name)](2.1.1)200.2 subh3 +[(NASM will normally choose the name of your output file for you; precisely how it does this is dependent on)]183.2 norm1 +[(the object file format. For Microsoft object file formats \()2(obj)0(, )2(win32)0( and )2(win64)0(\), it will remove the )2(.asm)]172.2 norm0 +[(extension \(or whatever extension you like to use \226 NASM doesn't care\) from your source file name and)]161.2 norm0 +[(substitute )2(.obj)0(. For Unix object file formats \()2(aout)0(, )2(as86)0(, )2(coff)0(, )2(elf32)0(, )2(elf64)0(, )2(ieee)0(, )2(macho32)0( and)]150.2 norm0 +[2(macho64)0(\) it will substitute )2(.o)0(. For )2(dbg)0(, )2(rdf)0(, )2(ith)0( and )2(srec)0(, it will use )2(.dbg)0(, )2(.rdf)0(, )2(.ith)0( and )2(.srec)0(,)]139.2 norm0 +[(respectively, and for the )2(bin)0( format it will simply remove the extension, so that )2(myfile.asm)0( produces the)]128.2 norm0 +[(output file )2(myfile)0(.)]117.2 norm2 +(17)pageodd +restore showpage +%%Page: 18 18 +%%BeginPageSetup +save +%%EndPageSetup +/18 pa +[(If the output file already exists, NASM will overwrite it, unless it has the same name as the input file, in)]681 norm1 +[(which case it will give a warning and use )2(nasm.out)0( as the output file name instead.)]670 norm2 +[(For situations in which this behaviour is unacceptable, NASM provides the )2(-o)0( command-line option, which)]653 norm1 +[(allows you to specify your desired output file name. You invoke )2(-o)0( by following it with the name you wish)]642 norm0 +[(for the output file, either with or without an intervening space. For example:)]631 norm2 +[2(nasm -f bin program.asm -o program.com )]614 code1 +[2(nasm -f bin driver.asm -odriver.sys)]603 code2 +[(Note that this is a small o, and is different from a capital O , which is used to specify the number of)]586 norm1 +[(optimisation passes required. See ){/section-2.1.22 xl}(section 2.1.22){el}(.)]575 norm2 +[{/section-2.1.2 xa}(The )2(-f)0( Option: Specifying the )(Output File Format)](2.1.2)555.8 subh3 +[(If you do not supply the )2(-f)0( option to NASM, it will choose an output file format for you itself. In the)]538.8 norm1 +[(distribution versions of NASM, the default is always )2(bin)0(; if you've compiled your own copy of NASM, you)]527.8 norm0 +[(can redefine )2(OF_DEFAULT)0( at compile time and choose what you want the default to be.)]516.8 norm2 +[(Like )2(-o)0(, the intervening space between )2(-f)0( and the output file format is optional; so )2(-f elf)0( and )2(-felf)0( are)]499.8 norm1 +[(both valid.)]488.8 norm2 +[(A complete list of the available output file formats can be given by issuing the command )2(nasm -hf)0(.)]471.8 norm3 +[{/section-2.1.3 xa}(The )2(-l)0( Option: Generating a )(Listing File)](2.1.3)452.6 subh3 +[(If you supply the )2(-l)0( option to NASM, followed \(with the usual optional space\) by a file name, NASM will)]435.6 norm1 +[(generate a )(source-listing file for you, in which addresses and generated code are listed on the left, and the)]424.6 norm0 +[(actual source code, with expansions of multi-line macros \(except those which specifically request no)]413.6 norm0 +[(expansion in source listings: see ){/section-4.3.10 xl}(section 4.3.10){el}(\) on the right. For example:)]402.6 norm2 +[2(nasm -f elf myfile.asm -l myfile.lst)]385.6 code3 +[(If a list file is selected, you may turn off listing for a section of your source with )2([list -])0(, and turn it back)]368.6 norm1 +[(on with )2([list +])0(, \(the default, obviously\). There is no "user form" \(without the brackets\). This can be used)]357.6 norm0 +[(to list only sections of interest, avoiding excessively long listings.)]346.6 norm2 +[{/section-2.1.4 xa}(The )2(-M)0( Option: Generate )(Makefile Dependencies)](2.1.4)327.4 subh3 +[(This option can be used to generate makefile dependencies on stdout. This can be redirected to a file for)]310.4 norm1 +[(further processing. For example:)]299.4 norm2 +[2(nasm -M myfile.asm > myfile.dep)]282.4 code3 +[{/section-2.1.5 xa}(The )2(-MG)0( Option: Generate )(Makefile Dependencies)](2.1.5)263.2 subh3 +[(This option can be used to generate makefile dependencies on stdout. This differs from the )2(-M)0( option in that if)]246.2 norm1 +[(a nonexisting file is encountered, it is assumed to be a generated file and is added to the dependency list)]235.2 norm0 +[(without a prefix.)]224.2 norm2 +[{/section-2.1.6 xa}(The )2(-MF)0( Option: Set Makefile Dependency File)](2.1.6)205 subh3 +[(This option can be used with the )2(-M)0( or )2(-MG)0( options to send the output to a file, rather than to stdout. For)]188 norm1 +[(example:)]177 norm2 +[2(nasm -M -MF myfile.dep myfile.asm)]160 code3 +[{/section-2.1.7 xa}(The )2(-MD)0( Option: Assemble and Generate Dependencies)](2.1.7)140.8 subh3 +[(The )2(-MD)0( option acts as the combination of the )2(-M)0( and )2(-MF)0( options \(i.e. a filename has to be specified.\))]123.8 norm1 +[(However, unlike the )2(-M)0( or )2(-MG)0( options, )2(-MD)0( does )1(not)0( inhibit the normal operation of the assembler. Use this)]112.8 norm0 +[(to automatically generate updated dependencies with every assembly session. For example:)]101.8 norm2 +(18)pageeven +restore showpage +%%Page: 19 19 +%%BeginPageSetup +save +%%EndPageSetup +/19 pa +[2(nasm -f elf -o myfile.o -MD myfile.dep myfile.asm)]681 code3 +[{/section-2.1.8 xa}(The )2(-MT)0( Option: Dependency Target Name)](2.1.8)661.8 subh3 +[(The )2(-MT)0( option can be used to override the default name of the dependency target. This is normally the same)]644.8 norm1 +[(as the output filename, specified by the )2(-o)0( option.)]633.8 norm2 +[{/section-2.1.9 xa}(The )2(-MQ)0( Option: Dependency Target Name \(Quoted\))](2.1.9)614.6 subh3 +[(The )2(-MQ)0( option acts as the )2(-MT)0( option, except it tries to quote characters that have special meaning in)]597.6 norm1 +[(Makefile syntax. This is not foolproof, as not all characters with special meaning are quotable in Make.)]586.6 norm2 +[{/section-2.1.10 xa}(The )2(-MP)0( Option: Emit phony targets)](2.1.10)567.4 subh3 +[(When used with any of the dependency generation options, the )2(-MP)0( option causes NASM to emit a phony)]550.4 norm1 +[(target without dependencies for each header file. This prevents Make from complaining if a header file has)]539.4 norm0 +[(been removed.)]528.4 norm2 +[{/section-2.1.11 xa}(The )2(-F)0( Option: Selecting a )(Debug Information Format)](2.1.11)509.2 subh3 +[(This option is used to select the format of the debug information emitted into the output file, to be used by a)]492.2 norm1 +[(debugger \(or )1(will)0( be\). Prior to version 2.03.01, the use of this switch did )1(not)0( enable output of the selected)]481.2 norm0 +[(debug info format. Use )2(-g)0(, see ){/section-2.1.12 xl}(section 2.1.12){el}(, to enable output. Versions 2.03.01 and later automatically)]470.2 norm0 +[(enable )2(-g)0( if )2(-F)0( is specified.)]459.2 norm2 +[(A complete list of the available debug file formats for an output format can be seen by issuing the command)]442.2 norm1 +[2(nasm -f <format> -y)0(. Not all output formats currently support debugging output. See ){/section-2.1.26 xl}(section 2.1.26){el}(.)]431.2 norm2 +[(This should not be confused with the )2(-f dbg)0( output format option which is not built into NASM by default.)]414.2 norm1 +[(For information on how to enable it when building from the sources, see ){/section-7.14 xl}(section 7.14){el}(.)]403.2 norm2 +[{/section-2.1.12 xa}(The )2(-g)0( Option: Enabling )(Debug Information.)](2.1.12)384 subh3 +[(This option can be used to generate debugging information in the specified format. See ){/section-2.1.11 xl}(section 2.1.11){el}(. Using)]367 norm1 +[2(-g)0( without )2(-F)0( results in emitting debug info in the default format, if any, for the selected output format. If no)]356 norm0 +[(debug information is currently implemented in the selected output format, )2(-g)0( is )1(silently ignored)0(.)]345 norm2 +[{/section-2.1.13 xa}(The )2(-X)0( Option: Selecting an )(Error Reporting Format)](2.1.13)325.8 subh3 +[(This option can be used to select an error reporting format for any error messages that might be produced by)]308.8 norm1 +[(NASM.)]297.8 norm2 +[(Currently, two error reporting formats may be selected. They are the )2(-Xvc)0( option and the )2(-Xgnu)0( option. The)]280.8 norm1 +[(GNU format is the default and looks like this:)]269.8 norm2 +[2(filename.asm:65: error: specific error message)]252.8 code3 +[(where )2(filename.asm)0( is the name of the source file in which the error was detected, )2(65)0( is the source file)]235.8 norm1 +[(line number on which the error was detected, )2(error)0( is the severity of the error \(this could be )2(warning)0(\),)]224.8 norm0 +[(and )2(specific error message)0( is a more detailed text message which should help pinpoint the exact)]213.8 norm0 +[(problem.)]202.8 norm2 +[(The other format, specified by )2(-Xvc)0( is the style used by Microsoft Visual C++ and some other programs. It)]185.8 norm1 +[(looks like this:)]174.8 norm2 +[2(filename.asm\(65\) : error: specific error message)]157.8 code3 +[(where the only difference is that the line number is in parentheses instead of being delimited by colons.)]140.8 norm3 +[(See also the )2(Visual C++)0( output format, ){/section-7.5 xl}(section 7.5){el}(.)]123.8 norm3 +(19)pageodd +restore showpage +%%Page: 20 20 +%%BeginPageSetup +save +%%EndPageSetup +/20 pa +[{/section-2.1.14 xa}(The )2(-Z)0( Option: Send Errors to a File)](2.1.14)678.8 subh3 +[(Under )2(MS-DOS)0( it can be difficult \(though there are ways\) to redirect the standard-error output of a program)]661.8 norm1 +[(to a file. Since NASM usually produces its warning and )(error messages on )2(stderr)0(, this can make it hard to)]650.8 norm0 +[(capture the errors if \(for example\) you want to load them into an editor.)]639.8 norm2 +[(NASM therefore provides the )2(-Z)0( option, taking a filename argument which causes errors to be sent to the)]622.8 norm1 +[(specified files rather than standard error. Therefore you can )(redirect the errors into a file by typing)]611.8 norm2 +[2(nasm -Z myfile.err -f obj myfile.asm)]594.8 code3 +[(In earlier versions of NASM, this option was called )2(-E)0(, but it was changed since )2(-E)0( is an option)]577.8 norm1 +[(conventionally used for preprocessing only, with disastrous results. See ){/section-2.1.20 xl}(section 2.1.20){el}(.)]566.8 norm2 +[{/section-2.1.15 xa}(The )2(-s)0( Option: Send Errors to )2(stdout)](2.1.15)547.6 subh3 +[(The )2(-s)0( option redirects )(error messages to )2(stdout)0( rather than )2(stderr)0(, so it can be redirected under)]530.6 norm1 +[2(MS-DOS)0(. To assemble the file )2(myfile.asm)0( and pipe its output to the )2(more)0( program, you can type:)]519.6 norm2 +[2(nasm -s -f obj myfile.asm | more)]502.6 code3 +[(See also the )2(-Z)0( option, ){/section-2.1.14 xl}(section 2.1.14){el}(.)]485.6 norm3 +[{/section-2.1.16 xa}(The )2(-i)0( Option: Include File Search Directories)](2.1.16)466.4 subh3 +[(When NASM sees the )2(%include)0( or )2(%pathsearch)0( directive in a source file \(see ){/section-4.6.1 xl}(section 4.6.1){el}(, ){/section-4.6.2 xl}(section){el}]449.4 norm1 +[{/section-4.6.2 xl}(4.6.2){el}( or ){/section-3.2.3 xl}(section 3.2.3){el}(\), it will search for the given file not only in the current directory, but also in any)]438.4 norm0 +[(directories specified on the command line by the use of the )2(-i)0( option. Therefore you can include files from a)]427.4 norm0 +[(macro library, for example, by typing)]416.4 norm2 +[2(nasm -ic:\\macrolib\\ -f obj myfile.asm)]399.4 code3 +[(\(As usual, a space between )2(-i)0( and the path name is allowed, and optional\).)]382.4 norm3 +[(NASM, in the interests of complete source-code portability, does not understand the file naming conventions)]365.4 norm1 +[(of the OS it is running on; the string you provide as an argument to the )2(-i)0( option will be prepended exactly as)]354.4 norm0 +[(written to the name of the include file. Therefore the trailing backslash in the above example is necessary.)]343.4 norm0 +[(Under Unix, a trailing forward slash is similarly necessary.)]332.4 norm2 +[(\(You can use this to your advantage, if you're really )(perverse, by noting that the option )2(-ifoo)0( will cause)]315.4 norm1 +[2(%include "bar.i")0( to search for the file )2(foobar.i)0(...\))]304.4 norm2 +[(If you want to define a )1(standard)0( )(include search path, similar to )2(/usr/include)0( on Unix systems, you)]287.4 norm1 +[(should place one or more )2(-i)0( directives in the )2(NASMENV)0( environment variable \(see ){/section-2.1.28 xl}(section 2.1.28){el}(\).)]276.4 norm2 +[(For Makefile compatibility with many C compilers, this option can also be specified as )2(-I)0(.)]259.4 norm3 +[{/section-2.1.17 xa}(The )2(-p)0( Option: )(Pre-Include a File)](2.1.17)240.2 subh3 +[(NASM allows you to specify files to be )1(pre-included)0( into your source file, by the use of the )2(-p)0( option. So)]223.2 norm1 +[(running)]212.2 norm2 +[2(nasm myfile.asm -p myinc.inc)]195.2 code3 +[(is equivalent to running )2(nasm myfile.asm)0( and placing the directive )2(%include "myinc.inc")0( at the)]178.2 norm1 +[(start of the file.)]167.2 norm2 +[(For consistency with the )2(-I)0(, )2(-D)0( and )2(-U)0( options, this option can also be specified as )2(-P)0(.)]150.2 norm3 +[{/section-2.1.18 xa}(The )2(-d)0( Option: )(Pre-Define a Macro)](2.1.18)131 subh3 +[(Just as the )2(-p)0( option gives an alternative to placing )2(%include)0( directives at the start of a source file, the )2(-d)]114 norm1 +[(option gives an alternative to placing a )2(%define)0( directive. You could code)]103 norm2 +(20)pageeven +restore showpage +%%Page: 21 21 +%%BeginPageSetup +save +%%EndPageSetup +/21 pa +[2(nasm myfile.asm -dFOO=100)]681 code3 +[(as an alternative to placing the directive)]664 norm3 +[2(%define FOO 100)]647 code3 +[(at the start of the file. You can miss off the macro value, as well: the option )2(-dFOO)0( is equivalent to coding)]630 norm1 +[2(%define FOO)0(. This form of the directive may be useful for selecting )(assembly-time options which are then)]619 norm0 +[(tested using )2(%ifdef)0(, for example )2(-dDEBUG)0(.)]608 norm2 +[(For Makefile compatibility with many C compilers, this option can also be specified as )2(-D)0(.)]591 norm3 +[{/section-2.1.19 xa}(The )2(-u)0( Option: )(Undefine a Macro)](2.1.19)571.8 subh3 +[(The )2(-u)0( option undefines a macro that would otherwise have been pre-defined, either automatically or by a)]554.8 norm1 +[2(-p)0( or )2(-d)0( option specified earlier on the command lines.)]543.8 norm2 +[(For example, the following command line:)]526.8 norm3 +[2(nasm myfile.asm -dFOO=100 -uFOO)]509.8 code3 +[(would result in )2(FOO)0( )1(not)0( being a predefined macro in the program. This is useful to override options specified)]492.8 norm1 +[(at a different point in a Makefile.)]481.8 norm2 +[(For Makefile compatibility with many C compilers, this option can also be specified as )2(-U)0(.)]464.8 norm3 +[{/section-2.1.20 xa}(The )2(-E)0( Option: Preprocess Only)](2.1.20)445.6 subh3 +[(NASM allows the )(preprocessor to be run on its own, up to a point. Using the )2(-E)0( option \(which requires no)]428.6 norm1 +[(arguments\) will cause NASM to preprocess its input file, expand all the macro references, remove all the)]417.6 norm0 +[(comments and preprocessor directives, and print the resulting file on standard output \(or save it to a file, if the)]406.6 norm0 +[2(-o)0( option is also used\).)]395.6 norm2 +[(This option cannot be applied to programs which require the preprocessor to evaluate )(expressions which)]378.6 norm1 +[(depend on the values of symbols: so code such as)]367.6 norm2 +[2(%assign tablesize \($-tablestart\))]350.6 code3 +[(will cause an error in )(preprocess-only mode.)]333.6 norm3 +[(For compatiblity with older version of NASM, this option can also be written )2(-e)0(. )2(-E)0( in older versions of)]316.6 norm1 +[(NASM was the equivalent of the current )2(-Z)0( option, ){/section-2.1.14 xl}(section 2.1.14){el}(.)]305.6 norm2 +[{/section-2.1.21 xa}(The )2(-a)0( Option: Don't Preprocess At All)](2.1.21)286.4 subh3 +[(If NASM is being used as the back end to a compiler, it might be desirable to )(suppress preprocessing)]269.4 norm1 +[(completely and assume the compiler has already done it, to save time and increase compilation speeds. The)]258.4 norm0 +[2(-a)0( option, requiring no argument, instructs NASM to replace its powerful )(preprocessor with a )(stub)]247.4 norm0 +[(preprocessor which does nothing.)]236.4 norm2 +[{/section-2.1.22 xa}(The )2(-O)0( Option: Specifying )(Multipass Optimization)](2.1.22)217.2 subh3 +[(NASM defaults to not optimizing operands which can fit into a signed byte. This means that if you want the)]200.2 norm1 +[(shortest possible object code, you have to enable optimization.)]189.2 norm2 +[(Using the )2(-O)0( option, you can tell NASM to carry out different levels of optimization. The syntax is:)]172.2 norm3 +[2(-O0)0(: No optimization. All operands take their long forms, if a short form is not specified, except)]155.2 bull1 +[(conditional jumps. This is intended to match NASM 0.98 behavior.)]144.2 bull2 +[2(-O1)0(: Minimal optimization. As above, but immediate operands which will fit in a signed byte are)]127.2 bull1 +[(optimized, unless the long form is specified. Conditional jumps default to the long form unless otherwise)]116.2 bull0 +[(specified.)]105.2 bull2 +(21)pageodd +restore showpage +%%Page: 22 22 +%%BeginPageSetup +save +%%EndPageSetup +/22 pa +[2(-Ox)0( \(where )2(x)0( is the actual letter )2(x)0(\): Multipass optimization. Minimize branch offsets and signed)]681 bull1 +[(immediate bytes, overriding size specification unless the )2(strict)0( keyword has been used \(see ){/section-3.7 xl}(section){el}]670 bull0 +[{/section-3.7 xl}(3.7){el}(\). For compatability with earlier releases, the letter )2(x)0( may also be any number greater than one. This)]659 bull0 +[(number has no effect on the actual number of passes.)]648 bull2 +[(The )2(-Ox)0( mode is recommended for most uses.)]631 norm3 +[(Note that this is a capital )2(O)0(, and is different from a small )2(o)0(, which is used to specify the output file name. See)]614 norm1 +[{/section-2.1.1 xl}(section 2.1.1){el}(.)]603 norm2 +[{/section-2.1.23 xa}(The )2(-t)0( Option: Enable TASM Compatibility Mode)](2.1.23)583.8 subh3 +[(NASM includes a limited form of compatibility with Borland's )2(TASM)0(. When NASM's )2(-t)0( option is used, the)]566.8 norm1 +[(following changes are made:)]555.8 norm2 +[(local labels may be prefixed with )2(@@)0( instead of )2(.)]538.8 bull3 +[(size override is supported within brackets. In TASM compatible mode, a size override inside square)]521.8 bull1 +[(brackets changes the size of the operand, and not the address type of the operand as it does in NASM)]510.8 bull0 +[(syntax. E.g. )2(mov eax,[DWORD val])0( is valid syntax in TASM compatibility mode. Note that you lose)]499.8 bull0 +[(the ability to override the default address type for the instruction.)]488.8 bull2 +[(unprefixed forms of some directives supported \()2(arg)0(, )2(elif)0(, )2(else)0(, )2(endif)0(, )2(if)0(, )2(ifdef)0(, )2(ifdifi)0(,)]471.8 bull1 +[2(ifndef)0(, )2(include)0(, )2(local)0(\))]460.8 bull2 +[{/section-2.1.24 xa}(The )2(-w)0( and )2(-W)0( Options: Enable or Disable Assembly )(Warnings)](2.1.24)441.6 subh3 +[(NASM can observe many conditions during the course of assembly which are worth mentioning to the user,)]424.6 norm1 +[(but not a sufficiently severe error to justify NASM refusing to generate an output file. These conditions are)]413.6 norm0 +[(reported like errors, but come up with the word `warning' before the message. Warnings do not prevent)]402.6 norm0 +[(NASM from generating an output file and returning a success status to the operating system.)]391.6 norm2 +[(Some conditions are even less severe than that: they are only sometimes worth mentioning to the user.)]374.6 norm1 +[(Therefore NASM supports the )2(-w)0( command-line option, which enables or disables certain classes of)]363.6 norm0 +[(assembly warning. Such warning classes are described by a name, for example )2(orphan-labels)0(; you can)]352.6 norm0 +[(enable warnings of this class by the command-line option )2(-w+orphan-labels)0( and disable it by)]341.6 norm0 +[2(-w-orphan-labels)0(.)]330.6 norm2 +[(The )(suppressible warning classes are:)]313.6 norm3 +[2(macro-params)0( covers warnings about )(multi-line macros being invoked with the wrong number of)]296.6 bull1 +[(parameters. This warning class is enabled by default; see ){/section-4.3.2 xl}(section 4.3.2){el}( for an example of why you might)]285.6 bull0 +[(want to disable it.)]274.6 bull2 +[2(macro-selfref)0( warns if a macro references itself. This warning class is disabled by default.)]257.6 bull3 +[2(macro-defaults)0( warns when a macro has more default parameters than optional parameters. This)]240.6 bull1 +[(warning class is enabled by default; see ){/section-4.3.5 xl}(section 4.3.5){el}( for why you might want to disable it.)]229.6 bull2 +[2(orphan-labels)0( covers warnings about source lines which contain no instruction but define a label)]212.6 bull1 +[(without a trailing colon. NASM warns about this somewhat obscure condition by default; see ){/section-3.1 xl}(section 3.1){el}]201.6 bull0 +[(for more information.)]190.6 bull2 +[2(number-overflow)0( covers warnings about numeric constants which don't fit in 64 bits. This warning)]173.6 bull1 +[(class is enabled by default.)]162.6 bull2 +[2(gnu-elf-extensions)0( warns if 8-bit or 16-bit relocations are used in )2(-f elf)0( format. The GNU)]145.6 bull1 +[(extensions allow this. This warning class is disabled by default.)]134.6 bull2 +[2(float-overflow)0( warns about floating point overflow. Enabled by default.)]117.6 bull3 +[2(float-denorm)0( warns about floating point denormals. Disabled by default.)]100.6 bull3 +(22)pageeven +restore showpage +%%Page: 23 23 +%%BeginPageSetup +save +%%EndPageSetup +/23 pa +[2(float-underflow)0( warns about floating point underflow. Disabled by default.)]681 bull3 +[2(float-toolong)0( warns about too many digits in floating-point numbers. Enabled by default.)]664 bull3 +[2(user)0( controls )2(%warning)0( directives \(see ){/section-4.9 xl}(section 4.9){el}(\). Enabled by default.)]647 bull3 +[2(error)0( causes warnings to be treated as errors. Disabled by default.)]630 bull3 +[2(all)0( is an alias for )1(all)0( suppressible warning classes \(not including )2(error)0(\). Thus, )2(-w+all)0( enables all)]613 bull1 +[(available warnings.)]602 bull2 +[(In addition, you can set warning classes across sections. Warning classes may be enabled with)]585 norm1 +[2([warning +warning-name])0(, disabled with )2([warning -warning-name])0( or reset to their original)]574 norm0 +[(value with )2([warning *warning-name])0(. No "user form" \(without the brackets\) exists.)]563 norm2 +[(Since version 2.00, NASM has also supported the gcc-like syntax )2(-Wwarning)0( and )2(-Wno-warning)]546 norm1 +[(instead of )2(-w+warning)0( and )2(-w-warning)0(, respectively.)]535 norm2 +[{/section-2.1.25 xa}(The )2(-v)0( Option: Display )(Version Info)](2.1.25)515.8 subh3 +[(Typing )2(NASM -v)0( will display the version of NASM which you are using, and the date on which it was)]498.8 norm1 +[(compiled.)]487.8 norm2 +[(You will need the version number if you report a bug.)]470.8 norm3 +[{/section-2.1.26 xa}(The )2(-y)0( Option: Display Available Debug Info Formats)](2.1.26)451.6 subh3 +[(Typing )2(nasm -f <option> -y)0( will display a list of the available debug info formats for the given output)]434.6 norm1 +[(format. The default format is indicated by an asterisk. For example:)]423.6 norm2 +[2(nasm -f elf -y)]406.6 code3 +[2(valid debug formats for 'elf32' output format are )]389.6 code1 +[2( \('*' denotes default\): )]378.6 code0 +[2( * stabs ELF32 \(i386\) stabs debug format for Linux )]367.6 code0 +[2( dwarf elf32 \(i386\) dwarf debug format for Linux)]356.6 code2 +[{/section-2.1.27 xa}(The )2(--prefix)0( and )2(--postfix)0( Options.)](2.1.27)337.4 subh3 +[(The )2(--prefix)0( and )2(--postfix)0( options prepend or append \(respectively\) the given argument to all)]320.4 norm1 +[2(global)0( or )2(extern)0( variables. E.g. )2(--prefix _)0( will prepend the underscore to all global and external)]309.4 norm0 +[(variables, as C sometimes \(but not always\) likes it.)]298.4 norm2 +[{/section-2.1.28 xa}(The )2(NASMENV)0( )(Environment Variable)](2.1.28)279.2 subh3 +[(If you define an environment variable called )2(NASMENV)0(, the program will interpret it as a list of extra)]262.2 norm1 +[(command-line options, which are processed before the real command line. You can use this to define)]251.2 norm0 +[(standard search directories for include files, by putting )2(-i)0( options in the )2(NASMENV)0( variable.)]240.2 norm2 +[(The value of the variable is split up at white space, so that the value )2(-s -ic:\\nasmlib\\)0( will be treated as)]223.2 norm1 +[(two separate options. However, that means that the value )2(-dNAME="my name")0( won't do what you might)]212.2 norm0 +[(want, because it will be split at the space and the NASM command-line processing will get confused by the)]201.2 norm0 +[(two nonsensical words )2(-dNAME="my)0( and )2(name")0(.)]190.2 norm2 +[(To get round this, NASM provides a feature whereby, if you begin the )2(NASMENV)0( environment variable with)]173.2 norm1 +[(some character that isn't a minus sign, then NASM will treat this character as the )(separator character for)]162.2 norm0 +[(options. So setting the )2(NASMENV)0( variable to the value )2(!-s!-ic:\\nasmlib\\)0( is equivalent to setting it to)]151.2 norm0 +[2(-s -ic:\\nasmlib\\)0(, but )2(!-dNAME="my name")0( will work.)]140.2 norm2 +[(This environment variable was previously called )2(NASM)0(. This was changed with version 0.98.31.)]123.2 norm3 +(23)pageodd +restore showpage +%%Page: 24 24 +%%BeginPageSetup +save +%%EndPageSetup +/24 pa +[{/section-2.2 xa}(Quick Start for )(MASM Users)](2.2)676.6 head3 +[(If you're used to writing programs with MASM, or with )(TASM in MASM-compatible \(non-Ideal\) mode, or)]659.6 norm1 +[(with )2(a86)0(, this section attempts to outline the major differences between MASM's syntax and NASM's. If)]648.6 norm0 +[(you're not already used to MASM, it's probably worth skipping this section.)]637.6 norm2 +[{/section-2.2.1 xa}(NASM Is )(Case-Sensitive)](2.2.1)618.4 subh3 +[(One simple difference is that NASM is case-sensitive. It makes a difference whether you call your label )2(foo)0(,)]601.4 norm1 +[2(Foo)0( or )2(FOO)0(. If you're assembling to )2(DOS)0( or )2(OS/2)0( )2(.OBJ)0( files, you can invoke the )2(UPPERCASE)0( directive)]590.4 norm0 +[(\(documented in ){/section-7.4 xl}(section 7.4){el}(\) to ensure that all symbols exported to other code modules are forced to be upper)]579.4 norm0 +[(case; but even then, )1(within)0( a single module, NASM will distinguish between labels differing only in case.)]568.4 norm2 +[{/section-2.2.2 xa}(NASM Requires )(Square Brackets For )(Memory References)](2.2.2)549.2 subh3 +[(NASM was designed with simplicity of syntax in mind. One of the )(design goals of NASM is that it should be)]532.2 norm1 +[(possible, as far as is practical, for the user to look at a single line of NASM code and tell what opcode is)]521.2 norm0 +[(generated by it. You can't do this in MASM: if you declare, for example,)]510.2 norm2 +[2(foo equ 1 )]493.2 code1 +[2(bar dw 2)]482.2 code2 +[(then the two lines of code)]465.2 norm3 +[2( mov ax,foo )]448.2 code1 +[2( mov ax,bar)]437.2 code2 +[(generate completely different opcodes, despite having identical-looking syntaxes.)]420.2 norm3 +[(NASM avoids this undesirable situation by having a much simpler syntax for memory references. The rule is)]403.2 norm1 +[(simply that any access to the )1(contents)0( of a memory location requires square brackets around the address, and)]392.2 norm0 +[(any access to the )1(address)0( of a variable doesn't. So an instruction of the form )2(mov ax,foo)0( will )1(always)0( refer)]381.2 norm0 +[(to a compile-time constant, whether it's an )2(EQU)0( or the address of a variable; and to access the )1(contents)0( of the)]370.2 norm0 +[(variable )2(bar)0(, you must code )2(mov ax,[bar])0(.)]359.2 norm2 +[(This also means that NASM has no need for MASM's )2(OFFSET)0( keyword, since the MASM code)]342.2 norm1 +[2(mov ax,offset bar)0( means exactly the same thing as NASM's )2(mov ax,bar)0(. If you're trying to get)]331.2 norm0 +[(large amounts of MASM code to assemble sensibly under NASM, you can always code)]320.2 norm0 +[2(%idefine offset)0( to make the preprocessor treat the )2(OFFSET)0( keyword as a no-op.)]309.2 norm2 +[(This issue is even more confusing in )2(a86)0(, where declaring a label with a trailing colon defines it to be a)]292.2 norm1 +[(`label' as opposed to a `variable' and causes )2(a86)0( to adopt NASM-style semantics; so in )2(a86)0(, )2(mov ax,var)]281.2 norm0 +[(has different behaviour depending on whether )2(var)0( was declared as )2(var: dw 0)0( \(a label\) or )2(var dw 0)0( \(a)]270.2 norm0 +[(word-size variable\). NASM is very simple by comparison: )1(everything)0( is a label.)]259.2 norm2 +[(NASM, in the interests of simplicity, also does not support the )(hybrid syntaxes supported by MASM and its)]242.2 norm1 +[(clones, such as )2(mov ax,table[bx])0(, where a memory reference is denoted by one portion outside square)]231.2 norm0 +[(brackets and another portion inside. The correct syntax for the above is )2(mov ax,[table+bx])0(. Likewise,)]220.2 norm0 +[2(mov ax,es:[di])0( is wrong and )2(mov ax,[es:di])0( is right.)]209.2 norm2 +[{/section-2.2.3 xa}(NASM Doesn't Store )(Variable Types)](2.2.3)190 subh3 +[(NASM, by design, chooses not to remember the types of variables you declare. Whereas MASM will)]173 norm1 +[(remember, on seeing )2(var dw 0)0(, that you declared )2(var)0( as a word-size variable, and will then be able to fill)]162 norm0 +[(in the )(ambiguity in the size of the instruction )2(mov var,2)0(, NASM will deliberately remember nothing about)]151 norm0 +[(the symbol )2(var)0( except where it begins, and so you must explicitly code )2(mov word [var],2)0(.)]140 norm2 +[(For this reason, NASM doesn't support the )2(LODS)0(, )2(MOVS)0(, )2(STOS)0(, )2(SCAS)0(, )2(CMPS)0(, )2(INS)0(, or )2(OUTS)0( instructions,)]123 norm1 +[(but only supports the forms such as )2(LODSB)0(, )2(MOVSW)0(, and )2(SCASD)0(, which explicitly specify the size of the)]112 norm0 +[(components of the strings being manipulated.)]101 norm2 +(24)pageeven +restore showpage +%%Page: 25 25 +%%BeginPageSetup +save +%%EndPageSetup +/25 pa +[{/section-2.2.4 xa}(NASM Doesn't )2(ASSUME)](2.2.4)678.8 subh3 +[(As part of NASM's drive for simplicity, it also does not support the )2(ASSUME)0( directive. NASM will not keep)]661.8 norm1 +[(track of what values you choose to put in your segment registers, and will never )1(automatically)0( generate a)]650.8 norm0 +[(segment override prefix.)]639.8 norm2 +[{/section-2.2.5 xa}(NASM Doesn't Support )(Memory Models)](2.2.5)620.6 subh3 +[(NASM also does not have any directives to support different 16-bit memory models. The programmer has to)]603.6 norm1 +[(keep track of which functions are supposed to be called with a )(far call and which with a )(near call, and is)]592.6 norm0 +[(responsible for putting the correct form of )2(RET)0( instruction \()2(RETN)0( or )2(RETF)0(; NASM accepts )2(RET)0( itself as an)]581.6 norm0 +[(alternate form for )2(RETN)0(\); in addition, the programmer is responsible for coding CALL FAR instructions)]570.6 norm0 +[(where necessary when calling )1(external)0( functions, and must also keep track of which external variable)]559.6 norm0 +[(definitions are far and which are near.)]548.6 norm2 +[{/section-2.2.6 xa}(Floating-Point Differences)](2.2.6)529.4 subh3 +[(NASM uses different names to refer to floating-point registers from MASM: where MASM would call them)]512.4 norm1 +[2(ST\(0\))0(, )2(ST\(1\))0( and so on, and )2(a86)0( would call them simply )2(0)0(, )2(1)0( and so on, NASM chooses to call them)]501.4 norm0 +[2(st0)0(, )2(st1)0( etc.)]490.4 norm2 +[(As of version 0.96, NASM now treats the instructions with )(`nowait' forms in the same way as)]473.4 norm1 +[(MASM-compatible assemblers. The idiosyncratic treatment employed by 0.95 and earlier was based on a)]462.4 norm0 +[(misunderstanding by the authors.)]451.4 norm2 +[{/section-2.2.7 xa}(Other Differences)](2.2.7)432.2 subh3 +[(For historical reasons, NASM uses the keyword )2(TWORD)0( where MASM and compatible assemblers use)]415.2 norm1 +[2(TBYTE)0(.)]404.2 norm2 +[(NASM does not declare )(uninitialized storage in the same way as MASM: where a MASM programmer might)]387.2 norm1 +[(use )2(stack db 64 dup \(?\))0(, NASM requires )2(stack resb 64)0(, intended to be read as `reserve 64)]376.2 norm0 +[(bytes'. For a limited amount of compatibility, since NASM treats )2(?)0( as a valid character in symbol names, you)]365.2 norm0 +[(can code )2(? equ 0)0( and then writing )2(dw ?)0( will at least do something vaguely useful. )2(DUP)0( is still not a)]354.2 norm0 +[(supported syntax, however.)]343.2 norm2 +[(In addition to all of this, macros and directives work completely differently to MASM. See ){/chapter-4 xl}(chapter 4){el}( and)]326.2 norm1 +[{/chapter-6 xl}(chapter 6){el}( for further details.)]315.2 norm2 +(25)pageodd +restore showpage +%%Page: 26 26 +%%BeginPageSetup +save +%%EndPageSetup +/26 pa +[{/chapter-3 xa}(Chapter 3: The NASM Language)]642.8 chap3 +[{/section-3.1 xa}(Layout of a NASM Source Line)](3.1)603.4 head3 +[(Like most assemblers, each NASM source line contains \(unless it is a macro, a preprocessor directive or an)]586.4 norm1 +[(assembler directive: see ){/chapter-4 xl}(chapter 4){el}( and ){/chapter-6 xl}(chapter 6){el}(\) some combination of the four fields)]575.4 norm2 +[2(label: instruction operands ; comment)]558.4 code3 +[(As usual, most of these fields are optional; the presence or absence of any combination of a label, an)]541.4 norm1 +[(instruction and a comment is allowed. Of course, the operand field is either required or forbidden by the)]530.4 norm0 +[(presence and nature of the instruction field.)]519.4 norm2 +[(NASM uses backslash \(\\\) as the line continuation character; if a line ends with backslash, the next line is)]502.4 norm1 +[(considered to be a part of the backslash-ended line.)]491.4 norm2 +[(NASM places no restrictions on white space within a line: labels may have white space before them, or)]474.4 norm1 +[(instructions may have no space before them, or anything. The )(colon after a label is also optional. \(Note that)]463.4 norm0 +[(this means that if you intend to code )2(lodsb)0( alone on a line, and type )2(lodab)0( by accident, then that's still a)]452.4 norm0 +[(valid source line which does nothing but define a label. Running NASM with the command-line option)]441.4 norm0 +[2(-w+orphan-labels)0( will cause it to warn you if you define a label alone on a line without a )(trailing colon.\))]430.4 norm2 +[(Valid characters in labels are letters, numbers, )2(_)0(, )2($)0(, )2(#)0(, )2(@)0(, )2(~)0(, )2(.)0(, and )2(?)0(. The only characters which may be used)]413.4 norm1 +[(as the )1(first)0( character of an identifier are letters, )2(.)0( \(with special meaning: see ){/section-3.9 xl}(section 3.9){el}(\), )2(_)0( and )2(?)0(. An)]402.4 norm0 +[(identifier may also be prefixed with a )2($)0( to indicate that it is intended to be read as an identifier and not a)]391.4 norm0 +[(reserved word; thus, if some other module you are linking with defines a symbol called )2(eax)0(, you can refer to)]380.4 norm0 +[2($eax)0( in NASM code to distinguish the symbol from the register. Maximum length of an identifier is 4095)]369.4 norm0 +[(characters.)]358.4 norm2 +[(The instruction field may contain any machine instruction: Pentium and P6 instructions, FPU instructions,)]341.4 norm1 +[(MMX instructions and even undocumented instructions are all supported. The instruction may be prefixed by)]330.4 norm0 +[2(LOCK)0(, )2(REP)0(, )2(REPE)0(/)2(REPZ)0( or )2(REPNE)0(/)2(REPNZ)0(, in the usual way. Explicit )(address-size and )(operand-size)]319.4 norm0 +[(prefixes )2(A16)0(, )2(A32)0(, )2(A64)0(, )2(O16)0( and )2(O32)0(, )2(O64)0( are provided \226 one example of their use is given in ){/chapter-10 xl}(chapter 10){el}(.)]308.4 norm0 +[(You can also use the name of a )(segment register as an instruction prefix: coding )2(es mov [bx],ax)0( is)]297.4 norm0 +[(equivalent to coding )2(mov [es:bx],ax)0(. We recommend the latter syntax, since it is consistent with other)]286.4 norm0 +[(syntactic features of the language, but for instructions such as )2(LODSB)0(, which has no operands and yet can)]275.4 norm0 +[(require a segment override, there is no clean syntactic way to proceed apart from )2(es lodsb)0(.)]264.4 norm2 +[(An instruction is not required to use a prefix: prefixes such as )2(CS)0(, )2(A32)0(, )2(LOCK)0( or )2(REPE)0( can appear on a line)]247.4 norm1 +[(by themselves, and NASM will just generate the prefix bytes.)]236.4 norm2 +[(In addition to actual machine instructions, NASM also supports a number of pseudo-instructions, described in)]219.4 norm1 +[{/section-3.2 xl}(section 3.2){el}(.)]208.4 norm2 +[(Instruction )(operands may take a number of forms: they can be registers, described simply by the register name)]191.4 norm1 +[(\(e.g. )2(ax)0(, )2(bp)0(, )2(ebx)0(, )2(cr0)0(: NASM does not use the )2(gas)0(\226style syntax in which register names must be prefixed)]180.4 norm0 +[(by a )2(%)0( sign\), or they can be )(effective addresses \(see ){/section-3.3 xl}(section 3.3){el}(\), constants \(){/section-3.4 xl}(section 3.4){el}(\) or expressions)]169.4 norm0 +[(\(){/section-3.5 xl}(section 3.5){el}(\).)]158.4 norm2 +[(For x87 )(floating-point instructions, NASM accepts a wide range of syntaxes: you can use two-operand forms)]141.4 norm1 +[(like MASM supports, or you can use NASM's native single-operand forms in most cases. For example, you)]130.4 norm0 +[(can code:)]119.4 norm2 +(26)pageeven +restore showpage +%%Page: 27 27 +%%BeginPageSetup +save +%%EndPageSetup +/27 pa +[2( fadd st1 ; this sets st0 := st0 + st1 )]681 code1 +[2( fadd st0,st1 ; so does this )]670 code0 +[2()]659 code0 +[2( fadd st1,st0 ; this sets st1 := st1 + st0 )]648 code0 +[2( fadd to st1 ; so does this)]637 code2 +[(Almost any x87 floating-point instruction that references memory must use one of the prefixes )2(DWORD)0(,)]620 norm1 +[2(QWORD)0( or )2(TWORD)0( to indicate what size of )(memory operand it refers to.)]609 norm2 +[{/section-3.2 xa}(Pseudo-Instructions)](3.2)587.6 head3 +[(Pseudo-instructions are things which, though not real x86 machine instructions, are used in the instruction)]570.6 norm1 +[(field anyway because that's the most convenient place to put them. The current pseudo-instructions are )2(DB)0(,)]559.6 norm0 +[2(DW)0(, )2(DD)0(, )2(DQ)0(, )2(DT)0(, )2(DO)0( and )2(DY)0(; their )(uninitialized counterparts )2(RESB)0(, )2(RESW)0(, )2(RESD)0(, )2(RESQ)0(, )2(REST)0(, )2(RESO)0( and)]548.6 norm0 +[2(RESY)0(; the )2(INCBIN)0( command, the )2(EQU)0( command, and the )2(TIMES)0( prefix.)]537.6 norm2 +[{/section-3.2.1 xa}2(DB)0( and Friends: Declaring Initialized Data)](3.2.1)518.4 subh3 +[2(DB)0(, )2(DW)0(, )2(DD)0(, )2(DQ)0(, )2(DT)0(, )2(DO)0( and )2(DY)0( are used, much as in MASM, to declare initialized data in the output file.)]501.4 norm1 +[(They can be invoked in a wide range of ways: )]490.4 norm2 +[2( db 0x55 ; just the byte 0x55 )]473.4 code1 +[2( db 0x55,0x56,0x57 ; three bytes in succession )]462.4 code0 +[2( db 'a',0x55 ; character constants are OK )]451.4 code0 +[2( db 'hello',13,10,'$' ; so are string constants )]440.4 code0 +[2( dw 0x1234 ; 0x34 0x12 )]429.4 code0 +[2( dw 'a' ; 0x61 0x00 \(it's just a number\) )]418.4 code0 +[2( dw 'ab' ; 0x61 0x62 \(character constant\) )]407.4 code0 +[2( dw 'abc' ; 0x61 0x62 0x63 0x00 \(string\) )]396.4 code0 +[2( dd 0x12345678 ; 0x78 0x56 0x34 0x12 )]385.4 code0 +[2( dd 1.234567e20 ; floating-point constant )]374.4 code0 +[2( dq 0x123456789abcdef0 ; eight byte constant )]363.4 code0 +[2( dq 1.234567e20 ; double-precision float )]352.4 code0 +[2( dt 1.234567e20 ; extended-precision float)]341.4 code2 +[2(DT)0(, )2(DO)0( and )2(DY)0( do not accept )(numeric constants as operands.)]324.4 norm3 +[{/section-3.2.2 xa}2(RESB)0( and Friends: Declaring )(Uninitialized Data)](3.2.2)305.2 subh3 +[2(RESB)0(, )2(RESW)0(, )2(RESD)0(, )2(RESQ)0(, )2(REST)0(, )2(RESO)0( and )2(RESY)0( are designed to be used in the BSS section of a module:)]288.2 norm1 +[(they declare )1(uninitialized)0( storage space. Each takes a single operand, which is the number of bytes, words,)]277.2 norm0 +[(doublewords or whatever to reserve. As stated in ){/section-2.2.7 xl}(section 2.2.7){el}(, NASM does not support the MASM/TASM)]266.2 norm0 +[(syntax of reserving uninitialized space by writing )2(DW ?)0( or similar things: this is what it does instead. The)]255.2 norm0 +[(operand to a )2(RESB)0(\226type pseudo-instruction is a )1(critical expression)0(: see ){/section-3.8 xl}(section 3.8){el}(.)]244.2 norm2 +[(For example:)]227.2 norm3 +[2(buffer: resb 64 ; reserve 64 bytes )]210.2 code1 +[2(wordvar: resw 1 ; reserve a word )]199.2 code0 +[2(realarray resq 10 ; array of ten reals )]188.2 code0 +[2(ymmval: resy 1 ; one YMM register)]177.2 code2 +[{/section-3.2.3 xa}2(INCBIN)0(: Including External )(Binary Files)](3.2.3)158 subh3 +[2(INCBIN)0( is borrowed from the old Amiga assembler )(DevPac: it includes a binary file verbatim into the output)]141 norm1 +[(file. This can be handy for \(for example\) including )(graphics and )(sound data directly into a game executable)]130 norm0 +[(file. It can be called in one of these three ways:)]119 norm2 +(27)pageodd +restore showpage +%%Page: 28 28 +%%BeginPageSetup +save +%%EndPageSetup +/28 pa +[2( incbin "file.dat" ; include the whole file )]681 code1 +[2( incbin "file.dat",1024 ; skip the first 1024 bytes )]670 code0 +[2( incbin "file.dat",1024,512 ; skip the first 1024, and )]659 code0 +[2( ; actually include at most 512)]648 code2 +[2(INCBIN)0( is both a directive and a standard macro; the standard macro version searches for the file in the)]631 norm1 +[(include file search path and adds the file to the dependency lists. This macro can be overridden if desired.)]620 norm2 +[{/section-3.2.4 xa}2(EQU)0(: Defining Constants)](3.2.4)600.8 subh3 +[2(EQU)0( defines a symbol to a given constant value: when )2(EQU)0( is used, the source line must contain a label. The)]583.8 norm1 +[(action of )2(EQU)0( is to define the given label name to the value of its \(only\) operand. This definition is absolute,)]572.8 norm0 +[(and cannot change later. So, for example,)]561.8 norm2 +[2(message db 'hello, world' )]544.8 code1 +[2(msglen equ $-message)]533.8 code2 +[(defines )2(msglen)0( to be the constant 12. )2(msglen)0( may not then be redefined later. This is not a )(preprocessor)]516.8 norm1 +[(definition either: the value of )2(msglen)0( is evaluated )1(once)0(, using the value of )2($)0( \(see ){/section-3.5 xl}(section 3.5){el}( for an)]505.8 norm0 +[(explanation of )2($)0(\) at the point of definition, rather than being evaluated wherever it is referenced and using the)]494.8 norm0 +[(value of )2($)0( at the point of reference.)]483.8 norm2 +[{/section-3.2.5 xa}2(TIMES)0(: )(Repeating Instructions or Data)](3.2.5)464.6 subh3 +[(The )2(TIMES)0( prefix causes the instruction to be assembled multiple times. This is partly present as NASM's)]447.6 norm1 +[(equivalent of the )2(DUP)0( syntax supported by )(MASM\226compatible assemblers, in that you can code)]436.6 norm2 +[2(zerobuf: times 64 db 0)]419.6 code3 +[(or similar things; but )2(TIMES)0( is more versatile than that. The argument to )2(TIMES)0( is not just a numeric)]402.6 norm1 +[(constant, but a numeric )1(expression)0(, so you can do things like)]391.6 norm2 +[2(buffer: db 'hello, world' )]374.6 code1 +[2( times 64-$+buffer db ' ')]363.6 code2 +[(which will store exactly enough spaces to make the total length of )2(buffer)0( up to 64. Finally, )2(TIMES)0( can be)]346.6 norm1 +[(applied to ordinary instructions, so you can code trivial )(unrolled loops in it:)]335.6 norm2 +[2( times 100 movsb)]318.6 code3 +[(Note that there is no effective difference between )2(times 100 resb 1)0( and )2(resb 100)0(, except that the)]301.6 norm1 +[(latter will be assembled about 100 times faster due to the internal structure of the assembler.)]290.6 norm2 +[(The operand to )2(TIMES)0( is a critical expression \(){/section-3.8 xl}(section 3.8){el}(\).)]273.6 norm3 +[(Note also that )2(TIMES)0( can't be applied to )(macros: the reason for this is that )2(TIMES)0( is processed after the)]256.6 norm1 +[(macro phase, which allows the argument to )2(TIMES)0( to contain expressions such as )2(64-$+buffer)0( as above.)]245.6 norm0 +[(To repeat more than one line of code, or a complex macro, use the preprocessor )2(%rep)0( directive.)]234.6 norm2 +[{/section-3.3 xa}(Effective Addresses)](3.3)213.2 head3 +[(An )(effective address is any operand to an instruction which )(references memory. Effective addresses, in)]196.2 norm1 +[(NASM, have a very simple syntax: they consist of an expression evaluating to the desired address, enclosed in)]185.2 norm0 +[(square brackets. For example:)]174.2 norm2 +[2(wordvar dw 123 )]157.2 code1 +[2( mov ax,[wordvar] )]146.2 code0 +[2( mov ax,[wordvar+1] )]135.2 code0 +[2( mov ax,[es:wordvar+bx])]124.2 code2 +(28)pageeven +restore showpage +%%Page: 29 29 +%%BeginPageSetup +save +%%EndPageSetup +/29 pa +[(Anything not conforming to this simple system is not a valid memory reference in NASM, for example)]681 norm1 +[2(es:wordvar[bx])0(.)]670 norm2 +[(More complicated effective addresses, such as those involving more than one register, work in exactly the)]653 norm1 +[(same way:)]642 norm2 +[2( mov eax,[ebx*2+ecx+offset] )]625 code1 +[2( mov ax,[bp+di+8])]614 code2 +[(NASM is capable of doing )(algebra on these effective addresses, so that things which don't necessarily )1(look)]597 norm1 +[(legal are perfectly all right:)]586 norm2 +[2( mov eax,[ebx*5] ; assembles as [ebx*4+ebx] )]569 code1 +[2( mov eax,[label1*2-label2] ; ie [label1+\(label1-label2\)])]558 code2 +[(Some forms of effective address have more than one assembled form; in most such cases NASM will generate)]541 norm1 +[(the smallest form it can. For example, there are distinct assembled forms for the 32-bit effective addresses)]530 norm0 +[2([eax*2+0])0( and )2([eax+eax])0(, and NASM will generally generate the latter on the grounds that the former)]519 norm0 +[(requires four bytes to store a zero offset.)]508 norm2 +[(NASM has a hinting mechanism which will cause )2([eax+ebx])0( and )2([ebx+eax])0( to generate different)]491 norm1 +[(opcodes; this is occasionally useful because )2([esi+ebp])0( and )2([ebp+esi])0( have different default segment)]480 norm0 +[(registers.)]469 norm2 +[(However, you can force NASM to generate an effective address in a particular form by the use of the)]452 norm1 +[(keywords )2(BYTE)0(, )2(WORD)0(, )2(DWORD)0( and )2(NOSPLIT)0(. If you need )2([eax+3])0( to be assembled using a double-word)]441 norm0 +[(offset field instead of the one byte NASM will normally generate, you can code )2([dword eax+3])0(.)]430 norm0 +[(Similarly, you can force NASM to use a byte offset for a small value which it hasn't seen on the first pass \(see)]419 norm0 +[{/section-3.8 xl}(section 3.8){el}( for an example of such a code fragment\) by using )2([byte eax+offset])0(. As special cases,)]408 norm0 +[2([byte eax])0( will code )2([eax+0])0( with a byte offset of zero, and )2([dword eax])0( will code it with a)]397 norm0 +[(double-word offset of zero. The normal form, )2([eax])0(, will be coded with no offset field.)]386 norm2 +[(The form described in the previous paragraph is also useful if you are trying to access data in a 32-bit)]369 norm1 +[(segment from within 16 bit code. For more information on this see the section on mixed-size addressing)]358 norm0 +[(\(){/section-10.2 xl}(section 10.2){el}(\). In particular, if you need to access data with a known offset that is larger than will fit in a)]347 norm0 +[(16-bit value, if you don't specify that it is a dword offset, nasm will cause the high word of the offset to be)]336 norm0 +[(lost.)]325 norm2 +[(Similarly, NASM will split )2([eax*2])0( into )2([eax+eax])0( because that allows the offset field to be absent and)]308 norm1 +[(space to be saved; in fact, it will also split )2([eax*2+offset])0( into )2([eax+eax+offset])0(. You can combat)]297 norm0 +[(this behaviour by the use of the )2(NOSPLIT)0( keyword: )2([nosplit eax*2])0( will force )2([eax*2+0])0( to be)]286 norm0 +[(generated literally.)]275 norm2 +[(In 64-bit mode, NASM will by default generate absolute addresses. The )2(REL)0( keyword makes it produce)]258 norm1 +[2(RIP)0(\226relative addresses. Since this is frequently the normally desired behaviour, see the )2(DEFAULT)0( directive)]247 norm0 +[(\(){/section-6.2 xl}(section 6.2){el}(\). The keyword )2(ABS)0( overrides )2(REL)0(.)]236 norm2 +[{/section-3.4 xa}(Constants)](3.4)214.6 head3 +[(NASM understands four different types of constant: numeric, character, string and floating-point.)]197.6 norm3 +[{/section-3.4.1 xa}(Numeric Constants)](3.4.1)178.4 subh3 +[(A numeric constant is simply a number. NASM allows you to specify numbers in a variety of number bases,)]161.4 norm1 +[(in a variety of ways: you can suffix )2(H)0( or )2(X)0(, )2(Q)0( or )2(O)0(, and )2(B)0( for )(hexadecimal, )(octal and )(binary respectively, or)]150.4 norm0 +[(you can prefix )2(0x)0( for hexadecimal in the style of C, or you can prefix )2($)0( for hexadecimal in the style of)]139.4 norm0 +[(Borland Pascal. Note, though, that the )2($)0( prefix does double duty as a prefix on identifiers \(see ){/section-3.1 xl}(section 3.1){el}(\), so)]128.4 norm0 +[(a hex number prefixed with a )2($)0( sign must have a digit after the )2($)0( rather than a letter. In addition, current)]117.4 norm0 +(29)pageodd +restore showpage +%%Page: 30 30 +%%BeginPageSetup +save +%%EndPageSetup +/30 pa +[(versions of NASM accept the prefix )2(0h)0( for hexadecimal, )2(0o)0( or )2(0q)0( for octal, and )2(0b)0( for binary. Please note)]681 norm0 +[(that unlike C, a )2(0)0( prefix by itself does )1(not)0( imply an octal constant!)]670 norm2 +[(Numeric constants can have underscores \()2(_)0(\) interspersed to break up long strings.)]653 norm3 +[(Some examples \(all producing exactly the same code\):)]636 norm3 +[2( mov ax,200 ; decimal )]619 code1 +[2( mov ax,0200 ; still decimal )]608 code0 +[2( mov ax,0200d ; explicitly decimal )]597 code0 +[2( mov ax,0d200 ; also decimal )]586 code0 +[2( mov ax,0c8h ; hex )]575 code0 +[2( mov ax,$0c8 ; hex again: the 0 is required )]564 code0 +[2( mov ax,0xc8 ; hex yet again )]553 code0 +[2( mov ax,0hc8 ; still hex )]542 code0 +[2( mov ax,310q ; octal )]531 code0 +[2( mov ax,310o ; octal again )]520 code0 +[2( mov ax,0o310 ; octal yet again )]509 code0 +[2( mov ax,0q310 ; hex yet again )]498 code0 +[2( mov ax,11001000b ; binary )]487 code0 +[2( mov ax,1100_1000b ; same binary constant )]476 code0 +[2( mov ax,0b1100_1000 ; same binary constant yet again)]465 code2 +[{/section-3.4.2 xa}(Character Strings)](3.4.2)445.8 subh3 +[(A character string consists of up to eight characters enclosed in either single quotes \()2('...')0(\), double quotes)]428.8 norm1 +[(\()2("...")0(\) or backquotes \()2(`...`)0(\). Single or double quotes are equivalent to NASM \(except of course that)]417.8 norm0 +[(surrounding the constant with single quotes allows double quotes to appear within it and vice versa\); the)]406.8 norm0 +[(contents of those are represented verbatim. Strings enclosed in backquotes support C-style )2(\\)0(\226escapes for)]395.8 norm0 +[(special characters.)]384.8 norm2 +[(The following )(escape sequences are recognized by backquoted strings:)]367.8 norm3 +[2( \\' single quote \('\) )]350.8 code1 +[2( \\" double quote \("\) )]339.8 code0 +[2( \\` backquote \(`\) )]328.8 code0 +[2( \\\\ backslash \(\\\) )]317.8 code0 +[2( \\? question mark \(?\) )]306.8 code0 +[2( \\a BEL \(ASCII 7\) )]295.8 code0 +[2( \\b BS \(ASCII 8\) )]284.8 code0 +[2( \\t TAB \(ASCII 9\) )]273.8 code0 +[2( \\n LF \(ASCII 10\) )]262.8 code0 +[2( \\v VT \(ASCII 11\) )]251.8 code0 +[2( \\f FF \(ASCII 12\) )]240.8 code0 +[2( \\r CR \(ASCII 13\) )]229.8 code0 +[2( \\e ESC \(ASCII 27\) )]218.8 code0 +[2( \\377 Up to 3 octal digits - literal byte )]207.8 code0 +[2( \\xFF Up to 2 hexadecimal digits - literal byte )]196.8 code0 +[2( \\u1234 4 hexadecimal digits - Unicode character )]185.8 code0 +[2( \\U12345678 8 hexadecimal digits - Unicode character)]174.8 code2 +[(All other escape sequences are reserved. Note that )2(\\0)0(, meaning a )2(NUL)0( character \(ASCII 0\), is a special case)]157.8 norm1 +[(of the octal escape sequence.)]146.8 norm2 +[(Unicode characters specified with )2(\\u)0( or )2(\\U)0( are converted to )(UTF-8. For example, the following lines are all)]129.8 norm1 +[(equivalent:)]118.8 norm2 +(30)pageeven +restore showpage +%%Page: 31 31 +%%BeginPageSetup +save +%%EndPageSetup +/31 pa +[2( db `\\u263a` ; UTF-8 smiley face )]681 code1 +[2( db `\\xe2\\x98\\xba` ; UTF-8 smiley face )]670 code0 +[2( db 0E2h, 098h, 0BAh ; UTF-8 smiley face)]659 code2 +[{/section-3.4.3 xa}(Character Constants)](3.4.3)639.8 subh3 +[(A character constant consists of a string up to eight bytes long, used in an expression context. It is treated as if)]622.8 norm1 +[(it was an integer.)]611.8 norm2 +[(A character constant with more than one byte will be arranged with )(little-endian order in mind: if you code)]594.8 norm3 +[2( mov eax,'abcd')]577.8 code3 +[(then the constant generated is not )2(0x61626364)0(, but )2(0x64636261)0(, so that if you were then to store the)]560.8 norm1 +[(value into memory, it would read )2(abcd)0( rather than )2(dcba)0(. This is also the sense of character constants)]549.8 norm0 +[(understood by the Pentium's )2(CPUID)0( instruction.)]538.8 norm2 +[{/section-3.4.4 xa}(String Constants)](3.4.4)519.6 subh3 +[(String constants are character strings used in the context of some pseudo-instructions, namely the )2(DB)0( family)]502.6 norm1 +[(and )2(INCBIN)0( \(where it represents a filename.\) They are also used in certain preprocessor directives.)]491.6 norm2 +[(A string constant looks like a character constant, only longer. It is treated as a concatenation of)]474.6 norm1 +[(maximum-size character constants for the conditions. So the following are equivalent:)]463.6 norm2 +[2( db 'hello' ; string constant )]446.6 code1 +[2( db 'h','e','l','l','o' ; equivalent character constants)]435.6 code2 +[(And the following are also equivalent:)]418.6 norm3 +[2( dd 'ninechars' ; doubleword string constant )]401.6 code1 +[2( dd 'nine','char','s' ; becomes three doublewords )]390.6 code0 +[2( db 'ninechars',0,0,0 ; and really looks like this)]379.6 code2 +[(Note that when used in a string-supporting context, quoted strings are treated as a string constants even if)]362.6 norm1 +[(they are short enough to be a character constant, because otherwise )2(db 'ab')0( would have the same effect as)]351.6 norm0 +[2(db 'a')0(, which would be silly. Similarly, three-character or four-character constants are treated as strings)]340.6 norm0 +[(when they are operands to )2(DW)0(, and so forth.)]329.6 norm2 +[{/section-3.4.5 xa}(Unicode Strings)](3.4.5)310.4 subh3 +[(The special operators )2(__utf16__)0( and )2(__utf32__)0( allows definition of Unicode strings. They take a string)]293.4 norm1 +[(in UTF-8 format and converts it to \(littleendian\) UTF-16 or UTF-32, respectively.)]282.4 norm2 +[(For example:)]265.4 norm3 +[2(%define u\(x\) __utf16__\(x\) )]248.4 code1 +[2(%define w\(x\) __utf32__\(x\) )]237.4 code0 +[2()]226.4 code0 +[2( dw u\('C:\\WINDOWS'\), 0 ; Pathname in UTF-16 )]215.4 code0 +[2( dd w\(`A + B = \\u206a`\), 0 ; String in UTF-32)]204.4 code2 +[2(__utf16__)0( and )2(__utf32__)0( can be applied either to strings passed to the )2(DB)0( family instructions, or to)]187.4 norm1 +[(character constants in an expression context.)]176.4 norm2 +[{/section-3.4.6 xa}(Floating-Point Constants)](3.4.6)157.2 subh3 +[(Floating-point constants are acceptable only as arguments to )2(DB)0(, )2(DW)0(, )2(DD)0(, )2(DQ)0(, )2(DT)0(, and )2(DO)0(, or as arguments to)]140.2 norm1 +[(the special operators )2(__float8__)0(, )2(__float16__)0(, )2(__float32__)0(, )2(__float64__)0(, )2(__float80m__)0(,)]129.2 norm0 +[2(__float80e__)0(, )2(__float128l__)0(, and )2(__float128h__)0(.)]118.2 norm2 +(31)pageodd +restore showpage +%%Page: 32 32 +%%BeginPageSetup +save +%%EndPageSetup +/32 pa +[(Floating-point constants are expressed in the traditional form: digits, then a period, then optionally more)]681 norm1 +[(digits, then optionally an )2(E)0( followed by an exponent. The period is mandatory, so that NASM can distinguish)]670 norm0 +[(between )2(dd 1)0(, which declares an integer constant, and )2(dd 1.0)0( which declares a floating-point constant.)]659 norm0 +[(NASM also support C99-style hexadecimal floating-point: )2(0x)0(, hexadecimal digits, period, optionally more)]648 norm0 +[(hexadeximal digits, then optionally a )2(P)0( followed by a )1(binary)0( \(not hexadecimal\) exponent in decimal notation.)]637 norm2 +[(Underscores to break up groups of digits are permitted in floating-point constants as well.)]620 norm3 +[(Some examples:)]603 norm3 +[2( db -0.2 ; "Quarter precision" )]586 code1 +[2( dw -0.5 ; IEEE 754r/SSE5 half precision )]575 code0 +[2( dd 1.2 ; an easy one )]564 code0 +[2( dd 1.222_222_222 ; underscores are permitted )]553 code0 +[2( dd 0x1p+2 ; 1.0x2^2 = 4.0 )]542 code0 +[2( dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0 )]531 code0 +[2( dq 1.e10 ; 10 000 000 000.0 )]520 code0 +[2( dq 1.e+10 ; synonymous with 1.e10 )]509 code0 +[2( dq 1.e-10 ; 0.000 000 000 1 )]498 code0 +[2( dt 3.141592653589793238462 ; pi )]487 code0 +[2( do 1.e+4000 ; IEEE 754r quad precision)]476 code2 +[(The 8-bit "quarter-precision" floating-point format is sign:exponent:mantissa = 1:4:3 with an exponent bias)]459 norm1 +[(of 7. This appears to be the most frequently used 8-bit floating-point format, although it is not covered by)]448 norm0 +[(any formal standard. This is sometimes called a ")(minifloat.")]437 norm2 +[(The special operators are used to produce floating-point numbers in other contexts. They produce the binary)]420 norm1 +[(representation of a specific floating-point number as an integer, and can use anywhere integer constants are)]409 norm0 +[(used in an expression. )2(__float80m__)0( and )2(__float80e__)0( produce the 64-bit mantissa and 16-bit)]398 norm0 +[(exponent of an 80-bit floating-point number, and )2(__float128l__)0( and )2(__float128h__)0( produce the)]387 norm0 +[(lower and upper 64-bit halves of a 128-bit floating-point number, respectively.)]376 norm2 +[(For example:)]359 norm3 +[2( mov rax,__float64__\(3.141592653589793238462\))]342 code3 +[(... would assign the binary representation of pi as a 64-bit floating point number into )2(RAX)0(. This is exactly)]325 norm1 +[(equivalent to:)]314 norm2 +[2( mov rax,0x400921fb54442d18)]297 code3 +[(NASM cannot do compile-time arithmetic on floating-point constants. This is because NASM is designed to)]280 norm1 +[(be portable \226 although it always generates code to run on x86 processors, the assembler itself can run on any)]269 norm0 +[(system with an ANSI C compiler. Therefore, the assembler cannot guarantee the presence of a floating-point)]258 norm0 +[(unit capable of handling the )(Intel number formats, and so for NASM to be able to do floating arithmetic it)]247 norm0 +[(would have to include its own complete set of floating-point routines, which would significantly increase the)]236 norm0 +[(size of the assembler for very little benefit.)]225 norm2 +[(The special tokens )2(__Infinity__)0(, )2(__QNaN__)0( \(or )2(__NaN__)0(\) and )2(__SNaN__)0( can be used to generate)]208 norm1 +[(infinities, quiet )(NaNs, and signalling NaNs, respectively. These are normally used as macros:)]197 norm2 +[2(%define Inf __Infinity__ )]180 code1 +[2(%define NaN __QNaN__ )]169 code0 +[2()]158 code0 +[2( dq +1.5, -Inf, NaN ; Double-precision constants)]147 code2 +(32)pageeven +restore showpage +%%Page: 33 33 +%%BeginPageSetup +save +%%EndPageSetup +/33 pa +[{/section-3.4.7 xa}(Packed BCD Constants)](3.4.7)678.8 subh3 +[(x87-style packed BCD constants can be used in the same contexts as 80-bit floating-point numbers. They)]661.8 norm1 +[(are suffixed with )2(p)0( or prefixed with )2(0p)0(, and can include up to 18 decimal digits.)]650.8 norm2 +[(As with other numeric constants, underscores can be used to separate digits.)]633.8 norm3 +[(For example:)]616.8 norm3 +[2( dt 12_345_678_901_245_678p )]599.8 code1 +[2( dt -12_345_678_901_245_678p )]588.8 code0 +[2( dt +0p33 )]577.8 code0 +[2( dt 33p)]566.8 code2 +[{/section-3.5 xa}(Expressions)](3.5)545.4 head3 +[(Expressions in NASM are similar in syntax to those in C. Expressions are evaluated as 64-bit integers which)]528.4 norm1 +[(are then adjusted to the appropriate size.)]517.4 norm2 +[(NASM supports two special tokens in expressions, allowing calculations to involve the current assembly)]500.4 norm1 +[(position: the )2($)0( and )2($$)0( tokens. )2($)0( evaluates to the assembly position at the beginning of the line containing the)]489.4 norm0 +[(expression; so you can code an )(infinite loop using )2(JMP $)0(. )2($$)0( evaluates to the beginning of the current)]478.4 norm0 +[(section; so you can tell how far into the section you are by using )2(\($-$$\))0(.)]467.4 norm2 +[(The arithmetic )(operators provided by NASM are listed here, in increasing order of )(precedence.)]450.4 norm3 +[{/section-3.5.1 xa}2(|)0(: )(Bitwise OR Operator)](3.5.1)431.2 subh3 +[(The )2(|)0( operator gives a bitwise OR, exactly as performed by the )2(OR)0( machine instruction. Bitwise OR is the)]414.2 norm1 +[(lowest-priority arithmetic operator supported by NASM.)]403.2 norm2 +[{/section-3.5.2 xa}2(^)0(: )(Bitwise XOR Operator)](3.5.2)384 subh3 +[2(^)0( provides the bitwise XOR operation.)]367 norm3 +[{/section-3.5.3 xa}2(&)0(: )(Bitwise AND Operator)](3.5.3)347.8 subh3 +[2(&)0( provides the bitwise AND operation.)]330.8 norm3 +[{/section-3.5.4 xa}2(<<)0( and )2(>>)0(: )(Bit Shift Operators)](3.5.4)311.6 subh3 +[2(<<)0( gives a bit-shift to the left, just as it does in C. So )2(5<<3)0( evaluates to 5 times 8, or 40. )2(>>)0( gives a bit-shift)]294.6 norm1 +[(to the right; in NASM, such a shift is )1(always)0( unsigned, so that the bits shifted in from the left-hand end are)]283.6 norm0 +[(filled with zero rather than a sign-extension of the previous highest bit.)]272.6 norm2 +[{/section-3.5.5 xa}2(+)0( and )2(-)0(: )(Addition and )(Subtraction Operators)](3.5.5)253.4 subh3 +[(The )2(+)0( and )2(-)0( operators do perfectly ordinary addition and subtraction.)]236.4 norm3 +[{/section-3.5.6 xa}2(*)0(, )2(/)0(, )2(//)0(, )2(%)0( and )2(%%)0(: )(Multiplication and )(Division)](3.5.6)217.2 subh3 +[2(*)0( is the multiplication operator. )2(/)0( and )2(//)0( are both division operators: )2(/)0( is )(unsigned division and )2(//)0( is )(signed)]200.2 norm1 +[(division. Similarly, )2(%)0( and )2(%%)0( provide )(unsigned and )(signed modulo operators respectively.)]189.2 norm2 +[(NASM, like ANSI C, provides no guarantees about the sensible operation of the signed modulo operator.)]172.2 norm3 +[(Since the )2(%)0( character is used extensively by the macro )(preprocessor, you should ensure that both the signed)]155.2 norm1 +[(and unsigned modulo operators are followed by white space wherever they appear.)]144.2 norm2 +(33)pageodd +restore showpage +%%Page: 34 34 +%%BeginPageSetup +save +%%EndPageSetup +/34 pa +[{/section-3.5.7 xa}(Unary Operators: )2(+)0(, )2(-)0(, )2(~)0(, )2(!)0( and )2(SEG)](3.5.7)678.8 subh3 +[(The highest-priority operators in NASM's expression grammar are those which only apply to one argument.)]661.8 norm1 +[2(-)0( negates its operand, )2(+)0( does nothing \(it's provided for symmetry with )2(-)0(\), )2(~)0( computes the )(one's complement)]650.8 norm0 +[(of its operand, )2(!)0( is the )(logical negation operator, and )2(SEG)0( provides the )(segment address of its operand)]639.8 norm0 +[(\(explained in more detail in ){/section-3.6 xl}(section 3.6){el}(\).)]628.8 norm2 +[{/section-3.6 xa}2(SEG)0( and )2(WRT)](3.6)607.4 head3 +[(When writing large 16-bit programs, which must be split into multiple )(segments, it is often necessary to be)]590.4 norm1 +[(able to refer to the )(segment part of the address of a symbol. NASM supports the )2(SEG)0( operator to perform this)]579.4 norm0 +[(function.)]568.4 norm2 +[(The )2(SEG)0( operator returns the )1(preferred)0( segment base of a symbol, defined as the segment base relative to)]551.4 norm1 +[(which the offset of the symbol makes sense. So the code)]540.4 norm2 +[2( mov ax,seg symbol )]523.4 code1 +[2( mov es,ax )]512.4 code0 +[2( mov bx,symbol)]501.4 code2 +[(will load )2(ES:BX)0( with a valid pointer to the symbol )2(symbol)0(.)]484.4 norm3 +[(Things can be more complex than this: since 16-bit segments and )(groups may )(overlap, you might)]467.4 norm1 +[(occasionally want to refer to some symbol using a different segment base from the preferred one. NASM lets)]456.4 norm0 +[(you do this, by the use of the )2(WRT)0( \(With Reference To\) keyword. So you can do things like)]445.4 norm2 +[2( mov ax,weird_seg ; weird_seg is a segment base )]428.4 code1 +[2( mov es,ax )]417.4 code0 +[2( mov bx,symbol wrt weird_seg)]406.4 code2 +[(to load )2(ES:BX)0( with a different, but functionally equivalent, pointer to the symbol )2(symbol)0(.)]389.4 norm3 +[(NASM supports far \(inter-segment\) calls and jumps by means of the syntax )2(call segment:offset)0(,)]372.4 norm1 +[(where )2(segment)0( and )2(offset)0( both represent immediate values. So to call a far procedure, you could code)]361.4 norm0 +[(either of)]350.4 norm2 +[2( call \(seg procedure\):procedure )]333.4 code1 +[2( call weird_seg:\(procedure wrt weird_seg\))]322.4 code2 +[(\(The parentheses are included for clarity, to show the intended parsing of the above instructions. They are not)]305.4 norm1 +[(necessary in practice.\))]294.4 norm2 +[(NASM supports the syntax )2(call far procedure)0( as a synonym for the first of the above usages. )2(JMP)]277.4 norm1 +[(works identically to )2(CALL)0( in these examples.)]266.4 norm2 +[(To declare a )(far pointer to a data item in a data segment, you must code)]249.4 norm3 +[2( dw symbol, seg symbol)]232.4 code3 +[(NASM supports no convenient synonym for this, though you can always invent one using the macro)]215.4 norm1 +[(processor.)]204.4 norm2 +[{/section-3.7 xa}2(STRICT)0(: Inhibiting Optimization)](3.7)183 head3 +[(When assembling with the optimizer set to level 2 or higher \(see ){/section-2.1.22 xl}(section 2.1.22){el}(\), NASM will use size)]166 norm1 +[(specifiers \()2(BYTE)0(, )2(WORD)0(, )2(DWORD)0(, )2(QWORD)0(, )2(TWORD)0(, )2(OWORD)0( or )2(YWORD)0(\), but will give them the smallest)]155 norm0 +[(possible size. The keyword )2(STRICT)0( can be used to inhibit optimization and force a particular operand to be)]144 norm0 +[(emitted in the specified size. For example, with the optimizer on, and in )2(BITS 16)0( mode,)]133 norm2 +[2( push dword 33)]116 code3 +(34)pageeven +restore showpage +%%Page: 35 35 +%%BeginPageSetup +save +%%EndPageSetup +/35 pa +[(is encoded in three bytes )2(66 6A 21)0(, whereas)]681 norm3 +[2( push strict dword 33)]664 code3 +[(is encoded in six bytes, with a full dword immediate operand )2(66 68 21 00 00 00)0(.)]647 norm3 +[(With the optimizer off, the same code \(six bytes\) is generated whether the )2(STRICT)0( keyword was used or not.)]630 norm3 +[{/section-3.8 xa}(Critical Expressions)](3.8)608.6 head3 +[(Although NASM has an optional multi-pass optimizer, there are some expressions which must be resolvable)]591.6 norm1 +[(on the first pass. These are called )1(Critical Expressions)0(.)]580.6 norm2 +[(The first pass is used to determine the size of all the assembled code and data, so that the second pass, when)]563.6 norm1 +[(generating all the code, knows all the symbol addresses the code refers to. So one thing NASM can't handle is)]552.6 norm0 +[(code whose size depends on the value of a symbol declared after the code in question. For example,)]541.6 norm2 +[2( times \(label-$\) db 0 )]524.6 code1 +[2(label: db 'Where am I?')]513.6 code2 +[(The argument to )2(TIMES)0( in this case could equally legally evaluate to anything at all; NASM will reject this)]496.6 norm1 +[(example because it cannot tell the size of the )2(TIMES)0( line when it first sees it. It will just as firmly reject the)]485.6 norm0 +[(slightly )(paradoxical code)]474.6 norm2 +[2( times \(label-$+1\) db 0 )]457.6 code1 +[2(label: db 'NOW where am I?')]446.6 code2 +[(in which )1(any)0( value for the )2(TIMES)0( argument is by definition wrong!)]429.6 norm3 +[(NASM rejects these examples by means of a concept called a )1(critical expression)0(, which is defined to be an)]412.6 norm1 +[(expression whose value is required to be computable in the first pass, and which must therefore depend only)]401.6 norm0 +[(on symbols defined before it. The argument to the )2(TIMES)0( prefix is a critical expression.)]390.6 norm2 +[{/section-3.9 xa}(Local Labels)](3.9)369.2 head3 +[(NASM gives special treatment to symbols beginning with a )(period. A label beginning with a single period is)]352.2 norm1 +[(treated as a )1(local)0( label, which means that it is associated with the previous non-local label. So, for example:)]341.2 norm2 +[2(label1 ; some code )]324.2 code1 +[2()]313.2 code0 +[2(.loop )]302.2 code0 +[2( ; some more code )]291.2 code0 +[2()]280.2 code0 +[2( jne .loop )]269.2 code0 +[2( ret )]258.2 code0 +[2()]247.2 code0 +[2(label2 ; some code )]236.2 code0 +[2()]225.2 code0 +[2(.loop )]214.2 code0 +[2( ; some more code )]203.2 code0 +[2()]192.2 code0 +[2( jne .loop )]181.2 code0 +[2( ret)]170.2 code2 +[(In the above code fragment, each )2(JNE)0( instruction jumps to the line immediately before it, because the two)]153.2 norm1 +[(definitions of )2(.loop)0( are kept separate by virtue of each being associated with the previous non-local label.)]142.2 norm2 +[(This form of local label handling is borrowed from the old Amiga assembler )(DevPac; however, NASM goes)]125.2 norm1 +[(one step further, in allowing access to local labels from other parts of the code. This is achieved by means of)]114.2 norm0 +[1(defining)0( a local label in terms of the previous non-local label: the first definition of )2(.loop)0( above is really)]103.2 norm0 +(35)pageodd +restore showpage +%%Page: 36 36 +%%BeginPageSetup +save +%%EndPageSetup +/36 pa +[(defining a symbol called )2(label1.loop)0(, and the second defines a symbol called )2(label2.loop)0(. So, if you)]681 norm0 +[(really needed to, you could write)]670 norm2 +[2(label3 ; some more code )]653 code1 +[2( ; and some more )]642 code0 +[2()]631 code0 +[2( jmp label1.loop)]620 code2 +[(Sometimes it is useful \226 in a macro, for instance \226 to be able to define a label which can be referenced from)]603 norm1 +[(anywhere but which doesn't interfere with the normal local-label mechanism. Such a label can't be non-local)]592 norm0 +[(because it would interfere with subsequent definitions of, and references to, local labels; and it can't be local)]581 norm0 +[(because the macro that defined it wouldn't know the label's full name. NASM therefore introduces a third)]570 norm0 +[(type of label, which is probably only useful in macro definitions: if a label begins with the )(special prefix )2(..@)0(,)]559 norm0 +[(then it does nothing to the local label mechanism. So you could code)]548 norm2 +[2(label1: ; a non-local label )]531 code1 +[2(.local: ; this is really label1.local )]520 code0 +[2(..@foo: ; this is a special symbol )]509 code0 +[2(label2: ; another non-local label )]498 code0 +[2(.local: ; this is really label2.local )]487 code0 +[2()]476 code0 +[2( jmp ..@foo ; this will jump three lines up)]465 code2 +[(NASM has the capacity to define other special symbols beginning with a double period: for example,)]448 norm1 +[2(..start)0( is used to specify the entry point in the )2(obj)0( output format \(see ){/section-7.4.6 xl}(section 7.4.6){el}(\).)]437 norm2 +(36)pageeven +restore showpage +%%Page: 37 37 +%%BeginPageSetup +save +%%EndPageSetup +/37 pa +[{/chapter-4 xa}(Chapter 4: The NASM )(Preprocessor)]642.8 chap3 +[(NASM contains a powerful )(macro processor, which supports conditional assembly, multi-level file inclusion,)]607.8 norm1 +[(two forms of macro \(single-line and multi-line\), and a `context stack' mechanism for extra macro power.)]596.8 norm0 +[(Preprocessor directives all begin with a )2(%)0( sign.)]585.8 norm2 +[(The preprocessor collapses all lines which end with a backslash \(\\\) character into a single line. Thus:)]568.8 norm3 +[2(%define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \\ )]551.8 code1 +[2( THIS_VALUE)]540.8 code2 +[(will work like a single-line macro without the backslash-newline sequence.)]523.8 norm3 +[{/section-4.1 xa}(Single-Line Macros)](4.1)502.4 head3 +[{/section-4.1.1 xa}(The Normal Way: )2(%define)](4.1.1)483.2 subh3 +[(Single-line macros are defined using the )2(%define)0( preprocessor directive. The definitions work in a similar)]466.2 norm1 +[(way to C; so you can do things like)]455.2 norm2 +[2(%define ctrl 0x1F & )]438.2 code1 +[2(%define param\(a,b\) \(\(a\)+\(a\)*\(b\)\) )]427.2 code0 +[2()]416.2 code0 +[2( mov byte [param\(2,ebx\)], ctrl 'D')]405.2 code2 +[(which will expand to)]388.2 norm3 +[2( mov byte [\(2\)+\(2\)*\(ebx\)], 0x1F & 'D')]371.2 code3 +[(When the expansion of a single-line macro contains tokens which invoke another macro, the expansion is)]354.2 norm1 +[(performed at invocation time, not at definition time. Thus the code)]343.2 norm2 +[2(%define a\(x\) 1+b\(x\) )]326.2 code1 +[2(%define b\(x\) 2*x )]315.2 code0 +[2()]304.2 code0 +[2( mov ax,a\(8\))]293.2 code2 +[(will evaluate in the expected way to )2(mov ax,1+2*8)0(, even though the macro )2(b)0( wasn't defined at the time of)]276.2 norm1 +[(definition of )2(a)0(.)]265.2 norm2 +[(Macros defined with )2(%define)0( are )(case sensitive: after )2(%define foo bar)0(, only )2(foo)0( will expand to )2(bar)0(:)]248.2 norm1 +[2(Foo)0( or )2(FOO)0( will not. By using )2(%idefine)0( instead of )2(%define)0( \(the `i' stands for `insensitive'\) you can)]237.2 norm0 +[(define all the case variants of a macro at once, so that )2(%idefine foo bar)0( would cause )2(foo)0(, )2(Foo)0(, )2(FOO)0(,)]226.2 norm0 +[2(fOO)0( and so on all to expand to )2(bar)0(.)]215.2 norm2 +[(There is a mechanism which detects when a macro call has occurred as a result of a previous expansion of the)]198.2 norm1 +[(same macro, to guard against )(circular references and infinite loops. If this happens, the preprocessor will only)]187.2 norm0 +[(expand the first occurrence of the macro. Hence, if you code)]176.2 norm2 +[2(%define a\(x\) 1+a\(x\) )]159.2 code1 +[2()]148.2 code0 +[2( mov ax,a\(3\))]137.2 code2 +[(the macro )2(a\(3\))0( will expand once, becoming )2(1+a\(3\))0(, and will then expand no further. This behaviour can)]120.2 norm1 +[(be useful: see ){/section-9.1 xl}(section 9.1){el}( for an example of its use.)]109.2 norm2 +(37)pageodd +restore showpage +%%Page: 38 38 +%%BeginPageSetup +save +%%EndPageSetup +/38 pa +[(You can )(overload single-line macros: if you write)]681 norm3 +[2(%define foo\(x\) 1+x )]664 code1 +[2(%define foo\(x,y\) 1+x*y)]653 code2 +[(the preprocessor will be able to handle both types of macro call, by counting the parameters you pass; so)]636 norm1 +[2(foo\(3\))0( will become )2(1+3)0( whereas )2(foo\(ebx,2\))0( will become )2(1+ebx*2)0(. However, if you define)]625 norm2 +[2(%define foo bar)]608 code3 +[(then no other definition of )2(foo)0( will be accepted: a macro with no parameters prohibits the definition of the)]591 norm1 +[(same name as a macro )1(with)0( parameters, and vice versa.)]580 norm2 +[(This doesn't prevent single-line macros being )1(redefined)0(: you can perfectly well define a macro with)]563 norm3 +[2(%define foo bar)]546 code3 +[(and then re-define it later in the same source file with)]529 norm3 +[2(%define foo baz)]512 code3 +[(Then everywhere the macro )2(foo)0( is invoked, it will be expanded according to the most recent definition. This)]495 norm1 +[(is particularly useful when defining single-line macros with )2(%assign)0( \(see ){/section-4.1.7 xl}(section 4.1.7){el}(\).)]484 norm2 +[(You can )(pre-define single-line macros using the `-d' option on the NASM command line: see ){/section-2.1.18 xl}(section 2.1.18){el}(.)]467 norm3 +[{/section-4.1.2 xa}(Resolving )2(%define)0(: )2(%xdefine)](4.1.2)447.8 subh3 +[(To have a reference to an embedded single-line macro resolved at the time that the embedding macro is)]430.8 norm1 +[1(defined)0(, as opposed to when the embedding macro is )1(expanded)0(, you need a different mechanism to the one)]419.8 norm0 +[(offered by )2(%define)0(. The solution is to use )2(%xdefine)0(, or it's )(case-insensitive counterpart )2(%ixdefine)0(.)]408.8 norm2 +[(Suppose you have the following code:)]391.8 norm3 +[2(%define isTrue 1 )]374.8 code1 +[2(%define isFalse isTrue )]363.8 code0 +[2(%define isTrue 0 )]352.8 code0 +[2()]341.8 code0 +[2(val1: db isFalse )]330.8 code0 +[2()]319.8 code0 +[2(%define isTrue 1 )]308.8 code0 +[2()]297.8 code0 +[2(val2: db isFalse)]286.8 code2 +[(In this case, )2(val1)0( is equal to 0, and )2(val2)0( is equal to 1. This is because, when a single-line macro is defined)]269.8 norm1 +[(using )2(%define)0(, it is expanded only when it is called. As )2(isFalse)0( expands to )2(isTrue)0(, the expansion will)]258.8 norm0 +[(be the current value of )2(isTrue)0(. The first time it is called that is 0, and the second time it is 1.)]247.8 norm2 +[(If you wanted )2(isFalse)0( to expand to the value assigned to the embedded macro )2(isTrue)0( at the time that)]230.8 norm1 +[2(isFalse)0( was defined, you need to change the above code to use )2(%xdefine)0(.)]219.8 norm2 +[2(%xdefine isTrue 1 )]202.8 code1 +[2(%xdefine isFalse isTrue )]191.8 code0 +[2(%xdefine isTrue 0 )]180.8 code0 +[2()]169.8 code0 +[2(val1: db isFalse )]158.8 code0 +[2()]147.8 code0 +[2(%xdefine isTrue 1 )]136.8 code0 +[2()]125.8 code0 +[2(val2: db isFalse)]114.8 code2 +(38)pageeven +restore showpage +%%Page: 39 39 +%%BeginPageSetup +save +%%EndPageSetup +/39 pa +[(Now, each time that )2(isFalse)0( is called, it expands to 1, as that is what the embedded macro )2(isTrue)]681 norm1 +[(expanded to at the time that )2(isFalse)0( was defined.)]670 norm2 +[{/section-4.1.3 xa}(Macro Indirection: )2(%[...])](4.1.3)650.8 subh3 +[(The )2(%[...])0( construct can be used to expand macros in contexts where macro expansion would otherwise)]633.8 norm1 +[(not occur, including in the names other macros. For example, if you have a set of macros named )2(Foo16)0(,)]622.8 norm0 +[2(Foo32)0( and )2(Foo64)0(, you could write:)]611.8 norm2 +[2( mov ax,Foo%[__BITS__] ; The Foo value)]594.8 code3 +[(to use the builtin macro )2(__BITS__)0( \(see ){/section-4.11.5 xl}(section 4.11.5){el}(\) to automatically select between them. Similarly, the)]577.8 norm1 +[(two statements:)]566.8 norm2 +[2(%xdefine Bar Quux ; Expands due to %xdefine )]549.8 code1 +[2(%define Bar %[Quux] ; Expands due to %[...])]538.8 code2 +[(have, in fact, exactly the same effect.)]521.8 norm3 +[2(%[...])0( concatenates to adjacent tokens in the same way that multi-line macro parameters do, see ){/section-4.3.8 xl}(section){el}]504.8 norm1 +[{/section-4.3.8 xl}(4.3.8){el}( for details.)]493.8 norm2 +[{/section-4.1.4 xa}(Concatenating Single Line Macro Tokens: )2(%+)](4.1.4)474.6 subh3 +[(Individual tokens in single line macros can be concatenated, to produce longer tokens for later processing.)]457.6 norm1 +[(This can be useful if there are several similar macros that perform similar functions.)]446.6 norm2 +[(Please note that a space is required after )2(%+)0(, in order to disambiguate it from the syntax )2(%+1)0( used in multiline)]429.6 norm1 +[(macros.)]418.6 norm2 +[(As an example, consider the following:)]401.6 norm3 +[2(%define BDASTART 400h ; Start of BIOS data area)]384.6 code3 +[2(struc tBIOSDA ; its structure )]367.6 code1 +[2( .COM1addr RESW 1 )]356.6 code0 +[2( .COM2addr RESW 1 )]345.6 code0 +[2( ; ..and so on )]334.6 code0 +[2(endstruc)]323.6 code2 +[(Now, if we need to access the elements of tBIOSDA in different places, we can end up with:)]306.6 norm3 +[2( mov ax,BDASTART + tBIOSDA.COM1addr )]289.6 code1 +[2( mov bx,BDASTART + tBIOSDA.COM2addr)]278.6 code2 +[(This will become pretty ugly \(and tedious\) if used in many places, and can be reduced in size significantly by)]261.6 norm1 +[(using the following macro:)]250.6 norm2 +[2(; Macro to access BIOS variables by their names \(from tBDA\):)]233.6 code3 +[2(%define BDA\(x\) BDASTART + tBIOSDA. %+ x)]216.6 code3 +[(Now the above code can be written as:)]199.6 norm3 +[2( mov ax,BDA\(COM1addr\) )]182.6 code1 +[2( mov bx,BDA\(COM2addr\))]171.6 code2 +[(Using this feature, we can simplify references to a lot of macros \(and, in turn, reduce typing errors\).)]154.6 norm3 +[{/section-4.1.5 xa}(The Macro Name Itself: )2(%?)0( and )2(%??)](4.1.5)135.4 subh3 +[(The special symbols )2(%?)0( and )2(%??)0( can be used to reference the macro name itself inside a macro expansion,)]118.4 norm1 +[(this is supported for both single-and multi-line macros. )2(%?)0( refers to the macro name as )1(invoked)0(, whereas)]107.4 norm0 +(39)pageodd +restore showpage +%%Page: 40 40 +%%BeginPageSetup +save +%%EndPageSetup +/40 pa +[2(%??)0( refers to the macro name as )1(declared)0(. The two are always the same for case-sensitive macros, but for)]681 norm0 +[(case-insensitive macros, they can differ.)]670 norm2 +[(For example:)]653 norm3 +[2(%idefine Foo mov %?,%?? )]636 code1 +[2()]625 code0 +[2( foo )]614 code0 +[2( FOO)]603 code2 +[(will expand to:)]586 norm3 +[2( mov foo,Foo )]569 code1 +[2( mov FOO,Foo)]558 code2 +[(The sequence:)]541 norm3 +[2(%idefine keyword $%?)]524 code3 +[(can be used to make a keyword "disappear", for example in case a new instruction has been used as a label in)]507 norm1 +[(older code. For example:)]496 norm2 +[2(%idefine pause $%? ; Hide the PAUSE instruction)]479 code3 +[{/section-4.1.6 xa}(Undefining Single-Line Macros: )2(%undef)](4.1.6)459.8 subh3 +[(Single-line macros can be removed with the )2(%undef)0( directive. For example, the following sequence:)]442.8 norm3 +[2(%define foo bar )]425.8 code1 +[2(%undef foo )]414.8 code0 +[2()]403.8 code0 +[2( mov eax, foo)]392.8 code2 +[(will expand to the instruction )2(mov eax, foo)0(, since after )2(%undef)0( the macro )2(foo)0( is no longer defined.)]375.8 norm3 +[(Macros that would otherwise be pre-defined can be undefined on the command-line using the `-u' option on)]358.8 norm1 +[(the NASM command line: see ){/section-2.1.19 xl}(section 2.1.19){el}(.)]347.8 norm2 +[{/section-4.1.7 xa}(Preprocessor Variables: )2(%assign)](4.1.7)328.6 subh3 +[(An alternative way to define single-line macros is by means of the )2(%assign)0( command \(and its)]311.6 norm1 +[(case-insensitive counterpart )2(%iassign)0(, which differs from )2(%assign)0( in exactly the same way that)]300.6 norm0 +[2(%idefine)0( differs from )2(%define)0(\).)]289.6 norm2 +[2(%assign)0( is used to define single-line macros which take no parameters and have a numeric value. This)]272.6 norm1 +[(value can be specified in the form of an expression, and it will be evaluated once, when the )2(%assign)]261.6 norm0 +[(directive is processed.)]250.6 norm2 +[(Like )2(%define)0(, macros defined using )2(%assign)0( can be re-defined later, so you can do things like)]233.6 norm3 +[2(%assign i i+1)]216.6 code3 +[(to increment the numeric value of a macro.)]199.6 norm3 +[2(%assign)0( is useful for controlling the termination of )2(%rep)0( preprocessor loops: see ){/section-4.5 xl}(section 4.5){el}( for an)]182.6 norm1 +[(example of this. Another use for )2(%assign)0( is given in ){/section-8.4 xl}(section 8.4){el}( and ){/section-9.1 xl}(section 9.1){el}(.)]171.6 norm2 +[(The expression passed to )2(%assign)0( is a )(critical expression \(see ){/section-3.8 xl}(section 3.8){el}(\), and must also evaluate to a pure)]154.6 norm1 +[(number \(rather than a relocatable reference such as a code or data address, or anything involving a register\).)]143.6 norm2 +(40)pageeven +restore showpage +%%Page: 41 41 +%%BeginPageSetup +save +%%EndPageSetup +/41 pa +[{/section-4.1.8 xa}(Defining Strings: )2(%defstr)](4.1.8)678.8 subh3 +[2(%defstr)0(, and its case-insensitive counterpart )2(%idefstr)0(, define or redefine a single-line macro without)]661.8 norm1 +[(parameters but converts the entire right-hand side, after macro expansion, to a quoted string before definition.)]650.8 norm2 +[(For example:)]633.8 norm3 +[2(%defstr test TEST)]616.8 code3 +[(is equivalent to)]599.8 norm3 +[2(%define test 'TEST')]582.8 code3 +[(This can be used, for example, with the )2(%!)0( construct \(see ){/section-4.10.2 xl}(section 4.10.2){el}(\):)]565.8 norm3 +[2(%defstr PATH %!PATH ; The operating system PATH variable)]548.8 code3 +[{/section-4.1.9 xa}(Defining Tokens: )2(%deftok)](4.1.9)529.6 subh3 +[2(%deftok)0(, and its case-insensitive counterpart )2(%ideftok)0(, define or redefine a single-line macro without)]512.6 norm1 +[(parameters but converts the second parameter, after string conversion, to a sequence of tokens.)]501.6 norm2 +[(For example:)]484.6 norm3 +[2(%deftok test 'TEST')]467.6 code3 +[(is equivalent to)]450.6 norm3 +[2(%define test TEST)]433.6 code3 +[{/section-4.2 xa}(String Manipulation in Macros)](4.2)412.2 head3 +[(It's often useful to be able to handle strings in macros. NASM supports a few simple string handling macro)]395.2 norm1 +[(operators from which more complex operations can be constructed.)]384.2 norm2 +[(All the string operators define or redefine a value \(either a string or a numeric value\) to a single-line macro.)]367.2 norm1 +[(When producing a string value, it may change the style of quoting of the input string or strings, and possibly)]356.2 norm0 +[(use )2(\\)0(\226escapes inside )2(`)0(\226quoted strings.)]345.2 norm2 +[{/section-4.2.1 xa}(Concatenating Strings: )2(%strcat)](4.2.1)326 subh3 +[(The )2(%strcat)0( operator concatenates quoted strings and assign them to a single-line macro.)]309 norm3 +[(For example:)]292 norm3 +[2(%strcat alpha "Alpha: ", '12" screen')]275 code3 +[(... would assign the value )2('Alpha: 12" screen')0( to )2(alpha)0(. Similarly:)]258 norm3 +[2(%strcat beta '"foo"\\', "'bar'")]241 code3 +[(... would assign the value )2(`"foo"\\\\'bar'`)0( to )2(beta)0(.)]224 norm3 +[(The use of commas to separate strings is permitted but optional.)]207 norm3 +[{/section-4.2.2 xa}(String Length: )2(%strlen)](4.2.2)187.8 subh3 +[(The )2(%strlen)0( operator assigns the length of a string to a macro. For example:)]170.8 norm3 +[2(%strlen charcnt 'my string')]153.8 code3 +[(In this example, )2(charcnt)0( would receive the value 9, just as if an )2(%assign)0( had been used. In this example,)]136.8 norm1 +[2('my string')0( was a literal string but it could also have been a single-line macro that expands to a string, as)]125.8 norm0 +[(in the following example:)]114.8 norm2 +(41)pageodd +restore showpage +%%Page: 42 42 +%%BeginPageSetup +save +%%EndPageSetup +/42 pa +[2(%define sometext 'my string' )]681 code1 +[2(%strlen charcnt sometext)]670 code2 +[(As in the first case, this would result in )2(charcnt)0( being assigned the value of 9.)]653 norm3 +[{/section-4.2.3 xa}(Extracting Substrings: )2(%substr)](4.2.3)633.8 subh3 +[(Individual letters or substrings in strings can be extracted using the )2(%substr)0( operator. An example of its use)]616.8 norm1 +[(is probably more useful than the description:)]605.8 norm2 +[2(%substr mychar 'xyzw' 1 ; equivalent to %define mychar 'x' )]588.8 code1 +[2(%substr mychar 'xyzw' 2 ; equivalent to %define mychar 'y' )]577.8 code0 +[2(%substr mychar 'xyzw' 3 ; equivalent to %define mychar 'z' )]566.8 code0 +[2(%substr mychar 'xyzw' 2,2 ; equivalent to %define mychar 'yz' )]555.8 code0 +[2(%substr mychar 'xyzw' 2,-1 ; equivalent to %define mychar 'yzw' )]544.8 code0 +[2(%substr mychar 'xyzw' 2,-2 ; equivalent to %define mychar 'yz')]533.8 code2 +[(As with )2(%strlen)0( \(see ){/section-4.2.2 xl}(section 4.2.2){el}(\), the first parameter is the single-line macro to be created and the)]516.8 norm1 +[(second is the string. The third parameter specifies the first character to be selected, and the optional fourth)]505.8 norm0 +[(parameter preceeded by comma\) is the length. Note that the first index is 1, not 0 and the last index is equal to)]494.8 norm0 +[(the value that )2(%strlen)0( would assign given the same string. Index values out of range result in an empty)]483.8 norm0 +[(string. A negative length means "until N-1 characters before the end of string", i.e. )2(-1)0( means until end of)]472.8 norm0 +[(string, )2(-2)0( until one character before, etc.)]461.8 norm2 +[{/section-4.3 xa}(Multi-Line Macros: )2(%macro)](4.3)440.4 head3 +[(Multi-line macros are much more like the type of macro seen in MASM and TASM: a multi-line macro)]423.4 norm1 +[(definition in NASM looks something like this.)]412.4 norm2 +[2(%macro prologue 1 )]395.4 code1 +[2()]384.4 code0 +[2( push ebp )]373.4 code0 +[2( mov ebp,esp )]362.4 code0 +[2( sub esp,%1 )]351.4 code0 +[2()]340.4 code0 +[2(%endmacro)]329.4 code2 +[(This defines a C-like function prologue as a macro: so you would invoke the macro with a call such as)]312.4 norm3 +[2(myfunc: prologue 12)]295.4 code3 +[(which would expand to the three lines of code)]278.4 norm3 +[2(myfunc: push ebp )]261.4 code1 +[2( mov ebp,esp )]250.4 code0 +[2( sub esp,12)]239.4 code2 +[(The number )2(1)0( after the macro name in the )2(%macro)0( line defines the number of parameters the macro)]222.4 norm1 +[2(prologue)0( expects to receive. The use of )2(%1)0( inside the macro definition refers to the first parameter to the)]211.4 norm0 +[(macro call. With a macro taking more than one parameter, subsequent parameters would be referred to as )2(%2)0(,)]200.4 norm0 +[2(%3)0( and so on.)]189.4 norm2 +[(Multi-line macros, like single-line macros, are )(case-sensitive, unless you define them using the alternative)]172.4 norm1 +[(directive )2(%imacro)0(.)]161.4 norm2 +[(If you need to pass a comma as )1(part)0( of a parameter to a multi-line macro, you can do that by enclosing the)]144.4 norm1 +[(entire parameter in )(braces. So you could code things like)]133.4 norm2 +[2(%macro silly 2 )]116.4 code1 +[2()]105.4 code0 +(42)pageeven +restore showpage +%%Page: 43 43 +%%BeginPageSetup +save +%%EndPageSetup +/43 pa +[2( %2: db %1 )]681 code0 +[2()]670 code0 +[2(%endmacro )]659 code0 +[2()]648 code0 +[2( silly 'a', letter_a ; letter_a: db 'a' )]637 code0 +[2( silly 'ab', string_ab ; string_ab: db 'ab' )]626 code0 +[2( silly {13,10}, crlf ; crlf: db 13,10)]615 code2 +[{/section-4.3.1 xa}(Recursive Multi-Line Macros: )2(%rmacro)](4.3.1)595.8 subh3 +[(A multi-line macro cannot be referenced within itself, in order to prevent accidental infinite recursion.)]578.8 norm3 +[(Recursive multi-line macros allow for self-referencing, with the caveat that the user is aware of the)]561.8 norm1 +[(existence, use and purpose of recursive multi-line macros. There is also a generous, but sane, upper limit to)]550.8 norm0 +[(the number of recursions, in order to prevent run-away memory consumption in case of accidental infinite)]539.8 norm0 +[(recursion.)]528.8 norm2 +[(As with non-recursive multi-line macros, recursive multi-line macros are )(case-sensitive, unless you define)]511.8 norm1 +[(them using the alternative directive )2(%irmacro)0(.)]500.8 norm2 +[{/section-4.3.2 xa}(Overloading Multi-Line Macros)](4.3.2)481.6 subh3 +[(As with single-line macros, multi-line macros can be overloaded by defining the same macro name several)]464.6 norm1 +[(times with different numbers of parameters. This time, no exception is made for macros with no parameters at)]453.6 norm0 +[(all. So you could define)]442.6 norm2 +[2(%macro prologue 0 )]425.6 code1 +[2()]414.6 code0 +[2( push ebp )]403.6 code0 +[2( mov ebp,esp )]392.6 code0 +[2()]381.6 code0 +[2(%endmacro)]370.6 code2 +[(to define an alternative form of the function prologue which allocates no local stack space.)]353.6 norm3 +[(Sometimes, however, you might want to `overload' a machine instruction; for example, you might want to)]336.6 norm1 +[(define)]325.6 norm2 +[2(%macro push 2 )]308.6 code1 +[2()]297.6 code0 +[2( push %1 )]286.6 code0 +[2( push %2 )]275.6 code0 +[2()]264.6 code0 +[2(%endmacro)]253.6 code2 +[(so that you could code)]236.6 norm3 +[2( push ebx ; this line is not a macro call )]219.6 code1 +[2( push eax,ecx ; but this one is)]208.6 code2 +[(Ordinarily, NASM will give a warning for the first of the above two lines, since )2(push)0( is now defined to be a)]191.6 norm1 +[(macro, and is being invoked with a number of parameters for which no definition has been given. The correct)]180.6 norm0 +[(code will still be generated, but the assembler will give a warning. This warning can be disabled by the use of)]169.6 norm0 +[(the )2(-w-macro-params)0( command-line option \(see ){/section-2.1.24 xl}(section 2.1.24){el}(\).)]158.6 norm2 +[{/section-4.3.3 xa}(Macro-Local Labels)](4.3.3)139.4 subh3 +[(NASM allows you to define labels within a multi-line macro definition in such a way as to make them local)]122.4 norm1 +[(to the macro call: so calling the same macro multiple times will use a different label each time. You do this by)]111.4 norm0 +(43)pageodd +restore showpage +%%Page: 44 44 +%%BeginPageSetup +save +%%EndPageSetup +/44 pa +[(prefixing )2(%%)0( to the label name. So you can invent an instruction which executes a )2(RET)0( if the )2(Z)0( flag is set by)]681 norm0 +[(doing this:)]670 norm2 +[2(%macro retz 0 )]653 code1 +[2()]642 code0 +[2( jnz %%skip )]631 code0 +[2( ret )]620 code0 +[2( %%skip: )]609 code0 +[2()]598 code0 +[2(%endmacro)]587 code2 +[(You can call this macro as many times as you want, and every time you call it NASM will make up a different)]570 norm1 +[(`real' name to substitute for the label )2(%%skip)0(. The names NASM invents are of the form )2(..@2345.skip)0(,)]559 norm0 +[(where the number 2345 changes with every macro call. The )2(..@)0( prefix prevents macro-local labels from)]548 norm0 +[(interfering with the local label mechanism, as described in ){/section-3.9 xl}(section 3.9){el}(. You should avoid defining your own)]537 norm0 +[(labels in this form \(the )2(..@)0( prefix, then a number, then another period\) in case they interfere with)]526 norm0 +[(macro-local labels.)]515 norm2 +[{/section-4.3.4 xa}(Greedy Macro Parameters)](4.3.4)495.8 subh3 +[(Occasionally it is useful to define a macro which lumps its entire command line into one parameter definition,)]478.8 norm1 +[(possibly after extracting one or two smaller parameters from the front. An example might be a macro to write)]467.8 norm0 +[(a text string to a file in MS-DOS, where you might want to be able to write)]456.8 norm2 +[2( writefile [filehandle],"hello, world",13,10)]439.8 code3 +[(NASM allows you to define the last parameter of a macro to be )1(greedy)0(, meaning that if you invoke the macro)]422.8 norm1 +[(with more parameters than it expects, all the spare parameters get lumped into the last defined one along with)]411.8 norm0 +[(the separating commas. So if you code:)]400.8 norm2 +[2(%macro writefile 2+ )]383.8 code1 +[2()]372.8 code0 +[2( jmp %%endstr )]361.8 code0 +[2( %%str: db %2 )]350.8 code0 +[2( %%endstr: )]339.8 code0 +[2( mov dx,%%str )]328.8 code0 +[2( mov cx,%%endstr-%%str )]317.8 code0 +[2( mov bx,%1 )]306.8 code0 +[2( mov ah,0x40 )]295.8 code0 +[2( int 0x21 )]284.8 code0 +[2()]273.8 code0 +[2(%endmacro)]262.8 code2 +[(then the example call to )2(writefile)0( above will work as expected: the text before the first comma,)]245.8 norm1 +[2([filehandle])0(, is used as the first macro parameter and expanded when )2(%1)0( is referred to, and all the)]234.8 norm0 +[(subsequent text is lumped into )2(%2)0( and placed after the )2(db)0(.)]223.8 norm2 +[(The greedy nature of the macro is indicated to NASM by the use of the )2(+)0( sign after the parameter count on the)]206.8 norm1 +[2(%macro)0( line.)]195.8 norm2 +[(If you define a greedy macro, you are effectively telling NASM how it should expand the macro given )1(any)]178.8 norm1 +[(number of parameters from the actual number specified up to infinity; in this case, for example, NASM now)]167.8 norm0 +[(knows what to do when it sees a call to )2(writefile)0( with 2, 3, 4 or more parameters. NASM will take this)]156.8 norm0 +[(into account when overloading macros, and will not allow you to define another form of )2(writefile)0( taking)]145.8 norm0 +[(4 parameters \(for example\).)]134.8 norm2 +[(Of course, the above macro could have been implemented as a non-greedy macro, in which case the call to it)]117.8 norm1 +[(would have had to look like)]106.8 norm2 +(44)pageeven +restore showpage +%%Page: 45 45 +%%BeginPageSetup +save +%%EndPageSetup +/45 pa +[2( writefile [filehandle], {"hello, world",13,10})]681 code3 +[(NASM provides both mechanisms for putting )(commas in macro parameters, and you choose which one you)]664 norm1 +[(prefer for each macro definition.)]653 norm2 +[(See ){/section-6.3.1 xl}(section 6.3.1){el}( for a better way to write the above macro.)]636 norm3 +[{/section-4.3.5 xa}(Default Macro Parameters)](4.3.5)616.8 subh3 +[(NASM also allows you to define a multi-line macro with a )1(range)0( of allowable parameter counts. If you do)]599.8 norm1 +[(this, you can specify defaults for )(omitted parameters. So, for example:)]588.8 norm2 +[2(%macro die 0-1 "Painful program death has occurred." )]571.8 code1 +[2()]560.8 code0 +[2( writefile 2,%1 )]549.8 code0 +[2( mov ax,0x4c01 )]538.8 code0 +[2( int 0x21 )]527.8 code0 +[2()]516.8 code0 +[2(%endmacro)]505.8 code2 +[(This macro \(which makes use of the )2(writefile)0( macro defined in ){/section-4.3.4 xl}(section 4.3.4){el}(\) can be called with an)]488.8 norm1 +[(explicit error message, which it will display on the error output stream before exiting, or it can be called with)]477.8 norm0 +[(no parameters, in which case it will use the default error message supplied in the macro definition.)]466.8 norm2 +[(In general, you supply a minimum and maximum number of parameters for a macro of this type; the)]449.8 norm1 +[(minimum number of parameters are then required in the macro call, and then you provide defaults for the)]438.8 norm0 +[(optional ones. So if a macro definition began with the line)]427.8 norm2 +[2(%macro foobar 1-3 eax,[ebx+2])]410.8 code3 +[(then it could be called with between one and three parameters, and )2(%1)0( would always be taken from the macro)]393.8 norm1 +[(call. )2(%2)0(, if not specified by the macro call, would default to )2(eax)0(, and )2(%3)0( if not specified would default to)]382.8 norm0 +[2([ebx+2])0(.)]371.8 norm2 +[(You can provide extra information to a macro by providing too many default parameters:)]354.8 norm3 +[2(%macro quux 1 something)]337.8 code3 +[(This will trigger a warning by default; see ){/section-2.1.24 xl}(section 2.1.24){el}( for more information. When )2(quux)0( is invoked, it)]320.8 norm1 +[(receives not one but two parameters. )2(something)0( can be referred to as )2(%2)0(. The difference between passing)]309.8 norm0 +[2(something)0( this way and writing )2(something)0( in the macro body is that with this way )2(something)0( is)]298.8 norm0 +[(evaluated when the macro is defined, not when it is expanded.)]287.8 norm2 +[(You may omit parameter defaults from the macro definition, in which case the parameter default is taken to be)]270.8 norm1 +[(blank. This can be useful for macros which can take a variable number of parameters, since the )2(%0)0( token \(see)]259.8 norm0 +[{/section-4.3.6 xl}(section 4.3.6){el}(\) allows you to determine how many parameters were really passed to the macro call.)]248.8 norm2 +[(This defaulting mechanism can be combined with the greedy-parameter mechanism; so the )2(die)0( macro above)]231.8 norm1 +[(could be made more powerful, and more useful, by changing the first line of the definition to)]220.8 norm2 +[2(%macro die 0-1+ "Painful program death has occurred.",13,10)]203.8 code3 +[(The maximum parameter count can be infinite, denoted by )2(*)0(. In this case, of course, it is impossible to)]186.8 norm1 +[(provide a )1(full)0( set of default parameters. Examples of this usage are shown in ){/section-4.3.7 xl}(section 4.3.7){el}(.)]175.8 norm2 +[{/section-4.3.6 xa}2(%0)0(: )(Macro Parameter Counter)](4.3.6)156.6 subh3 +[(The parameter reference )2(%0)0( will return a numeric constant giving the number of parameters received, that is,)]139.6 norm1 +[(if )2(%0)0( is n then )2(%)0(n is the last parameter. )2(%0)0( is mostly useful for macros that can take a variable number of)]128.6 norm0 +[(parameters. It can be used as an argument to )2(%rep)0( \(see ){/section-4.5 xl}(section 4.5){el}(\) in order to iterate through all the)]117.6 norm0 +[(parameters of a macro. Examples are given in ){/section-4.3.7 xl}(section 4.3.7){el}(.)]106.6 norm2 +(45)pageodd +restore showpage +%%Page: 46 46 +%%BeginPageSetup +save +%%EndPageSetup +/46 pa +[{/section-4.3.7 xa}2(%rotate)0(: )(Rotating Macro Parameters)](4.3.7)678.8 subh3 +[(Unix shell programmers will be familiar with the )2(shift)0( shell command, which allows the arguments passed)]661.8 norm1 +[(to a shell script \(referenced as )2($1)0(, )2($2)0( and so on\) to be moved left by one place, so that the argument)]650.8 norm0 +[(previously referenced as )2($2)0( becomes available as )2($1)0(, and the argument previously referenced as )2($1)0( is no)]639.8 norm0 +[(longer available at all.)]628.8 norm2 +[(NASM provides a similar mechanism, in the form of )2(%rotate)0(. As its name suggests, it differs from the)]611.8 norm1 +[(Unix )2(shift)0( in that no parameters are lost: parameters rotated off the left end of the argument list reappear on)]600.8 norm0 +[(the right, and vice versa.)]589.8 norm2 +[2(%rotate)0( is invoked with a single numeric argument \(which may be an expression\). The macro parameters)]572.8 norm1 +[(are rotated to the left by that many places. If the argument to )2(%rotate)0( is negative, the macro parameters are)]561.8 norm0 +[(rotated to the right.)]550.8 norm2 +[(So a pair of macros to save and restore a set of registers might work as follows:)]533.8 norm3 +[2(%macro multipush 1-* )]516.8 code1 +[2()]505.8 code0 +[2( %rep %0 )]494.8 code0 +[2( push %1 )]483.8 code0 +[2( %rotate 1 )]472.8 code0 +[2( %endrep )]461.8 code0 +[2()]450.8 code0 +[2(%endmacro)]439.8 code2 +[(This macro invokes the )2(PUSH)0( instruction on each of its arguments in turn, from left to right. It begins by)]422.8 norm1 +[(pushing its first argument, )2(%1)0(, then invokes )2(%rotate)0( to move all the arguments one place to the left, so that)]411.8 norm0 +[(the original second argument is now available as )2(%1)0(. Repeating this procedure as many times as there were)]400.8 norm0 +[(arguments \(achieved by supplying )2(%0)0( as the argument to )2(%rep)0(\) causes each argument in turn to be pushed.)]389.8 norm2 +[(Note also the use of )2(*)0( as the maximum parameter count, indicating that there is no upper limit on the number)]372.8 norm1 +[(of parameters you may supply to the )2(multipush)0( macro.)]361.8 norm2 +[(It would be convenient, when using this macro, to have a )2(POP)0( equivalent, which )1(didn't)0( require the arguments)]344.8 norm1 +[(to be given in reverse order. Ideally, you would write the )2(multipush)0( macro call, then cut-and-paste the)]333.8 norm0 +[(line to where the pop needed to be done, and change the name of the called macro to )2(multipop)0(, and the)]322.8 norm0 +[(macro would take care of popping the registers in the opposite order from the one in which they were pushed.)]311.8 norm2 +[(This can be done by the following definition:)]294.8 norm3 +[2(%macro multipop 1-* )]277.8 code1 +[2()]266.8 code0 +[2( %rep %0 )]255.8 code0 +[2( %rotate -1 )]244.8 code0 +[2( pop %1 )]233.8 code0 +[2( %endrep )]222.8 code0 +[2()]211.8 code0 +[2(%endmacro)]200.8 code2 +[(This macro begins by rotating its arguments one place to the )1(right)0(, so that the original )1(last)0( argument appears)]183.8 norm1 +[(as )2(%1)0(. This is then popped, and the arguments are rotated right again, so the second-to-last argument)]172.8 norm0 +[(becomes )2(%1)0(. Thus the arguments are iterated through in reverse order.)]161.8 norm2 +[{/section-4.3.8 xa}(Concatenating Macro Parameters)](4.3.8)142.6 subh3 +[(NASM can concatenate macro parameters and macro indirection constructs on to other text surrounding them.)]125.6 norm1 +[(This allows you to declare a family of symbols, for example, in a macro definition. If, for example, you)]114.6 norm0 +[(wanted to generate a table of key codes along with offsets into the table, you could code something like)]103.6 norm2 +(46)pageeven +restore showpage +%%Page: 47 47 +%%BeginPageSetup +save +%%EndPageSetup +/47 pa +[2(%macro keytab_entry 2 )]681 code1 +[2()]670 code0 +[2( keypos%1 equ $-keytab )]659 code0 +[2( db %2 )]648 code0 +[2()]637 code0 +[2(%endmacro )]626 code0 +[2()]615 code0 +[2(keytab: )]604 code0 +[2( keytab_entry F1,128+1 )]593 code0 +[2( keytab_entry F2,128+2 )]582 code0 +[2( keytab_entry Return,13)]571 code2 +[(which would expand to)]554 norm3 +[2(keytab: )]537 code1 +[2(keyposF1 equ $-keytab )]526 code0 +[2( db 128+1 )]515 code0 +[2(keyposF2 equ $-keytab )]504 code0 +[2( db 128+2 )]493 code0 +[2(keyposReturn equ $-keytab )]482 code0 +[2( db 13)]471 code2 +[(You can just as easily concatenate text on to the other end of a macro parameter, by writing )2(%1foo)0(.)]454 norm3 +[(If you need to append a )1(digit)0( to a macro parameter, for example defining labels )2(foo1)0( and )2(foo2)0( when passed)]437 norm1 +[(the parameter )2(foo)0(, you can't code )2(%11)0( because that would be taken as the eleventh macro parameter.)]426 norm0 +[(Instead, you must code )2(%{1}1)0(, which will separate the first )2(1)0( \(giving the number of the macro parameter\))]415 norm0 +[(from the second \(literal text to be concatenated to the parameter\).)]404 norm2 +[(This concatenation can also be applied to other preprocessor in-line objects, such as macro-local labels)]387 norm1 +[(\(){/section-4.3.3 xl}(section 4.3.3){el}(\) and context-local labels \(){/section-4.7.2 xl}(section 4.7.2){el}(\). In all cases, ambiguities in syntax can be resolved by)]376 norm0 +[(enclosing everything after the )2(%)0( sign and before the literal text in braces: so )2(%{%foo}bar)0( concatenates the)]365 norm0 +[(text )2(bar)0( to the end of the real name of the macro-local label )2(%%foo)0(. \(This is unnecessary, since the form)]354 norm0 +[(NASM uses for the real names of macro-local labels means that the two usages )2(%{%foo}bar)0( and)]343 norm0 +[2(%%foobar)0( would both expand to the same thing anyway; nevertheless, the capability is there.\))]332 norm2 +[(The single-line macro indirection construct, )2(%[...])0( \(){/section-4.1.3 xl}(section 4.1.3){el}(\), behaves the same way as macro)]315 norm1 +[(parameters for the purpose of concatenation.)]304 norm2 +[(See also the )2(%+)0( operator, ){/section-4.1.4 xl}(section 4.1.4){el}(.)]287 norm3 +[{/section-4.3.9 xa}(Condition Codes as Macro Parameters)](4.3.9)267.8 subh3 +[(NASM can give special treatment to a macro parameter which contains a condition code. For a start, you can)]250.8 norm1 +[(refer to the macro parameter )2(%1)0( by means of the alternative syntax )2(%+1)0(, which informs NASM that this)]239.8 norm0 +[(macro parameter is supposed to contain a condition code, and will cause the preprocessor to report an error)]228.8 norm0 +[(message if the macro is called with a parameter which is )1(not)0( a valid condition code.)]217.8 norm2 +[(Far more usefully, though, you can refer to the macro parameter by means of )2(%-1)0(, which NASM will expand)]200.8 norm1 +[(as the )1(inverse)0( condition code. So the )2(retz)0( macro defined in ){/section-4.3.3 xl}(section 4.3.3){el}( can be replaced by a general)]189.8 norm0 +[(conditional-return macro like this:)]178.8 norm2 +[2(%macro retc 1 )]161.8 code1 +[2()]150.8 code0 +[2( j%-1 %%skip )]139.8 code0 +[2( ret )]128.8 code0 +[2( %%skip: )]117.8 code0 +(47)pageodd +restore showpage +%%Page: 48 48 +%%BeginPageSetup +save +%%EndPageSetup +/48 pa +[2()]681 code0 +[2(%endmacro)]670 code2 +[(This macro can now be invoked using calls like )2(retc ne)0(, which will cause the conditional-jump instruction)]653 norm1 +[(in the macro expansion to come out as )2(JE)0(, or )2(retc po)0( which will make the jump a )2(JPE)0(.)]642 norm2 +[(The )2(%+1)0( macro-parameter reference is quite happy to interpret the arguments )2(CXZ)0( and )2(ECXZ)0( as valid)]625 norm1 +[(condition codes; however, )2(%-1)0( will report an error if passed either of these, because no inverse condition)]614 norm0 +[(code exists.)]603 norm2 +[{/section-4.3.10 xa}(Disabling Listing Expansion)](4.3.10)583.8 subh3 +[(When NASM is generating a listing file from your program, it will generally expand multi-line macros by)]566.8 norm1 +[(means of writing the macro call and then listing each line of the expansion. This allows you to see which)]555.8 norm0 +[(instructions in the macro expansion are generating what code; however, for some macros this clutters the)]544.8 norm0 +[(listing up unnecessarily.)]533.8 norm2 +[(NASM therefore provides the )2(.nolist)0( qualifier, which you can include in a macro definition to inhibit the)]516.8 norm1 +[(expansion of the macro in the listing file. The )2(.nolist)0( qualifier comes directly after the number of)]505.8 norm0 +[(parameters, like this:)]494.8 norm2 +[2(%macro foo 1.nolist)]477.8 code3 +[(Or like this:)]460.8 norm3 +[2(%macro bar 1-5+.nolist a,b,c,d,e,f,g,h)]443.8 code3 +[{/section-4.3.11 xa}(Undefining Multi-Line Macros: )2(%unmacro)](4.3.11)424.6 subh3 +[(Multi-line macros can be removed with the )2(%unmacro)0( directive. Unlike the )2(%undef)0( directive, however,)]407.6 norm1 +[2(%unmacro)0( takes an argument specification, and will only remove )(exact matches with that argument)]396.6 norm0 +[(specification.)]385.6 norm2 +[(For example:)]368.6 norm3 +[2(%macro foo 1-3 )]351.6 code1 +[2( ; Do something )]340.6 code0 +[2(%endmacro )]329.6 code0 +[2(%unmacro foo 1-3)]318.6 code2 +[(removes the previously defined macro )2(foo)0(, but)]301.6 norm3 +[2(%macro bar 1-3 )]284.6 code1 +[2( ; Do something )]273.6 code0 +[2(%endmacro )]262.6 code0 +[2(%unmacro bar 1)]251.6 code2 +[(does )1(not)0( remove the macro )2(bar)0(, since the argument specification does not match exactly.)]234.6 norm3 +[{/section-4.3.12 xa}(Exiting Multi-Line Macros: )2(%exitmacro)](4.3.12)215.4 subh3 +[(Multi-line macro expansions can be arbitrarily terminated with the )2(%exitmacro)0( directive.)]198.4 norm3 +[(For example:)]181.4 norm3 +[2(%macro foo 1-3 )]164.4 code1 +[2( ; Do something )]153.4 code0 +[2( %if<condition> )]142.4 code0 +[2( %exitmacro )]131.4 code0 +[2( %endif )]120.4 code0 +(48)pageeven +restore showpage +%%Page: 49 49 +%%BeginPageSetup +save +%%EndPageSetup +/49 pa +[2( ; Do something )]681 code0 +[2(%endmacro)]670 code2 +[{/section-4.4 xa}(Conditional Assembly)](4.4)648.6 head3 +[(Similarly to the C preprocessor, NASM allows sections of a source file to be assembled only if certain)]631.6 norm1 +[(conditions are met. The general syntax of this feature looks like this:)]620.6 norm2 +[2(%if<condition> )]603.6 code1 +[2( ; some code which only appears if <condition> is met )]592.6 code0 +[2(%elif<condition2> )]581.6 code0 +[2( ; only appears if <condition> is not met but <condition2> is )]570.6 code0 +[2(%else )]559.6 code0 +[2( ; this appears if neither <condition> nor <condition2> was met )]548.6 code0 +[2(%endif)]537.6 code2 +[(The inverse forms )2(%ifn)0( and )2(%elifn)0( are also supported.)]520.6 norm3 +[(The )2(%else)0( clause is optional, as is the )2(%elif)0( clause. You can have more than one )2(%elif)0( clause as well.)]503.6 norm3 +[(There are a number of variants of the )2(%if)0( directive. Each has its corresponding )2(%elif)0(, )2(%ifn)0(, and )2(%elifn)]486.6 norm1 +[(directives; for example, the equivalents to the )2(%ifdef)0( directive are )2(%elifdef)0(, )2(%ifndef)0(, and)]475.6 norm0 +[2(%elifndef)0(.)]464.6 norm2 +[{/section-4.4.1 xa}2(%ifdef)0(: Testing Single-Line Macro Existence)](4.4.1)445.4 subh3 +[(Beginning a conditional-assembly block with the line )2(%ifdef MACRO)0( will assemble the subsequent code if,)]428.4 norm1 +[(and only if, a single-line macro called )2(MACRO)0( is defined. If not, then the )2(%elif)0( and )2(%else)0( blocks \(if any\))]417.4 norm0 +[(will be processed instead.)]406.4 norm2 +[(For example, when debugging a program, you might want to write code such as)]389.4 norm3 +[2( ; perform some function )]372.4 code1 +[2(%ifdef DEBUG )]361.4 code0 +[2( writefile 2,"Function performed successfully",13,10 )]350.4 code0 +[2(%endif )]339.4 code0 +[2( ; go and do something else)]328.4 code2 +[(Then you could use the command-line option )2(-dDEBUG)0( to create a version of the program which produced)]311.4 norm1 +[(debugging messages, and remove the option to generate the final release version of the program.)]300.4 norm2 +[(You can test for a macro )1(not)0( being defined by using )2(%ifndef)0( instead of )2(%ifdef)0(. You can also test for)]283.4 norm1 +[(macro definitions in )2(%elif)0( blocks by using )2(%elifdef)0( and )2(%elifndef)0(.)]272.4 norm2 +[{/section-4.4.2 xa}2(%ifmacro)0(: Testing Multi-Line Macro Existence)](4.4.2)253.2 subh3 +[(The )2(%ifmacro)0( directive operates in the same way as the )2(%ifdef)0( directive, except that it checks for the)]236.2 norm1 +[(existence of a multi-line macro.)]225.2 norm2 +[(For example, you may be working with a large project and not have control over the macros in a library. You)]208.2 norm1 +[(may want to create a macro with one name if it doesn't already exist, and another name if one with that name)]197.2 norm0 +[(does exist.)]186.2 norm2 +[(The )2(%ifmacro)0( is considered true if defining a macro with the given name and number of arguments would)]169.2 norm1 +[(cause a definitions conflict. For example:)]158.2 norm2 +[2(%ifmacro MyMacro 1-3 )]141.2 code1 +[2()]130.2 code0 +[2( %error "MyMacro 1-3" causes a conflict with an existing macro. )]119.2 code0 +[2()]108.2 code0 +(49)pageodd +restore showpage +%%Page: 50 50 +%%BeginPageSetup +save +%%EndPageSetup +/50 pa +[2(%else )]681 code0 +[2()]670 code0 +[2( %macro MyMacro 1-3 )]659 code0 +[2()]648 code0 +[2( ; insert code to define the macro )]637 code0 +[2()]626 code0 +[2( %endmacro )]615 code0 +[2()]604 code0 +[2(%endif)]593 code2 +[(This will create the macro "MyMacro 1-3" if no macro already exists which would conflict with it, and emits)]576 norm1 +[(a warning if there would be a definition conflict.)]565 norm2 +[(You can test for the macro not existing by using the )2(%ifnmacro)0( instead of )2(%ifmacro)0(. Additional tests can)]548 norm1 +[(be performed in )2(%elif)0( blocks by using )2(%elifmacro)0( and )2(%elifnmacro)0(.)]537 norm2 +[{/section-4.4.3 xa}2(%ifctx)0(: Testing the Context Stack)](4.4.3)517.8 subh3 +[(The conditional-assembly construct )2(%ifctx)0( will cause the subsequent code to be assembled if and only if)]500.8 norm1 +[(the top context on the preprocessor's context stack has the same name as one of the arguments. As with)]489.8 norm0 +[2(%ifdef)0(, the inverse and )2(%elif)0( forms )2(%ifnctx)0(, )2(%elifctx)0( and )2(%elifnctx)0( are also supported.)]478.8 norm2 +[(For more details of the context stack, see ){/section-4.7 xl}(section 4.7){el}(. For a sample use of )2(%ifctx)0(, see ){/section-4.7.5 xl}(section 4.7.5){el}(.)]461.8 norm3 +[{/section-4.4.4 xa}2(%if)0(: Testing Arbitrary Numeric Expressions)](4.4.4)442.6 subh3 +[(The conditional-assembly construct )2(%if expr)0( will cause the subsequent code to be assembled if and only if)]425.6 norm1 +[(the value of the numeric expression )2(expr)0( is non-zero. An example of the use of this feature is in deciding)]414.6 norm0 +[(when to break out of a )2(%rep)0( preprocessor loop: see ){/section-4.5 xl}(section 4.5){el}( for a detailed example.)]403.6 norm2 +[(The expression given to )2(%if)0(, and its counterpart )2(%elif)0(, is a critical expression \(see ){/section-3.8 xl}(section 3.8){el}(\).)]386.6 norm3 +[2(%if)0( extends the normal NASM expression syntax, by providing a set of )(relational operators which are not)]369.6 norm1 +[(normally available in expressions. The operators )2(=)0(, )2(<)0(, )2(>)0(, )2(<=)0(, )2(>=)0( and )2(<>)0( test equality, less-than, greater-than,)]358.6 norm0 +[(less-or-equal, greater-or-equal and not-equal respectively. The C-like forms )2(==)0( and )2(!=)0( are supported as)]347.6 norm0 +[(alternative forms of )2(=)0( and )2(<>)0(. In addition, low-priority logical operators )2(&&)0(, )2(^^)0( and )2(||)0( are provided,)]336.6 norm0 +[(supplying )(logical AND, )(logical XOR and )(logical OR. These work like the C logical operators \(although C has)]325.6 norm0 +[(no logical XOR\), in that they always return either 0 or 1, and treat any non-zero input as 1 \(so that )2(^^)0(, for)]314.6 norm0 +[(example, returns 1 if exactly one of its inputs is zero, and 0 otherwise\). The relational operators also return 1)]303.6 norm0 +[(for true and 0 for false.)]292.6 norm2 +[(Like other )2(%if)0( constructs, )2(%if)0( has a counterpart )2(%elif)0(, and negative forms )2(%ifn)0( and )2(%elifn)0(.)]275.6 norm3 +[{/section-4.4.5 xa}2(%ifidn)0( and )2(%ifidni)0(: Testing Exact Text Identity)](4.4.5)256.4 subh3 +[(The construct )2(%ifidn text1,text2)0( will cause the subsequent code to be assembled if and only if)]239.4 norm1 +[2(text1)0( and )2(text2)0(, after expanding single-line macros, are identical pieces of text. Differences in white)]228.4 norm0 +[(space are not counted.)]217.4 norm2 +[2(%ifidni)0( is similar to )2(%ifidn)0(, but is )(case-insensitive.)]200.4 norm3 +[(For example, the following macro pushes a register or number on the stack, and allows you to treat )2(IP)0( as a)]183.4 norm1 +[(real register:)]172.4 norm2 +[2(%macro pushparam 1 )]155.4 code1 +[2()]144.4 code0 +[2( %ifidni %1,ip )]133.4 code0 +[2( call %%label )]122.4 code0 +[2( %%label: )]111.4 code0 +[2( %else )]100.4 code0 +(50)pageeven +restore showpage +%%Page: 51 51 +%%BeginPageSetup +save +%%EndPageSetup +/51 pa +[2( push %1 )]681 code0 +[2( %endif )]670 code0 +[2()]659 code0 +[2(%endmacro)]648 code2 +[(Like other )2(%if)0( constructs, )2(%ifidn)0( has a counterpart )2(%elifidn)0(, and negative forms )2(%ifnidn)0( and)]631 norm1 +[2(%elifnidn)0(. Similarly, )2(%ifidni)0( has counterparts )2(%elifidni)0(, )2(%ifnidni)0( and )2(%elifnidni)0(.)]620 norm2 +[{/section-4.4.6 xa}2(%ifid)0(, )2(%ifnum)0(, )2(%ifstr)0(: Testing Token Types)](4.4.6)600.8 subh3 +[(Some macros will want to perform different tasks depending on whether they are passed a number, a string, or)]583.8 norm1 +[(an identifier. For example, a string output macro might want to be able to cope with being passed either a)]572.8 norm0 +[(string constant or a pointer to an existing string.)]561.8 norm2 +[(The conditional assembly construct )2(%ifid)0(, taking one parameter \(which may be blank\), assembles the)]544.8 norm1 +[(subsequent code if and only if the first token in the parameter exists and is an identifier. )2(%ifnum)0( works)]533.8 norm0 +[(similarly, but tests for the token being a numeric constant; )2(%ifstr)0( tests for it being a string.)]522.8 norm2 +[(For example, the )2(writefile)0( macro defined in ){/section-4.3.4 xl}(section 4.3.4){el}( can be extended to take advantage of )2(%ifstr)]505.8 norm1 +[(in the following fashion:)]494.8 norm2 +[2(%macro writefile 2-3+ )]477.8 code1 +[2()]466.8 code0 +[2( %ifstr %2 )]455.8 code0 +[2( jmp %%endstr )]444.8 code0 +[2( %if %0 = 3 )]433.8 code0 +[2( %%str: db %2,%3 )]422.8 code0 +[2( %else )]411.8 code0 +[2( %%str: db %2 )]400.8 code0 +[2( %endif )]389.8 code0 +[2( %%endstr: mov dx,%%str )]378.8 code0 +[2( mov cx,%%endstr-%%str )]367.8 code0 +[2( %else )]356.8 code0 +[2( mov dx,%2 )]345.8 code0 +[2( mov cx,%3 )]334.8 code0 +[2( %endif )]323.8 code0 +[2( mov bx,%1 )]312.8 code0 +[2( mov ah,0x40 )]301.8 code0 +[2( int 0x21 )]290.8 code0 +[2()]279.8 code0 +[2(%endmacro)]268.8 code2 +[(Then the )2(writefile)0( macro can cope with being called in either of the following two ways:)]251.8 norm3 +[2( writefile [file], strpointer, length )]234.8 code1 +[2( writefile [file], "hello", 13, 10)]223.8 code2 +[(In the first, )2(strpointer)0( is used as the address of an already-declared string, and )2(length)0( is used as its)]206.8 norm1 +[(length; in the second, a string is given to the macro, which therefore declares it itself and works out the)]195.8 norm0 +[(address and length for itself.)]184.8 norm2 +[(Note the use of )2(%if)0( inside the )2(%ifstr)0(: this is to detect whether the macro was passed two arguments \(so the)]167.8 norm1 +[(string would be a single string constant, and )2(db %2)0( would be adequate\) or more \(in which case, all but the)]156.8 norm0 +[(first two would be lumped together into )2(%3)0(, and )2(db %2,%3)0( would be required\).)]145.8 norm2 +[(The usual )2(%elif)0(..., )2(%ifn)0(..., and )2(%elifn)0(... versions exist for each of )2(%ifid)0(, )2(%ifnum)0( and )2(%ifstr)0(.)]128.8 norm3 +(51)pageodd +restore showpage +%%Page: 52 52 +%%BeginPageSetup +save +%%EndPageSetup +/52 pa +[{/section-4.4.7 xa}2(%iftoken)0(: Test for a Single Token)](4.4.7)678.8 subh3 +[(Some macros will want to do different things depending on if it is passed a single token \(e.g. paste it to)]661.8 norm1 +[(something else using )2(%+)0(\) versus a multi-token sequence.)]650.8 norm2 +[(The conditional assembly construct )2(%iftoken)0( assembles the subsequent code if and only if the expanded)]633.8 norm1 +[(parameters consist of exactly one token, possibly surrounded by whitespace.)]622.8 norm2 +[(For example:)]605.8 norm3 +[2(%iftoken 1)]588.8 code3 +[(will assemble the subsequent code, but)]571.8 norm3 +[2(%iftoken -1)]554.8 code3 +[(will not, since )2(-1)0( contains two tokens: the unary minus operator )2(-)0(, and the number )2(1)0(.)]537.8 norm3 +[(The usual )2(%eliftoken)0(, )2(%ifntoken)0(, and )2(%elifntoken)0( variants are also provided.)]520.8 norm3 +[{/section-4.4.8 xa}2(%ifempty)0(: Test for Empty Expansion)](4.4.8)501.6 subh3 +[(The conditional assembly construct )2(%ifempty)0( assembles the subsequent code if and only if the expanded)]484.6 norm1 +[(parameters do not contain any tokens at all, whitespace excepted.)]473.6 norm2 +[(The usual )2(%elifempty)0(, )2(%ifnempty)0(, and )2(%elifnempty)0( variants are also provided.)]456.6 norm3 +[{/section-4.5 xa}(Preprocessor Loops)(: )2(%rep)](4.5)435.2 head3 +[(NASM's )2(TIMES)0( prefix, though useful, cannot be used to invoke a multi-line macro multiple times, because)]418.2 norm1 +[(it is processed by NASM after macros have already been expanded. Therefore NASM provides another form)]407.2 norm0 +[(of loop, this time at the preprocessor level: )2(%rep)0(.)]396.2 norm2 +[(The directives )2(%rep)0( and )2(%endrep)0( \()2(%rep)0( takes a numeric argument, which can be an expression; )2(%endrep)]379.2 norm1 +[(takes no arguments\) can be used to enclose a chunk of code, which is then replicated as many times as)]368.2 norm0 +[(specified by the preprocessor:)]357.2 norm2 +[2(%assign i 0 )]340.2 code1 +[2(%rep 64 )]329.2 code0 +[2( inc word [table+2*i] )]318.2 code0 +[2(%assign i i+1 )]307.2 code0 +[2(%endrep)]296.2 code2 +[(This will generate a sequence of 64 )2(INC)0( instructions, incrementing every word of memory from )2([table])0( to)]279.2 norm1 +[2([table+126])0(.)]268.2 norm2 +[(For more complex termination conditions, or to break out of a repeat loop part way along, you can use the)]251.2 norm1 +[2(%exitrep)0( directive to terminate the loop, like this:)]240.2 norm2 +[2(fibonacci: )]223.2 code1 +[2(%assign i 0 )]212.2 code0 +[2(%assign j 1 )]201.2 code0 +[2(%rep 100 )]190.2 code0 +[2(%if j > 65535 )]179.2 code0 +[2( %exitrep )]168.2 code0 +[2(%endif )]157.2 code0 +[2( dw j )]146.2 code0 +[2(%assign k j+i )]135.2 code0 +[2(%assign i j )]124.2 code0 +[2(%assign j k )]113.2 code0 +[2(%endrep )]102.2 code0 +(52)pageeven +restore showpage +%%Page: 53 53 +%%BeginPageSetup +save +%%EndPageSetup +/53 pa +[2()]681 code0 +[2(fib_number equ \($-fibonacci\)/2)]670 code2 +[(This produces a list of all the Fibonacci numbers that will fit in 16 bits. Note that a maximum repeat count)]653 norm1 +[(must still be given to )2(%rep)0(. This is to prevent the possibility of NASM getting into an infinite loop in the)]642 norm0 +[(preprocessor, which \(on multitasking or multi-user systems\) would typically cause all the system memory to)]631 norm0 +[(be gradually used up and other applications to start crashing.)]620 norm2 +[{/section-4.6 xa}(Source Files and Dependencies)](4.6)598.6 head3 +[(These commands allow you to split your sources into multiple files.)]581.6 norm3 +[{/section-4.6.1 xa}2(%include)0(: )(Including Other Files)](4.6.1)562.4 subh3 +[(Using, once again, a very similar syntax to the C preprocessor, NASM's preprocessor lets you include other)]545.4 norm1 +[(source files into your code. This is done by the use of the )2(%include)0( directive:)]534.4 norm2 +[2(%include "macros.mac")]517.4 code3 +[(will include the contents of the file )2(macros.mac)0( into the source file containing the )2(%include)0( directive.)]500.4 norm3 +[(Include files are )(searched for in the current directory \(the directory you're in when you run NASM, as)]483.4 norm1 +[(opposed to the location of the NASM executable or the location of the source file\), plus any directories)]472.4 norm0 +[(specified on the NASM command line using the )2(-i)0( option.)]461.4 norm2 +[(The standard C idiom for preventing a file being included more than once is just as applicable in NASM: if)]444.4 norm1 +[(the file )2(macros.mac)0( has the form)]433.4 norm2 +[2(%ifndef MACROS_MAC )]416.4 code1 +[2( %define MACROS_MAC )]405.4 code0 +[2( ; now define some macros )]394.4 code0 +[2(%endif)]383.4 code2 +[(then including the file more than once will not cause errors, because the second time the file is included)]366.4 norm1 +[(nothing will happen because the macro )2(MACROS_MAC)0( will already be defined.)]355.4 norm2 +[(You can force a file to be included even if there is no )2(%include)0( directive that explicitly includes it, by using)]338.4 norm1 +[(the )2(-p)0( option on the NASM command line \(see ){/section-2.1.17 xl}(section 2.1.17){el}(\).)]327.4 norm2 +[{/section-4.6.2 xa}2(%pathsearch)0(: Search the Include Path)](4.6.2)308.2 subh3 +[(The )2(%pathsearch)0( directive takes a single-line macro name and a filename, and declare or redefines the)]291.2 norm1 +[(specified single-line macro to be the include-path-resolved version of the filename, if the file exists)]280.2 norm0 +[(\(otherwise, it is passed unchanged.\))]269.2 norm2 +[(For example,)]252.2 norm3 +[2(%pathsearch MyFoo "foo.bin")]235.2 code3 +[(... with )2(-Ibins/)0( in the include path may end up defining the macro )2(MyFoo)0( to be )2("bins/foo.bin")0(.)]218.2 norm3 +[{/section-4.6.3 xa}2(%depend)0(: Add Dependent Files)](4.6.3)199 subh3 +[(The )2(%depend)0( directive takes a filename and adds it to the list of files to be emitted as dependency generation)]182 norm1 +[(when the )2(-M)0( options and its relatives \(see ){/section-2.1.4 xl}(section 2.1.4){el}(\) are used. It produces no output.)]171 norm2 +[(This is generally used in conjunction with )2(%pathsearch)0(. For example, a simplified version of the standard)]154 norm1 +[(macro wrapper for the )2(INCBIN)0( directive looks like:)]143 norm2 +[2(%imacro incbin 1-2+ 0 )]126 code1 +[2(%pathsearch dep %1 )]115 code0 +[2(%depend dep )]104 code0 +(53)pageodd +restore showpage +%%Page: 54 54 +%%BeginPageSetup +save +%%EndPageSetup +/54 pa +[2( incbin dep,%2 )]681 code0 +[2(%endmacro)]670 code2 +[(This first resolves the location of the file into the macro )2(dep)0(, then adds it to the dependency lists, and finally)]653 norm1 +[(issues the assembler-level )2(INCBIN)0( directive.)]642 norm2 +[{/section-4.6.4 xa}2(%use)0(: Include Standard Macro Package)](4.6.4)622.8 subh3 +[(The )2(%use)0( directive is similar to )2(%include)0(, but rather than including the contents of a file, it includes a)]605.8 norm1 +[(named standard macro package. The standard macro packages are part of NASM, and are described in ){/chapter-5 xl}(chapter){el}]594.8 norm0 +[{/chapter-5 xl}(5){el}(.)]583.8 norm2 +[(Unlike the )2(%include)0( directive, package names for the )2(%use)0( directive do not require quotes, but quotes are)]566.8 norm1 +[(permitted. In NASM 2.04 and 2.05 the unquoted form would be macro-expanded; this is no longer true. Thus,)]555.8 norm0 +[(the following lines are equivalent:)]544.8 norm2 +[2(%use altreg )]527.8 code1 +[2(%use 'altreg')]516.8 code2 +[(Standard macro packages are protected from multiple inclusion. When a standard macro package is used, a)]499.8 norm1 +[(testable single-line macro of the form )2(__USE_)1(package)2(__)0( is also defined, see ){/section-4.11.8 xl}(section 4.11.8){el}(.)]488.8 norm2 +[{/section-4.7 xa}(The )(Context Stack)](4.7)467.4 head3 +[(Having labels that are local to a macro definition is sometimes not quite powerful enough: sometimes you)]450.4 norm1 +[(want to be able to share labels between several macro calls. An example might be a )2(REPEAT)0( ... )2(UNTIL)0( loop,)]439.4 norm0 +[(in which the expansion of the )2(REPEAT)0( macro would need to be able to refer to a label which the )2(UNTIL)]428.4 norm0 +[(macro had defined. However, for such a macro you would also want to be able to nest these loops.)]417.4 norm2 +[(NASM provides this level of power by means of a )1(context stack)0(. The preprocessor maintains a stack of)]400.4 norm1 +[1(contexts)0(, each of which is characterized by a name. You add a new context to the stack using the )2(%push)]389.4 norm0 +[(directive, and remove one using )2(%pop)0(. You can define labels that are local to a particular context on the stack.)]378.4 norm2 +[{/section-4.7.1 xa}2(%push)0( and )2(%pop)0(: )(Creating and Removing Contexts)](4.7.1)359.2 subh3 +[(The )2(%push)0( directive is used to create a new context and place it on the top of the context stack. )2(%push)0( takes)]342.2 norm1 +[(an optional argument, which is the name of the context. For example:)]331.2 norm2 +[2(%push foobar)]314.2 code3 +[(This pushes a new context called )2(foobar)0( on the stack. You can have several contexts on the stack with the)]297.2 norm1 +[(same name: they can still be distinguished. If no name is given, the context is unnamed \(this is normally used)]286.2 norm0 +[(when both the )2(%push)0( and the )2(%pop)0( are inside a single macro definition.\))]275.2 norm2 +[(The directive )2(%pop)0(, taking one optional argument, removes the top context from the context stack and)]258.2 norm1 +[(destroys it, along with any labels associated with it. If an argument is given, it must match the name of the)]247.2 norm0 +[(current context, otherwise it will issue an error.)]236.2 norm2 +[{/section-4.7.2 xa}(Context-Local Labels)](4.7.2)217 subh3 +[(Just as the usage )2(%%foo)0( defines a label which is local to the particular macro call in which it is used, the)]200 norm1 +[(usage )2(%$foo)0( is used to define a label which is local to the context on the top of the context stack. So the)]189 norm0 +[2(REPEAT)0( and )2(UNTIL)0( example given above could be implemented by means of:)]178 norm2 +[2(%macro repeat 0 )]161 code1 +[2()]150 code0 +[2( %push repeat )]139 code0 +[2( %$begin: )]128 code0 +[2()]117 code0 +[2(%endmacro )]106 code0 +(54)pageeven +restore showpage +%%Page: 55 55 +%%BeginPageSetup +save +%%EndPageSetup +/55 pa +[2()]681 code0 +[2(%macro until 1 )]670 code0 +[2()]659 code0 +[2( j%-1 %$begin )]648 code0 +[2( %pop )]637 code0 +[2()]626 code0 +[2(%endmacro)]615 code2 +[(and invoked by means of, for example,)]598 norm3 +[2( mov cx,string )]581 code1 +[2( repeat )]570 code0 +[2( add cx,3 )]559 code0 +[2( scasb )]548 code0 +[2( until e)]537 code2 +[(which would scan every fourth byte of a string in search of the byte in )2(AL)0(.)]520 norm3 +[(If you need to define, or access, labels local to the context )1(below)0( the top one on the stack, you can use)]503 norm1 +[2(%$$foo)0(, or )2(%$$$foo)0( for the context below that, and so on.)]492 norm2 +[{/section-4.7.3 xa}(Context-Local Single-Line Macros)](4.7.3)472.8 subh3 +[(NASM also allows you to define single-line macros which are local to a particular context, in just the same)]455.8 norm1 +[(way:)]444.8 norm2 +[2(%define %$localmac 3)]427.8 code3 +[(will define the single-line macro )2(%$localmac)0( to be local to the top context on the stack. Of course, after a)]410.8 norm1 +[(subsequent )2(%push)0(, it can then still be accessed by the name )2(%$$localmac)0(.)]399.8 norm2 +[{/section-4.7.4 xa}2(%repl)0(: )(Renaming a Context)](4.7.4)380.6 subh3 +[(If you need to change the name of the top context on the stack \(in order, for example, to have it respond)]363.6 norm1 +[(differently to )2(%ifctx)0(\), you can execute a )2(%pop)0( followed by a )2(%push)0(; but this will have the side effect of)]352.6 norm0 +[(destroying all context-local labels and macros associated with the context that was just popped.)]341.6 norm2 +[(NASM provides the directive )2(%repl)0(, which )1(replaces)0( a context with a different name, without touching the)]324.6 norm1 +[(associated macros and labels. So you could replace the destructive code)]313.6 norm2 +[2(%pop )]296.6 code1 +[2(%push newname)]285.6 code2 +[(with the non-destructive version )2(%repl newname)0(.)]268.6 norm3 +[{/section-4.7.5 xa}(Example Use of the )(Context Stack: )(Block IFs)](4.7.5)249.4 subh3 +[(This example makes use of almost all the context-stack features, including the conditional-assembly)]232.4 norm1 +[(construct )2(%ifctx)0(, to implement a block IF statement as a set of macros.)]221.4 norm2 +[2(%macro if 1 )]204.4 code1 +[2()]193.4 code0 +[2( %push if )]182.4 code0 +[2( j%-1 %$ifnot )]171.4 code0 +[2()]160.4 code0 +[2(%endmacro )]149.4 code0 +[2()]138.4 code0 +[2(%macro else 0 )]127.4 code0 +[2()]116.4 code0 +[2( %ifctx if )]105.4 code0 +(55)pageodd +restore showpage +%%Page: 56 56 +%%BeginPageSetup +save +%%EndPageSetup +/56 pa +[2( %repl else )]681 code0 +[2( jmp %$ifend )]670 code0 +[2( %$ifnot: )]659 code0 +[2( %else )]648 code0 +[2( %error "expected `if' before `else'" )]637 code0 +[2( %endif )]626 code0 +[2()]615 code0 +[2(%endmacro )]604 code0 +[2()]593 code0 +[2(%macro endif 0 )]582 code0 +[2()]571 code0 +[2( %ifctx if )]560 code0 +[2( %$ifnot: )]549 code0 +[2( %pop )]538 code0 +[2( %elifctx else )]527 code0 +[2( %$ifend: )]516 code0 +[2( %pop )]505 code0 +[2( %else )]494 code0 +[2( %error "expected `if' or `else' before `endif'" )]483 code0 +[2( %endif )]472 code0 +[2()]461 code0 +[2(%endmacro)]450 code2 +[(This code is more robust than the )2(REPEAT)0( and )2(UNTIL)0( macros given in ){/section-4.7.2 xl}(section 4.7.2){el}(, because it uses)]433 norm1 +[(conditional assembly to check that the macros are issued in the right order \(for example, not calling )2(endif)]422 norm0 +[(before )2(if)0(\) and issues a )2(%error)0( if they're not.)]411 norm2 +[(In addition, the )2(endif)0( macro has to be able to cope with the two distinct cases of either directly following an)]394 norm1 +[2(if)0(, or following an )2(else)0(. It achieves this, again, by using conditional assembly to do different things)]383 norm0 +[(depending on whether the context on top of the stack is )2(if)0( or )2(else)0(.)]372 norm2 +[(The )2(else)0( macro has to preserve the context on the stack, in order to have the )2(%$ifnot)0( referred to by the )2(if)]355 norm1 +[(macro be the same as the one defined by the )2(endif)0( macro, but has to change the context's name so that)]344 norm0 +[2(endif)0( will know there was an intervening )2(else)0(. It does this by the use of )2(%repl)0(.)]333 norm2 +[(A sample usage of these macros might look like:)]316 norm3 +[2( cmp ax,bx )]299 code1 +[2()]288 code0 +[2( if ae )]277 code0 +[2( cmp bx,cx )]266 code0 +[2()]255 code0 +[2( if ae )]244 code0 +[2( mov ax,cx )]233 code0 +[2( else )]222 code0 +[2( mov ax,bx )]211 code0 +[2( endif )]200 code0 +[2()]189 code0 +[2( else )]178 code0 +[2( cmp ax,cx )]167 code0 +[2()]156 code0 +[2( if ae )]145 code0 +[2( mov ax,cx )]134 code0 +[2( endif )]123 code0 +[2()]112 code0 +[2( endif)]101 code2 +(56)pageeven +restore showpage +%%Page: 57 57 +%%BeginPageSetup +save +%%EndPageSetup +/57 pa +[(The block-)2(IF)0( macros handle nesting quite happily, by means of pushing another context, describing the inner)]681 norm1 +[2(if)0(, on top of the one describing the outer )2(if)0(; thus )2(else)0( and )2(endif)0( always refer to the last unmatched )2(if)]670 norm0 +[(or )2(else)0(.)]659 norm2 +[{/section-4.8 xa}(Stack Relative Preprocessor Directives)](4.8)637.6 head3 +[(The following preprocessor directives provide a way to use labels to refer to local variables allocated on the)]620.6 norm1 +[(stack.)]609.6 norm2 +[2(%arg)0( \(see ){/section-4.8.1 xl}(section 4.8.1){el}(\))]592.6 bull3 +[2(%stacksize)0( \(see ){/section-4.8.2 xl}(section 4.8.2){el}(\))]575.6 bull3 +[2(%local)0( \(see ){/section-4.8.3 xl}(section 4.8.3){el}(\))]558.6 bull3 +[{/section-4.8.1 xa}2(%arg)0( Directive)](4.8.1)539.4 subh3 +[(The )2(%arg)0( directive is used to simplify the handling of parameters passed on the stack. Stack based parameter)]522.4 norm1 +[(passing is used by many high level languages, including C, C++ and Pascal.)]511.4 norm2 +[(While NASM has macros which attempt to duplicate this functionality \(see ){/section-8.4.5 xl}(section 8.4.5){el}(\), the syntax is not)]494.4 norm1 +[(particularly convenient to use. and is not TASM compatible. Here is an example which shows the use of)]483.4 norm0 +[2(%arg)0( without any external macros:)]472.4 norm2 +[2(some_function: )]455.4 code1 +[2()]444.4 code0 +[2( %push mycontext ; save the current context )]433.4 code0 +[2( %stacksize large ; tell NASM to use bp )]422.4 code0 +[2( %arg i:word, j_ptr:word )]411.4 code0 +[2()]400.4 code0 +[2( mov ax,[i] )]389.4 code0 +[2( mov bx,[j_ptr] )]378.4 code0 +[2( add ax,[bx] )]367.4 code0 +[2( ret )]356.4 code0 +[2()]345.4 code0 +[2( %pop ; restore original context)]334.4 code2 +[(This is similar to the procedure defined in ){/section-8.4.5 xl}(section 8.4.5){el}( and adds the value in i to the value pointed to by j_ptr)]317.4 norm1 +[(and returns the sum in the ax register. See ){/section-4.7.1 xl}(section 4.7.1){el}( for an explanation of )2(push)0( and )2(pop)0( and the use of)]306.4 norm0 +[(context stacks.)]295.4 norm2 +[{/section-4.8.2 xa}2(%stacksize)0( Directive)](4.8.2)276.2 subh3 +[(The )2(%stacksize)0( directive is used in conjunction with the )2(%arg)0( \(see ){/section-4.8.1 xl}(section 4.8.1){el}(\) and the )2(%local)0( \(see)]259.2 norm1 +[{/section-4.8.3 xl}(section 4.8.3){el}(\) directives. It tells NASM the default size to use for subsequent )2(%arg)0( and )2(%local)0( directives.)]248.2 norm0 +[(The )2(%stacksize)0( directive takes one required argument which is one of )2(flat)0(, )2(flat64)0(, )2(large)0( or )2(small)0(.)]237.2 norm2 +[2(%stacksize flat)]220.2 code3 +[(This form causes NASM to use stack-based parameter addressing relative to )2(ebp)0( and it assumes that a near)]203.2 norm1 +[(form of call was used to get to this label \(i.e. that )2(eip)0( is on the stack\).)]192.2 norm2 +[2(%stacksize flat64)]175.2 code3 +[(This form causes NASM to use stack-based parameter addressing relative to )2(rbp)0( and it assumes that a near)]158.2 norm1 +[(form of call was used to get to this label \(i.e. that )2(rip)0( is on the stack\).)]147.2 norm2 +[2(%stacksize large)]130.2 code3 +[(This form uses )2(bp)0( to do stack-based parameter addressing and assumes that a far form of call was used to get)]113.2 norm1 +[(to this address \(i.e. that )2(ip)0( and )2(cs)0( are on the stack\).)]102.2 norm2 +(57)pageodd +restore showpage +%%Page: 58 58 +%%BeginPageSetup +save +%%EndPageSetup +/58 pa +[2(%stacksize small)]681 code3 +[(This form also uses )2(bp)0( to address stack parameters, but it is different from )2(large)0( because it also assumes)]664 norm1 +[(that the old value of bp is pushed onto the stack \(i.e. it expects an )2(ENTER)0( instruction\). In other words, it)]653 norm0 +[(expects that )2(bp)0(, )2(ip)0( and )2(cs)0( are on the top of the stack, underneath any local space which may have been)]642 norm0 +[(allocated by )2(ENTER)0(. This form is probably most useful when used in combination with the )2(%local)0( directive)]631 norm0 +[(\(see ){/section-4.8.3 xl}(section 4.8.3){el}(\).)]620 norm2 +[{/section-4.8.3 xa}2(%local)0( Directive)](4.8.3)600.8 subh3 +[(The )2(%local)0( directive is used to simplify the use of local temporary stack variables allocated in a stack)]583.8 norm1 +[(frame. Automatic local variables in C are an example of this kind of variable. The )2(%local)0( directive is most)]572.8 norm0 +[(useful when used with the )2(%stacksize)0( \(see ){/section-4.8.2 xl}(section 4.8.2){el}( and is also compatible with the )2(%arg)0( directive)]561.8 norm0 +[(\(see ){/section-4.8.1 xl}(section 4.8.1){el}(\). It allows simplified reference to variables on the stack which have been allocated typically)]550.8 norm0 +[(by using the )2(ENTER)0( instruction. An example of its use is the following:)]539.8 norm2 +[2(silly_swap: )]522.8 code1 +[2()]511.8 code0 +[2( %push mycontext ; save the current context )]500.8 code0 +[2( %stacksize small ; tell NASM to use bp )]489.8 code0 +[2( %assign %$localsize 0 ; see text for explanation )]478.8 code0 +[2( %local old_ax:word, old_dx:word )]467.8 code0 +[2()]456.8 code0 +[2( enter %$localsize,0 ; see text for explanation )]445.8 code0 +[2( mov [old_ax],ax ; swap ax & bx )]434.8 code0 +[2( mov [old_dx],dx ; and swap dx & cx )]423.8 code0 +[2( mov ax,bx )]412.8 code0 +[2( mov dx,cx )]401.8 code0 +[2( mov bx,[old_ax] )]390.8 code0 +[2( mov cx,[old_dx] )]379.8 code0 +[2( leave ; restore old bp )]368.8 code0 +[2( ret ; )]357.8 code0 +[2()]346.8 code0 +[2( %pop ; restore original context)]335.8 code2 +[(The )2(%$localsize)0( variable is used internally by the )2(%local)0( directive and )1(must)0( be defined within the)]318.8 norm1 +[(current context before the )2(%local)0( directive may be used. Failure to do so will result in one expression)]307.8 norm0 +[(syntax error for each )2(%local)0( variable declared. It then may be used in the construction of an appropriately)]296.8 norm0 +[(sized ENTER instruction as shown in the example.)]285.8 norm2 +[{/section-4.9 xa}(Reporting )(User-Defined Errors: )2(%error)0(, )2(%warning)0(, )2(%fatal)](4.9)264.4 head3 +[(The preprocessor directive )2(%error)0( will cause NASM to report an error if it occurs in assembled code. So if)]247.4 norm1 +[(other users are going to try to assemble your source files, you can ensure that they define the right macros by)]236.4 norm0 +[(means of code like this:)]225.4 norm2 +[2(%ifdef F1 )]208.4 code1 +[2( ; do some setup )]197.4 code0 +[2(%elifdef F2 )]186.4 code0 +[2( ; do some different setup )]175.4 code0 +[2(%else )]164.4 code0 +[2( %error "Neither F1 nor F2 was defined." )]153.4 code0 +[2(%endif)]142.4 code2 +[(Then any user who fails to understand the way your code is supposed to be assembled will be quickly warned)]125.4 norm1 +[(of their mistake, rather than having to wait until the program crashes on being run and then not knowing what)]114.4 norm0 +[(went wrong.)]103.4 norm2 +(58)pageeven +restore showpage +%%Page: 59 59 +%%BeginPageSetup +save +%%EndPageSetup +/59 pa +[(Similarly, )2(%warning)0( issues a warning, but allows assembly to continue:)]681 norm3 +[2(%ifdef F1 )]664 code1 +[2( ; do some setup )]653 code0 +[2(%elifdef F2 )]642 code0 +[2( ; do some different setup )]631 code0 +[2(%else )]620 code0 +[2( %warning "Neither F1 nor F2 was defined, assuming F1." )]609 code0 +[2( %define F1 )]598 code0 +[2(%endif)]587 code2 +[2(%error)0( and )2(%warning)0( are issued only on the final assembly pass. This makes them safe to use in)]570 norm1 +[(conjunction with tests that depend on symbol values.)]559 norm2 +[2(%fatal)0( terminates assembly immediately, regardless of pass. This is useful when there is no point in)]542 norm1 +[(continuing the assembly further, and doing so is likely just going to cause a spew of confusing error messages.)]531 norm2 +[(It is optional for the message string after )2(%error)0(, )2(%warning)0( or )2(%fatal)0( to be quoted. If it is )1(not)0(, then)]514 norm1 +[(single-line macros are expanded in it, which can be used to display more information to the user. For)]503 norm0 +[(example:)]492 norm2 +[2(%if foo > 64 )]475 code1 +[2( %assign foo_over foo-64 )]464 code0 +[2( %error foo is foo_over bytes too large )]453 code0 +[2(%endif)]442 code2 +[{/section-4.10 xa}(Other Preprocessor Directives)](4.10)420.6 head3 +[(NASM also has preprocessor directives which allow access to information from external sources. Currently)]403.6 norm1 +[(they include:)]392.6 norm2 +[2(%line)0( enables NASM to correctly handle the output of another preprocessor \(see ){/section-4.10.1 xl}(section 4.10.1){el}(\).)]375.6 bull3 +[2(%!)0( enables NASM to read in the value of an environment variable, which can then be used in your)]358.6 bull1 +[(program \(see ){/section-4.10.2 xl}(section 4.10.2){el}(\).)]347.6 bull2 +[{/section-4.10.1 xa}2(%line)0( Directive)](4.10.1)328.4 subh3 +[(The )2(%line)0( directive is used to notify NASM that the input line corresponds to a specific line number in)]311.4 norm1 +[(another file. Typically this other file would be an original source file, with the current NASM input being the)]300.4 norm0 +[(output of a pre-processor. The )2(%line)0( directive allows NASM to output messages which indicate the line)]289.4 norm0 +[(number of the original source file, instead of the file that is being read by NASM.)]278.4 norm2 +[(This preprocessor directive is not generally of use to programmers, by may be of interest to preprocessor)]261.4 norm1 +[(authors. The usage of the )2(%line)0( preprocessor directive is as follows:)]250.4 norm2 +[2(%line nnn[+mmm] [filename])]233.4 code3 +[(In this directive, )2(nnn)0( identifies the line of the original source file which this line corresponds to. )2(mmm)0( is an)]216.4 norm1 +[(optional parameter which specifies a line increment value; each line of the input file read in is considered to)]205.4 norm0 +[(correspond to )2(mmm)0( lines of the original source file. Finally, )2(filename)0( is an optional parameter which)]194.4 norm0 +[(specifies the file name of the original source file.)]183.4 norm2 +[(After reading a )2(%line)0( preprocessor directive, NASM will report all file name and line numbers relative to)]166.4 norm1 +[(the values specified therein.)]155.4 norm2 +(59)pageodd +restore showpage +%%Page: 60 60 +%%BeginPageSetup +save +%%EndPageSetup +/60 pa +[{/section-4.10.2 xa}2(%!<env>)0(: Read an environment variable.)](4.10.2)678.8 subh3 +[(The )2(%!<env>)0( directive makes it possible to read the value of an environment variable at assembly time. This)]661.8 norm1 +[(could, for example, be used to store the contents of an environment variable into a string, which could be used)]650.8 norm0 +[(at some other point in your code.)]639.8 norm2 +[(For example, suppose that you have an environment variable )2(FOO)0(, and you want the contents of )2(FOO)0( to be)]622.8 norm1 +[(embedded in your program. You could do that as follows:)]611.8 norm2 +[2(%defstr FOO %!FOO)]594.8 code3 +[(See ){/section-4.1.8 xl}(section 4.1.8){el}( for notes on the )2(%defstr)0( directive.)]577.8 norm3 +[{/section-4.11 xa}(Standard Macros)](4.11)556.4 head3 +[(NASM defines a set of standard macros, which are already defined when it starts to process any source file. If)]539.4 norm1 +[(you really need a program to be assembled with no pre-defined macros, you can use the )2(%clear)0( directive to)]528.4 norm0 +[(empty the preprocessor of everything but context-local preprocessor variables and single-line macros.)]517.4 norm2 +[(Most )(user-level assembler directives \(see ){/chapter-6 xl}(chapter 6){el}(\) are implemented as macros which invoke primitive)]500.4 norm1 +[(directives; these are described in ){/chapter-6 xl}(chapter 6){el}(. The rest of the standard macro set is described here.)]489.4 norm2 +[{/section-4.11.1 xa}(NASM Version Macros)](4.11.1)470.2 subh3 +[(The single-line macros )2(__NASM_MAJOR__)0(, )2(__NASM_MINOR__)0(, )2(__NASM_SUBMINOR__)0( and)]453.2 norm1 +[2(___NASM_PATCHLEVEL__)0( expand to the major, minor, subminor and patch level parts of the )(version)]442.2 norm0 +[(number of NASM being used. So, under NASM 0.98.32p1 for example, )2(__NASM_MAJOR__)0( would be)]431.2 norm0 +[(defined to be 0, )2(__NASM_MINOR__)0( would be defined as 98, )2(__NASM_SUBMINOR__)0( would be defined to)]420.2 norm0 +[(32, and )2(___NASM_PATCHLEVEL__)0( would be defined as 1.)]409.2 norm2 +[(Additionally, the macro )2(__NASM_SNAPSHOT__)0( is defined for automatically generated snapshot releases)]392.2 norm1 +[1(only)0(.)]381.2 norm2 +[{/section-4.11.2 xa}2(__NASM_VERSION_ID__)0(: )(NASM Version ID)](4.11.2)362 subh3 +[(The single-line macro )2(__NASM_VERSION_ID__)0( expands to a dword integer representing the full version)]345 norm1 +[(number of the version of nasm being used. The value is the equivalent to )2(__NASM_MAJOR__)0(,)]334 norm0 +[2(__NASM_MINOR__)0(, )2(__NASM_SUBMINOR__)0( and )2(___NASM_PATCHLEVEL__)0( concatenated to produce a)]323 norm0 +[(single doubleword. Hence, for 0.98.32p1, the returned number would be equivalent to:)]312 norm2 +[2( dd 0x00622001)]295 code3 +[(or)]278 norm3 +[2( db 1,32,98,0)]261 code3 +[(Note that the above lines are generate exactly the same code, the second line is used just to give an indication)]244 norm1 +[(of the order that the separate values will be present in memory.)]233 norm2 +[{/section-4.11.3 xa}2(__NASM_VER__)0(: )(NASM Version string)](4.11.3)213.8 subh3 +[(The single-line macro )2(__NASM_VER__)0( expands to a string which defines the version number of nasm being)]196.8 norm1 +[(used. So, under NASM 0.98.32 for example,)]185.8 norm2 +[2( db __NASM_VER__)]168.8 code3 +[(would expand to)]151.8 norm3 +[2( db "0.98.32")]134.8 code3 +(60)pageeven +restore showpage +%%Page: 61 61 +%%BeginPageSetup +save +%%EndPageSetup +/61 pa +[{/section-4.11.4 xa}2(__FILE__)0( and )2(__LINE__)0(: File Name and Line Number)](4.11.4)678.8 subh3 +[(Like the C preprocessor, NASM allows the user to find out the file name and line number containing the)]661.8 norm1 +[(current instruction. The macro )2(__FILE__)0( expands to a string constant giving the name of the current input)]650.8 norm0 +[(file \(which may change through the course of assembly if )2(%include)0( directives are used\), and )2(__LINE__)]639.8 norm0 +[(expands to a numeric constant giving the current line number in the input file.)]628.8 norm2 +[(These macros could be used, for example, to communicate debugging information to a macro, since invoking)]611.8 norm1 +[2(__LINE__)0( inside a macro definition \(either single-line or multi-line\) will return the line number of the)]600.8 norm0 +[(macro )1(call)0(, rather than )1(definition)0(. So to determine where in a piece of code a crash is occurring, for example,)]589.8 norm0 +[(one could write a routine )2(stillhere)0(, which is passed a line number in )2(EAX)0( and outputs something like)]578.8 norm0 +[(`line 155: still here'. You could then write a macro)]567.8 norm2 +[2(%macro notdeadyet 0 )]550.8 code1 +[2()]539.8 code0 +[2( push eax )]528.8 code0 +[2( mov eax,__LINE__ )]517.8 code0 +[2( call stillhere )]506.8 code0 +[2( pop eax )]495.8 code0 +[2()]484.8 code0 +[2(%endmacro)]473.8 code2 +[(and then pepper your code with calls to )2(notdeadyet)0( until you find the crash point.)]456.8 norm3 +[{/section-4.11.5 xa}2(__BITS__)0(: Current BITS Mode)](4.11.5)437.6 subh3 +[(The )2(__BITS__)0( standard macro is updated every time that the BITS mode is set using the )2(BITS XX)0( or)]420.6 norm1 +[2([BITS XX])0( directive, where XX is a valid mode number of 16, 32 or 64. )2(__BITS__)0( receives the specified)]409.6 norm0 +[(mode number and makes it globally available. This can be very useful for those who utilize mode-dependent)]398.6 norm0 +[(macros.)]387.6 norm2 +[{/section-4.11.6 xa}2(__OUTPUT_FORMAT__)0(: Current Output Format)](4.11.6)368.4 subh3 +[(The )2(__OUTPUT_FORMAT__)0( standard macro holds the current Output Format, as given by the )2(-f)0( option or)]351.4 norm1 +[(NASM's default. Type )2(nasm -hf)0( for a list.)]340.4 norm2 +[2(%ifidn __OUTPUT_FORMAT__, win32 )]323.4 code1 +[2( %define NEWLINE 13, 10 )]312.4 code0 +[2(%elifidn __OUTPUT_FORMAT__, elf32 )]301.4 code0 +[2( %define NEWLINE 10 )]290.4 code0 +[2(%endif)]279.4 code2 +[{/section-4.11.7 xa}(Assembly Date and Time Macros)](4.11.7)260.2 subh3 +[(NASM provides a variety of macros that represent the timestamp of the assembly session.)]243.2 norm3 +[(The )2(__DATE__)0( and )2(__TIME__)0( macros give the assembly date and time as strings, in ISO 8601 format)]226.2 bull1 +[(\()2("YYYY-MM-DD")0( and )2("HH:MM:SS")0(, respectively.\))]215.2 bull2 +[(The )2(__DATE_NUM__)0( and )2(__TIME_NUM__)0( macros give the assembly date and time in numeric form; in)]198.2 bull1 +[(the format )2(YYYYMMDD)0( and )2(HHMMSS)0( respectively.)]187.2 bull2 +[(The )2(__UTC_DATE__)0( and )2(__UTC_TIME__)0( macros give the assembly date and time in universal time)]170.2 bull1 +[(\(UTC\) as strings, in ISO 8601 format \()2("YYYY-MM-DD")0( and )2("HH:MM:SS")0(, respectively.\) If the host)]159.2 bull0 +[(platform doesn't provide UTC time, these macros are undefined.)]148.2 bull2 +[(The )2(__UTC_DATE_NUM__)0( and )2(__UTC_TIME_NUM__)0( macros give the assembly date and time)]131.2 bull1 +[(universal time \(UTC\) in numeric form; in the format )2(YYYYMMDD)0( and )2(HHMMSS)0( respectively. If the host)]120.2 bull0 +[(platform doesn't provide UTC time, these macros are undefined.)]109.2 bull2 +(61)pageodd +restore showpage +%%Page: 62 62 +%%BeginPageSetup +save +%%EndPageSetup +/62 pa +[(The )2(__POSIX_TIME__)0( macro is defined as a number containing the number of seconds since the POSIX)]681 bull1 +[(epoch, 1 January 1970 00:00:00 UTC; excluding any leap seconds. This is computed using UTC time if)]670 bull0 +[(available on the host platform, otherwise it is computed using the local time as if it was UTC.)]659 bull2 +[(All instances of time and date macros in the same assembly session produce consistent output. For example,)]642 norm1 +[(in an assembly session started at 42 seconds after midnight on January 1, 2010 in Moscow \(timezone UTC+3\))]631 norm0 +[(these macros would have the following values, assuming, of course, a properly configured environment with a)]620 norm0 +[(correct clock:)]609 norm2 +[2( __DATE__ "2010-01-01" )]592 code1 +[2( __TIME__ "00:00:42" )]581 code0 +[2( __DATE_NUM__ 20100101 )]570 code0 +[2( __TIME_NUM__ 000042 )]559 code0 +[2( __UTC_DATE__ "2009-12-31" )]548 code0 +[2( __UTC_TIME__ "21:00:42" )]537 code0 +[2( __UTC_DATE_NUM__ 20091231 )]526 code0 +[2( __UTC_TIME_NUM__ 210042 )]515 code0 +[2( __POSIX_TIME__ 1262293242)]504 code2 +[{/section-4.11.8 xa}2(__USE_)1(package)2(__)0(: Package Include Test)](4.11.8)484.8 subh3 +[(When a standard macro package \(see ){/chapter-5 xl}(chapter 5){el}(\) is included with the )2(%use)0( directive \(see ){/section-4.6.4 xl}(section 4.6.4){el}(\), a)]467.8 norm1 +[(single-line macro of the form )2(__USE_)1(package)2(__)0( is automatically defined. This allows testing if a particular)]456.8 norm0 +[(package is invoked or not.)]445.8 norm2 +[(For example, if the )2(altreg)0( package is included \(see ){/section-5.1 xl}(section 5.1){el}(\), then the macro )2(__USE_ALTREG__)0( is)]428.8 norm1 +[(defined.)]417.8 norm2 +[{/section-4.11.9 xa}2(__PASS__)0(: Assembly Pass)](4.11.9)398.6 subh3 +[(The macro )2(__PASS__)0( is defined to be )2(1)0( on preparatory passes, and )2(2)0( on the final pass. In preprocess-only)]381.6 norm1 +[(mode, it is set to )2(3)0(, and when running only to generate dependencies \(due to the )2(-M)0( or )2(-MG)0( option, see)]370.6 norm0 +[{/section-2.1.4 xl}(section 2.1.4){el}(\) it is set to )2(0)0(.)]359.6 norm2 +[1(Avoid using this macro if at all possible. It is tremendously easy to generate very strange errors by misusing)]342.6 norm1 +[1(it, and the semantics may change in future versions of NASM.)]331.6 norm2 +[{/section-4.11.10 xa}2(STRUC)0( and )2(ENDSTRUC)0(: )(Declaring Structure Data Types)](4.11.10)312.4 subh3 +[(The core of NASM contains no intrinsic means of defining data structures; instead, the preprocessor is)]295.4 norm1 +[(sufficiently powerful that data structures can be implemented as a set of macros. The macros )2(STRUC)0( and)]284.4 norm0 +[2(ENDSTRUC)0( are used to define a structure data type.)]273.4 norm2 +[2(STRUC)0( takes one or two parameters. The first parameter is the name of the data type. The second, optional)]256.4 norm1 +[(parameter is the base offset of the structure. The name of the data type is defined as a symbol with the value)]245.4 norm0 +[(of the base offset, and the name of the data type with the suffix )2(_size)0( appended to it is defined as an )2(EQU)]234.4 norm0 +[(giving the size of the structure. Once )2(STRUC)0( has been issued, you are defining the structure, and should)]223.4 norm0 +[(define fields using the )2(RESB)0( family of pseudo-instructions, and then invoke )2(ENDSTRUC)0( to finish the)]212.4 norm0 +[(definition.)]201.4 norm2 +[(For example, to define a structure called )2(mytype)0( containing a longword, a word, a byte and a string of bytes,)]184.4 norm1 +[(you might code)]173.4 norm2 +[2(struc mytype )]156.4 code1 +[2()]145.4 code0 +[2( mt_long: resd 1 )]134.4 code0 +[2( mt_word: resw 1 )]123.4 code0 +[2( mt_byte: resb 1 )]112.4 code0 +[2( mt_str: resb 32 )]101.4 code0 +(62)pageeven +restore showpage +%%Page: 63 63 +%%BeginPageSetup +save +%%EndPageSetup +/63 pa +[2()]681 code0 +[2(endstruc)]670 code2 +[(The above code defines six symbols: )2(mt_long)0( as 0 \(the offset from the beginning of a )2(mytype)0( structure to)]653 norm1 +[(the longword field\), )2(mt_word)0( as 4, )2(mt_byte)0( as 6, )2(mt_str)0( as 7, )2(mytype_size)0( as 39, and )2(mytype)0( itself)]642 norm0 +[(as zero.)]631 norm2 +[(The reason why the structure type name is defined at zero by default is a side effect of allowing structures to)]614 norm1 +[(work with the local label mechanism: if your structure members tend to have the same names in more than)]603 norm0 +[(one structure, you can define the above structure like this:)]592 norm2 +[2(struc mytype )]575 code1 +[2()]564 code0 +[2( .long: resd 1 )]553 code0 +[2( .word: resw 1 )]542 code0 +[2( .byte: resb 1 )]531 code0 +[2( .str: resb 32 )]520 code0 +[2()]509 code0 +[2(endstruc)]498 code2 +[(This defines the offsets to the structure fields as )2(mytype.long)0(, )2(mytype.word)0(, )2(mytype.byte)0( and)]481 norm1 +[2(mytype.str)0(.)]470 norm2 +[(NASM, since it has no )1(intrinsic)0( structure support, does not support any form of period notation to refer to the)]453 norm1 +[(elements of a structure once you have one \(except the above local-label notation\), so code such as)]442 norm0 +[2(mov ax,[mystruc.mt_word])0( is not valid. )2(mt_word)0( is a constant just like any other constant, so the)]431 norm0 +[(correct syntax is )2(mov ax,[mystruc+mt_word])0( or )2(mov ax,[mystruc+mytype.word])0(.)]420 norm2 +[(Sometimes you only have the address of the structure displaced by an offset. For example, consider this)]403 norm1 +[(standard stack frame setup:)]392 norm2 +[2(push ebp )]375 code1 +[2(mov ebp, esp )]364 code0 +[2(sub esp, 40)]353 code2 +[(In this case, you could access an element by subtracting the offset:)]336 norm3 +[2(mov [ebp - 40 + mytype.word], ax)]319 code3 +[(However, if you do not want to repeat this offset, you can use \22640 as a base offset:)]302 norm3 +[2(struc mytype, -40)]285 code3 +[(And access an element this way:)]268 norm3 +[2(mov [ebp + mytype.word], ax)]251 code3 +[{/section-4.11.11 xa}2(ISTRUC)0(, )2(AT)0( and )2(IEND)0(: Declaring )(Instances of Structures)](4.11.11)231.8 subh3 +[(Having defined a structure type, the next thing you typically want to do is to declare instances of that structure)]214.8 norm1 +[(in your data segment. NASM provides an easy way to do this in the )2(ISTRUC)0( mechanism. To declare a)]203.8 norm0 +[(structure of type )2(mytype)0( in a program, you code something like this:)]192.8 norm2 +[2(mystruc: )]175.8 code1 +[2( istruc mytype )]164.8 code0 +[2()]153.8 code0 +[2( at mt_long, dd 123456 )]142.8 code0 +[2( at mt_word, dw 1024 )]131.8 code0 +[2( at mt_byte, db 'x' )]120.8 code0 +[2( at mt_str, db 'hello, world', 13, 10, 0 )]109.8 code0 +(63)pageodd +restore showpage +%%Page: 64 64 +%%BeginPageSetup +save +%%EndPageSetup +/64 pa +[2()]681 code0 +[2( iend)]670 code2 +[(The function of the )2(AT)0( macro is to make use of the )2(TIMES)0( prefix to advance the assembly position to the)]653 norm1 +[(correct point for the specified structure field, and then to declare the specified data. Therefore the structure)]642 norm0 +[(fields must be declared in the same order as they were specified in the structure definition.)]631 norm2 +[(If the data to go in a structure field requires more than one source line to specify, the remaining source lines)]614 norm1 +[(can easily come after the )2(AT)0( line. For example:)]603 norm2 +[2( at mt_str, db 123,134,145,156,167,178,189 )]586 code1 +[2( db 190,100,0)]575 code2 +[(Depending on personal taste, you can also omit the code part of the )2(AT)0( line completely, and start the structure)]558 norm1 +[(field on the next line:)]547 norm2 +[2( at mt_str )]530 code1 +[2( db 'hello, world' )]519 code0 +[2( db 13,10,0)]508 code2 +[{/section-4.11.12 xa}2(ALIGN)0( and )2(ALIGNB)0(: Data Alignment)](4.11.12)488.8 subh3 +[(The )2(ALIGN)0( and )2(ALIGNB)0( macros provides a convenient way to align code or data on a word, longword,)]471.8 norm1 +[(paragraph or other boundary. \(Some assemblers call this directive )2(EVEN)0(.\) The syntax of the )2(ALIGN)0( and)]460.8 norm0 +[2(ALIGNB)0( macros is)]449.8 norm2 +[2( align 4 ; align on 4-byte boundary )]432.8 code1 +[2( align 16 ; align on 16-byte boundary )]421.8 code0 +[2( align 8,db 0 ; pad with 0s rather than NOPs )]410.8 code0 +[2( align 4,resb 1 ; align to 4 in the BSS )]399.8 code0 +[2( alignb 4 ; equivalent to previous line)]388.8 code2 +[(Both macros require their first argument to be a power of two; they both compute the number of additional)]371.8 norm1 +[(bytes required to bring the length of the current section up to a multiple of that power of two, and then apply)]360.8 norm0 +[(the )2(TIMES)0( prefix to their second argument to perform the alignment.)]349.8 norm2 +[(If the second argument is not specified, the default for )2(ALIGN)0( is )2(NOP)0(, and the default for )2(ALIGNB)0( is)]332.8 norm1 +[2(RESB 1)0(. So if the second argument is specified, the two macros are equivalent. Normally, you can just use)]321.8 norm0 +[2(ALIGN)0( in code and data sections and )2(ALIGNB)0( in BSS sections, and never need the second argument except)]310.8 norm0 +[(for special purposes.)]299.8 norm2 +[2(ALIGN)0( and )2(ALIGNB)0(, being simple macros, perform no error checking: they cannot warn you if their first)]282.8 norm1 +[(argument fails to be a power of two, or if their second argument generates more than one byte of code. In each)]271.8 norm0 +[(of these cases they will silently do the wrong thing.)]260.8 norm2 +[2(ALIGNB)0( \(or )2(ALIGN)0( with a second argument of )2(RESB 1)0(\) can be used within structure definitions:)]243.8 norm3 +[2(struc mytype2 )]226.8 code1 +[2()]215.8 code0 +[2( mt_byte: )]204.8 code0 +[2( resb 1 )]193.8 code0 +[2( alignb 2 )]182.8 code0 +[2( mt_word: )]171.8 code0 +[2( resw 1 )]160.8 code0 +[2( alignb 4 )]149.8 code0 +[2( mt_long: )]138.8 code0 +[2( resd 1 )]127.8 code0 +[2( mt_str: )]116.8 code0 +[2( resb 32 )]105.8 code0 +(64)pageeven +restore showpage +%%Page: 65 65 +%%BeginPageSetup +save +%%EndPageSetup +/65 pa +[2()]681 code0 +[2(endstruc)]670 code2 +[(This will ensure that the structure members are sensibly aligned relative to the base of the structure.)]653 norm3 +[(A final caveat: )2(ALIGN)0( and )2(ALIGNB)0( work relative to the beginning of the )1(section)0(, not the beginning of the)]636 norm1 +[(address space in the final executable. Aligning to a 16-byte boundary when the section you're in is only)]625 norm0 +[(guaranteed to be aligned to a 4-byte boundary, for example, is a waste of effort. Again, NASM does not)]614 norm0 +[(check that the section's alignment characteristics are sensible for the use of )2(ALIGN)0( or )2(ALIGNB)0(.)]603 norm2 +[(See also the )2(smartalign)0( standard macro package, ){/section-5.2 xl}(section 5.2){el}(.)]586 norm3 +(65)pageodd +restore showpage +%%Page: 66 66 +%%BeginPageSetup +save +%%EndPageSetup +/66 pa +[{/chapter-5 xa}(Chapter 5: )(Standard Macro Packages)]642.8 chap3 +[(The )2(%use)0( directive \(see ){/section-4.6.4 xl}(section 4.6.4){el}(\) includes one of the standard macro packages included with the NASM)]607.8 norm1 +[(distribution and compiled into the NASM binary. It operates like the )2(%include)0( directive \(see ){/section-4.6.1 xl}(section 4.6.1){el}(\),)]596.8 norm0 +[(but the included contents is provided by NASM itself.)]585.8 norm2 +[(The names of standard macro packages are case insensitive, and can be quoted or not.)]568.8 norm3 +[{/section-5.1 xa}2(altreg)0(: )(Alternate Register Names)](5.1)547.4 head3 +[(The )2(altreg)0( standard macro package provides alternate register names. It provides numeric register names)]530.4 norm1 +[(for all registers \(not just )2(R8)0(\226)2(R15)0(\), the Intel-defined aliases )2(R8L)0(\226)2(R15L)0( for the low bytes of register \(as)]519.4 norm0 +[(opposed to the NASM/AMD standard names )2(R8B)0(\226)2(R15B)0(\), and the names )2(R0H)0(\226)2(R3H)0( \(by analogy with)]508.4 norm0 +[2(R0L)0(\226)2(R3L)0(\) for )2(AH)0(, )2(CH)0(, )2(DH)0(, and )2(BH)0(.)]497.4 norm2 +[(Example use:)]480.4 norm3 +[2(%use altreg )]463.4 code1 +[2()]452.4 code0 +[2(proc: )]441.4 code0 +[2( mov r0l,r3h ; mov al,bh )]430.4 code0 +[2( ret)]419.4 code2 +[(See also ){/section-11.1 xl}(section 11.1){el}(.)]402.4 norm3 +[{/section-5.2 xa}2(smartalign)0(: Smart )2(ALIGN)0( Macro)](5.2)381 head3 +[(The )2(smartalign)0( standard macro package provides for an )2(ALIGN)0( macro which is more powerful than the)]364 norm1 +[(default \(and backwards-compatible\) one \(see ){/section-4.11.12 xl}(section 4.11.12){el}(\). When the )2(smartalign)0( package is enabled,)]353 norm0 +[(when )2(ALIGN)0( is used without a second argument, NASM will generate a sequence of instructions more)]342 norm0 +[(efficient than a series of )2(NOP)0(. Furthermore, if the padding exceeds a specific threshold, then NASM will)]331 norm0 +[(generate a jump over the entire padding sequence.)]320 norm2 +[(The specific instructions generated can be controlled with the new )2(ALIGNMODE)0( macro. This macro takes two)]303 norm1 +[(parameters: one mode, and an optional jump threshold override. The modes are as follows:)]292 norm2 +[2(generic)0(: Works on all x86 CPUs and should have reasonable performance. The default jump threshold)]275 bull1 +[(is 8. This is the default.)]264 bull2 +[2(nop)0(: Pad out with )2(NOP)0( instructions. The only difference compared to the standard )2(ALIGN)0( macro is that)]247 bull1 +[(NASM can still jump over a large padding area. The default jump threshold is 16.)]236 bull2 +[2(k7)0(: Optimize for the AMD K7 \(Athlon/Althon XP\). These instructions should still work on all x86 CPUs.)]219 bull1 +[(The default jump threshold is 16.)]208 bull2 +[2(k8)0(: Optimize for the AMD K8 \(Opteron/Althon 64\). These instructions should still work on all x86 CPUs.)]191 bull1 +[(The default jump threshold is 16.)]180 bull2 +[2(p6)0(: Optimize for Intel CPUs. This uses the long )2(NOP)0( instructions first introduced in Pentium Pro. This is)]163 bull1 +[(incompatible with all CPUs of family 5 or lower, as well as some VIA CPUs and several virtualization)]152 bull0 +[(solutions. The default jump threshold is 16.)]141 bull2 +[(The macro )2(__ALIGNMODE__)0( is defined to contain the current alignment mode. A number of other macros)]124 norm1 +[(beginning with )2(__ALIGN_)0( are used internally by this macro package.)]113 norm2 +(66)pageeven +restore showpage +%%Page: 67 67 +%%BeginPageSetup +save +%%EndPageSetup +/67 pa +[{/chapter-6 xa}(Chapter 6: )(Assembler Directives)]642.8 chap3 +[(NASM, though it attempts to avoid the bureaucracy of assemblers like MASM and TASM, is nevertheless)]607.8 norm1 +[(forced to support a )1(few)0( directives. These are described in this chapter.)]596.8 norm2 +[(NASM's directives come in two types: )1(user-level)0( directives and )1(primitive)0( directives. Typically, each)]579.8 norm1 +[(directive has a user-level form and a primitive form. In almost all cases, we recommend that users use the)]568.8 norm0 +[(user-level forms of the directives, which are implemented as macros which call the primitive forms.)]557.8 norm2 +[(Primitive directives are enclosed in square brackets; user-level directives are not.)]540.8 norm3 +[(In addition to the universal directives described in this chapter, each object file format can optionally supply)]523.8 norm1 +[(extra directives in order to control particular features of that file format. These )1(format-specific)0( directives are)]512.8 norm0 +[(documented along with the formats that implement them, in ){/chapter-7 xl}(chapter 7){el}(.)]501.8 norm2 +[{/section-6.1 xa}2(BITS)0(: Specifying Target )(Processor Mode)](6.1)480.4 head3 +[(The )2(BITS)0( directive specifies whether NASM should generate code )(designed to run on a processor operating)]463.4 norm1 +[(in 16-bit mode, 32-bit mode or 64-bit mode. The syntax is )2(BITS XX)0(, where XX is 16, 32 or 64.)]452.4 norm2 +[(In most cases, you should not need to use )2(BITS)0( explicitly. The )2(aout)0(, )2(coff)0(, )2(elf)0(, )2(macho)0(, )2(win32)0( and)]435.4 norm1 +[2(win64)0( object formats, which are designed for use in 32-bit or 64-bit operating systems, all cause NASM to)]424.4 norm0 +[(select 32-bit or 64-bit mode, respectively, by default. The )2(obj)0( object format allows you to specify each)]413.4 norm0 +[(segment you define as either )2(USE16)0( or )2(USE32)0(, and NASM will set its operating mode accordingly, so the)]402.4 norm0 +[(use of the )2(BITS)0( directive is once again unnecessary.)]391.4 norm2 +[(The most likely reason for using the )2(BITS)0( directive is to write 32-bit or 64-bit code in a flat binary file; this)]374.4 norm1 +[(is because the )2(bin)0( output format defaults to 16-bit mode in anticipation of it being used most frequently to)]363.4 norm0 +[(write DOS )2(.COM)0( programs, DOS )2(.SYS)0( device drivers and boot loader software.)]352.4 norm2 +[(You do )1(not)0( need to specify )2(BITS 32)0( merely in order to use 32-bit instructions in a 16-bit DOS program; if)]335.4 norm1 +[(you do, the assembler will generate incorrect code because it will be writing code targeted at a 32-bit)]324.4 norm0 +[(platform, to be run on a 16-bit one.)]313.4 norm2 +[(When NASM is in )2(BITS 16)0( mode, instructions which use 32-bit data are prefixed with an 0x66 byte, and)]296.4 norm1 +[(those referring to 32-bit addresses have an 0x67 prefix. In )2(BITS 32)0( mode, the reverse is true: 32-bit)]285.4 norm0 +[(instructions require no prefixes, whereas instructions using 16-bit data need an 0x66 and those working on)]274.4 norm0 +[(16-bit addresses need an 0x67.)]263.4 norm2 +[(When NASM is in )2(BITS 64)0( mode, most instructions operate the same as they do for )2(BITS 32)0( mode.)]246.4 norm1 +[(However, there are 8 more general and SSE registers, and 16-bit addressing is no longer supported.)]235.4 norm2 +[(The default address size is 64 bits; 32-bit addressing can be selected with the 0x67 prefix. The default)]218.4 norm1 +[(operand size is still 32 bits, however, and the 0x66 prefix selects 16-bit operand size. The )2(REX)0( prefix is used)]207.4 norm0 +[(both to select 64-bit operand size, and to access the new registers. NASM automatically inserts REX prefixes)]196.4 norm0 +[(when necessary.)]185.4 norm2 +[(When the )2(REX)0( prefix is used, the processor does not know how to address the AH, BH, CH or DH \(high 8-bit)]168.4 norm1 +[(legacy\) registers. Instead, it is possible to access the the low 8-bits of the SP, BP SI and DI registers as SPL,)]157.4 norm0 +[(BPL, SIL and DIL, respectively; but only when the REX prefix is used.)]146.4 norm2 +[(The )2(BITS)0( directive has an exactly equivalent primitive form, )2([BITS 16])0(, )2([BITS 32])0( and )2([BITS 64])0(.)]129.4 norm1 +[(The user-level form is a macro which has no function other than to call the primitive form.)]118.4 norm2 +[(Note that the space is neccessary, e.g. )2(BITS32)0( will )1(not)0( work!)]101.4 norm3 +(67)pageodd +restore showpage +%%Page: 68 68 +%%BeginPageSetup +save +%%EndPageSetup +/68 pa +[{/section-6.1.1 xa}2(USE16)0( & )2(USE32)0(: Aliases for BITS)](6.1.1)678.8 subh3 +[(The `)2(USE16)0(' and `)2(USE32)0(' directives can be used in place of `)2(BITS 16)0(' and `)2(BITS 32)0(', for compatibility)]661.8 norm1 +[(with other assemblers.)]650.8 norm2 +[{/section-6.2 xa}2(DEFAULT)0(: Change the assembler defaults)](6.2)629.4 head3 +[(The )2(DEFAULT)0( directive changes the assembler defaults. Normally, NASM defaults to a mode where the)]612.4 norm1 +[(programmer is expected to explicitly specify most features directly. However, this is occationally obnoxious,)]601.4 norm0 +[(as the explicit form is pretty much the only one one wishes to use.)]590.4 norm2 +[(Currently, the only )2(DEFAULT)0( that is settable is whether or not registerless instructions in 64-bit mode are)]573.4 norm1 +[2(RIP)0(\226relative or not. By default, they are absolute unless overridden with the )2(REL)0( specifier \(see ){/section-3.3 xl}(section 3.3){el}(\).)]562.4 norm0 +[(However, if )2(DEFAULT REL)0( is specified, )2(REL)0( is default, unless overridden with the )2(ABS)0( specifier, )1(except)]551.4 norm0 +[1(when used with an FS or GS segment override)0(.)]540.4 norm2 +[(The special handling of )2(FS)0( and )2(GS)0( overrides are due to the fact that these registers are generally used as)]523.4 norm1 +[(thread pointers or other special functions in 64-bit mode, and generating )2(RIP)0(\226relative addresses would be)]512.4 norm0 +[(extremely confusing.)]501.4 norm2 +[2(DEFAULT REL)0( is disabled with )2(DEFAULT ABS)0(.)]484.4 norm3 +[{/section-6.3 xa}2(SECTION)0( or )2(SEGMENT)0(: Changing and )(Defining Sections)](6.3)463 head3 +[(The )2(SECTION)0( directive \()2(SEGMENT)0( is an exactly equivalent synonym\) changes which section of the output)]446 norm1 +[(file the code you write will be assembled into. In some object file formats, the number and names of sections)]435 norm0 +[(are fixed; in others, the user may make up as many as they wish. Hence )2(SECTION)0( may sometimes give an)]424 norm0 +[(error message, or may define a new section, if you try to switch to a section that does not \(yet\) exist.)]413 norm2 +[(The Unix object formats, and the )2(bin)0( object format \(but see ){/section-7.1.3 xl}(section 7.1.3){el}(, all support the )(standardized section)]396 norm1 +[(names )2(.text)0(, )2(.data)0( and )2(.bss)0( for the code, data and uninitialized-data sections. The )2(obj)0( format, by)]385 norm0 +[(contrast, does not recognize these section names as being special, and indeed will strip off the leading period)]374 norm0 +[(of any section name that has one.)]363 norm2 +[{/section-6.3.1 xa}(The )2(__SECT__)0( Macro)](6.3.1)343.8 subh3 +[(The )2(SECTION)0( directive is unusual in that its user-level form functions differently from its primitive form.)]326.8 norm1 +[(The primitive form, )2([SECTION xyz])0(, simply switches the current target section to the one given. The)]315.8 norm0 +[(user-level form, )2(SECTION xyz)0(, however, first defines the single-line macro )2(__SECT__)0( to be the primitive)]304.8 norm0 +[2([SECTION])0( directive which it is about to issue, and then issues it. So the user-level directive)]293.8 norm2 +[2( SECTION .text)]276.8 code3 +[(expands to the two lines)]259.8 norm3 +[2(%define __SECT__ [SECTION .text] )]242.8 code1 +[2( [SECTION .text])]231.8 code2 +[(Users may find it useful to make use of this in their own macros. For example, the )2(writefile)0( macro)]214.8 norm1 +[(defined in ){/section-4.3.4 xl}(section 4.3.4){el}( can be usefully rewritten in the following more sophisticated form:)]203.8 norm2 +[2(%macro writefile 2+ )]186.8 code1 +[2()]175.8 code0 +[2( [section .data] )]164.8 code0 +[2()]153.8 code0 +[2( %%str: db %2 )]142.8 code0 +[2( %%endstr: )]131.8 code0 +[2()]120.8 code0 +[2( __SECT__ )]109.8 code0 +(68)pageeven +restore showpage +%%Page: 69 69 +%%BeginPageSetup +save +%%EndPageSetup +/69 pa +[2()]681 code0 +[2( mov dx,%%str )]670 code0 +[2( mov cx,%%endstr-%%str )]659 code0 +[2( mov bx,%1 )]648 code0 +[2( mov ah,0x40 )]637 code0 +[2( int 0x21 )]626 code0 +[2()]615 code0 +[2(%endmacro)]604 code2 +[(This form of the macro, once passed a string to output, first switches temporarily to the data section of the file,)]587 norm1 +[(using the primitive form of the )2(SECTION)0( directive so as not to modify )2(__SECT__)0(. It then declares its string)]576 norm0 +[(in the data section, and then invokes )2(__SECT__)0( to switch back to )1(whichever)0( section the user was previously)]565 norm0 +[(working in. It thus avoids the need, in the previous version of the macro, to include a )2(JMP)0( instruction to jump)]554 norm0 +[(over the data, and also does not fail if, in a complicated )2(OBJ)0( format module, the user could potentially be)]543 norm0 +[(assembling the code in any of several separate code sections.)]532 norm2 +[{/section-6.4 xa}2(ABSOLUTE)0(: Defining Absolute Labels)](6.4)510.6 head3 +[(The )2(ABSOLUTE)0( directive can be thought of as an alternative form of )2(SECTION)0(: it causes the subsequent)]493.6 norm1 +[(code to be directed at no physical section, but at the hypothetical section starting at the given absolute address.)]482.6 norm0 +[(The only instructions you can use in this mode are the )2(RESB)0( family.)]471.6 norm2 +[2(ABSOLUTE)0( is used as follows:)]454.6 norm3 +[2(absolute 0x1A )]437.6 code1 +[2()]426.6 code0 +[2( kbuf_chr resw 1 )]415.6 code0 +[2( kbuf_free resw 1 )]404.6 code0 +[2( kbuf resw 16)]393.6 code2 +[(This example describes a section of the PC BIOS data area, at segment address 0x40: the above code defines)]376.6 norm1 +[2(kbuf_chr)0( to be 0x1A, )2(kbuf_free)0( to be 0x1C, and )2(kbuf)0( to be 0x1E.)]365.6 norm2 +[(The user-level form of )2(ABSOLUTE)0(, like that of )2(SECTION)0(, redefines the )2(__SECT__)0( macro when it is)]348.6 norm1 +[(invoked.)]337.6 norm2 +[2(STRUC)0( and )2(ENDSTRUC)0( are defined as macros which use )2(ABSOLUTE)0( \(and also )2(__SECT__)0(\).)]320.6 norm3 +[2(ABSOLUTE)0( doesn't have to take an absolute constant as an argument: it can take an expression \(actually, a)]303.6 norm1 +[(critical expression: see ){/section-3.8 xl}(section 3.8){el}(\) and it can be a value in a segment. For example, a TSR can re-use its)]292.6 norm0 +[(setup code as run-time BSS like this:)]281.6 norm2 +[2( org 100h ; it's a .COM program )]264.6 code1 +[2()]253.6 code0 +[2( jmp setup ; setup code comes last )]242.6 code0 +[2()]231.6 code0 +[2( ; the resident part of the TSR goes here )]220.6 code0 +[2(setup: )]209.6 code0 +[2( ; now write the code that installs the TSR here )]198.6 code0 +[2()]187.6 code0 +[2(absolute setup )]176.6 code0 +[2()]165.6 code0 +[2(runtimevar1 resw 1 )]154.6 code0 +[2(runtimevar2 resd 20 )]143.6 code0 +[2()]132.6 code0 +[2(tsr_end:)]121.6 code2 +(69)pageodd +restore showpage +%%Page: 70 70 +%%BeginPageSetup +save +%%EndPageSetup +/70 pa +[(This defines some variables `on top of' the setup code, so that after the setup has finished running, the space it)]681 norm1 +[(took up can be re-used as data storage for the running TSR. The symbol `tsr_end' can be used to calculate the)]670 norm0 +[(total size of the part of the TSR that needs to be made resident.)]659 norm2 +[{/section-6.5 xa}2(EXTERN)0(: )(Importing Symbols from Other Modules)](6.5)637.6 head3 +[2(EXTERN)0( is similar to the MASM directive )2(EXTRN)0( and the C keyword )2(extern)0(: it is used to declare a symbol)]620.6 norm1 +[(which is not defined anywhere in the module being assembled, but is assumed to be defined in some other)]609.6 norm0 +[(module and needs to be referred to by this one. Not every object-file format can support external variables:)]598.6 norm0 +[(the )2(bin)0( format cannot.)]587.6 norm2 +[(The )2(EXTERN)0( directive takes as many arguments as you like. Each argument is the name of a symbol:)]570.6 norm3 +[2(extern _printf )]553.6 code1 +[2(extern _sscanf,_fscanf)]542.6 code2 +[(Some object-file formats provide extra features to the )2(EXTERN)0( directive. In all cases, the extra features are)]525.6 norm1 +[(used by suffixing a colon to the symbol name followed by object-format specific text. For example, the )2(obj)]514.6 norm0 +[(format allows you to declare that the default segment base of an external should be the group )2(dgroup)0( by)]503.6 norm0 +[(means of the directive)]492.6 norm2 +[2(extern _variable:wrt dgroup)]475.6 code3 +[(The primitive form of )2(EXTERN)0( differs from the user-level form only in that it can take only one argument at)]458.6 norm1 +[(a time: the support for multiple arguments is implemented at the preprocessor level.)]447.6 norm2 +[(You can declare the same variable as )2(EXTERN)0( more than once: NASM will quietly ignore the second and)]430.6 norm1 +[(later redeclarations. You can't declare a variable as )2(EXTERN)0( as well as something else, though.)]419.6 norm2 +[{/section-6.6 xa}2(GLOBAL)0(: )(Exporting Symbols to Other Modules)](6.6)398.2 head3 +[2(GLOBAL)0( is the other end of )2(EXTERN)0(: if one module declares a symbol as )2(EXTERN)0( and refers to it, then in)]381.2 norm1 +[(order to prevent linker errors, some other module must actually )1(define)0( the symbol and declare it as )2(GLOBAL)0(.)]370.2 norm0 +[(Some assemblers use the name )2(PUBLIC)0( for this purpose.)]359.2 norm2 +[(The )2(GLOBAL)0( directive applying to a symbol must appear )1(before)0( the definition of the symbol.)]342.2 norm3 +[2(GLOBAL)0( uses the same syntax as )2(EXTERN)0(, except that it must refer to symbols which )1(are)0( defined in the same)]325.2 norm1 +[(module as the )2(GLOBAL)0( directive. For example:)]314.2 norm2 +[2(global _main )]297.2 code1 +[2(_main: )]286.2 code0 +[2( ; some code)]275.2 code2 +[2(GLOBAL)0(, like )2(EXTERN)0(, allows object formats to define private extensions by means of a colon. The )2(elf)]258.2 norm1 +[(object format, for example, lets you specify whether global data items are functions or data:)]247.2 norm2 +[2(global hashlookup:function, hashtable:data)]230.2 code3 +[(Like )2(EXTERN)0(, the primitive form of )2(GLOBAL)0( differs from the user-level form only in that it can take only)]213.2 norm1 +[(one argument at a time.)]202.2 norm2 +[{/section-6.7 xa}2(COMMON)0(: Defining Common Data Areas)](6.7)180.8 head3 +[(The )2(COMMON)0( directive is used to declare )1(common variables)0(. A common variable is much like a global)]163.8 norm1 +[(variable declared in the uninitialized data section, so that)]152.8 norm2 +[2(common intvar 4)]135.8 code3 +[(is similar in function to)]118.8 norm3 +(70)pageeven +restore showpage +%%Page: 71 71 +%%BeginPageSetup +save +%%EndPageSetup +/71 pa +[2(global intvar )]681 code1 +[2(section .bss )]670 code0 +[2()]659 code0 +[2(intvar resd 1)]648 code2 +[(The difference is that if more than one module defines the same common variable, then at link time those)]631 norm1 +[(variables will be )1(merged)0(, and references to )2(intvar)0( in all modules will point at the same piece of memory.)]620 norm2 +[(Like )2(GLOBAL)0( and )2(EXTERN)0(, )2(COMMON)0( supports object-format specific extensions. For example, the )2(obj)]603 norm1 +[(format allows common variables to be NEAR or FAR, and the )2(elf)0( format allows you to specify the)]592 norm0 +[(alignment requirements of a common variable:)]581 norm2 +[2(common commvar 4:near ; works in OBJ )]564 code1 +[2(common intarray 100:4 ; works in ELF: 4 byte aligned)]553 code2 +[(Once again, like )2(EXTERN)0( and )2(GLOBAL)0(, the primitive form of )2(COMMON)0( differs from the user-level form only)]536 norm1 +[(in that it can take only one argument at a time.)]525 norm2 +[{/section-6.8 xa}2(CPU)0(: Defining CPU Dependencies)](6.8)503.6 head3 +[(The )2(CPU)0( directive restricts assembly to those instructions which are available on the specified CPU.)]486.6 norm3 +[(Options are:)]469.6 norm3 +[2(CPU 8086)0( Assemble only 8086 instruction set)]452.6 bull3 +[2(CPU 186)0( Assemble instructions up to the 80186 instruction set)]435.6 bull3 +[2(CPU 286)0( Assemble instructions up to the 286 instruction set)]418.6 bull3 +[2(CPU 386)0( Assemble instructions up to the 386 instruction set)]401.6 bull3 +[2(CPU 486)0( 486 instruction set)]384.6 bull3 +[2(CPU 586)0( Pentium instruction set)]367.6 bull3 +[2(CPU PENTIUM)0( Same as 586)]350.6 bull3 +[2(CPU 686)0( P6 instruction set)]333.6 bull3 +[2(CPU PPRO)0( Same as 686)]316.6 bull3 +[2(CPU P2)0( Same as 686)]299.6 bull3 +[2(CPU P3)0( Pentium III \(Katmai\) instruction sets)]282.6 bull3 +[2(CPU KATMAI)0( Same as P3)]265.6 bull3 +[2(CPU P4)0( Pentium 4 \(Willamette\) instruction set)]248.6 bull3 +[2(CPU WILLAMETTE)0( Same as P4)]231.6 bull3 +[2(CPU PRESCOTT)0( Prescott instruction set)]214.6 bull3 +[2(CPU X64)0( x86-64 \(x64/AMD64/Intel 64\) instruction set)]197.6 bull3 +[2(CPU IA64)0( IA64 CPU \(in x86 mode\) instruction set)]180.6 bull3 +[(All options are case insensitive. All instructions will be selected only if they apply to the selected CPU or)]163.6 norm1 +[(lower. By default, all instructions are available.)]152.6 norm2 +[{/section-6.9 xa}2(FLOAT)0(: Handling of )(floating-point constants)](6.9)131.2 head3 +[(By default, floating-point constants are rounded to nearest, and IEEE denormals are supported. The following)]114.2 norm1 +[(options can be set to alter this behaviour:)]103.2 norm2 +(71)pageodd +restore showpage +%%Page: 72 72 +%%BeginPageSetup +save +%%EndPageSetup +/72 pa +[2(FLOAT DAZ)0( Flush denormals to zero)]681 bull3 +[2(FLOAT NODAZ)0( Do not flush denormals to zero \(default\))]664 bull3 +[2(FLOAT NEAR)0( Round to nearest \(default\))]647 bull3 +[2(FLOAT UP)0( Round up \(toward +Infinity\))]630 bull3 +[2(FLOAT DOWN)0( Round down \(toward \226Infinity\))]613 bull3 +[2(FLOAT ZERO)0( Round toward zero)]596 bull3 +[2(FLOAT DEFAULT)0( Restore default settings)]579 bull3 +[(The standard macros )2(__FLOAT_DAZ__)0(, )2(__FLOAT_ROUND__)0(, and )2(__FLOAT__)0( contain the current state,)]562 norm1 +[(as long as the programmer has avoided the use of the brackeded primitive form, \()2([FLOAT])0(\).)]551 norm2 +[2(__FLOAT__)0( contains the full set of floating-point settings; this value can be saved away and invoked later to)]534 norm1 +[(restore the setting.)]523 norm2 +(72)pageeven +restore showpage +%%Page: 73 73 +%%BeginPageSetup +save +%%EndPageSetup +/73 pa +[{/chapter-7 xa}(Chapter 7: )(Output Formats)]642.8 chap3 +[(NASM is a portable assembler, designed to be able to compile on any ANSI C-supporting platform and)]607.8 norm1 +[(produce output to run on a variety of Intel x86 operating systems. For this reason, it has a large number of)]596.8 norm0 +[(available output formats, selected using the )2(-f)0( option on the NASM )(command line. Each of these formats,)]585.8 norm0 +[(along with its extensions to the base NASM syntax, is detailed in this chapter.)]574.8 norm2 +[(As stated in ){/section-2.1.1 xl}(section 2.1.1){el}(, NASM chooses a )(default name for your output file based on the input file name and)]557.8 norm1 +[(the chosen output format. This will be generated by removing the )(extension \()2(.asm)0(, )2(.s)0(, or whatever you like)]546.8 norm0 +[(to use\) from the input file name, and substituting an extension defined by the output format. The extensions)]535.8 norm0 +[(are given with each format below.)]524.8 norm2 +[{/section-7.1 xa}2(bin)0(: )(Flat-Form Binary)( Output)](7.1)503.4 head3 +[(The )2(bin)0( format does not produce object files: it generates nothing in the output file except the code you)]486.4 norm1 +[(wrote. Such `pure binary' files are used by )(MS-DOS: )2(.COM)0( executables and )2(.SYS)0( device drivers are pure)]475.4 norm0 +[(binary files. Pure binary output is also useful for )(operating system and )(boot loader development.)]464.4 norm2 +[(The )2(bin)0( format supports )(multiple section names. For details of how NASM handles sections in the )2(bin)]447.4 norm1 +[(format, see ){/section-7.1.3 xl}(section 7.1.3){el}(.)]436.4 norm2 +[(Using the )2(bin)0( format puts NASM by default into 16-bit mode \(see ){/section-6.1 xl}(section 6.1){el}(\). In order to use )2(bin)0( to write)]419.4 norm1 +[(32-bit or 64-bit code, such as an OS kernel, you need to explicitly issue the )2(BITS 32)0( or )2(BITS 64)0( directive.)]408.4 norm2 +[2(bin)0( has no default output file name extension: instead, it leaves your file name as it is once the original)]391.4 norm1 +[(extension has been removed. Thus, the default is for NASM to assemble )2(binprog.asm)0( into a binary file)]380.4 norm0 +[(called )2(binprog)0(.)]369.4 norm2 +[{/section-7.1.1 xa}2(ORG)0(: Binary File )(Program Origin)](7.1.1)350.2 subh3 +[(The )2(bin)0( format provides an additional directive to the list given in ){/chapter-6 xl}(chapter 6){el}(: )2(ORG)0(. The function of the )2(ORG)]333.2 norm1 +[(directive is to specify the origin address which NASM will assume the program begins at when it is loaded)]322.2 norm0 +[(into memory.)]311.2 norm2 +[(For example, the following code will generate the longword )2(0x00000104)0(:)]294.2 norm3 +[2( org 0x100 )]277.2 code1 +[2( dd label )]266.2 code0 +[2(label:)]255.2 code2 +[(Unlike the )2(ORG)0( directive provided by MASM-compatible assemblers, which allows you to jump around in)]238.2 norm1 +[(the object file and overwrite code you have already generated, NASM's )2(ORG)0( does exactly what the directive)]227.2 norm0 +[(says: )1(origin)0(. Its sole function is to specify one offset which is added to all internal address references within)]216.2 norm0 +[(the section; it does not permit any of the trickery that MASM's version does. See ){/section-12.1.3 xl}(section 12.1.3){el}( for further)]205.2 norm0 +[(comments.)]194.2 norm2 +[{/section-7.1.2 xa}2(bin)0( Extensions to the )2(SECTION)0( Directive)](7.1.2)175 subh3 +[(The )2(bin)0( output format extends the )2(SECTION)0( \(or )2(SEGMENT)0(\) directive to allow you to specify the alignment)]158 norm1 +[(requirements of segments. This is done by appending the )2(ALIGN)0( qualifier to the end of the section-definition)]147 norm0 +[(line. For example,)]136 norm2 +[2(section .data align=16)]119 code3 +[(switches to the section )2(.data)0( and also specifies that it must be aligned on a 16-byte boundary.)]102 norm3 +(73)pageodd +restore showpage +%%Page: 74 74 +%%BeginPageSetup +save +%%EndPageSetup +/74 pa +[(The parameter to )2(ALIGN)0( specifies how many low bits of the section start address must be forced to zero. The)]681 norm1 +[(alignment value given may be any power of two.)]670 norm2 +[{/section-7.1.3 xa}(Multisection)( Support for the )2(bin)0( Format)](7.1.3)650.8 subh3 +[(The )2(bin)0( format allows the use of multiple sections, of arbitrary names, besides the "known" )2(.text)0(, )2(.data)0(,)]633.8 norm1 +[(and )2(.bss)0( names.)]622.8 norm2 +[(Sections may be designated )2(progbits)0( or )2(nobits)0(. Default is )2(progbits)0( \(except )2(.bss)0(, which defaults)]605.8 bull1 +[(to )2(nobits)0(, of course\).)]594.8 bull2 +[(Sections can be aligned at a specified boundary following the previous section with )2(align=)0(, or at an)]577.8 bull1 +[(arbitrary byte-granular position with )2(start=)0(.)]566.8 bull2 +[(Sections can be given a virtual start address, which will be used for the calculation of all memory)]549.8 bull1 +[(references within that section with )2(vstart=)0(.)]538.8 bull2 +[(Sections can be ordered using )2(follows=<section>)0( or )2(vfollows=<section>)0( as an alternative to)]521.8 bull1 +[(specifying an explicit start address.)]510.8 bull2 +[(Arguments to )2(org)0(, )2(start)0(, )2(vstart)0(, and )2(align=)0( are critical expressions. See ){/section-3.8 xl}(section 3.8){el}(. E.g.)]493.8 bull1 +[2(align=\(1 << ALIGN_SHIFT\))0( \226 )2(ALIGN_SHIFT)0( must be defined before it is used here.)]482.8 bull2 +[(Any code which comes before an explicit )2(SECTION)0( directive is directed by default into the )2(.text)]465.8 bull1 +[(section.)]454.8 bull2 +[(If an )2(ORG)0( statement is not given, )2(ORG 0)0( is used by default.)]437.8 bull3 +[(The )2(.bss)0( section will be placed after the last )2(progbits)0( section, unless )2(start=)0(, )2(vstart=)0(,)]420.8 bull1 +[2(follows=)0(, or )2(vfollows=)0( has been specified.)]409.8 bull2 +[(All sections are aligned on dword boundaries, unless a different alignment has been specified.)]392.8 bull3 +[(Sections may not overlap.)]375.8 bull3 +[(NASM creates the )2(section.<secname>.start)0( for each section, which may be used in your code.)]358.8 bull3 +[{/section-7.1.4 xa}(Map Files)](7.1.4)339.6 subh3 +[(Map files can be generated in )2(-f bin)0( format by means of the )2([map])0( option. Map types of )2(all)0( \(default\),)]322.6 norm1 +[2(brief)0(, )2(sections)0(, )2(segments)0(, or )2(symbols)0( may be specified. Output may be directed to )2(stdout)]311.6 norm0 +[(\(default\), )2(stderr)0(, or a specified file. E.g. )2([map symbols myfile.map])0(. No "user form" exists, the)]300.6 norm0 +[(square brackets must be used.)]289.6 norm2 +[{/section-7.2 xa}2(ith)0(: )(Intel Hex Output)](7.2)268.2 head3 +[(The )2(ith)0( file format produces Intel hex-format files. Just as the )2(bin)0( format, this is a flat memory image)]251.2 norm1 +[(format with no support for relocation or linking. It is usually used with ROM programmers and similar)]240.2 norm0 +[(utilities.)]229.2 norm2 +[(All extensions supported by the )2(bin)0( file format is also supported by the )2(ith)0( file format.)]212.2 norm3 +[2(ith)0( provides a default output file-name extension of )2(.ith)0(.)]195.2 norm3 +[{/section-7.3 xa}2(srec)0(: )(Motorola S-Records Output)](7.3)173.8 head3 +[(The )2(srec)0( file format produces Motorola S-records files. Just as the )2(bin)0( format, this is a flat memory image)]156.8 norm1 +[(format with no support for relocation or linking. It is usually used with ROM programmers and similar)]145.8 norm0 +[(utilities.)]134.8 norm2 +[(All extensions supported by the )2(bin)0( file format is also supported by the )2(srec)0( file format.)]117.8 norm3 +[2(srec)0( provides a default output file-name extension of )2(.srec)0(.)]100.8 norm3 +(74)pageeven +restore showpage +%%Page: 75 75 +%%BeginPageSetup +save +%%EndPageSetup +/75 pa +[{/section-7.4 xa}2(obj)0(: )(Microsoft OMF)( Object Files)](7.4)676.6 head3 +[(The )2(obj)0( file format \(NASM calls it )2(obj)0( rather than )2(omf)0( for historical reasons\) is the one produced by)]659.6 norm1 +[(MASM and )(TASM, which is typically fed to 16-bit DOS linkers to produce )2(.EXE)0( files. It is also the format)]648.6 norm0 +[(used by )(OS/2.)]637.6 norm2 +[2(obj)0( provides a default output file-name extension of )2(.obj)0(.)]620.6 norm3 +[2(obj)0( is not exclusively a 16-bit format, though: NASM has full support for the 32-bit extensions to the)]603.6 norm1 +[(format. In particular, 32-bit )2(obj)0( format files are used by )(Borland's Win32 compilers, instead of using)]592.6 norm0 +[(Microsoft's newer )2(win32)0( object file format.)]581.6 norm2 +[(The )2(obj)0( format does not define any special segment names: you can call your segments anything you like.)]564.6 norm1 +[(Typical names for segments in )2(obj)0( format files are )2(CODE)0(, )2(DATA)0( and )2(BSS)0(.)]553.6 norm2 +[(If your source file contains code before specifying an explicit )2(SEGMENT)0( directive, then NASM will invent its)]536.6 norm1 +[(own segment called )2(__NASMDEFSEG)0( for you.)]525.6 norm2 +[(When you define a segment in an )2(obj)0( file, NASM defines the segment name as a symbol as well, so that you)]508.6 norm1 +[(can access the segment address of the segment. So, for example:)]497.6 norm2 +[2(segment data )]480.6 code1 +[2()]469.6 code0 +[2(dvar: dw 1234 )]458.6 code0 +[2()]447.6 code0 +[2(segment code )]436.6 code0 +[2()]425.6 code0 +[2(function: )]414.6 code0 +[2( mov ax,data ; get segment address of data )]403.6 code0 +[2( mov ds,ax ; and move it into DS )]392.6 code0 +[2( inc word [dvar] ; now this reference will work )]381.6 code0 +[2( ret)]370.6 code2 +[(The )2(obj)0( format also enables the use of the )2(SEG)0( and )2(WRT)0( operators, so that you can write code which does)]353.6 norm1 +[(things like)]342.6 norm2 +[2(extern foo )]325.6 code1 +[2()]314.6 code0 +[2( mov ax,seg foo ; get preferred segment of foo )]303.6 code0 +[2( mov ds,ax )]292.6 code0 +[2( mov ax,data ; a different segment )]281.6 code0 +[2( mov es,ax )]270.6 code0 +[2( mov ax,[ds:foo] ; this accesses `foo' )]259.6 code0 +[2( mov [es:foo wrt data],bx ; so does this)]248.6 code2 +[{/section-7.4.1 xa}2(obj)0( Extensions to the )2(SEGMENT)0( Directive)](7.4.1)229.4 subh3 +[(The )2(obj)0( output format extends the )2(SEGMENT)0( \(or )2(SECTION)0(\) directive to allow you to specify various)]212.4 norm1 +[(properties of the segment you are defining. This is done by appending extra qualifiers to the end of the)]201.4 norm0 +[(segment-definition line. For example,)]190.4 norm2 +[2(segment code private align=16)]173.4 code3 +[(defines the segment )2(code)0(, but also declares it to be a private segment, and requires that the portion of it)]156.4 norm1 +[(described in this code module must be aligned on a 16-byte boundary.)]145.4 norm2 +[(The available qualifiers are:)]128.4 norm3 +[2(PRIVATE)0(, )2(PUBLIC)0(, )2(COMMON)0( and )2(STACK)0( specify the combination characteristics of the segment.)]111.4 bull1 +[2(PRIVATE)0( segments do not get combined with any others by the linker; )2(PUBLIC)0( and )2(STACK)0( segments get)]100.4 bull0 +(75)pageodd +restore showpage +%%Page: 76 76 +%%BeginPageSetup +save +%%EndPageSetup +/76 pa +[(concatenated together at link time; and )2(COMMON)0( segments all get overlaid on top of each other rather than)]681 bull0 +[(stuck end-to-end.)]670 bull2 +[2(ALIGN)0( is used, as shown above, to specify how many low bits of the segment start address must be forced)]653 bull1 +[(to zero. The alignment value given may be any power of two from 1 to 4096; in reality, the only values)]642 bull0 +[(supported are 1, 2, 4, 16, 256 and 4096, so if 8 is specified it will be rounded up to 16, and 32, 64 and 128)]631 bull0 +[(will all be rounded up to 256, and so on. Note that alignment to 4096-byte boundaries is a )(PharLap)]620 bull0 +[(extension to the format and may not be supported by all linkers.)]609 bull2 +[2(CLASS)0( can be used to specify the segment class; this feature indicates to the linker that segments of the)]592 bull1 +[(same class should be placed near each other in the output file. The class name can be any word, e.g.)]581 bull0 +[2(CLASS=CODE)0(.)]570 bull2 +[2(OVERLAY)0(, like )2(CLASS)0(, is specified with an arbitrary word as an argument, and provides overlay)]553 bull1 +[(information to an overlay-capable linker.)]542 bull2 +[(Segments can be declared as )2(USE16)0( or )2(USE32)0(, which has the effect of recording the choice in the object)]525 bull1 +[(file and also ensuring that NASM's default assembly mode when assembling in that segment is 16-bit or)]514 bull0 +[(32-bit respectively.)]503 bull2 +[(When writing )(OS/2 object files, you should declare 32-bit segments as )2(FLAT)0(, which causes the default)]486 bull1 +[(segment base for anything in the segment to be the special group )2(FLAT)0(, and also defines the group if it is)]475 bull0 +[(not already defined.)]464 bull2 +[(The )2(obj)0( file format also allows segments to be declared as having a pre-defined absolute segment)]447 bull1 +[(address, although no linkers are currently known to make sensible use of this feature; nevertheless, NASM)]436 bull0 +[(allows you to declare a segment such as )2(SEGMENT SCREEN ABSOLUTE=0xB800)0( if you need to. The)]425 bull0 +[2(ABSOLUTE)0( and )2(ALIGN)0( keywords are mutually exclusive.)]414 bull2 +[(NASM's default segment attributes are )2(PUBLIC)0(, )2(ALIGN=1)0(, no class, no overlay, and )2(USE16)0(.)]397 norm3 +[{/section-7.4.2 xa}2(GROUP)0(: Defining Groups of Segments)](7.4.2)377.8 subh3 +[(The )2(obj)0( format also allows segments to be grouped, so that a single segment register can be used to refer to)]360.8 norm1 +[(all the segments in a group. NASM therefore supplies the )2(GROUP)0( directive, whereby you can code)]349.8 norm2 +[2(segment data )]332.8 code1 +[2()]321.8 code0 +[2( ; some data )]310.8 code0 +[2()]299.8 code0 +[2(segment bss )]288.8 code0 +[2()]277.8 code0 +[2( ; some uninitialized data )]266.8 code0 +[2()]255.8 code0 +[2(group dgroup data bss)]244.8 code2 +[(which will define a group called )2(dgroup)0( to contain the segments )2(data)0( and )2(bss)0(. Like )2(SEGMENT)0(, )2(GROUP)]227.8 norm1 +[(causes the group name to be defined as a symbol, so that you can refer to a variable )2(var)0( in the )2(data)0( segment)]216.8 norm0 +[(as )2(var wrt data)0( or as )2(var wrt dgroup)0(, depending on which segment value is currently in your)]205.8 norm0 +[(segment register.)]194.8 norm2 +[(If you just refer to )2(var)0(, however, and )2(var)0( is declared in a segment which is part of a group, then NASM will)]177.8 norm1 +[(default to giving you the offset of )2(var)0( from the beginning of the )1(group)0(, not the )1(segment)0(. Therefore)]166.8 norm0 +[2(SEG var)0(, also, will return the group base rather than the segment base.)]155.8 norm2 +[(NASM will allow a segment to be part of more than one group, but will generate a warning if you do this.)]138.8 norm1 +[(Variables declared in a segment which is part of more than one group will default to being relative to the first)]127.8 norm0 +[(group that was defined to contain the segment.)]116.8 norm2 +(76)pageeven +restore showpage +%%Page: 77 77 +%%BeginPageSetup +save +%%EndPageSetup +/77 pa +[(A group does not have to contain any segments; you can still make )2(WRT)0( references to a group which does not)]681 norm1 +[(contain the variable you are referring to. OS/2, for example, defines the special group )2(FLAT)0( with no segments)]670 norm0 +[(in it.)]659 norm2 +[{/section-7.4.3 xa}2(UPPERCASE)0(: Disabling Case Sensitivity in Output)](7.4.3)639.8 subh3 +[(Although NASM itself is )(case sensitive, some OMF linkers are not; therefore it can be useful for NASM to)]622.8 norm1 +[(output single-case object files. The )2(UPPERCASE)0( format-specific directive causes all segment, group and)]611.8 norm0 +[(symbol names that are written to the object file to be forced to upper case just before being written. Within a)]600.8 norm0 +[(source file, NASM is still case-sensitive; but the object file can be written entirely in upper case if desired.)]589.8 norm2 +[2(UPPERCASE)0( is used alone on a line; it requires no parameters.)]572.8 norm3 +[{/section-7.4.4 xa}2(IMPORT)0(: Importing DLL Symbols)](7.4.4)553.6 subh3 +[(The )2(IMPORT)0( format-specific directive defines a symbol to be imported from a DLL, for use if you are)]536.6 norm1 +[(writing a DLL's )(import library in NASM. You still need to declare the symbol as )2(EXTERN)0( as well as using)]525.6 norm0 +[(the )2(IMPORT)0( directive.)]514.6 norm2 +[(The )2(IMPORT)0( directive takes two required parameters, separated by white space, which are \(respectively\) the)]497.6 norm1 +[(name of the symbol you wish to import and the name of the library you wish to import it from. For example:)]486.6 norm2 +[2( import WSAStartup wsock32.dll)]469.6 code3 +[(A third optional parameter gives the name by which the symbol is known in the library you are importing it)]452.6 norm1 +[(from, in case this is not the same as the name you wish the symbol to be known by to your code once you)]441.6 norm0 +[(have imported it. For example:)]430.6 norm2 +[2( import asyncsel wsock32.dll WSAAsyncSelect)]413.6 code3 +[{/section-7.4.5 xa}2(EXPORT)0(: Exporting DLL Symbols)](7.4.5)394.4 subh3 +[(The )2(EXPORT)0( format-specific directive defines a global symbol to be exported as a DLL symbol, for use if)]377.4 norm1 +[(you are writing a DLL in NASM. You still need to declare the symbol as )2(GLOBAL)0( as well as using the)]366.4 norm0 +[2(EXPORT)0( directive.)]355.4 norm2 +[2(EXPORT)0( takes one required parameter, which is the name of the symbol you wish to export, as it was defined)]338.4 norm1 +[(in your source file. An optional second parameter \(separated by white space from the first\) gives the )1(external)]327.4 norm0 +[(name of the symbol: the name by which you wish the symbol to be known to programs using the DLL. If this)]316.4 norm0 +[(name is the same as the internal name, you may leave the second parameter off.)]305.4 norm2 +[(Further parameters can be given to define attributes of the exported symbol. These parameters, like the)]288.4 norm1 +[(second, are separated by white space. If further parameters are given, the external name must also be)]277.4 norm0 +[(specified, even if it is the same as the internal name. The available attributes are:)]266.4 norm2 +[2(resident)0( indicates that the exported name is to be kept resident by the system loader. This is an)]249.4 bull1 +[(optimisation for frequently used symbols imported by name.)]238.4 bull2 +[2(nodata)0( indicates that the exported symbol is a function which does not make use of any initialized data.)]221.4 bull3 +[2(parm=NNN)0(, where )2(NNN)0( is an integer, sets the number of parameter words for the case in which the symbol)]204.4 bull1 +[(is a call gate between 32-bit and 16-bit segments.)]193.4 bull2 +[(An attribute which is just a number indicates that the symbol should be exported with an identifying)]176.4 bull1 +[(number \(ordinal\), and gives the desired number.)]165.4 bull2 +[(For example:)]148.4 norm3 +[2( export myfunc )]131.4 code1 +[2( export myfunc TheRealMoreFormalLookingFunctionName )]120.4 code0 +(77)pageodd +restore showpage +%%Page: 78 78 +%%BeginPageSetup +save +%%EndPageSetup +/78 pa +[2( export myfunc myfunc 1234 ; export by ordinal )]681 code0 +[2( export myfunc myfunc resident parm=23 nodata)]670 code2 +[{/section-7.4.6 xa}2(..start)0(: Defining the )(Program Entry Point)](7.4.6)650.8 subh3 +[2(OMF)0( linkers require exactly one of the object files being linked to define the program entry point, where)]633.8 norm1 +[(execution will begin when the program is run. If the object file that defines the entry point is assembled using)]622.8 norm0 +[(NASM, you specify the entry point by declaring the special symbol )2(..start)0( at the point where you wish)]611.8 norm0 +[(execution to begin.)]600.8 norm2 +[{/section-7.4.7 xa}2(obj)0( Extensions to the )2(EXTERN)0( Directive)](7.4.7)581.6 subh3 +[(If you declare an external symbol with the directive)]564.6 norm3 +[2( extern foo)]547.6 code3 +[(then references such as )2(mov ax,foo)0( will give you the offset of )2(foo)0( from its preferred segment base \(as)]530.6 norm1 +[(specified in whichever module )2(foo)0( is actually defined in\). So to access the contents of )2(foo)0( you will usually)]519.6 norm0 +[(need to do something like)]508.6 norm2 +[2( mov ax,seg foo ; get preferred segment base )]491.6 code1 +[2( mov es,ax ; move it into ES )]480.6 code0 +[2( mov ax,[es:foo] ; and use offset `foo' from it)]469.6 code2 +[(This is a little unwieldy, particularly if you know that an external is going to be accessible from a given)]452.6 norm1 +[(segment or group, say )2(dgroup)0(. So if )2(DS)0( already contained )2(dgroup)0(, you could simply code)]441.6 norm2 +[2( mov ax,[foo wrt dgroup])]424.6 code3 +[(However, having to type this every time you want to access )2(foo)0( can be a pain; so NASM allows you to)]407.6 norm1 +[(declare )2(foo)0( in the alternative form)]396.6 norm2 +[2( extern foo:wrt dgroup)]379.6 code3 +[(This form causes NASM to pretend that the preferred segment base of )2(foo)0( is in fact )2(dgroup)0(; so the)]362.6 norm1 +[(expression )2(seg foo)0( will now return )2(dgroup)0(, and the expression )2(foo)0( is equivalent to )2(foo wrt dgroup)0(.)]351.6 norm2 +[(This )(default-)2(WRT)0( mechanism can be used to make externals appear to be relative to any group or segment in)]334.6 norm1 +[(your program. It can also be applied to common variables: see ){/section-7.4.8 xl}(section 7.4.8){el}(.)]323.6 norm2 +[{/section-7.4.8 xa}2(obj)0( Extensions to the )2(COMMON)0( Directive)](7.4.8)304.4 subh3 +[(The )2(obj)0( format allows common variables to be either near)( or far)(; NASM allows you to specify which your)]287.4 norm1 +[(variables should be by the use of the syntax)]276.4 norm2 +[2(common nearvar 2:near ; `nearvar' is a near common )]259.4 code1 +[2(common farvar 10:far ; and `farvar' is far)]248.4 code2 +[(Far common variables may be greater in size than 64Kb, and so the OMF specification says that they are)]231.4 norm1 +[(declared as a number of )1(elements)0( of a given size. So a 10-byte far common variable could be declared as ten)]220.4 norm0 +[(one-byte elements, five two-byte elements, two five-byte elements or one ten-byte element.)]209.4 norm2 +[(Some )2(OMF)0( linkers require the )(element size, as well as the variable size, to match when resolving common)]192.4 norm1 +[(variables declared in more than one module. Therefore NASM must allow you to specify the element size on)]181.4 norm0 +[(your far common variables. This is done by the following syntax:)]170.4 norm2 +[2(common c_5by2 10:far 5 ; two five-byte elements )]153.4 code1 +[2(common c_2by5 10:far 2 ; five two-byte elements)]142.4 code2 +[(If no element size is specified, the default is 1. Also, the )2(FAR)0( keyword is not required when an element size is)]125.4 norm1 +[(specified, since only far commons may have element sizes at all. So the above declarations could equivalently)]114.4 norm0 +[(be)]103.4 norm2 +(78)pageeven +restore showpage +%%Page: 79 79 +%%BeginPageSetup +save +%%EndPageSetup +/79 pa +[2(common c_5by2 10:5 ; two five-byte elements )]681 code1 +[2(common c_2by5 10:2 ; five two-byte elements)]670 code2 +[(In addition to these extensions, the )2(COMMON)0( directive in )2(obj)0( also supports default-)2(WRT)0( specification like)]653 norm1 +[2(EXTERN)0( does \(explained in ){/section-7.4.7 xl}(section 7.4.7){el}(\). So you can also declare things like)]642 norm2 +[2(common foo 10:wrt dgroup )]625 code1 +[2(common bar 16:far 2:wrt data )]614 code0 +[2(common baz 24:wrt data:6)]603 code2 +[{/section-7.5 xa}2(win32)0(: Microsoft Win32 Object Files)](7.5)581.6 head3 +[(The )2(win32)0( output format generates Microsoft Win32 object files, suitable for passing to Microsoft linkers)]564.6 norm1 +[(such as )(Visual C++. Note that Borland Win32 compilers do not use this format, but use )2(obj)0( instead \(see)]553.6 norm0 +[{/section-7.4 xl}(section 7.4){el}(\).)]542.6 norm2 +[2(win32)0( provides a default output file-name extension of )2(.obj)0(.)]525.6 norm3 +[(Note that although Microsoft say that Win32 object files follow the )2(COFF)0( \(Common Object File Format\))]508.6 norm1 +[(standard, the object files produced by Microsoft Win32 compilers are not compatible with COFF linkers such)]497.6 norm0 +[(as DJGPP's, and vice versa. This is due to a difference of opinion over the precise semantics of PC-relative)]486.6 norm0 +[(relocations. To produce COFF files suitable for DJGPP, use NASM's )2(coff)0( output format; conversely, the)]475.6 norm0 +[2(coff)0( format does not produce object files that Win32 linkers can generate correct output from.)]464.6 norm2 +[{/section-7.5.1 xa}2(win32)0( Extensions to the )2(SECTION)0( Directive)](7.5.1)445.4 subh3 +[(Like the )2(obj)0( format, )2(win32)0( allows you to specify additional information on the )2(SECTION)0( directive line, to)]428.4 norm1 +[(control the type and properties of sections you declare. Section types and properties are generated)]417.4 norm0 +[(automatically by NASM for the )(standard section names )2(.text)0(, )2(.data)0( and )2(.bss)0(, but may still be)]406.4 norm0 +[(overridden by these qualifiers.)]395.4 norm2 +[(The available qualifiers are:)]378.4 norm3 +[2(code)0(, or equivalently )2(text)0(, defines the section to be a code section. This marks the section as readable)]361.4 bull1 +[(and executable, but not writable, and also indicates to the linker that the type of the section is code.)]350.4 bull2 +[2(data)0( and )2(bss)0( define the section to be a data section, analogously to )2(code)0(. Data sections are marked as)]333.4 bull1 +[(readable and writable, but not executable. )2(data)0( declares an initialized data section, whereas )2(bss)0( declares)]322.4 bull0 +[(an uninitialized data section.)]311.4 bull2 +[2(rdata)0( declares an initialized data section that is readable but not writable. Microsoft compilers use this)]294.4 bull1 +[(section to place constants in it.)]283.4 bull2 +[2(info)0( defines the section to be an )(informational section, which is not included in the executable file by the)]266.4 bull1 +[(linker, but may \(for example\) pass information )1(to)0( the linker. For example, declaring an )2(info)0(\226type section)]255.4 bull0 +[(called )2(.drectve)0( causes the linker to interpret the contents of the section as command-line options.)]244.4 bull2 +[2(align=)0(, used with a trailing number as in )2(obj)0(, gives the )(alignment requirements of the section. The)]227.4 bull1 +[(maximum you may specify is 64: the Win32 object file format contains no means to request a greater)]216.4 bull0 +[(section alignment than this. If alignment is not explicitly specified, the defaults are 16-byte alignment for)]205.4 bull0 +[(code sections, 8-byte alignment for rdata sections and 4-byte alignment for data \(and BSS\) sections.)]194.4 bull0 +[(Informational sections get a default alignment of 1 byte \(no alignment\), though the value does not matter.)]183.4 bull2 +[(The defaults assumed by NASM if you do not specify the above qualifiers are:)]166.4 norm3 +[2(section .text code align=16 )]149.4 code1 +[2(section .data data align=4 )]138.4 code0 +[2(section .rdata rdata align=8 )]127.4 code0 +[2(section .bss bss align=4)]116.4 code2 +(79)pageodd +restore showpage +%%Page: 80 80 +%%BeginPageSetup +save +%%EndPageSetup +/80 pa +[(Any other section name is treated by default like )2(.text)0(.)]681 norm3 +[{/section-7.5.2 xa}2(win32)0(: Safe Structured Exception Handling)](7.5.2)661.8 subh3 +[(Among other improvements in Windows XP SP2 and Windows Server 2003 Microsoft has introduced)]644.8 norm1 +[(concept of "safe structured exception handling." General idea is to collect handlers' entry points in designated)]633.8 norm0 +[(read-only table and have alleged entry point verified against this table prior exception control is passed to the)]622.8 norm0 +[(handler. In order for an executable module to be equipped with such "safe exception handler table," all object)]611.8 norm0 +[(modules on linker command line has to comply with certain criteria. If one single module among them does)]600.8 norm0 +[(not, then the table in question is omitted and above mentioned run-time checks will not be performed for)]589.8 norm0 +[(application in question. Table omission is by default silent and therefore can be easily overlooked. One can)]578.8 norm0 +[(instruct linker to refuse to produce binary without such table by passing )2(/safeseh)0( command line option.)]567.8 norm2 +[(Without regard to this run-time check merits it's natural to expect NASM to be capable of generating)]550.8 norm1 +[(modules suitable for )2(/safeseh)0( linking. From developer's viewpoint the problem is two-fold:)]539.8 norm2 +[(how to adapt modules not deploying exception handlers of their own;)]522.8 bull3 +[(how to adapt/develop modules utilizing custom exception handling;)]505.8 bull3 +[(Former can be easily achieved with any NASM version by adding following line to source code:)]488.8 norm3 +[2($@feat.00 equ 1)]471.8 code3 +[(As of version 2.03 NASM adds this absolute symbol automatically. If it's not already present to be precise.)]454.8 norm1 +[(I.e. if for whatever reason developer would choose to assign another value in source file, it would still be)]443.8 norm0 +[(perfectly possible.)]432.8 norm2 +[(Registering custom exception handler on the other hand requires certain "magic." As of version 2.03)]415.8 norm1 +[(additional directive is implemented, )2(safeseh)0(, which instructs the assembler to produce appropriately)]404.8 norm0 +[(formatted input data for above mentioned "safe exception handler table." Its typical use would be:)]393.8 norm2 +[2(section .text )]376.8 code1 +[2(extern _MessageBoxA@16 )]365.8 code0 +[2(%if __NASM_VERSION_ID__ >= 0x02030000 )]354.8 code0 +[2(safeseh handler ; register handler as "safe handler" )]343.8 code0 +[2(%endif )]332.8 code0 +[2(handler: )]321.8 code0 +[2( push DWORD 1 ; MB_OKCANCEL )]310.8 code0 +[2( push DWORD caption )]299.8 code0 +[2( push DWORD text )]288.8 code0 +[2( push DWORD 0 )]277.8 code0 +[2( call _MessageBoxA@16 )]266.8 code0 +[2( sub eax,1 ; incidentally suits as return value )]255.8 code0 +[2( ; for exception handler )]244.8 code0 +[2( ret )]233.8 code0 +[2(global _main )]222.8 code0 +[2(_main: )]211.8 code0 +[2( push DWORD handler )]200.8 code0 +[2( push DWORD [fs:0] )]189.8 code0 +[2( mov DWORD [fs:0],esp ; engage exception handler )]178.8 code0 +[2( xor eax,eax )]167.8 code0 +[2( mov eax,DWORD[eax] ; cause exception )]156.8 code0 +[2( pop DWORD [fs:0] ; disengage exception handler )]145.8 code0 +[2( add esp,4 )]134.8 code0 +[2( ret )]123.8 code0 +[2(text: db 'OK to rethrow, CANCEL to generate core dump',0 )]112.8 code0 +[2(caption:db 'SEGV',0 )]101.8 code0 +(80)pageeven +restore showpage +%%Page: 81 81 +%%BeginPageSetup +save +%%EndPageSetup +/81 pa +[2()]681 code0 +[2(section .drectve info )]670 code0 +[2( db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ')]659 code2 +[(As you might imagine, it's perfectly possible to produce .exe binary with "safe exception handler table" and)]642 norm1 +[(yet engage unregistered exception handler. Indeed, handler is engaged by simply manipulating )2([fs:0])]631 norm0 +[(location at run-time, something linker has no power over, run-time that is. It should be explicitly mentioned)]620 norm0 +[(that such failure to register handler's entry point with )2(safeseh)0( directive has undesired side effect at)]609 norm0 +[(run-time. If exception is raised and unregistered handler is to be executed, the application is abruptly)]598 norm0 +[(terminated without any notification whatsoever. One can argue that system could at least have logged some)]587 norm0 +[(kind "non-safe exception handler in x.exe at address n" message in event log, but no, literally no notification)]576 norm0 +[(is provided and user is left with no clue on what caused application failure.)]565 norm2 +[(Finally, all mentions of linker in this paragraph refer to Microsoft linker version 7.x and later. Presence of)]548 norm1 +[2(@feat.00)0( symbol and input data for "safe exception handler table" causes no backward incompatibilities)]537 norm0 +[(and "safeseh" modules generated by NASM 2.03 and later can still be linked by earlier versions or)]526 norm0 +[(non-Microsoft linkers.)]515 norm2 +[{/section-7.6 xa}2(win64)0(: Microsoft Win64 Object Files)](7.6)493.6 head3 +[(The )2(win64)0( output format generates Microsoft Win64 object files, which is nearly 100% identical to the)]476.6 norm1 +[2(win32)0( object format \(){/section-7.5 xl}(section 7.5){el}(\) with the exception that it is meant to target 64-bit code and the x86-64)]465.6 norm0 +[(platform altogether. This object file is used exactly the same as the )2(win32)0( object format \(){/section-7.5 xl}(section 7.5){el}(\), in)]454.6 norm0 +[(NASM, with regard to this exception.)]443.6 norm2 +[{/section-7.6.1 xa}2(win64)0(: Writing Position-Independent Code)](7.6.1)424.4 subh3 +[(While )2(REL)0( takes good care of RIP-relative addressing, there is one aspect that is easy to overlook for a)]407.4 norm1 +[(Win64 programmer: indirect references. Consider a switch dispatch table:)]396.4 norm2 +[2( jmp QWORD[dsptch+rax*8] )]379.4 code1 +[2( ... )]368.4 code0 +[2(dsptch: dq case0 )]357.4 code0 +[2( dq case1 )]346.4 code0 +[2( ...)]335.4 code2 +[(Even novice Win64 assembler programmer will soon realize that the code is not 64-bit savvy. Most notably)]318.4 norm1 +[(linker will refuse to link it with)]307.4 norm0 +[(")2('ADDR32' relocation to '.text' invalid without /LARGEADDRESSAWARE:NO)0(". So)]296.4 norm0 +[([s]he will have to split jmp instruction as following:)]285.4 norm2 +[2( lea rbx,[rel dsptch] )]268.4 code1 +[2( jmp QWORD[rbx+rax*8])]257.4 code2 +[(What happens behind the scene is that effective address in )2(lea)0( is encoded relative to instruction pointer, or in)]240.4 norm1 +[(perfectly position-independent manner. But this is only part of the problem! Trouble is that in .dll context)]229.4 norm0 +[2(caseN)0( relocations will make their way to the final module and might have to be adjusted at .dll load time. To)]218.4 norm0 +[(be specific when it can't be loaded at preferred address. And when this occurs, pages with such relocations)]207.4 norm0 +[(will be rendered private to current process, which kind of undermines the idea of sharing .dll. But no worry,)]196.4 norm0 +[(it's trivial to fix:)]185.4 norm2 +[2( lea rbx,[rel dsptch] )]168.4 code1 +[2( add rbx,QWORD[rbx+rax*8] )]157.4 code0 +[2( jmp rbx )]146.4 code0 +[2( ... )]135.4 code0 +[2(dsptch: dq case0-dsptch )]124.4 code0 +[2( dq case1-dsptch )]113.4 code0 +[2( ...)]102.4 code2 +(81)pageodd +restore showpage +%%Page: 82 82 +%%BeginPageSetup +save +%%EndPageSetup +/82 pa +[(NASM version 2.03 and later provides another alternative, )2(wrt ..imagebase)0( operator, which returns)]681 norm1 +[(offset from base address of the current image, be it .exe or .dll module, therefore the name. For those)]670 norm0 +[(acquainted with PE-COFF format base address denotes start of )2(IMAGE_DOS_HEADER)0( structure. Here is)]659 norm0 +[(how to implement switch with these image-relative references:)]648 norm2 +[2( lea rbx,[rel dsptch] )]631 code1 +[2( mov eax,DWORD[rbx+rax*4] )]620 code0 +[2( sub rbx,dsptch wrt ..imagebase )]609 code0 +[2( add rbx,rax )]598 code0 +[2( jmp rbx )]587 code0 +[2( ... )]576 code0 +[2(dsptch: dd case0 wrt ..imagebase )]565 code0 +[2( dd case1 wrt ..imagebase)]554 code2 +[(One can argue that the operator is redundant. Indeed, snippet before last works just fine with any NASM)]537 norm1 +[(version and is not even Windows specific... The real reason for implementing )2(wrt ..imagebase)0( will)]526 norm0 +[(become apparent in next paragraph.)]515 norm2 +[(It should be noted that )2(wrt ..imagebase)0( is defined as 32-bit operand only:)]498 norm3 +[2( dd label wrt ..imagebase ; ok )]481 code1 +[2( dq label wrt ..imagebase ; bad )]470 code0 +[2( mov eax,label wrt ..imagebase ; ok )]459 code0 +[2( mov rax,label wrt ..imagebase ; bad)]448 code2 +[{/section-7.6.2 xa}2(win64)0(: Structured Exception Handling)](7.6.2)428.8 subh3 +[(Structured exception handing in Win64 is completely different matter from Win32. Upon exception program)]411.8 norm1 +[(counter value is noted, and linker-generated table comprising start and end addresses of all the functions [in)]400.8 norm0 +[(given executable module] is traversed and compared to the saved program counter. Thus so called)]389.8 norm0 +[2(UNWIND_INFO)0( structure is identified. If it's not found, then offending subroutine is assumed to be "leaf" and)]378.8 norm0 +[(just mentioned lookup procedure is attempted for its caller. In Win64 leaf function is such function that does)]367.8 norm0 +[(not call any other function )1(nor)0( modifies any Win64 non-volatile registers, including stack pointer. The latter)]356.8 norm0 +[(ensures that it's possible to identify leaf function's caller by simply pulling the value from the top of the stack.)]345.8 norm2 +[(While majority of subroutines written in assembler are not calling any other function, requirement for)]328.8 norm1 +[(non-volatile registers' immutability leaves developer with not more than 7 registers and no stack frame,)]317.8 norm0 +[(which is not necessarily what [s]he counted with. Customarily one would meet the requirement by saving)]306.8 norm0 +[(non-volatile registers on stack and restoring them upon return, so what can go wrong? If [and only if] an)]295.8 norm0 +[(exception is raised at run-time and no )2(UNWIND_INFO)0( structure is associated with such "leaf" function, the)]284.8 norm0 +[(stack unwind procedure will expect to find caller's return address on the top of stack immediately followed by)]273.8 norm0 +[(its frame. Given that developer pushed caller's non-volatile registers on stack, would the value on top point at)]262.8 norm0 +[(some code segment or even addressable space? Well, developer can attempt copying caller's return address to)]251.8 norm0 +[(the top of stack and this would actually work in some very specific circumstances. But unless developer can)]240.8 norm0 +[(guarantee that these circumstances are always met, it's more appropriate to assume worst case scenario, i.e.)]229.8 norm0 +[(stack unwind procedure going berserk. Relevant question is what happens then? Application is abruptly)]218.8 norm0 +[(terminated without any notification whatsoever. Just like in Win32 case, one can argue that system could at)]207.8 norm0 +[(least have logged "unwind procedure went berserk in x.exe at address n" in event log, but no, no trace of)]196.8 norm0 +[(failure is left.)]185.8 norm2 +[(Now, when we understand significance of the )2(UNWIND_INFO)0( structure, let's discuss what's in it and/or how)]168.8 norm1 +[(it's processed. First of all it is checked for presence of reference to custom language-specific exception)]157.8 norm0 +[(handler. If there is one, then it's invoked. Depending on the return value, execution flow is resumed)]146.8 norm0 +[(\(exception is said to be "handled"\), )1(or)0( rest of )2(UNWIND_INFO)0( structure is processed as following. Beside)]135.8 norm0 +[(optional reference to custom handler, it carries information about current callee's stack frame and where)]124.8 norm0 +[(non-volatile registers are saved. Information is detailed enough to be able to reconstruct contents of caller's)]113.8 norm0 +[(non-volatile registers upon call to current callee. And so caller's context is reconstructed, and then unwind)]102.8 norm0 +(82)pageeven +restore showpage +%%Page: 83 83 +%%BeginPageSetup +save +%%EndPageSetup +/83 pa +[(procedure is repeated, i.e. another )2(UNWIND_INFO)0( structure is associated, this time, with caller's instruction)]681 norm0 +[(pointer, which is then checked for presence of reference to language-specific handler, etc. The procedure is)]670 norm0 +[(recursively repeated till exception is handled. As last resort system "handles" it by generating memory core)]659 norm0 +[(dump and terminating the application.)]648 norm2 +[(As for the moment of this writing NASM unfortunately does not facilitate generation of above mentioned)]631 norm1 +[(detailed information about stack frame layout. But as of version 2.03 it implements building blocks for)]620 norm0 +[(generating structures involved in stack unwinding. As simplest example, here is how to deploy custom)]609 norm0 +[(exception handler for leaf function:)]598 norm2 +[2(default rel )]581 code1 +[2(section .text )]570 code0 +[2(extern MessageBoxA )]559 code0 +[2(handler: )]548 code0 +[2( sub rsp,40 )]537 code0 +[2( mov rcx,0 )]526 code0 +[2( lea rdx,[text] )]515 code0 +[2( lea r8,[caption] )]504 code0 +[2( mov r9,1 ; MB_OKCANCEL )]493 code0 +[2( call MessageBoxA )]482 code0 +[2( sub eax,1 ; incidentally suits as return value )]471 code0 +[2( ; for exception handler )]460 code0 +[2( add rsp,40 )]449 code0 +[2( ret )]438 code0 +[2(global main )]427 code0 +[2(main: )]416 code0 +[2( xor rax,rax )]405 code0 +[2( mov rax,QWORD[rax] ; cause exception )]394 code0 +[2( ret )]383 code0 +[2(main_end: )]372 code0 +[2(text: db 'OK to rethrow, CANCEL to generate core dump',0 )]361 code0 +[2(caption:db 'SEGV',0 )]350 code0 +[2()]339 code0 +[2(section .pdata rdata align=4 )]328 code0 +[2( dd main wrt ..imagebase )]317 code0 +[2( dd main_end wrt ..imagebase )]306 code0 +[2( dd xmain wrt ..imagebase )]295 code0 +[2(section .xdata rdata align=8 )]284 code0 +[2(xmain: db 9,0,0,0 )]273 code0 +[2( dd handler wrt ..imagebase )]262 code0 +[2(section .drectve info )]251 code0 +[2( db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ')]240 code2 +[(What you see in )2(.pdata)0( section is element of the "table comprising start and end addresses of function")]223 norm1 +[(along with reference to associated )2(UNWIND_INFO)0( structure. And what you see in )2(.xdata)0( section is)]212 norm0 +[2(UNWIND_INFO)0( structure describing function with no frame, but with designated exception handler.)]201 norm0 +[(References are )1(required)0( to be image-relative \(which is the real reason for implementing)]190 norm0 +[2(wrt ..imagebase)0( operator\). It should be noted that )2(rdata align=n)0(, as well as)]179 norm0 +[2(wrt ..imagebase)0(, are optional in these two segments' contexts, i.e. can be omitted. Latter means that )1(all)]168 norm0 +[(32-bit references, not only above listed required ones, placed into these two segments turn out)]157 norm0 +[(image-relative. Why is it important to understand? Developer is allowed to append handler-specific data to)]146 norm0 +[2(UNWIND_INFO)0( structure, and if [s]he adds a 32-bit reference, then [s]he will have to remember to adjust its)]135 norm0 +[(value to obtain the real pointer.)]124 norm2 +(83)pageodd +restore showpage +%%Page: 84 84 +%%BeginPageSetup +save +%%EndPageSetup +/84 pa +[(As already mentioned, in Win64 terms leaf function is one that does not call any other function )1(nor)0( modifies)]681 norm1 +[(any non-volatile register, including stack pointer. But it's not uncommon that assembler programmer plans to)]670 norm0 +[(utilize every single register and sometimes even have variable stack frame. Is there anything one can do with)]659 norm0 +[(bare building blocks? I.e. besides manually composing fully-fledged )2(UNWIND_INFO)0( structure, which would)]648 norm0 +[(surely be considered error-prone? Yes, there is. Recall that exception handler is called first, before stack)]637 norm0 +[(layout is analyzed. As it turned out, it's perfectly possible to manipulate current callee's context in custom)]626 norm0 +[(handler in manner that permits further stack unwinding. General idea is that handler would not actually)]615 norm0 +[("handle" the exception, but instead restore callee's context, as it was at its entry point and thus mimic leaf)]604 norm0 +[(function. In other words, handler would simply undertake part of unwinding procedure. Consider following)]593 norm0 +[(example:)]582 norm2 +[2(function: )]565 code1 +[2( mov rax,rsp ; copy rsp to volatile register )]554 code0 +[2( push r15 ; save non-volatile registers )]543 code0 +[2( push rbx )]532 code0 +[2( push rbp )]521 code0 +[2( mov r11,rsp ; prepare variable stack frame )]510 code0 +[2( sub r11,rcx )]499 code0 +[2( and r11,-64 )]488 code0 +[2( mov QWORD[r11],rax ; check for exceptions )]477 code0 +[2( mov rsp,r11 ; allocate stack frame )]466 code0 +[2( mov QWORD[rsp],rax ; save original rsp value )]455 code0 +[2(magic_point: )]444 code0 +[2( ... )]433 code0 +[2( mov r11,QWORD[rsp] ; pull original rsp value )]422 code0 +[2( mov rbp,QWORD[r11-24] )]411 code0 +[2( mov rbx,QWORD[r11-16] )]400 code0 +[2( mov r15,QWORD[r11-8] )]389 code0 +[2( mov rsp,r11 ; destroy frame )]378 code0 +[2( ret)]367 code2 +[(The keyword is that up to )2(magic_point)0( original )2(rsp)0( value remains in chosen volatile register and no)]350 norm1 +[(non-volatile register, except for )2(rsp)0(, is modified. While past )2(magic_point)0( )2(rsp)0( remains constant till the)]339 norm0 +[(very end of the )2(function)0(. In this case custom language-specific exception handler would look like this:)]328 norm2 +[2(EXCEPTION_DISPOSITION handler \(EXCEPTION_RECORD *rec,ULONG64 frame, )]311 code1 +[2( CONTEXT *context,DISPATCHER_CONTEXT *disp\) )]300 code0 +[2({ ULONG64 *rsp; )]289 code0 +[2( if \(context->Rip<\(ULONG64\)magic_point\) )]278 code0 +[2( rsp = \(ULONG64 *\)context->Rax; )]267 code0 +[2( else )]256 code0 +[2( { rsp = \(\(ULONG64 **\)context->Rsp\)[0]; )]245 code0 +[2( context->Rbp = rsp[-3]; )]234 code0 +[2( context->Rbx = rsp[-2]; )]223 code0 +[2( context->R15 = rsp[-1]; )]212 code0 +[2( } )]201 code0 +[2( context->Rsp = \(ULONG64\)rsp; )]190 code0 +[2()]179 code0 +[2( memcpy \(disp->ContextRecord,context,sizeof\(CONTEXT\)\); )]168 code0 +[2( RtlVirtualUnwind\(UNW_FLAG_NHANDLER,disp->ImageBase, )]157 code0 +[2( dips->ControlPc,disp->FunctionEntry,disp->ContextRecord, )]146 code0 +[2( &disp->HandlerData,&disp->EstablisherFrame,NULL\); )]135 code0 +[2( return ExceptionContinueSearch; )]124 code0 +[2(})]113 code2 +(84)pageeven +restore showpage +%%Page: 85 85 +%%BeginPageSetup +save +%%EndPageSetup +/85 pa +[(As custom handler mimics leaf function, corresponding )2(UNWIND_INFO)0( structure does not have to contain)]681 norm1 +[(any information about stack frame and its layout.)]670 norm2 +[{/section-7.7 xa}2(coff)0(: )(Common Object File Format)](7.7)648.6 head3 +[(The )2(coff)0( output type produces )2(COFF)0( object files suitable for linking with the )(DJGPP linker.)]631.6 norm3 +[2(coff)0( provides a default output file-name extension of )2(.o)0(.)]614.6 norm3 +[(The )2(coff)0( format supports the same extensions to the )2(SECTION)0( directive as )2(win32)0( does, except that the)]597.6 norm1 +[2(align)0( qualifier and the )2(info)0( section type are not supported.)]586.6 norm2 +[{/section-7.8 xa}2(macho32)0( and )2(macho64)0(: )(Mach Object File Format)](7.8)565.2 head3 +[(The )2(macho32)0( and )2(macho64)0( output formts produces )2(Mach-O)0( object files suitable for linking with the)]548.2 norm1 +[(MacOS X linker. )2(macho)0( is a synonym for )2(macho32)0(.)]537.2 norm2 +[2(macho)0( provides a default output file-name extension of )2(.o)0(.)]520.2 norm3 +[{/section-7.9 xa}2(elf32)0( and )2(elf64)0(: )(Executable and Linkable Format Object Files)](7.9)498.8 head3 +[(The )2(elf32)0( and )2(elf64)0( output formats generate )2(ELF32 and ELF64)0( \(Executable and Linkable Format\))]481.8 norm1 +[(object files, as used by Linux as well as )(Unix System V, including )(Solaris x86, )(UnixWare and )(SCO Unix.)]470.8 norm0 +[2(elf)0( provides a default output file-name extension of )2(.o)0(. )2(elf)0( is a synonym for )2(elf32)0(.)]459.8 norm2 +[{/section-7.9.1 xa}(ELF specific directive )2(osabi)](7.9.1)440.6 subh3 +[(The ELF header specifies the application binary interface for the target operating system \(OSABI\). This field)]423.6 norm1 +[(can be set by using the )2(osabi)0( directive with the numeric value \(0-255\) of the target system. If this directive)]412.6 norm0 +[(is not used, the default value will be "UNIX System V ABI" \(0\) which will work on most systems which)]401.6 norm0 +[(support ELF.)]390.6 norm2 +[{/section-7.9.2 xa}2(elf)0( Extensions to the )2(SECTION)0( Directive)](7.9.2)371.4 subh3 +[(Like the )2(obj)0( format, )2(elf)0( allows you to specify additional information on the )2(SECTION)0( directive line, to)]354.4 norm1 +[(control the type and properties of sections you declare. Section types and properties are generated)]343.4 norm0 +[(automatically by NASM for the )(standard section names, but may still be overridden by these qualifiers.)]332.4 norm2 +[(The available qualifiers are:)]315.4 norm3 +[2(alloc)0( defines the section to be one which is loaded into memory when the program is run. )2(noalloc)]298.4 bull1 +[(defines it to be one which is not, such as an informational or comment section.)]287.4 bull2 +[2(exec)0( defines the section to be one which should have execute permission when the program is run.)]270.4 bull1 +[2(noexec)0( defines it as one which should not.)]259.4 bull2 +[2(write)0( defines the section to be one which should be writable when the program is run. )2(nowrite)0( defines)]242.4 bull1 +[(it as one which should not.)]231.4 bull2 +[2(progbits)0( defines the section to be one with explicit contents stored in the object file: an ordinary code)]214.4 bull1 +[(or data section, for example, )2(nobits)0( defines the section to be one with no explicit contents given, such as)]203.4 bull0 +[(a BSS section.)]192.4 bull2 +[2(align=)0(, used with a trailing number as in )2(obj)0(, gives the )(alignment requirements of the section.)]175.4 bull3 +[2(tls)0( defines the section to be one which contains thread local variables.)]158.4 bull3 +[(The defaults assumed by NASM if you do not specify the above qualifiers are:)]141.4 norm3 +[( )( )( )( )( )( )( )( )( )]124.4 norm3 +(85)pageodd +restore showpage +%%Page: 86 86 +%%BeginPageSetup +save +%%EndPageSetup +/86 pa +[2(section .text progbits alloc exec nowrite align=16 )]681 code1 +[2(section .rodata progbits alloc noexec nowrite align=4 )]670 code0 +[2(section .lrodata progbits alloc noexec nowrite align=4 )]659 code0 +[2(section .data progbits alloc noexec write align=4 )]648 code0 +[2(section .ldata progbits alloc noexec write align=4 )]637 code0 +[2(section .bss nobits alloc noexec write align=4 )]626 code0 +[2(section .lbss nobits alloc noexec write align=4 )]615 code0 +[2(section .tdata progbits alloc noexec write align=4 tls )]604 code0 +[2(section .tbss nobits alloc noexec write align=4 tls )]593 code0 +[2(section .comment progbits noalloc noexec nowrite align=1 )]582 code0 +[2(section other progbits alloc noexec nowrite align=1)]571 code2 +[(\(Any section name other than those in the above table is treated by default like )2(other)0( in the above table.)]554 norm1 +[(Please note that section names are case sensitive.\))]543 norm2 +[{/section-7.9.3 xa}(Position-Independent Code)(: )2(elf)0( Special Symbols and )2(WRT)](7.9.3)523.8 subh3 +[(The )2(ELF)0( specification contains enough features to allow position-independent code \(PIC\) to be written,)]506.8 norm1 +[(which makes )(ELF shared libraries very flexible. However, it also means NASM has to be able to generate a)]495.8 norm0 +[(variety of ELF specific relocation types in ELF object files, if it is to be an assembler which can write PIC.)]484.8 norm2 +[(Since )2(ELF)0( does not support segment-base references, the )2(WRT)0( operator is not used for its normal purpose;)]467.8 norm1 +[(therefore NASM's )2(elf)0( output format makes use of )2(WRT)0( for a different purpose, namely the PIC-specific)]456.8 norm0 +[(relocation types.)]445.8 norm2 +[2(elf)0( defines five special symbols which you can use as the right-hand side of the )2(WRT)0( operator to obtain PIC)]428.8 norm1 +[(relocation types. They are )2(..gotpc)0(, )2(..gotoff)0(, )2(..got)0(, )2(..plt)0( and )2(..sym)0(. Their functions are)]417.8 norm0 +[(summarized here:)]406.8 norm2 +[(Referring to the symbol marking the global offset table base using )2(wrt ..gotpc)0( will end up giving the)]389.8 bull1 +[(distance from the beginning of the current section to the global offset table.)]378.8 bull0 +[(\()2(_GLOBAL_OFFSET_TABLE_)0( is the standard symbol name used to refer to the )(GOT.\) So you would then)]367.8 bull0 +[(need to add )2($$)0( to the result to get the real address of the GOT.)]356.8 bull2 +[(Referring to a location in one of your own sections using )2(wrt ..gotoff)0( will give the distance from the)]339.8 bull1 +[(beginning of the GOT to the specified location, so that adding on the address of the GOT would give the)]328.8 bull0 +[(real address of the location you wanted.)]317.8 bull2 +[(Referring to an external or global symbol using )2(wrt ..got)0( causes the linker to build an entry )1(in)0( the)]300.8 bull1 +[(GOT containing the address of the symbol, and the reference gives the distance from the beginning of the)]289.8 bull0 +[(GOT to the entry; so you can add on the address of the GOT, load from the resulting address, and end up)]278.8 bull0 +[(with the address of the symbol.)]267.8 bull2 +[(Referring to a procedure name using )2(wrt ..plt)0( causes the linker to build a )(procedure linkage table)]250.8 bull1 +[(entry for the symbol, and the reference gives the address of the )(PLT entry. You can only use this in)]239.8 bull0 +[(contexts which would generate a PC-relative relocation normally \(i.e. as the destination for )2(CALL)0( or )2(JMP)0(\),)]228.8 bull0 +[(since ELF contains no relocation type to refer to PLT entries absolutely.)]217.8 bull2 +[(Referring to a symbol name using )2(wrt ..sym)0( causes NASM to write an ordinary relocation, but instead)]200.8 bull1 +[(of making the relocation relative to the start of the section and then adding on the offset to the symbol, it)]189.8 bull0 +[(will write a relocation record aimed directly at the symbol in question. The distinction is a necessary one)]178.8 bull0 +[(due to a peculiarity of the dynamic linker.)]167.8 bull2 +[(A fuller explanation of how to use these relocation types to write shared libraries entirely in NASM is given in)]150.8 norm1 +[{/section-9.2 xl}(section 9.2){el}(.)]139.8 norm2 +(86)pageeven +restore showpage +%%Page: 87 87 +%%BeginPageSetup +save +%%EndPageSetup +/87 pa +[{/section-7.9.4 xa}(Thread Local Storage)(: )2(elf)0( Special Symbols and )2(WRT)](7.9.4)678.8 subh3 +[(In ELF32 mode, referring to an external or global symbol using )2(wrt ..tlsie)0( )( causes the linker to build)]661.8 bull1 +[(an entry )1(in)0( the GOT containing the offset of the symbol within the TLS block, so you can access the value)]650.8 bull0 +[(of the symbol with code such as:)]639.8 bull2 +[2( mov eax,[tid wrt ..tlsie] )]622.8 code1 +[2( mov [gs:eax],ebx)]611.8 code2 +[(In ELF64 mode, referring to an external or global symbol using )2(wrt ..gottpoff)0( )( causes the linker to)]594.8 bull1 +[(build an entry )1(in)0( the GOT containing the offset of the symbol within the TLS block, so you can access the)]583.8 bull0 +[(value of the symbol with code such as:)]572.8 bull2 +[2( mov rax,[rel tid wrt ..gottpoff] )]555.8 code1 +[2( mov rcx,[fs:rax])]544.8 code2 +[{/section-7.9.5 xa}2(elf)0( Extensions to the )2(GLOBAL)0( Directive)](7.9.5)525.6 subh3 +[2(ELF)0( object files can contain more information about a global symbol than just its address: they can contain)]508.6 norm1 +[(the )(size of the symbol and its )(type as well. These are not merely debugger conveniences, but are actually)]497.6 norm0 +[(necessary when the program being written is a )(shared library. NASM therefore supports some extensions to)]486.6 norm0 +[(the )2(GLOBAL)0( directive, allowing you to specify these features.)]475.6 norm2 +[(You can specify whether a global variable is a function or a data object by suffixing the name with a colon)]458.6 norm1 +[(and the word )2(function)0( or )2(data)0(. \()2(object)0( is a synonym for )2(data)0(.\) For example:)]447.6 norm2 +[2(global hashlookup:function, hashtable:data)]430.6 code3 +[(exports the global symbol )2(hashlookup)0( as a function and )2(hashtable)0( as a data object.)]413.6 norm3 +[(Optionally, you can control the ELF visibility of the symbol. Just add one of the visibility keywords:)]396.6 norm1 +[2(default)0(, )2(internal)0(, )2(hidden)0(, or )2(protected)0(. The default is )2(default)0( of course. For example, to make)]385.6 norm0 +[2(hashlookup)0( hidden:)]374.6 norm2 +[2(global hashlookup:function hidden)]357.6 code3 +[(You can also specify the size of the data associated with the symbol, as a numeric expression \(which may)]340.6 norm1 +[(involve labels, and even forward references\) after the type specifier. Like this:)]329.6 norm2 +[2(global hashtable:data \(hashtable.end - hashtable\) )]312.6 code1 +[2()]301.6 code0 +[2(hashtable: )]290.6 code0 +[2( db this,that,theother ; some data here )]279.6 code0 +[2(.end:)]268.6 code2 +[(This makes NASM automatically calculate the length of the table and place that information into the )2(ELF)]251.6 norm1 +[(symbol table.)]240.6 norm2 +[(Declaring the type and size of global symbols is necessary when writing shared library code. For more)]223.6 norm1 +[(information, see ){/section-9.2.4 xl}(section 9.2.4){el}(.)]212.6 norm2 +[{/section-7.9.6 xa}2(elf)0( Extensions to the )2(COMMON)0( Directive )](7.9.6)193.4 subh3 +[2(ELF)0( also allows you to specify alignment requirements )(on common variables. This is done by putting a)]176.4 norm1 +[(number \(which must be a power of two\) after the name and size of the common variable, separated \(as usual\))]165.4 norm0 +[(by a colon. For example, an array of doublewords would benefit from 4-byte alignment:)]154.4 norm2 +[2(common dwordarray 128:4)]137.4 code3 +[(This declares the total size of the array to be 128 bytes, and requires that it be aligned on a 4-byte boundary.)]120.4 norm3 +(87)pageodd +restore showpage +%%Page: 88 88 +%%BeginPageSetup +save +%%EndPageSetup +/88 pa +[{/section-7.9.7 xa}(16-bit code and ELF )](7.9.7)678.8 subh3 +[(The )2(ELF32)0( specification doesn't provide relocations for 8- and 16-bit values, but the GNU )2(ld)0( linker adds)]661.8 norm1 +[(these as an extension. NASM can generate GNU-compatible relocations, to allow 16-bit code to be linked as)]650.8 norm0 +[(ELF using GNU )2(ld)0(. If NASM is used with the )2(-w+gnu-elf-extensions)0( option, a warning is issued)]639.8 norm0 +[(when one of these relocations is generated.)]628.8 norm2 +[{/section-7.9.8 xa}(Debug formats and ELF )](7.9.8)609.6 subh3 +[2(ELF32)0( and )2(ELF64)0( provide debug information in )2(STABS)0( and )2(DWARF)0( formats. Line number information is)]592.6 norm1 +[(generated for all executable sections, but please note that only the ".text" section is executable by default.)]581.6 norm2 +[{/section-7.10 xa}2(aout)0(: Linux )2(a.out)0( Object Files)](7.10)560.2 head3 +[(The )2(aout)0( format generates )2(a.out)0( object files, in the form used by early Linux systems \(current Linux)]543.2 norm1 +[(systems use ELF, see ){/section-7.9 xl}(section 7.9){el}(.\) These differ from other )2(a.out)0( object files in that the magic number in the)]532.2 norm0 +[(first four bytes of the file is different; also, some implementations of )2(a.out)0(, for example NetBSD's, support)]521.2 norm0 +[(position-independent code, which Linux's implementation does not.)]510.2 norm2 +[2(a.out)0( provides a default output file-name extension of )2(.o)0(.)]493.2 norm3 +[2(a.out)0( is a very simple object format. It supports no special directives, no special symbols, no use of )2(SEG)0( or)]476.2 norm1 +[2(WRT)0(, and no extensions to any standard directives. It supports only the three )(standard section names )2(.text)0(,)]465.2 norm0 +[2(.data)0( and )2(.bss)0(.)]454.2 norm2 +[{/section-7.11 xa}2(aoutb)0(: )(NetBSD/)(FreeBSD/)(OpenBSD )2(a.out)0( Object Files)](7.11)432.8 head3 +[(The )2(aoutb)0( format generates )2(a.out)0( object files, in the form used by the various free )2(BSD Unix)0( clones,)]415.8 norm1 +[2(NetBSD)0(, )2(FreeBSD)0( and )2(OpenBSD)0(. For simple object files, this object format is exactly the same as )2(aout)]404.8 norm0 +[(except for the magic number in the first four bytes of the file. However, the )2(aoutb)0( format supports)]393.8 norm0 +[(position-independent code in the same way as the )2(elf)0( format, so you can use it to write )2(BSD)0( )(shared libraries.)]382.8 norm2 +[2(aoutb)0( provides a default output file-name extension of )2(.o)0(.)]365.8 norm3 +[2(aoutb)0( supports no special directives, no special symbols, and only the three )(standard section names )2(.text)0(,)]348.8 norm1 +[2(.data)0( and )2(.bss)0(. However, it also supports the same use of )2(WRT)0( as )2(elf)0( does, to provide)]337.8 norm0 +[(position-independent code relocation types. See ){/section-7.9.3 xl}(section 7.9.3){el}( for full documentation of this feature.)]326.8 norm2 +[2(aoutb)0( also supports the same extensions to the )2(GLOBAL)0( directive as )2(elf)0( does: see ){/section-7.9.5 xl}(section 7.9.5){el}( for)]309.8 norm1 +[(documentation of this.)]298.8 norm2 +[{/section-7.12 xa}2(as86)0(: )(Minix/Linux)( )2(as86)0( Object Files)](7.12)277.4 head3 +[(The Minix/Linux 16-bit assembler )2(as86)0( has its own non-standard object file format. Although its)]260.4 norm1 +[(companion linker )2(ld86)0( produces something close to ordinary )2(a.out)0( binaries as output, the object file)]249.4 norm0 +[(format used to communicate between )2(as86)0( and )2(ld86)0( is not itself )2(a.out)0(.)]238.4 norm2 +[(NASM supports this format, just in case it is useful, as )2(as86)0(. )2(as86)0( provides a default output file-name)]221.4 norm1 +[(extension of )2(.o)0(.)]210.4 norm2 +[2(as86)0( is a very simple object format \(from the NASM user's point of view\). It supports no special directives,)]193.4 norm1 +[(no use of )2(SEG)0( or )2(WRT)0(, and no extensions to any standard directives. It supports only the three )(standard section)]182.4 norm0 +[(names )2(.text)0(, )2(.data)0( and )2(.bss)0(. The only special symbol supported is )2(..start)0(.)]171.4 norm2 +[{/section-7.13 xa}2(rdf)0(: )(Relocatable Dynamic Object File Format)](7.13)150 head3 +[(The )2(rdf)0( output format produces )2(RDOFF)0( object files. )2(RDOFF)0( \(Relocatable Dynamic Object File Format\) is a)]133 norm1 +[(home-grown object-file format, designed alongside NASM itself and reflecting in its file format the internal)]122 norm0 +[(structure of the assembler.)]111 norm2 +(88)pageeven +restore showpage +%%Page: 89 89 +%%BeginPageSetup +save +%%EndPageSetup +/89 pa +[2(RDOFF)0( is not used by any well-known operating systems. Those writing their own systems, however, may)]681 norm1 +[(well wish to use )2(RDOFF)0( as their object format, on the grounds that it is designed primarily for simplicity and)]670 norm0 +[(contains very little file-header bureaucracy.)]659 norm2 +[(The Unix NASM archive, and the DOS archive which includes sources, both contain an )2(rdoff)0( subdirectory)]642 norm1 +[(holding a set of RDOFF utilities: an RDF linker, an )2(RDF)0( static-library manager, an RDF file dump utility,)]631 norm0 +[(and a program which will load and execute an RDF executable under Linux.)]620 norm2 +[2(rdf)0( supports only the )(standard section names )2(.text)0(, )2(.data)0( and )2(.bss)0(.)]603 norm3 +[{/section-7.13.1 xa}(Requiring a Library: The )2(LIBRARY)0( Directive)](7.13.1)583.8 subh3 +[2(RDOFF)0( contains a mechanism for an object file to demand a given library to be linked to the module, either at)]566.8 norm1 +[(load time or run time. This is done by the )2(LIBRARY)0( directive, which takes one argument which is the name)]555.8 norm0 +[(of the module:)]544.8 norm2 +[2( library mylib.rdl)]527.8 code3 +[{/section-7.13.2 xa}(Specifying a Module Name: The )2(MODULE)0( Directive)](7.13.2)508.6 subh3 +[(Special )2(RDOFF)0( header record is used to store the name of the module. It can be used, for example, by)]491.6 norm1 +[(run-time loader to perform dynamic linking. )2(MODULE)0( directive takes one argument which is the name of)]480.6 norm0 +[(current module:)]469.6 norm2 +[2( module mymodname)]452.6 code3 +[(Note that when you statically link modules and tell linker to strip the symbols from output file, all module)]435.6 norm1 +[(names will be stripped too. To avoid it, you should start module names with )2($)0(, like:)]424.6 norm2 +[2( module $kernel.core)]407.6 code3 +[{/section-7.13.3 xa}2(rdf)0( Extensions to the )2(GLOBAL)0( Directive)](7.13.3)388.4 subh3 +[2(RDOFF)0( global symbols can contain additional information needed by the static linker. You can mark a global)]371.4 norm1 +[(symbol as exported, thus telling the linker do not strip it from target executable or library file. Like in )2(ELF)0(,)]360.4 norm0 +[(you can also specify whether an exported symbol is a procedure \(function\) or data object.)]349.4 norm2 +[(Suffixing the name with a colon and the word )2(export)0( you make the symbol exported:)]332.4 norm3 +[2( global sys_open:export)]315.4 code3 +[(To specify that exported symbol is a procedure \(function\), you add the word )2(proc)0( or )2(function)0( after)]298.4 norm1 +[(declaration:)]287.4 norm2 +[2( global sys_open:export proc)]270.4 code3 +[(Similarly, to specify exported data object, add the word )2(data)0( or )2(object)0( to the directive:)]253.4 norm3 +[2( global kernel_ticks:export data)]236.4 code3 +[{/section-7.13.4 xa}2(rdf)0( Extensions to the )2(EXTERN)0( Directive)](7.13.4)217.2 subh3 +[(By default the )2(EXTERN)0( directive in )2(RDOFF)0( declares a "pure external" symbol \(i.e. the static linker will)]200.2 norm1 +[(complain if such a symbol is not resolved\). To declare an "imported" symbol, which must be resolved later)]189.2 norm0 +[(during a dynamic linking phase, )2(RDOFF)0( offers an additional )2(import)0( modifier. As in )2(GLOBAL)0(, you can also)]178.2 norm0 +[(specify whether an imported symbol is a procedure \(function\) or data object. For example:)]167.2 norm2 +[2( library $libc )]150.2 code1 +[2( extern _open:import )]139.2 code0 +[2( extern _printf:import proc )]128.2 code0 +[2( extern _errno:import data)]117.2 code2 +(89)pageodd +restore showpage +%%Page: 90 90 +%%BeginPageSetup +save +%%EndPageSetup +/90 pa +[(Here the directive )2(LIBRARY)0( is also included, which gives the dynamic linker a hint as to where to find)]681 norm1 +[(requested symbols.)]670 norm2 +[{/section-7.14 xa}2(dbg)0(: Debugging Format)](7.14)648.6 head3 +[(The )2(dbg)0( output format is not built into NASM in the default configuration. If you are building your own)]631.6 norm1 +[(NASM executable from the sources, you can define )2(OF_DBG)0( in )2(output/outform.h)0( or on the compiler)]620.6 norm0 +[(command line, and obtain the )2(dbg)0( output format.)]609.6 norm2 +[(The )2(dbg)0( format does not output an object file as such; instead, it outputs a text file which contains a complete)]592.6 norm1 +[(list of all the transactions between the main body of NASM and the output-format back end module. It is)]581.6 norm0 +[(primarily intended to aid people who want to write their own output drivers, so that they can get a clearer idea)]570.6 norm0 +[(of the various requests the main program makes of the output driver, and in what order they happen.)]559.6 norm2 +[(For simple files, one can easily use the )2(dbg)0( format like this:)]542.6 norm3 +[2(nasm -f dbg filename.asm)]525.6 code3 +[(which will generate a diagnostic file called )2(filename.dbg)0(. However, this will not work well on files)]508.6 norm1 +[(which were designed for a different object format, because each object format defines its own macros \(usually)]497.6 norm0 +[(user-level forms of directives\), and those macros will not be defined in the )2(dbg)0( format. Therefore it can be)]486.6 norm0 +[(useful to run NASM twice, in order to do the preprocessing with the native object format selected:)]475.6 norm2 +[2(nasm -e -f rdf -o rdfprog.i rdfprog.asm )]458.6 code1 +[2(nasm -a -f dbg rdfprog.i)]447.6 code2 +[(This preprocesses )2(rdfprog.asm)0( into )2(rdfprog.i)0(, keeping the )2(rdf)0( object format selected in order to)]430.6 norm1 +[(make sure RDF special directives are converted into primitive form correctly. Then the preprocessed source is)]419.6 norm0 +[(fed through the )2(dbg)0( format to generate the final diagnostic output.)]408.6 norm2 +[(This workaround will still typically not work for programs intended for )2(obj)0( format, because the )2(obj)]391.6 norm1 +[2(SEGMENT)0( and )2(GROUP)0( directives have side effects of defining the segment and group names as symbols; )2(dbg)]380.6 norm0 +[(will not do this, so the program will not assemble. You will have to work around that by defining the symbols)]369.6 norm0 +[(yourself \(using )2(EXTERN)0(, for example\) if you really need to get a )2(dbg)0( trace of an )2(obj)0(\226specific source file.)]358.6 norm2 +[2(dbg)0( accepts any section name and any directives at all, and logs them all to its output file.)]341.6 norm3 +(90)pageeven +restore showpage +%%Page: 91 91 +%%BeginPageSetup +save +%%EndPageSetup +/91 pa +[{/chapter-8 xa}(Chapter 8: Writing 16-bit Code \(DOS, Windows 3/3.1\))]642.8 chap3 +[(This chapter attempts to cover some of the common issues encountered when writing 16-bit code to run)]607.8 norm1 +[(under )2(MS-DOS)0( or )2(Windows 3.x)0(. It covers how to link programs to produce )2(.EXE)0( or )2(.COM)0( files, how to)]596.8 norm0 +[(write )2(.SYS)0( device drivers, and how to interface assembly language code with 16-bit C compilers and with)]585.8 norm0 +[(Borland Pascal.)]574.8 norm2 +[{/section-8.1 xa}(Producing )2(.EXE)0( Files)](8.1)553.4 head3 +[(Any large program written under DOS needs to be built as a )2(.EXE)0( file: only )2(.EXE)0( files have the necessary)]536.4 norm1 +[(internal structure required to span more than one 64K segment. )(Windows programs, also, have to be built as)]525.4 norm0 +[2(.EXE)0( files, since Windows does not support the )2(.COM)0( format.)]514.4 norm2 +[(In general, you generate )2(.EXE)0( files by using the )2(obj)0( output format to produce one or more )2(.OBJ)0( files, and)]497.4 norm1 +[(then linking them together using a linker. However, NASM also supports the direct generation of simple DOS)]486.4 norm0 +[2(.EXE)0( files using the )2(bin)0( output format \(by using )2(DB)0( and )2(DW)0( to construct the )2(.EXE)0( file header\), and a macro)]475.4 norm0 +[(package is supplied to do this. Thanks to Yann Guidon for contributing the code for this.)]464.4 norm2 +[(NASM may also support )2(.EXE)0( natively as another output format in future releases.)]447.4 norm3 +[{/section-8.1.1 xa}(Using the )2(obj)0( Format To Generate )2(.EXE)0( Files)](8.1.1)428.2 subh3 +[(This section describes the usual method of generating )2(.EXE)0( files by linking )2(.OBJ)0( files together.)]411.2 norm3 +[(Most 16-bit programming language packages come with a suitable linker; if you have none of these, there is a)]394.2 norm1 +[(free linker called )(VAL)(, available in )2(LZH)0( archive format from ){(ftp://x2ftp.oulu.fi/pub/msdos/programming/lang/)wl}2(x2ftp.oulu.fi){el}0(. An LZH archiver can be)]383.2 norm0 +[(found at ){(ftp://ftp.simtel.net/pub/simtelnet/msdos/arcers)wl}2(ftp.simtel.net){el}0(. There is another `free' linker \(though this one doesn't come with sources\))]372.2 norm0 +[(called )(FREELINK, available from ){(http://www.pcorner.com/tpc/old/3-101.html)wl}2(www.pcorner.com){el}0(. A third, )2(djlink)0(, written by DJ Delorie, is)]361.2 norm0 +[(available at ){(http://www.delorie.com/djgpp/16bit/djlink/)wl}2(www.delorie.com){el}0(. A fourth linker, )2(ALINK)0(, written by Anthony A.J. Williams, is available at)]350.2 norm0 +[{(http://alink.sourceforge.net)wl}2(alink.sourceforge.net){el}0(.)]339.2 norm2 +[(When linking several )2(.OBJ)0( files into a )2(.EXE)0( file, you should ensure that exactly one of them has a start point)]322.2 norm1 +[(defined \(using the )2(..start)0( special symbol defined by the )2(obj)0( format: see ){/section-7.4.6 xl}(section 7.4.6){el}(\). If no module)]311.2 norm0 +[(defines a start point, the linker will not know what value to give the entry-point field in the output file header;)]300.2 norm0 +[(if more than one defines a start point, the linker will not know )1(which)0( value to use.)]289.2 norm2 +[(An example of a NASM source file which can be assembled to a )2(.OBJ)0( file and linked on its own to a )2(.EXE)]272.2 norm1 +[(is given here. It demonstrates the basic principles of defining a stack, initialising the segment registers, and)]261.2 norm0 +[(declaring a start point. This file is also provided in the )2(test)0( subdirectory of the NASM archives, under the)]250.2 norm0 +[(name )2(objexe.asm)0(.)]239.2 norm2 +[2(segment code )]222.2 code1 +[2()]211.2 code0 +[2(..start: )]200.2 code0 +[2( mov ax,data )]189.2 code0 +[2( mov ds,ax )]178.2 code0 +[2( mov ax,stack )]167.2 code0 +[2( mov ss,ax )]156.2 code0 +[2( mov sp,stacktop)]145.2 code2 +[(This initial piece of code sets up )2(DS)0( to point to the data segment, and initializes )2(SS)0( and )2(SP)0( to point to the top)]128.2 norm1 +[(of the provided stack. Notice that interrupts are implicitly disabled for one instruction after a move into )2(SS)0(,)]117.2 norm0 +(91)pageodd +restore showpage +%%Page: 92 92 +%%BeginPageSetup +save +%%EndPageSetup +/92 pa +[(precisely for this situation, so that there's no chance of an interrupt occurring between the loads of )2(SS)0( and )2(SP)]681 norm0 +[(and not having a stack to execute on.)]670 norm2 +[(Note also that the special symbol )2(..start)0( is defined at the beginning of this code, which means that will be)]653 norm1 +[(the entry point into the resulting executable file.)]642 norm2 +[2( mov dx,hello )]625 code1 +[2( mov ah,9 )]614 code0 +[2( int 0x21)]603 code2 +[(The above is the main program: load )2(DS:DX)0( with a pointer to the greeting message \()2(hello)0( is implicitly)]586 norm1 +[(relative to the segment )2(data)0(, which was loaded into )2(DS)0( in the setup code, so the full pointer is valid\), and)]575 norm0 +[(call the DOS print-string function.)]564 norm2 +[2( mov ax,0x4c00 )]547 code1 +[2( int 0x21)]536 code2 +[(This terminates the program using another DOS system call.)]519 norm3 +[2(segment data )]502 code1 +[2()]491 code0 +[2(hello: db 'hello, world', 13, 10, '$')]480 code2 +[(The data segment contains the string we want to display.)]463 norm3 +[2(segment stack stack )]446 code1 +[2( resb 64 )]435 code0 +[2(stacktop:)]424 code2 +[(The above code declares a stack segment containing 64 bytes of uninitialized stack space, and points)]407 norm1 +[2(stacktop)0( at the top of it. The directive )2(segment stack stack)0( defines a segment )1(called)0( )2(stack)0(, and)]396 norm0 +[(also of )1(type)0( )2(STACK)0(. The latter is not necessary to the correct running of the program, but linkers are likely to)]385 norm0 +[(issue warnings or errors if your program has no segment of type )2(STACK)0(.)]374 norm2 +[(The above file, when assembled into a )2(.OBJ)0( file, will link on its own to a valid )2(.EXE)0( file, which when run)]357 norm1 +[(will print `hello, world' and then exit.)]346 norm2 +[{/section-8.1.2 xa}(Using the )2(bin)0( Format To Generate )2(.EXE)0( Files)](8.1.2)326.8 subh3 +[(The )2(.EXE)0( file format is simple enough that it's possible to build a )2(.EXE)0( file by writing a pure-binary)]309.8 norm1 +[(program and sticking a 32-byte header on the front. This header is simple enough that it can be generated)]298.8 norm0 +[(using )2(DB)0( and )2(DW)0( commands by NASM itself, so that you can use the )2(bin)0( output format to directly generate)]287.8 norm0 +[2(.EXE)0( files.)]276.8 norm2 +[(Included in the NASM archives, in the )2(misc)0( subdirectory, is a file )2(exebin.mac)0( of macros. It defines three)]259.8 norm1 +[(macros: )2(EXE_begin)0(, )2(EXE_stack)0( and )2(EXE_end)0(.)]248.8 norm2 +[(To produce a )2(.EXE)0( file using this method, you should start by using )2(%include)0( to load the )2(exebin.mac)]231.8 norm1 +[(macro package into your source file. You should then issue the )2(EXE_begin)0( macro call \(which takes no)]220.8 norm0 +[(arguments\) to generate the file header data. Then write code as normal for the )2(bin)0( format \226 you can use all)]209.8 norm0 +[(three standard sections )2(.text)0(, )2(.data)0( and )2(.bss)0(. At the end of the file you should call the )2(EXE_end)0( macro)]198.8 norm0 +[(\(again, no arguments\), which defines some symbols to mark section sizes, and these symbols are referred to in)]187.8 norm0 +[(the header code generated by )2(EXE_begin)0(.)]176.8 norm2 +[(In this model, the code you end up writing starts at )2(0x100)0(, just like a )2(.COM)0( file \226 in fact, if you strip off the)]159.8 norm1 +[(32-byte header from the resulting )2(.EXE)0( file, you will have a valid )2(.COM)0( program. All the segment bases are)]148.8 norm0 +[(the same, so you are limited to a 64K program, again just like a )2(.COM)0( file. Note that an )2(ORG)0( directive is)]137.8 norm0 +[(issued by the )2(EXE_begin)0( macro, so you should not explicitly issue one of your own.)]126.8 norm2 +(92)pageeven +restore showpage +%%Page: 93 93 +%%BeginPageSetup +save +%%EndPageSetup +/93 pa +[(You can't directly refer to your segment base value, unfortunately, since this would require a relocation in the)]681 norm1 +[(header, and things would get a lot more complicated. So you should get your segment base by copying it out)]670 norm0 +[(of )2(CS)0( instead.)]659 norm2 +[(On entry to your )2(.EXE)0( file, )2(SS:SP)0( are already set up to point to the top of a 2Kb stack. You can adjust the)]642 norm1 +[(default stack size of 2Kb by calling the )2(EXE_stack)0( macro. For example, to change the stack size of your)]631 norm0 +[(program to 64 bytes, you would call )2(EXE_stack 64)0(.)]620 norm2 +[(A sample program which generates a )2(.EXE)0( file in this way is given in the )2(test)0( subdirectory of the NASM)]603 norm1 +[(archive, as )2(binexe.asm)0(.)]592 norm2 +[{/section-8.2 xa}(Producing )2(.COM)0( Files)](8.2)570.6 head3 +[(While large DOS programs must be written as )2(.EXE)0( files, small ones are often better written as )2(.COM)0( files.)]553.6 norm1 +[2(.COM)0( files are pure binary, and therefore most easily produced using the )2(bin)0( output format.)]542.6 norm2 +[{/section-8.2.1 xa}(Using the )2(bin)0( Format To Generate )2(.COM)0( Files)](8.2.1)523.4 subh3 +[2(.COM)0( files expect to be loaded at offset )2(100h)0( into their segment \(though the segment may change\).)]506.4 norm1 +[(Execution then begins at )2(100h)0(, i.e. right at the start of the program. So to write a )2(.COM)0( program, you would)]495.4 norm0 +[(create a source file looking like)]484.4 norm2 +[2( org 100h )]467.4 code1 +[2()]456.4 code0 +[2(section .text )]445.4 code0 +[2()]434.4 code0 +[2(start: )]423.4 code0 +[2( ; put your code here )]412.4 code0 +[2()]401.4 code0 +[2(section .data )]390.4 code0 +[2()]379.4 code0 +[2( ; put data items here )]368.4 code0 +[2()]357.4 code0 +[2(section .bss )]346.4 code0 +[2()]335.4 code0 +[2( ; put uninitialized data here)]324.4 code2 +[(The )2(bin)0( format puts the )2(.text)0( section first in the file, so you can declare data or BSS items before)]307.4 norm1 +[(beginning to write code if you want to and the code will still end up at the front of the file where it belongs.)]296.4 norm2 +[(The BSS \(uninitialized data\) section does not take up space in the )2(.COM)0( file itself: instead, addresses of BSS)]279.4 norm1 +[(items are resolved to point at space beyond the end of the file, on the grounds that this will be free memory)]268.4 norm0 +[(when the program is run. Therefore you should not rely on your BSS being initialized to all zeros when you)]257.4 norm0 +[(run.)]246.4 norm2 +[(To assemble the above program, you should use a command line like)]229.4 norm3 +[2(nasm myprog.asm -fbin -o myprog.com)]212.4 code3 +[(The )2(bin)0( format would produce a file called )2(myprog)0( if no explicit output file name were specified, so you)]195.4 norm1 +[(have to override it and give the desired file name.)]184.4 norm2 +[{/section-8.2.2 xa}(Using the )2(obj)0( Format To Generate )2(.COM)0( Files)](8.2.2)165.2 subh3 +[(If you are writing a )2(.COM)0( program as more than one module, you may wish to assemble several )2(.OBJ)0( files)]148.2 norm1 +[(and link them together into a )2(.COM)0( program. You can do this, provided you have a linker capable of)]137.2 norm0 +[(outputting )2(.COM)0( files directly \()(TLINK does this\), or alternatively a converter program such as )2(EXE2BIN)0( to)]126.2 norm0 +[(transform the )2(.EXE)0( file output from the linker into a )2(.COM)0( file.)]115.2 norm2 +(93)pageodd +restore showpage +%%Page: 94 94 +%%BeginPageSetup +save +%%EndPageSetup +/94 pa +[(If you do this, you need to take care of several things:)]681 norm3 +[(The first object file containing code should start its code segment with a line like )2(RESB 100h)0(. This is to)]664 bull1 +[(ensure that the code begins at offset )2(100h)0( relative to the beginning of the code segment, so that the linker)]653 bull0 +[(or converter program does not have to adjust address references within the file when generating the )2(.COM)]642 bull0 +[(file. Other assemblers use an )2(ORG)0( directive for this purpose, but )2(ORG)0( in NASM is a format-specific)]631 bull0 +[(directive to the )2(bin)0( output format, and does not mean the same thing as it does in MASM-compatible)]620 bull0 +[(assemblers.)]609 bull2 +[(You don't need to define a stack segment.)]592 bull3 +[(All your segments should be in the same group, so that every time your code or data references a symbol)]575 bull1 +[(offset, all offsets are relative to the same segment base. This is because, when a )2(.COM)0( file is loaded, all the)]564 bull0 +[(segment registers contain the same value.)]553 bull2 +[{/section-8.3 xa}(Producing )2(.SYS)0( Files)](8.3)531.6 head3 +[(MS-DOS device drivers \226 )2(.SYS)0( files \226 are pure binary files, similar to )2(.COM)0( files, except that they start at)]514.6 norm1 +[(origin zero rather than )2(100h)0(. Therefore, if you are writing a device driver using the )2(bin)0( format, you do not)]503.6 norm0 +[(need the )2(ORG)0( directive, since the default origin for )2(bin)0( is zero. Similarly, if you are using )2(obj)0(, you do not)]492.6 norm0 +[(need the )2(RESB 100h)0( at the start of your code segment.)]481.6 norm2 +[2(.SYS)0( files start with a header structure, containing pointers to the various routines inside the driver which do)]464.6 norm1 +[(the work. This structure should be defined at the start of the code segment, even though it is not actually code.)]453.6 norm2 +[(For more information on the format of )2(.SYS)0( files, and the data which has to go in the header structure, a list)]436.6 norm1 +[(of books is given in the Frequently Asked Questions list for the newsgroup)]425.6 norm0 +[{(news:comp.os.msdos.programmer)wl}2(comp.os.msdos.programmer){el}0(.)]414.6 norm2 +[{/section-8.4 xa}(Interfacing to 16-bit C Programs)](8.4)393.2 head3 +[(This section covers the basics of writing assembly routines that call, or are called from, C programs. To do)]376.2 norm1 +[(this, you would typically write an assembly module as a )2(.OBJ)0( file, and link it with your C modules to)]365.2 norm0 +[(produce a )(mixed-language program.)]354.2 norm2 +[{/section-8.4.1 xa}(External Symbol Names)](8.4.1)335 subh3 +[(C compilers have the convention that the names of all global symbols \(functions or data\) they define are)]318 norm1 +[(formed by prefixing an underscore to the name as it appears in the C program. So, for example, the function a)]307 norm0 +[(C programmer thinks of as )2(printf)0( appears to an assembly language programmer as )2(_printf)0(. This means)]296 norm0 +[(that in your assembly programs, you can define symbols without a leading underscore, and not have to worry)]285 norm0 +[(about name clashes with C symbols.)]274 norm2 +[(If you find the underscores inconvenient, you can define macros to replace the )2(GLOBAL)0( and )2(EXTERN)]257 norm1 +[(directives as follows:)]246 norm2 +[2(%macro cglobal 1 )]229 code1 +[2()]218 code0 +[2( global _%1 )]207 code0 +[2( %define %1 _%1 )]196 code0 +[2()]185 code0 +[2(%endmacro )]174 code0 +[2()]163 code0 +[2(%macro cextern 1 )]152 code0 +[2()]141 code0 +[2( extern _%1 )]130 code0 +[2( %define %1 _%1 )]119 code0 +(94)pageeven +restore showpage +%%Page: 95 95 +%%BeginPageSetup +save +%%EndPageSetup +/95 pa +[2()]681 code0 +[2(%endmacro)]670 code2 +[(\(These forms of the macros only take one argument at a time; a )2(%rep)0( construct could solve this.\))]653 norm3 +[(If you then declare an external like this:)]636 norm3 +[2(cextern printf)]619 code3 +[(then the macro will expand it as)]602 norm3 +[2(extern _printf )]585 code1 +[2(%define printf _printf)]574 code2 +[(Thereafter, you can reference )2(printf)0( as if it was a symbol, and the preprocessor will put the leading)]557 norm1 +[(underscore on where necessary.)]546 norm2 +[(The )2(cglobal)0( macro works similarly. You must use )2(cglobal)0( before defining the symbol in question, but)]529 norm1 +[(you would have had to do that anyway if you used )2(GLOBAL)0(.)]518 norm2 +[(Also see ){/section-2.1.27 xl}(section 2.1.27){el}(.)]501 norm3 +[{/section-8.4.2 xa}(Memory Models)](8.4.2)481.8 subh3 +[(NASM contains no mechanism to support the various C memory models directly; you have to keep track)]464.8 norm1 +[(yourself of which one you are writing for. This means you have to keep track of the following things:)]453.8 norm2 +[(In models using a single code segment \(tiny, small and compact\), functions are near. This means that)]436.8 bull1 +[(function pointers, when stored in data segments or pushed on the stack as function arguments, are 16 bits)]425.8 bull0 +[(long and contain only an offset field \(the )2(CS)0( register never changes its value, and always gives the segment)]414.8 bull0 +[(part of the full function address\), and that functions are called using ordinary near )2(CALL)0( instructions and)]403.8 bull0 +[(return using )2(RETN)0( \(which, in NASM, is synonymous with )2(RET)0( anyway\). This means both that you should)]392.8 bull0 +[(write your own routines to return with )2(RETN)0(, and that you should call external C routines with near )2(CALL)]381.8 bull0 +[(instructions.)]370.8 bull2 +[(In models using more than one code segment \(medium, large and huge\), functions are far. This means that)]353.8 bull1 +[(function pointers are 32 bits long \(consisting of a 16-bit offset followed by a 16-bit segment\), and that)]342.8 bull0 +[(functions are called using )2(CALL FAR)0( \(or )2(CALL seg:offset)0(\) and return using )2(RETF)0(. Again, you)]331.8 bull0 +[(should therefore write your own routines to return with )2(RETF)0( and use )2(CALL FAR)0( to call external routines.)]320.8 bull2 +[(In models using a single data segment \(tiny, small and medium\), data pointers are 16 bits long, containing)]303.8 bull1 +[(only an offset field \(the )2(DS)0( register doesn't change its value, and always gives the segment part of the full)]292.8 bull0 +[(data item address\).)]281.8 bull2 +[(In models using more than one data segment \(compact, large and huge\), data pointers are 32 bits long,)]264.8 bull1 +[(consisting of a 16-bit offset followed by a 16-bit segment. You should still be careful not to modify )2(DS)0( in)]253.8 bull0 +[(your routines without restoring it afterwards, but )2(ES)0( is free for you to use to access the contents of 32-bit)]242.8 bull0 +[(data pointers you are passed.)]231.8 bull2 +[(The huge memory model allows single data items to exceed 64K in size. In all other memory models, you)]214.8 bull1 +[(can access the whole of a data item just by doing arithmetic on the offset field of the pointer you are given,)]203.8 bull0 +[(whether a segment field is present or not; in huge model, you have to be more careful of your pointer)]192.8 bull0 +[(arithmetic.)]181.8 bull2 +[(In most memory models, there is a )1(default)0( data segment, whose segment address is kept in )2(DS)0( throughout)]164.8 bull1 +[(the program. This data segment is typically the same segment as the stack, kept in )2(SS)0(, so that functions')]153.8 bull0 +[(local variables \(which are stored on the stack\) and global data items can both be accessed easily without)]142.8 bull0 +[(changing )2(DS)0(. Particularly large data items are typically stored in other segments. However, some memory)]131.8 bull0 +[(models \(though not the standard ones, usually\) allow the assumption that )2(SS)0( and )2(DS)0( hold the same value to)]120.8 bull0 +[(be removed. Be careful about functions' local variables in this latter case.)]109.8 bull2 +(95)pageodd +restore showpage +%%Page: 96 96 +%%BeginPageSetup +save +%%EndPageSetup +/96 pa +[(In models with a single code segment, the segment is called )2(_TEXT)0(, so your code segment must also go by)]681 norm1 +[(this name in order to be linked into the same place as the main code segment. In models with a single data)]670 norm0 +[(segment, or with a default data segment, it is called )2(_DATA)0(.)]659 norm2 +[{/section-8.4.3 xa}(Function Definitions and Function Calls)](8.4.3)639.8 subh3 +[(The )(C calling convention in 16-bit programs is as follows. In the following description, the words )1(caller)0( and)]622.8 norm1 +[1(callee)0( are used to denote the function doing the calling and the function which gets called.)]611.8 norm2 +[(The caller pushes the function's parameters on the stack, one after another, in reverse order \(right to left, so)]594.8 bull1 +[(that the first argument specified to the function is pushed last\).)]583.8 bull2 +[(The caller then executes a )2(CALL)0( instruction to pass control to the callee. This )2(CALL)0( is either near or far)]566.8 bull1 +[(depending on the memory model.)]555.8 bull2 +[(The callee receives control, and typically \(although this is not actually necessary, in functions which do not)]538.8 bull1 +[(need to access their parameters\) starts by saving the value of )2(SP)0( in )2(BP)0( so as to be able to use )2(BP)0( as a base)]527.8 bull0 +[(pointer to find its parameters on the stack. However, the caller was probably doing this too, so part of the)]516.8 bull0 +[(calling convention states that )2(BP)0( must be preserved by any C function. Hence the callee, if it is going to set)]505.8 bull0 +[(up )2(BP)0( as a )1(frame pointer)0(, must push the previous value first.)]494.8 bull2 +[(The callee may then access its parameters relative to )2(BP)0(. The word at )2([BP])0( holds the previous value of )2(BP)]477.8 bull1 +[(as it was pushed; the next word, at )2([BP+2])0(, holds the offset part of the return address, pushed implicitly)]466.8 bull0 +[(by )2(CALL)0(. In a small-model \(near\) function, the parameters start after that, at )2([BP+4])0(; in a large-model)]455.8 bull0 +[(\(far\) function, the segment part of the return address lives at )2([BP+4])0(, and the parameters begin at)]444.8 bull0 +[2([BP+6])0(. The leftmost parameter of the function, since it was pushed last, is accessible at this offset from)]433.8 bull0 +[2(BP)0(; the others follow, at successively greater offsets. Thus, in a function such as )2(printf)0( which takes a)]422.8 bull0 +[(variable number of parameters, the pushing of the parameters in reverse order means that the function)]411.8 bull0 +[(knows where to find its first parameter, which tells it the number and type of the remaining ones.)]400.8 bull2 +[(The callee may also wish to decrease )2(SP)0( further, so as to allocate space on the stack for local variables,)]383.8 bull1 +[(which will then be accessible at negative offsets from )2(BP)0(.)]372.8 bull2 +[(The callee, if it wishes to return a value to the caller, should leave the value in )2(AL)0(, )2(AX)0( or )2(DX:AX)]355.8 bull1 +[(depending on the size of the value. Floating-point results are sometimes \(depending on the compiler\))]344.8 bull0 +[(returned in )2(ST0)0(.)]333.8 bull2 +[(Once the callee has finished processing, it restores )2(SP)0( from )2(BP)0( if it had allocated local stack space, then)]316.8 bull1 +[(pops the previous value of )2(BP)0(, and returns via )2(RETN)0( or )2(RETF)0( depending on memory model.)]305.8 bull2 +[(When the caller regains control from the callee, the function parameters are still on the stack, so it typically)]288.8 bull1 +[(adds an immediate constant to )2(SP)0( to remove them \(instead of executing a number of slow )2(POP)]277.8 bull0 +[(instructions\). Thus, if a function is accidentally called with the wrong number of parameters due to a)]266.8 bull0 +[(prototype mismatch, the stack will still be returned to a sensible state since the caller, which )1(knows)0( how)]255.8 bull0 +[(many parameters it pushed, does the removing.)]244.8 bull2 +[(It is instructive to compare this calling convention with that for Pascal programs \(described in ){/section-8.5.1 xl}(section 8.5.1){el}(\).)]227.8 norm1 +[(Pascal has a simpler convention, since no functions have variable numbers of parameters. Therefore the callee)]216.8 norm0 +[(knows how many parameters it should have been passed, and is able to deallocate them from the stack itself)]205.8 norm0 +[(by passing an immediate argument to the )2(RET)0( or )2(RETF)0( instruction, so the caller does not have to do it. Also,)]194.8 norm0 +[(the parameters are pushed in left-to-right order, not right-to-left, which means that a compiler can give)]183.8 norm0 +[(better guarantees about sequence points without performance suffering.)]172.8 norm2 +[(Thus, you would define a function in C style in the following way. The following example is for small model:)]155.8 norm3 +[2(global _myfunc )]138.8 code1 +[2()]127.8 code0 +[2(_myfunc: )]116.8 code0 +[2( push bp )]105.8 code0 +(96)pageeven +restore showpage +%%Page: 97 97 +%%BeginPageSetup +save +%%EndPageSetup +/97 pa +[2( mov bp,sp )]681 code0 +[2( sub sp,0x40 ; 64 bytes of local stack space )]670 code0 +[2( mov bx,[bp+4] ; first parameter to function )]659 code0 +[2()]648 code0 +[2( ; some more code )]637 code0 +[2()]626 code0 +[2( mov sp,bp ; undo "sub sp,0x40" above )]615 code0 +[2( pop bp )]604 code0 +[2( ret)]593 code2 +[(For a large-model function, you would replace )2(RET)0( by )2(RETF)0(, and look for the first parameter at )2([BP+6])]576 norm1 +[(instead of )2([BP+4])0(. Of course, if one of the parameters is a pointer, then the offsets of )1(subsequent)0( parameters)]565 norm0 +[(will change depending on the memory model as well: far pointers take up four bytes on the stack when passed)]554 norm0 +[(as a parameter, whereas near pointers take up two.)]543 norm2 +[(At the other end of the process, to call a C function from your assembly code, you would do something like)]526 norm1 +[(this:)]515 norm2 +[2(extern _printf )]498 code1 +[2()]487 code0 +[2( ; and then, further down... )]476 code0 +[2()]465 code0 +[2( push word [myint] ; one of my integer variables )]454 code0 +[2( push word mystring ; pointer into my data segment )]443 code0 +[2( call _printf )]432 code0 +[2( add sp,byte 4 ; `byte' saves space )]421 code0 +[2()]410 code0 +[2( ; then those data items... )]399 code0 +[2()]388 code0 +[2(segment _DATA )]377 code0 +[2()]366 code0 +[2(myint dw 1234 )]355 code0 +[2(mystring db 'This number -> %d <- should be 1234',10,0)]344 code2 +[(This piece of code is the small-model assembly equivalent of the C code)]327 norm3 +[2( int myint = 1234; )]310 code1 +[2( printf\("This number -> %d <- should be 1234\\n", myint\);)]299 code2 +[(In large model, the function-call code might look more like this. In this example, it is assumed that )2(DS)]282 norm1 +[(already holds the segment base of the segment )2(_DATA)0(. If not, you would have to initialize it first.)]271 norm2 +[2( push word [myint] )]254 code1 +[2( push word seg mystring ; Now push the segment, and... )]243 code0 +[2( push word mystring ; ... offset of "mystring" )]232 code0 +[2( call far _printf )]221 code0 +[2( add sp,byte 6)]210 code2 +[(The integer value still takes up one word on the stack, since large model does not affect the size of the )2(int)]193 norm1 +[(data type. The first argument \(pushed last\) to )2(printf)0(, however, is a data pointer, and therefore has to)]182 norm0 +[(contain a segment and offset part. The segment should be stored second in memory, and therefore must be)]171 norm0 +[(pushed first. \(Of course, )2(PUSH DS)0( would have been a shorter instruction than)]160 norm0 +[2(PUSH WORD SEG mystring)0(, if )2(DS)0( was set up as the above example assumed.\) Then the actual call)]149 norm0 +[(becomes a far call, since functions expect far calls in large model; and )2(SP)0( has to be increased by 6 rather than)]138 norm0 +[(4 afterwards to make up for the extra word of parameters.)]127 norm2 +(97)pageodd +restore showpage +%%Page: 98 98 +%%BeginPageSetup +save +%%EndPageSetup +/98 pa +[{/section-8.4.4 xa}(Accessing Data Items)](8.4.4)678.8 subh3 +[(To get at the contents of C variables, or to declare variables which C can access, you need only declare the)]661.8 norm1 +[(names as )2(GLOBAL)0( or )2(EXTERN)0(. \(Again, the names require leading underscores, as stated in ){/section-8.4.1 xl}(section 8.4.1){el}(.\))]650.8 norm0 +[(Thus, a C variable declared as )2(int i)0( can be accessed from assembler as)]639.8 norm2 +[2(extern _i )]622.8 code1 +[2()]611.8 code0 +[2( mov ax,[_i])]600.8 code2 +[(And to declare your own integer variable which C programs can access as )2(extern int j)0(, you do this)]583.8 norm1 +[(\(making sure you are assembling in the )2(_DATA)0( segment, if necessary\):)]572.8 norm2 +[2(global _j )]555.8 code1 +[2()]544.8 code0 +[2(_j dw 0)]533.8 code2 +[(To access a C array, you need to know the size of the components of the array. For example, )2(int)0( variables)]516.8 norm1 +[(are two bytes long, so if a C program declares an array as )2(int a[10])0(, you can access )2(a[3])0( by coding)]505.8 norm0 +[2(mov ax,[_a+6])0(. \(The byte offset 6 is obtained by multiplying the desired array index, 3, by the size of the)]494.8 norm0 +[(array element, 2.\) The sizes of the C base types in 16-bit compilers are: 1 for )2(char)0(, 2 for )2(short)0( and )2(int)0(, 4)]483.8 norm0 +[(for )2(long)0( and )2(float)0(, and 8 for )2(double)0(.)]472.8 norm2 +[(To access a C )(data structure, you need to know the offset from the base of the structure to the field you are)]455.8 norm1 +[(interested in. You can either do this by converting the C structure definition into a NASM structure definition)]444.8 norm0 +[(\(using )2(STRUC)0(\), or by calculating the one offset and using just that.)]433.8 norm2 +[(To do either of these, you should read your C compiler's manual to find out how it organizes data structures.)]416.8 norm1 +[(NASM gives no special alignment to structure members in its own )2(STRUC)0( macro, so you have to specify)]405.8 norm0 +[(alignment yourself if the C compiler generates it. Typically, you might find that a structure like)]394.8 norm2 +[2(struct { )]377.8 code1 +[2( char c; )]366.8 code0 +[2( int i; )]355.8 code0 +[2(} foo;)]344.8 code2 +[(might be four bytes long rather than three, since the )2(int)0( field would be aligned to a two-byte boundary.)]327.8 norm1 +[(However, this sort of feature tends to be a configurable option in the C compiler, either using command-line)]316.8 norm0 +[(options or )2(#pragma)0( lines, so you have to find out how your own compiler does it.)]305.8 norm2 +[{/section-8.4.5 xa}2(c16.mac)0(: Helper Macros for the 16-bit C Interface)](8.4.5)286.6 subh3 +[(Included in the NASM archives, in the )2(misc)0( directory, is a file )2(c16.mac)0( of macros. It defines three macros:)]269.6 norm1 +[2(proc)0(, )2(arg)0( and )2(endproc)0(. These are intended to be used for C-style procedure definitions, and they)]258.6 norm0 +[(automate a lot of the work involved in keeping track of the calling convention.)]247.6 norm2 +[(\(An alternative, TASM compatible form of )2(arg)0( is also now built into NASM's preprocessor. See ){/section-4.8 xl}(section 4.8){el}]230.6 norm1 +[(for details.\))]219.6 norm2 +[(An example of an assembly function using the macro set is given here:)]202.6 norm3 +[2(proc _nearproc )]185.6 code1 +[2()]174.6 code0 +[2(%$i arg )]163.6 code0 +[2(%$j arg )]152.6 code0 +[2( mov ax,[bp + %$i] )]141.6 code0 +[2( mov bx,[bp + %$j] )]130.6 code0 +[2( add ax,[bx] )]119.6 code0 +(98)pageeven +restore showpage +%%Page: 99 99 +%%BeginPageSetup +save +%%EndPageSetup +/99 pa +[2()]681 code0 +[2(endproc)]670 code2 +[(This defines )2(_nearproc)0( to be a procedure taking two arguments, the first \()2(i)0(\) an integer and the second \()2(j)0(\))]653 norm1 +[(a pointer to an integer. It returns )2(i + *j)0(.)]642 norm2 +[(Note that the )2(arg)0( macro has an )2(EQU)0( as the first line of its expansion, and since the label before the macro call)]625 norm1 +[(gets prepended to the first line of the expanded macro, the )2(EQU)0( works, defining )2(%$i)0( to be an offset from )2(BP)0(.)]614 norm0 +[(A context-local variable is used, local to the context pushed by the )2(proc)0( macro and popped by the)]603 norm0 +[2(endproc)0( macro, so that the same argument name can be used in later procedures. Of course, you don't )1(have)]592 norm0 +[(to do that.)]581 norm2 +[(The macro set produces code for near functions \(tiny, small and compact-model code\) by default. You can)]564 norm1 +[(have it generate far functions \(medium, large and huge-model code\) by means of coding)]553 norm0 +[2(%define FARCODE)0(. This changes the kind of return instruction generated by )2(endproc)0(, and also changes)]542 norm0 +[(the starting point for the argument offsets. The macro set contains no intrinsic dependency on whether data)]531 norm0 +[(pointers are far or not.)]520 norm2 +[2(arg)0( can take an optional parameter, giving the size of the argument. If no size is given, 2 is assumed, since it)]503 norm1 +[(is likely that many function parameters will be of type )2(int)0(.)]492 norm2 +[(The large-model equivalent of the above function would look like this:)]475 norm3 +[2(%define FARCODE )]458 code1 +[2()]447 code0 +[2(proc _farproc )]436 code0 +[2()]425 code0 +[2(%$i arg )]414 code0 +[2(%$j arg 4 )]403 code0 +[2( mov ax,[bp + %$i] )]392 code0 +[2( mov bx,[bp + %$j] )]381 code0 +[2( mov es,[bp + %$j + 2] )]370 code0 +[2( add ax,[bx] )]359 code0 +[2()]348 code0 +[2(endproc)]337 code2 +[(This makes use of the argument to the )2(arg)0( macro to define a parameter of size 4, because )2(j)0( is now a far)]320 norm1 +[(pointer. When we load from )2(j)0(, we must load a segment and an offset.)]309 norm2 +[{/section-8.5 xa}(Interfacing to )(Borland Pascal Programs)](8.5)287.6 head3 +[(Interfacing to Borland Pascal programs is similar in concept to interfacing to 16-bit C programs. The)]270.6 norm1 +[(differences are:)]259.6 norm2 +[(The leading underscore required for interfacing to C programs is not required for Pascal.)]242.6 bull3 +[(The memory model is always large: functions are far, data pointers are far, and no data item can be more)]225.6 bull1 +[(than 64K long. \(Actually, some functions are near, but only those functions that are local to a Pascal unit)]214.6 bull0 +[(and never called from outside it. All assembly functions that Pascal calls, and all Pascal functions that)]203.6 bull0 +[(assembly routines are able to call, are far.\) However, all static data declared in a Pascal program goes into)]192.6 bull0 +[(the default data segment, which is the one whose segment address will be in )2(DS)0( when control is passed to)]181.6 bull0 +[(your assembly code. The only things that do not live in the default data segment are local variables \(they)]170.6 bull0 +[(live in the stack segment\) and dynamically allocated variables. All data )1(pointers)0(, however, are far.)]159.6 bull2 +[(The function calling convention is different \226 described below.)]142.6 bull3 +[(Some data types, such as strings, are stored differently.)]125.6 bull3 +(99)pageodd +restore showpage +%%Page: 100 100 +%%BeginPageSetup +save +%%EndPageSetup +/100 pa +[(There are restrictions on the segment names you are allowed to use \226 Borland Pascal will ignore code or)]681 bull1 +[(data declared in a segment it doesn't like the name of. The restrictions are described below.)]670 bull2 +[{/section-8.5.1 xa}(The Pascal Calling Convention)](8.5.1)650.8 subh3 +[(The 16-bit Pascal calling convention is as follows. In the following description, the words )1(caller)0( and )1(callee)]633.8 norm1 +[(are used to denote the function doing the calling and the function which gets called.)]622.8 norm2 +[(The caller pushes the function's parameters on the stack, one after another, in normal order \(left to right, so)]605.8 bull1 +[(that the first argument specified to the function is pushed first\).)]594.8 bull2 +[(The caller then executes a far )2(CALL)0( instruction to pass control to the callee.)]577.8 bull3 +[(The callee receives control, and typically \(although this is not actually necessary, in functions which do not)]560.8 bull1 +[(need to access their parameters\) starts by saving the value of )2(SP)0( in )2(BP)0( so as to be able to use )2(BP)0( as a base)]549.8 bull0 +[(pointer to find its parameters on the stack. However, the caller was probably doing this too, so part of the)]538.8 bull0 +[(calling convention states that )2(BP)0( must be preserved by any function. Hence the callee, if it is going to set)]527.8 bull0 +[(up )2(BP)0( as a )(frame pointer, must push the previous value first.)]516.8 bull2 +[(The callee may then access its parameters relative to )2(BP)0(. The word at )2([BP])0( holds the previous value of )2(BP)]499.8 bull1 +[(as it was pushed. The next word, at )2([BP+2])0(, holds the offset part of the return address, and the next one at)]488.8 bull0 +[2([BP+4])0( the segment part. The parameters begin at )2([BP+6])0(. The rightmost parameter of the function,)]477.8 bull0 +[(since it was pushed last, is accessible at this offset from )2(BP)0(; the others follow, at successively greater)]466.8 bull0 +[(offsets.)]455.8 bull2 +[(The callee may also wish to decrease )2(SP)0( further, so as to allocate space on the stack for local variables,)]438.8 bull1 +[(which will then be accessible at negative offsets from )2(BP)0(.)]427.8 bull2 +[(The callee, if it wishes to return a value to the caller, should leave the value in )2(AL)0(, )2(AX)0( or )2(DX:AX)]410.8 bull1 +[(depending on the size of the value. Floating-point results are returned in )2(ST0)0(. Results of type )2(Real)]399.8 bull0 +[(\(Borland's own custom floating-point data type, not handled directly by the FPU\) are returned in)]388.8 bull0 +[2(DX:BX:AX)0(. To return a result of type )2(String)0(, the caller pushes a pointer to a temporary string before)]377.8 bull0 +[(pushing the parameters, and the callee places the returned string value at that location. The pointer is not a)]366.8 bull0 +[(parameter, and should not be removed from the stack by the )2(RETF)0( instruction.)]355.8 bull2 +[(Once the callee has finished processing, it restores )2(SP)0( from )2(BP)0( if it had allocated local stack space, then)]338.8 bull1 +[(pops the previous value of )2(BP)0(, and returns via )2(RETF)0(. It uses the form of )2(RETF)0( with an immediate)]327.8 bull0 +[(parameter, giving the number of bytes taken up by the parameters on the stack. This causes the parameters)]316.8 bull0 +[(to be removed from the stack as a side effect of the return instruction.)]305.8 bull2 +[(When the caller regains control from the callee, the function parameters have already been removed from)]288.8 bull1 +[(the stack, so it needs to do nothing further.)]277.8 bull2 +[(Thus, you would define a function in Pascal style, taking two )2(Integer)0(\226type parameters, in the following)]260.8 norm1 +[(way:)]249.8 norm2 +[2(global myfunc )]232.8 code1 +[2()]221.8 code0 +[2(myfunc: push bp )]210.8 code0 +[2( mov bp,sp )]199.8 code0 +[2( sub sp,0x40 ; 64 bytes of local stack space )]188.8 code0 +[2( mov bx,[bp+8] ; first parameter to function )]177.8 code0 +[2( mov bx,[bp+6] ; second parameter to function )]166.8 code0 +[2()]155.8 code0 +[2( ; some more code )]144.8 code0 +[2()]133.8 code0 +[2( mov sp,bp ; undo "sub sp,0x40" above )]122.8 code0 +[2( pop bp )]111.8 code0 +[2( retf 4 ; total size of params is 4)]100.8 code2 +(100)pageeven +restore showpage +%%Page: 101 101 +%%BeginPageSetup +save +%%EndPageSetup +/101 pa +[(At the other end of the process, to call a Pascal function from your assembly code, you would do something)]681 norm1 +[(like this:)]670 norm2 +[2(extern SomeFunc )]653 code1 +[2()]642 code0 +[2( ; and then, further down... )]631 code0 +[2()]620 code0 +[2( push word seg mystring ; Now push the segment, and... )]609 code0 +[2( push word mystring ; ... offset of "mystring" )]598 code0 +[2( push word [myint] ; one of my variables )]587 code0 +[2( call far SomeFunc)]576 code2 +[(This is equivalent to the Pascal code)]559 norm3 +[2(procedure SomeFunc\(String: PChar; Int: Integer\); )]542 code1 +[2( SomeFunc\(@mystring, myint\);)]531 code2 +[{/section-8.5.2 xa}(Borland Pascal )(Segment Name Restrictions)](8.5.2)511.8 subh3 +[(Since Borland Pascal's internal unit file format is completely different from )2(OBJ)0(, it only makes a very)]494.8 norm1 +[(sketchy job of actually reading and understanding the various information contained in a real )2(OBJ)0( file when it)]483.8 norm0 +[(links that in. Therefore an object file intended to be linked to a Pascal program must obey a number of)]472.8 norm0 +[(restrictions:)]461.8 norm2 +[(Procedures and functions must be in a segment whose name is either )2(CODE)0(, )2(CSEG)0(, or something ending in)]444.8 bull1 +[2(_TEXT)0(.)]433.8 bull2 +[(initialized data must be in a segment whose name is either )2(CONST)0( or something ending in )2(_DATA)0(.)]416.8 bull3 +[(Uninitialized data must be in a segment whose name is either )2(DATA)0(, )2(DSEG)0(, or something ending in )2(_BSS)0(.)]399.8 bull3 +[(Any other segments in the object file are completely ignored. )2(GROUP)0( directives and segment attributes are)]382.8 bull1 +[(also ignored.)]371.8 bull2 +[{/section-8.5.3 xa}(Using )2(c16.mac)0( With Pascal Programs)](8.5.3)352.6 subh3 +[(The )2(c16.mac)0( macro package, described in ){/section-8.4.5 xl}(section 8.4.5){el}(, can also be used to simplify writing functions to be)]335.6 norm1 +[(called from Pascal programs, if you code )2(%define PASCAL)0(. This definition ensures that functions are far)]324.6 norm0 +[(\(it implies )2(FARCODE)0(\), and also causes procedure return instructions to be generated with an operand.)]313.6 norm2 +[(Defining )2(PASCAL)0( does not change the code which calculates the argument offsets; you must declare your)]296.6 norm1 +[(function's arguments in reverse order. For example:)]285.6 norm2 +[2(%define PASCAL )]268.6 code1 +[2()]257.6 code0 +[2(proc _pascalproc )]246.6 code0 +[2()]235.6 code0 +[2(%$j arg 4 )]224.6 code0 +[2(%$i arg )]213.6 code0 +[2( mov ax,[bp + %$i] )]202.6 code0 +[2( mov bx,[bp + %$j] )]191.6 code0 +[2( mov es,[bp + %$j + 2] )]180.6 code0 +[2( add ax,[bx] )]169.6 code0 +[2()]158.6 code0 +[2(endproc)]147.6 code2 +[(This defines the same routine, conceptually, as the example in ){/section-8.4.5 xl}(section 8.4.5){el}(: it defines a function taking two)]130.6 norm1 +[(arguments, an integer and a pointer to an integer, which returns the sum of the integer and the contents of the)]119.6 norm0 +(101)pageodd +restore showpage +%%Page: 102 102 +%%BeginPageSetup +save +%%EndPageSetup +/102 pa +[(pointer. The only difference between this code and the large-model C version is that )2(PASCAL)0( is defined)]681 norm0 +[(instead of )2(FARCODE)0(, and that the arguments are declared in reverse order.)]670 norm2 +(102)pageeven +restore showpage +%%Page: 103 103 +%%BeginPageSetup +save +%%EndPageSetup +/103 pa +[{/chapter-9 xa}(Chapter 9: Writing 32-bit Code \(Unix, Win32, DJGPP\))]642.8 chap3 +[(This chapter attempts to cover some of the common issues involved when writing 32-bit code, to run under)]607.8 norm1 +[(Win32 or Unix, or to be linked with C code generated by a Unix-style C compiler such as )(DJGPP. It covers)]596.8 norm0 +[(how to write assembly code to interface with 32-bit C routines, and how to write position-independent code)]585.8 norm0 +[(for shared libraries.)]574.8 norm2 +[(Almost all 32-bit code, and in particular all code running under )2(Win32)0(, )2(DJGPP)0( or any of the PC Unix)]557.8 norm1 +[(variants, runs in )1(flat)0( memory model. This means that the segment registers and paging have already been set)]546.8 norm0 +[(up to give you the same 32-bit 4Gb address space no matter what segment you work relative to, and that you)]535.8 norm0 +[(should ignore all segment registers completely. When writing flat-model application code, you never need to)]524.8 norm0 +[(use a segment override or modify any segment register, and the code-section addresses you pass to )2(CALL)0( and)]513.8 norm0 +[2(JMP)0( live in the same address space as the data-section addresses you access your variables by and the)]502.8 norm0 +[(stack-section addresses you access local variables and procedure parameters by. Every address is 32 bits long)]491.8 norm0 +[(and contains only an offset part.)]480.8 norm2 +[{/section-9.1 xa}(Interfacing to 32-bit C Programs)](9.1)459.4 head3 +[(A lot of the discussion in ){/section-8.4 xl}(section 8.4){el}(, about interfacing to 16-bit C programs, still applies when working in 32)]442.4 norm1 +[(bits. The absence of memory models or segmentation worries simplifies things a lot.)]431.4 norm2 +[{/section-9.1.1 xa}(External Symbol Names)](9.1.1)412.2 subh3 +[(Most 32-bit C compilers share the convention used by 16-bit compilers, that the names of all global symbols)]395.2 norm1 +[(\(functions or data\) they define are formed by prefixing an underscore to the name as it appears in the C)]384.2 norm0 +[(program. However, not all of them do: the )2(ELF)0( specification states that C symbols do )1(not)0( have a leading)]373.2 norm0 +[(underscore on their assembly-language names.)]362.2 norm2 +[(The older Linux )2(a.out)0( C compiler, all )2(Win32)0( compilers, )2(DJGPP)0(, and )2(NetBSD)0( and )2(FreeBSD)0(, all use the)]345.2 norm1 +[(leading underscore; for these compilers, the macros )2(cextern)0( and )2(cglobal)0(, as given in ){/section-8.4.1 xl}(section 8.4.1){el}(, will)]334.2 norm0 +[(still work. For )2(ELF)0(, though, the leading underscore should not be used.)]323.2 norm2 +[(See also ){/section-2.1.27 xl}(section 2.1.27){el}(.)]306.2 norm3 +[{/section-9.1.2 xa}(Function Definitions and Function Calls)](9.1.2)287 subh3 +[(The )(C calling convention in 32-bit programs is as follows. In the following description, the words )1(caller)0( and)]270 norm1 +[1(callee)0( are used to denote the function doing the calling and the function which gets called.)]259 norm2 +[(The caller pushes the function's parameters on the stack, one after another, in reverse order \(right to left, so)]242 bull1 +[(that the first argument specified to the function is pushed last\).)]231 bull2 +[(The caller then executes a near )2(CALL)0( instruction to pass control to the callee.)]214 bull3 +[(The callee receives control, and typically \(although this is not actually necessary, in functions which do not)]197 bull1 +[(need to access their parameters\) starts by saving the value of )2(ESP)0( in )2(EBP)0( so as to be able to use )2(EBP)0( as a)]186 bull0 +[(base pointer to find its parameters on the stack. However, the caller was probably doing this too, so part of)]175 bull0 +[(the calling convention states that )2(EBP)0( must be preserved by any C function. Hence the callee, if it is going)]164 bull0 +[(to set up )2(EBP)0( as a )(frame pointer, must push the previous value first.)]153 bull2 +[(The callee may then access its parameters relative to )2(EBP)0(. The doubleword at )2([EBP])0( holds the previous)]136 bull1 +[(value of )2(EBP)0( as it was pushed; the next doubleword, at )2([EBP+4])0(, holds the return address, pushed)]125 bull0 +[(implicitly by )2(CALL)0(. The parameters start after that, at )2([EBP+8])0(. The leftmost parameter of the function,)]114 bull0 +[(since it was pushed last, is accessible at this offset from )2(EBP)0(; the others follow, at successively greater)]103 bull0 +(103)pageodd +restore showpage +%%Page: 104 104 +%%BeginPageSetup +save +%%EndPageSetup +/104 pa +[(offsets. Thus, in a function such as )2(printf)0( which takes a variable number of parameters, the pushing of)]681 bull0 +[(the parameters in reverse order means that the function knows where to find its first parameter, which tells)]670 bull0 +[(it the number and type of the remaining ones.)]659 bull2 +[(The callee may also wish to decrease )2(ESP)0( further, so as to allocate space on the stack for local variables,)]642 bull1 +[(which will then be accessible at negative offsets from )2(EBP)0(.)]631 bull2 +[(The callee, if it wishes to return a value to the caller, should leave the value in )2(AL)0(, )2(AX)0( or )2(EAX)0( depending)]614 bull1 +[(on the size of the value. Floating-point results are typically returned in )2(ST0)0(.)]603 bull2 +[(Once the callee has finished processing, it restores )2(ESP)0( from )2(EBP)0( if it had allocated local stack space, then)]586 bull1 +[(pops the previous value of )2(EBP)0(, and returns via )2(RET)0( \(equivalently, )2(RETN)0(\).)]575 bull2 +[(When the caller regains control from the callee, the function parameters are still on the stack, so it typically)]558 bull1 +[(adds an immediate constant to )2(ESP)0( to remove them \(instead of executing a number of slow )2(POP)]547 bull0 +[(instructions\). Thus, if a function is accidentally called with the wrong number of parameters due to a)]536 bull0 +[(prototype mismatch, the stack will still be returned to a sensible state since the caller, which )1(knows)0( how)]525 bull0 +[(many parameters it pushed, does the removing.)]514 bull2 +[(There is an alternative calling convention used by Win32 programs for Windows API calls, and also for)]497 norm1 +[(functions called )1(by)0( the Windows API such as window procedures: they follow what Microsoft calls the)]486 norm0 +[2(__stdcall)0( convention. This is slightly closer to the Pascal convention, in that the callee clears the stack by)]475 norm0 +[(passing a parameter to the )2(RET)0( instruction. However, the parameters are still pushed in right-to-left order.)]464 norm2 +[(Thus, you would define a function in C style in the following way:)]447 norm3 +[2(global _myfunc )]430 code1 +[2()]419 code0 +[2(_myfunc: )]408 code0 +[2( push ebp )]397 code0 +[2( mov ebp,esp )]386 code0 +[2( sub esp,0x40 ; 64 bytes of local stack space )]375 code0 +[2( mov ebx,[ebp+8] ; first parameter to function )]364 code0 +[2()]353 code0 +[2( ; some more code )]342 code0 +[2()]331 code0 +[2( leave ; mov esp,ebp / pop ebp )]320 code0 +[2( ret)]309 code2 +[(At the other end of the process, to call a C function from your assembly code, you would do something like)]292 norm1 +[(this:)]281 norm2 +[2(extern _printf )]264 code1 +[2()]253 code0 +[2( ; and then, further down... )]242 code0 +[2()]231 code0 +[2( push dword [myint] ; one of my integer variables )]220 code0 +[2( push dword mystring ; pointer into my data segment )]209 code0 +[2( call _printf )]198 code0 +[2( add esp,byte 8 ; `byte' saves space )]187 code0 +[2()]176 code0 +[2( ; then those data items... )]165 code0 +[2()]154 code0 +[2(segment _DATA )]143 code0 +[2()]132 code0 +[2(myint dd 1234 )]121 code0 +[2(mystring db 'This number -> %d <- should be 1234',10,0)]110 code2 +(104)pageeven +restore showpage +%%Page: 105 105 +%%BeginPageSetup +save +%%EndPageSetup +/105 pa +[(This piece of code is the assembly equivalent of the C code)]681 norm3 +[2( int myint = 1234; )]664 code1 +[2( printf\("This number -> %d <- should be 1234\\n", myint\);)]653 code2 +[{/section-9.1.3 xa}(Accessing Data Items)](9.1.3)633.8 subh3 +[(To get at the contents of C variables, or to declare variables which C can access, you need only declare the)]616.8 norm1 +[(names as )2(GLOBAL)0( or )2(EXTERN)0(. \(Again, the names require leading underscores, as stated in ){/section-9.1.1 xl}(section 9.1.1){el}(.\))]605.8 norm0 +[(Thus, a C variable declared as )2(int i)0( can be accessed from assembler as)]594.8 norm2 +[2( extern _i )]577.8 code1 +[2( mov eax,[_i])]566.8 code2 +[(And to declare your own integer variable which C programs can access as )2(extern int j)0(, you do this)]549.8 norm1 +[(\(making sure you are assembling in the )2(_DATA)0( segment, if necessary\):)]538.8 norm2 +[2( global _j )]521.8 code1 +[2(_j dd 0)]510.8 code2 +[(To access a C array, you need to know the size of the components of the array. For example, )2(int)0( variables)]493.8 norm1 +[(are four bytes long, so if a C program declares an array as )2(int a[10])0(, you can access )2(a[3])0( by coding)]482.8 norm0 +[2(mov ax,[_a+12])0(. \(The byte offset 12 is obtained by multiplying the desired array index, 3, by the size of)]471.8 norm0 +[(the array element, 4.\) The sizes of the C base types in 32-bit compilers are: 1 for )2(char)0(, 2 for )2(short)0(, 4 for)]460.8 norm0 +[2(int)0(, )2(long)0( and )2(float)0(, and 8 for )2(double)0(. Pointers, being 32-bit addresses, are also 4 bytes long.)]449.8 norm2 +[(To access a C )(data structure, you need to know the offset from the base of the structure to the field you are)]432.8 norm1 +[(interested in. You can either do this by converting the C structure definition into a NASM structure definition)]421.8 norm0 +[(\(using )2(STRUC)0(\), or by calculating the one offset and using just that.)]410.8 norm2 +[(To do either of these, you should read your C compiler's manual to find out how it organizes data structures.)]393.8 norm1 +[(NASM gives no special alignment to structure members in its own )2(STRUC)0( macro, so you have to specify)]382.8 norm0 +[(alignment yourself if the C compiler generates it. Typically, you might find that a structure like)]371.8 norm2 +[2(struct { )]354.8 code1 +[2( char c; )]343.8 code0 +[2( int i; )]332.8 code0 +[2(} foo;)]321.8 code2 +[(might be eight bytes long rather than five, since the )2(int)0( field would be aligned to a four-byte boundary.)]304.8 norm1 +[(However, this sort of feature is sometimes a configurable option in the C compiler, either using)]293.8 norm0 +[(command-line options or )2(#pragma)0( lines, so you have to find out how your own compiler does it.)]282.8 norm2 +[{/section-9.1.4 xa}2(c32.mac)0(: Helper Macros for the 32-bit C Interface)](9.1.4)263.6 subh3 +[(Included in the NASM archives, in the )2(misc)0( directory, is a file )2(c32.mac)0( of macros. It defines three macros:)]246.6 norm1 +[2(proc)0(, )2(arg)0( and )2(endproc)0(. These are intended to be used for C-style procedure definitions, and they)]235.6 norm0 +[(automate a lot of the work involved in keeping track of the calling convention.)]224.6 norm2 +[(An example of an assembly function using the macro set is given here:)]207.6 norm3 +[2(proc _proc32 )]190.6 code1 +[2()]179.6 code0 +[2(%$i arg )]168.6 code0 +[2(%$j arg )]157.6 code0 +[2( mov eax,[ebp + %$i] )]146.6 code0 +[2( mov ebx,[ebp + %$j] )]135.6 code0 +[2( add eax,[ebx] )]124.6 code0 +[2()]113.6 code0 +[2(endproc)]102.6 code2 +(105)pageodd +restore showpage +%%Page: 106 106 +%%BeginPageSetup +save +%%EndPageSetup +/106 pa +[(This defines )2(_proc32)0( to be a procedure taking two arguments, the first \()2(i)0(\) an integer and the second \()2(j)0(\) a)]681 norm1 +[(pointer to an integer. It returns )2(i + *j)0(.)]670 norm2 +[(Note that the )2(arg)0( macro has an )2(EQU)0( as the first line of its expansion, and since the label before the macro call)]653 norm1 +[(gets prepended to the first line of the expanded macro, the )2(EQU)0( works, defining )2(%$i)0( to be an offset from )2(BP)0(.)]642 norm0 +[(A context-local variable is used, local to the context pushed by the )2(proc)0( macro and popped by the)]631 norm0 +[2(endproc)0( macro, so that the same argument name can be used in later procedures. Of course, you don't )1(have)]620 norm0 +[(to do that.)]609 norm2 +[2(arg)0( can take an optional parameter, giving the size of the argument. If no size is given, 4 is assumed, since it)]592 norm1 +[(is likely that many function parameters will be of type )2(int)0( or pointers.)]581 norm2 +[{/section-9.2 xa}(Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF )(Shared Libraries)](9.2)559.6 head3 +[2(ELF)0( replaced the older )2(a.out)0( object file format under Linux because it contains support for)]542.6 norm1 +[(position-independent code \()(PIC\), which makes writing shared libraries much easier. NASM supports the )2(ELF)]531.6 norm0 +[(position-independent code features, so you can write Linux )2(ELF)0( shared libraries in NASM.)]520.6 norm2 +[(NetBSD, and its close cousins )(FreeBSD and )(OpenBSD, take a different approach by hacking PIC support into)]503.6 norm1 +[(the )2(a.out)0( format. NASM supports this as the )2(aoutb)0( output format, so you can write )(BSD shared libraries)]492.6 norm0 +[(in NASM too.)]481.6 norm2 +[(The operating system loads a PIC shared library by memory-mapping the library file at an arbitrarily chosen)]464.6 norm1 +[(point in the address space of the running process. The contents of the library's code section must therefore not)]453.6 norm0 +[(depend on where it is loaded in memory.)]442.6 norm2 +[(Therefore, you cannot get at your variables by writing code like this:)]425.6 norm3 +[2( mov eax,[myvar] ; WRONG)]408.6 code3 +[(Instead, the linker provides an area of memory called the )1(global offset table)0(, or )(GOT; the GOT is situated at a)]391.6 norm1 +[(constant distance from your library's code, so if you can find out where your library is loaded \(which is)]380.6 norm0 +[(typically done using a )2(CALL)0( and )2(POP)0( combination\), you can obtain the address of the GOT, and you can then)]369.6 norm0 +[(load the addresses of your variables out of linker-generated entries in the GOT.)]358.6 norm2 +[(The )1(data)0( section of a PIC shared library does not have these restrictions: since the data section is writable, it)]341.6 norm1 +[(has to be copied into memory anyway rather than just paged in from the library file, so as long as it's being)]330.6 norm0 +[(copied it can be relocated too. So you can put ordinary types of relocation in the data section without too)]319.6 norm0 +[(much worry \(but see ){/section-9.2.4 xl}(section 9.2.4){el}( for a caveat\).)]308.6 norm2 +[{/section-9.2.1 xa}(Obtaining the Address of the GOT)](9.2.1)289.4 subh3 +[(Each code module in your shared library should define the GOT as an external symbol:)]272.4 norm3 +[2(extern _GLOBAL_OFFSET_TABLE_ ; in ELF )]255.4 code1 +[2(extern __GLOBAL_OFFSET_TABLE_ ; in BSD a.out)]244.4 code2 +[(At the beginning of any function in your shared library which plans to access your data or BSS sections, you)]227.4 norm1 +[(must first calculate the address of the GOT. This is typically done by writing the function in this form:)]216.4 norm2 +[2(func: push ebp )]199.4 code1 +[2( mov ebp,esp )]188.4 code0 +[2( push ebx )]177.4 code0 +[2( call .get_GOT )]166.4 code0 +[2(.get_GOT: )]155.4 code0 +[2( pop ebx )]144.4 code0 +[2( add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc )]133.4 code0 +[2()]122.4 code0 +[2( ; the function body comes here )]111.4 code0 +[2()]100.4 code0 +(106)pageeven +restore showpage +%%Page: 107 107 +%%BeginPageSetup +save +%%EndPageSetup +/107 pa +[2( mov ebx,[ebp-4] )]681 code0 +[2( mov esp,ebp )]670 code0 +[2( pop ebp )]659 code0 +[2( ret)]648 code2 +[(\(For BSD, again, the symbol )2(_GLOBAL_OFFSET_TABLE)0( requires a second leading underscore.\))]631 norm3 +[(The first two lines of this function are simply the standard C prologue to set up a stack frame, and the last)]614 norm1 +[(three lines are standard C function epilogue. The third line, and the fourth to last line, save and restore the)]603 norm0 +[2(EBX)0( register, because PIC shared libraries use this register to store the address of the GOT.)]592 norm2 +[(The interesting bit is the )2(CALL)0( instruction and the following two lines. The )2(CALL)0( and )2(POP)0( combination)]575 norm1 +[(obtains the address of the label )2(.get_GOT)0(, without having to know in advance where the program was)]564 norm0 +[(loaded \(since the )2(CALL)0( instruction is encoded relative to the current position\). The )2(ADD)0( instruction makes use)]553 norm0 +[(of one of the special PIC relocation types: )(GOTPC relocation. With the )2(WRT ..gotpc)0( qualifier specified,)]542 norm0 +[(the symbol referenced \(here )2(_GLOBAL_OFFSET_TABLE_)0(, the special symbol assigned to the GOT\) is given)]531 norm0 +[(as an offset from the beginning of the section. \(Actually, )2(ELF)0( encodes it as the offset from the operand field)]520 norm0 +[(of the )2(ADD)0( instruction, but NASM simplifies this deliberately, so you do things the same way for both )2(ELF)]509 norm0 +[(and )2(BSD)0(.\) So the instruction then )1(adds)0( the beginning of the section, to get the real address of the GOT, and)]498 norm0 +[(subtracts the value of )2(.get_GOT)0( which it knows is in )2(EBX)0(. Therefore, by the time that instruction has)]487 norm0 +[(finished, )2(EBX)0( contains the address of the GOT.)]476 norm2 +[(If you didn't follow that, don't worry: it's never necessary to obtain the address of the GOT by any other)]459 norm1 +[(means, so you can put those three instructions into a macro and safely ignore them:)]448 norm2 +[2(%macro get_GOT 0 )]431 code1 +[2()]420 code0 +[2( call %%getgot )]409 code0 +[2( %%getgot: )]398 code0 +[2( pop ebx )]387 code0 +[2( add ebx,_GLOBAL_OFFSET_TABLE_+$$-%%getgot wrt ..gotpc )]376 code0 +[2()]365 code0 +[2(%endmacro)]354 code2 +[{/section-9.2.2 xa}(Finding Your Local Data Items)](9.2.2)334.8 subh3 +[(Having got the GOT, you can then use it to obtain the addresses of your data items. Most variables will reside)]317.8 norm1 +[(in the sections you have declared; they can be accessed using the )2(..gotoff)0( special )2(WRT)0( type. The way this)]306.8 norm0 +[(works is like this:)]295.8 norm2 +[2( lea eax,[ebx+myvar wrt ..gotoff])]278.8 code3 +[(The expression )2(myvar wrt ..gotoff)0( is calculated, when the shared library is linked, to be the offset to)]261.8 norm1 +[(the local variable )2(myvar)0( from the beginning of the GOT. Therefore, adding it to )2(EBX)0( as above will place the)]250.8 norm0 +[(real address of )2(myvar)0( in )2(EAX)0(.)]239.8 norm2 +[(If you declare variables as )2(GLOBAL)0( without specifying a size for them, they are shared between code modules)]222.8 norm1 +[(in the library, but do not get exported from the library to the program that loaded it. They will still be in your)]211.8 norm0 +[(ordinary data and BSS sections, so you can access them in the same way as local variables, using the above)]200.8 norm0 +[2(..gotoff)0( mechanism.)]189.8 norm2 +[(Note that due to a peculiarity of the way BSD )2(a.out)0( format handles this relocation type, there must be at)]172.8 norm1 +[(least one non-local symbol in the same section as the address you're trying to access.)]161.8 norm2 +[{/section-9.2.3 xa}(Finding External and Common Data Items)](9.2.3)142.6 subh3 +[(If your library needs to get at an external variable \(external to the )1(library)0(, not just to one of the modules)]125.6 norm1 +[(within it\), you must use the )2(..got)0( type to get at it. The )2(..got)0( type, instead of giving you the offset from)]114.6 norm0 +[(the GOT base to the variable, gives you the offset from the GOT base to a GOT )1(entry)0( containing the address)]103.6 norm0 +(107)pageodd +restore showpage +%%Page: 108 108 +%%BeginPageSetup +save +%%EndPageSetup +/108 pa +[(of the variable. The linker will set up this GOT entry when it builds the library, and the dynamic linker will)]681 norm0 +[(place the correct address in it at load time. So to obtain the address of an external variable )2(extvar)0( in )2(EAX)0(,)]670 norm0 +[(you would code)]659 norm2 +[2( mov eax,[ebx+extvar wrt ..got])]642 code3 +[(This loads the address of )2(extvar)0( out of an entry in the GOT. The linker, when it builds the shared library,)]625 norm1 +[(collects together every relocation of type )2(..got)0(, and builds the GOT so as to ensure it has every necessary)]614 norm0 +[(entry present.)]603 norm2 +[(Common variables must also be accessed in this way.)]586 norm3 +[{/section-9.2.4 xa}(Exporting Symbols to the Library User)](9.2.4)566.8 subh3 +[(If you want to export symbols to the user of the library, you have to declare whether they are functions or)]549.8 norm1 +[(data, and if they are data, you have to give the size of the data item. This is because the dynamic linker has to)]538.8 norm0 +[(build )(procedure linkage table entries for any exported functions, and also moves exported data items away)]527.8 norm0 +[(from the library's data section in which they were declared.)]516.8 norm2 +[(So to export a function to users of the library, you must use)]499.8 norm3 +[2(global func:function ; declare it as a function )]482.8 code1 +[2()]471.8 code0 +[2(func: push ebp )]460.8 code0 +[2()]449.8 code0 +[2( ; etc.)]438.8 code2 +[(And to export a data item such as an array, you would have to code)]421.8 norm3 +[2(global array:data array.end-array ; give the size too )]404.8 code1 +[2()]393.8 code0 +[2(array: resd 128 )]382.8 code0 +[2(.end:)]371.8 code2 +[(Be careful: If you export a variable to the library user, by declaring it as )2(GLOBAL)0( and supplying a size, the)]354.8 norm1 +[(variable will end up living in the data section of the main program, rather than in your library's data section,)]343.8 norm0 +[(where you declared it. So you will have to access your own global variable with the )2(..got)0( mechanism rather)]332.8 norm0 +[(than )2(..gotoff)0(, as if it were external \(which, effectively, it has become\).)]321.8 norm2 +[(Equally, if you need to store the address of an exported global in one of your data sections, you can't do it by)]304.8 norm1 +[(means of the standard sort of code:)]293.8 norm2 +[2(dataptr: dd global_data_item ; WRONG)]276.8 code3 +[(NASM will interpret this code as an ordinary relocation, in which )2(global_data_item)0( is merely an offset)]259.8 norm1 +[(from the beginning of the )2(.data)0( section \(or whatever\); so this reference will end up pointing at your data)]248.8 norm0 +[(section instead of at the exported global which resides elsewhere.)]237.8 norm2 +[(Instead of the above code, then, you must write)]220.8 norm3 +[2(dataptr: dd global_data_item wrt ..sym)]203.8 code3 +[(which makes use of the special )2(WRT)0( type )2(..sym)0( to instruct NASM to search the symbol table for a particular)]186.8 norm1 +[(symbol at that address, rather than just relocating by section base.)]175.8 norm2 +[(Either method will work for functions: referring to one of your functions by means of)]158.8 norm3 +[2(funcptr: dd my_function)]141.8 code3 +[(will give the user the address of the code you wrote, whereas)]124.8 norm3 +[2(funcptr: dd my_function wrt .sym)]107.8 code3 +(108)pageeven +restore showpage +%%Page: 109 109 +%%BeginPageSetup +save +%%EndPageSetup +/109 pa +[(will give the address of the procedure linkage table for the function, which is where the calling program will)]681 norm1 +[1(believe)0( the function lives. Either address is a valid way to call the function.)]670 norm2 +[{/section-9.2.5 xa}(Calling Procedures Outside the Library)](9.2.5)650.8 subh3 +[(Calling procedures outside your shared library has to be done by means of a )1(procedure linkage table)0(, or )(PLT.)]633.8 norm1 +[(The PLT is placed at a known offset from where the library is loaded, so the library code can make calls to the)]622.8 norm0 +[(PLT in a position-independent way. Within the PLT there is code to jump to offsets contained in the GOT, so)]611.8 norm0 +[(function calls to other shared libraries or to routines in the main program can be transparently passed off to)]600.8 norm0 +[(their real destinations.)]589.8 norm2 +[(To call an external routine, you must use another special PIC relocation type, )2(WRT ..plt)0(. This is much)]572.8 norm1 +[(easier than the GOT-based ones: you simply replace calls such as )2(CALL printf)0( with the PLT-relative)]561.8 norm0 +[(version )2(CALL printf WRT ..plt)0(.)]550.8 norm2 +[{/section-9.2.6 xa}(Generating the Library File)](9.2.6)531.6 subh3 +[(Having written some code modules and assembled them to )2(.o)0( files, you then generate your shared library)]514.6 norm1 +[(with a command such as)]503.6 norm2 +[2(ld -shared -o library.so module1.o module2.o # for ELF )]486.6 code1 +[2(ld -Bshareable -o library.so module1.o module2.o # for BSD)]475.6 code2 +[(For ELF, if your shared library is going to reside in system directories such as )2(/usr/lib)0( or )2(/lib)0(, it is)]458.6 norm1 +[(usually worth using the )2(-soname)0( flag to the linker, to store the final library file name, with a version)]447.6 norm0 +[(number, into the library:)]436.6 norm2 +[2(ld -shared -soname library.so.1 -o library.so.1.2 *.o)]419.6 code3 +[(You would then copy )2(library.so.1.2)0( into the library directory, and create )2(library.so.1)0( as a)]402.6 norm1 +[(symbolic link to it.)]391.6 norm2 +(109)pageodd +restore showpage +%%Page: 110 110 +%%BeginPageSetup +save +%%EndPageSetup +/110 pa +[{/chapter-10 xa}(Chapter 10: Mixing 16 and 32 Bit Code)]642.8 chap3 +[(This chapter tries to cover some of the issues, largely related to unusual forms of addressing and jump)]607.8 norm1 +[(instructions, encountered when writing operating system code such as protected-mode initialisation routines,)]596.8 norm0 +[(which require code that operates in mixed segment sizes, such as code in a 16-bit segment trying to modify)]585.8 norm0 +[(data in a 32-bit one, or jumps between different-size segments.)]574.8 norm2 +[{/section-10.1 xa}(Mixed-Size Jumps)](10.1)553.4 head3 +[(The most common form of )(mixed-size instruction is the one used when writing a 32-bit OS: having done)]536.4 norm1 +[(your setup in 16-bit mode, such as loading the kernel, you then have to boot it by switching into protected)]525.4 norm0 +[(mode and jumping to the 32-bit kernel start address. In a fully 32-bit OS, this tends to be the )1(only)0( mixed-size)]514.4 norm0 +[(instruction you need, since everything before it can be done in pure 16-bit code, and everything after it can be)]503.4 norm0 +[(pure 32-bit.)]492.4 norm2 +[(This jump must specify a 48-bit far address, since the target segment is a 32-bit one. However, it must be)]475.4 norm1 +[(assembled in a 16-bit segment, so just coding, for example,)]464.4 norm2 +[2( jmp 0x1234:0x56789ABC ; wrong!)]447.4 code3 +[(will not work, since the offset part of the address will be truncated to )2(0x9ABC)0( and the jump will be an)]430.4 norm1 +[(ordinary 16-bit far one.)]419.4 norm2 +[(The Linux kernel setup code gets round the inability of )2(as86)0( to generate the required instruction by coding it)]402.4 norm1 +[(manually, using )2(DB)0( instructions. NASM can go one better than that, by actually generating the right)]391.4 norm0 +[(instruction itself. Here's how to do it right:)]380.4 norm2 +[2( jmp dword 0x1234:0x56789ABC ; right)]363.4 code3 +[(The )2(DWORD)0( prefix \(strictly speaking, it should come )1(after)0( the colon, since it is declaring the )1(offset)0( field to be a)]346.4 norm1 +[(doubleword; but NASM will accept either form, since both are unambiguous\) forces the offset part to be)]335.4 norm0 +[(treated as far, in the assumption that you are deliberately writing a jump from a 16-bit segment to a 32-bit)]324.4 norm0 +[(one.)]313.4 norm2 +[(You can do the reverse operation, jumping from a 32-bit segment to a 16-bit one, by means of the )2(WORD)]296.4 norm1 +[(prefix:)]285.4 norm2 +[2( jmp word 0x8765:0x4321 ; 32 to 16 bit)]268.4 code3 +[(If the )2(WORD)0( prefix is specified in 16-bit mode, or the )2(DWORD)0( prefix in 32-bit mode, they will be ignored,)]251.4 norm1 +[(since each is explicitly forcing NASM into a mode it was in anyway.)]240.4 norm2 +[{/section-10.2 xa}(Addressing Between Different-Size Segments)](10.2)219 head3 +[(If your OS is mixed 16 and 32-bit, or if you are writing a DOS extender, you are likely to have to deal with)]202 norm1 +[(some 16-bit segments and some 32-bit ones. At some point, you will probably end up writing code in a)]191 norm0 +[(16-bit segment which has to access data in a 32-bit segment, or vice versa.)]180 norm2 +[(If the data you are trying to access in a 32-bit segment lies within the first 64K of the segment, you may be)]163 norm1 +[(able to get away with using an ordinary 16-bit addressing operation for the purpose; but sooner or later, you)]152 norm0 +[(will want to do 32-bit addressing from 16-bit mode.)]141 norm2 +[(The easiest way to do this is to make sure you use a register for the address, since any effective address)]124 norm1 +[(containing a 32-bit register is forced to be a 32-bit address. So you can do)]113 norm2 +(110)pageeven +restore showpage +%%Page: 111 111 +%%BeginPageSetup +save +%%EndPageSetup +/111 pa +[2( mov eax,offset_into_32_bit_segment_specified_by_fs )]681 code1 +[2( mov dword [fs:eax],0x11223344)]670 code2 +[(This is fine, but slightly cumbersome \(since it wastes an instruction and a register\) if you already know the)]653 norm1 +[(precise offset you are aiming at. The x86 architecture does allow 32-bit effective addresses to specify nothing)]642 norm0 +[(but a 4-byte offset, so why shouldn't NASM be able to generate the best instruction for the purpose?)]631 norm2 +[(It can. As in ){/section-10.1 xl}(section 10.1){el}(, you need only prefix the address with the )2(DWORD)0( keyword, and it will be forced to)]614 norm1 +[(be a 32-bit address:)]603 norm2 +[2( mov dword [fs:dword my_offset],0x11223344)]586 code3 +[(Also as in ){/section-10.1 xl}(section 10.1){el}(, NASM is not fussy about whether the )2(DWORD)0( prefix comes before or after the)]569 norm1 +[(segment override, so arguably a nicer-looking way to code the above instruction is)]558 norm2 +[2( mov dword [dword fs:my_offset],0x11223344)]541 code3 +[(Don't confuse the )2(DWORD)0( prefix )1(outside)0( the square brackets, which controls the size of the data stored at the)]524 norm1 +[(address, with the one )2(inside)0( the square brackets which controls the length of the address itself. The two can)]513 norm0 +[(quite easily be different:)]502 norm2 +[2( mov word [dword 0x12345678],0x9ABC)]485 code3 +[(This moves 16 bits of data to an address specified by a 32-bit offset.)]468 norm3 +[(You can also specify )2(WORD)0( or )2(DWORD)0( prefixes along with the )2(FAR)0( prefix to indirect far jumps or calls. For)]451 norm1 +[(example:)]440 norm2 +[2( call dword far [fs:word 0x4321])]423 code3 +[(This instruction contains an address specified by a 16-bit offset; it loads a 48-bit far pointer from that \(16-bit)]406 norm1 +[(segment and 32-bit offset\), and calls that address.)]395 norm2 +[{/section-10.3 xa}(Other Mixed-Size Instructions)](10.3)373.6 head3 +[(The other way you might want to access data might be using the string instructions \()2(LODSx)0(, )2(STOSx)0( and so)]356.6 norm1 +[(on\) or the )2(XLATB)0( instruction. These instructions, since they take no parameters, might seem to have no easy)]345.6 norm0 +[(way to make them perform 32-bit addressing when assembled in a 16-bit segment.)]334.6 norm2 +[(This is the purpose of NASM's )2(a16)0(, )2(a32)0( and )2(a64)0( prefixes. If you are coding )2(LODSB)0( in a 16-bit segment)]317.6 norm1 +[(but it is supposed to be accessing a string in a 32-bit segment, you should load the desired address into )2(ESI)]306.6 norm0 +[(and then code)]295.6 norm2 +[2( a32 lodsb)]278.6 code3 +[(The prefix forces the addressing size to 32 bits, meaning that )2(LODSB)0( loads from )2([DS:ESI])0( instead of)]261.6 norm1 +[2([DS:SI])0(. To access a string in a 16-bit segment when coding in a 32-bit one, the corresponding )2(a16)0( prefix)]250.6 norm0 +[(can be used.)]239.6 norm2 +[(The )2(a16)0(, )2(a32)0( and )2(a64)0( prefixes can be applied to any instruction in NASM's instruction table, but most of)]222.6 norm1 +[(them can generate all the useful forms without them. The prefixes are necessary only for instructions with)]211.6 norm0 +[(implicit addressing: )2(CMPSx)0(, )2(SCASx)0(, )2(LODSx)0(, )2(STOSx)0(, )2(MOVSx)0(, )2(INSx)0(, )2(OUTSx)0(, and )2(XLATB)0(. Also, the various)]200.6 norm0 +[(push and pop instructions \()2(PUSHA)0( and )2(POPF)0( as well as the more usual )2(PUSH)0( and )2(POP)0(\) can accept )2(a16)0(, )2(a32)]189.6 norm0 +[(or )2(a64)0( prefixes to force a particular one of )2(SP)0(, )2(ESP)0( or )2(RSP)0( to be used as a stack pointer, in case the stack)]178.6 norm0 +[(segment in use is a different size from the code segment.)]167.6 norm2 +[2(PUSH)0( and )2(POP)0(, when applied to segment registers in 32-bit mode, also have the slightly odd behaviour that)]150.6 norm1 +[(they push and pop 4 bytes at a time, of which the top two are ignored and the bottom two give the value of the)]139.6 norm0 +[(segment register being manipulated. To force the 16-bit behaviour of segment-register push and pop)]128.6 norm0 +[(instructions, you can use the operand-size prefix )2(o16)0(:)]117.6 norm2 +(111)pageodd +restore showpage +%%Page: 112 112 +%%BeginPageSetup +save +%%EndPageSetup +/112 pa +[2( o16 push ss )]681 code1 +[2( o16 push ds)]670 code2 +[(This code saves a doubleword of stack space by fitting two segment registers into the space which would)]653 norm1 +[(normally be consumed by pushing one.)]642 norm2 +[(\(You can also use the )2(o32)0( prefix to force the 32-bit behaviour when in 16-bit mode, but this seems less)]625 norm1 +[(useful.\))]614 norm2 +(112)pageeven +restore showpage +%%Page: 113 113 +%%BeginPageSetup +save +%%EndPageSetup +/113 pa +[{/chapter-11 xa}(Chapter 11: Writing 64-bit Code \(Unix, Win64\))]642.8 chap3 +[(This chapter attempts to cover some of the common issues involved when writing 64-bit code, to run under)]607.8 norm1 +[(Win64 or Unix. It covers how to write assembly code to interface with 64-bit C routines, and how to write)]596.8 norm0 +[(position-independent code for shared libraries.)]585.8 norm2 +[(All 64-bit code uses a flat memory model, since segmentation is not available in 64-bit mode. The one)]568.8 norm1 +[(exception is the )2(FS)0( and )2(GS)0( registers, which still add their bases.)]557.8 norm2 +[(Position independence in 64-bit mode is significantly simpler, since the processor supports )2(RIP)0(\226relative)]540.8 norm1 +[(addressing directly; see the )2(REL)0( keyword \(){/section-3.3 xl}(section 3.3){el}(\). On most 64-bit platforms, it is probably desirable to)]529.8 norm0 +[(make that the default, using the directive )2(DEFAULT REL)0( \(){/section-6.2 xl}(section 6.2){el}(\).)]518.8 norm2 +[(64-bit programming is relatively similar to 32-bit programming, but of course pointers are 64 bits long;)]501.8 norm1 +[(additionally, all existing platforms pass arguments in registers rather than on the stack. Furthermore, 64-bit)]490.8 norm0 +[(platforms use SSE2 by default for floating point. Please see the ABI documentation for your platform.)]479.8 norm2 +[(64-bit platforms differ in the sizes of the fundamental datatypes, not just from 32-bit platforms but from each)]462.8 norm1 +[(other. If a specific size data type is desired, it is probably best to use the types defined in the Standard C)]451.8 norm0 +[(header )2(<inttypes.h>)0(.)]440.8 norm2 +[(In 64-bit mode, the default instruction size is still 32 bits. When loading a value into a 32-bit register \(but not)]423.8 norm1 +[(an 8- or 16-bit register\), the upper 32 bits of the corresponding 64-bit register are set to zero.)]412.8 norm2 +[{/section-11.1 xa}(Register Names in 64-bit Mode)](11.1)391.4 head3 +[(NASM uses the following names for general-purpose registers in 64-bit mode, for 8-, 16-, 32- and 64-bit)]374.4 norm1 +[(references, respecitively:)]363.4 norm2 +[2( AL/AH, CL/CH, DL/DH, BL/BH, SPL, BPL, SIL, DIL, R8B-R15B )]346.4 code1 +[2( AX, CX, DX, BX, SP, BP, SI, DI, R8W-R15W )]335.4 code0 +[2( EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D-R15D )]324.4 code0 +[2( RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8-R15)]313.4 code2 +[(This is consistent with the AMD documentation and most other assemblers. The Intel documentation,)]296.4 norm1 +[(however, uses the names )2(R8L-R15L)0( for 8-bit references to the higher registers. It is possible to use those)]285.4 norm0 +[(names by definiting them as macros; similarly, if one wants to use numeric names for the low 8 registers,)]274.4 norm0 +[(define them as macros. The standard macro package )2(altreg)0( \(see ){/section-5.1 xl}(section 5.1){el}(\) can be used for this purpose.)]263.4 norm2 +[{/section-11.2 xa}(Immediates and Displacements in 64-bit Mode)](11.2)242 head3 +[(In 64-bit mode, immediates and displacements are generally only 32 bits wide. NASM will therefore truncate)]225 norm1 +[(most displacements and immediates to 32 bits.)]214 norm2 +[(The only instruction which takes a full )(64-bit immediate is:)]197 norm3 +[2( MOV reg64,imm64)]180 code3 +[(NASM will produce this instruction whenever the programmer uses )2(MOV)0( with an immediate into a 64-bit)]163 norm1 +[(register. If this is not desirable, simply specify the equivalent 32-bit register, which will be automatically)]152 norm0 +[(zero-extended by the processor, or specify the immediate as )2(DWORD)0(:)]141 norm2 +[2( mov rax,foo ; 64-bit immediate )]124 code1 +[2( mov rax,qword foo ; \(identical\) )]113 code0 +(113)pageodd +restore showpage +%%Page: 114 114 +%%BeginPageSetup +save +%%EndPageSetup +/114 pa +[2( mov eax,foo ; 32-bit immediate, zero-extended )]681 code0 +[2( mov rax,dword foo ; 32-bit immediate, sign-extended)]670 code2 +[(The length of these instructions are 10, 5 and 7 bytes, respectively.)]653 norm3 +[(The only instructions which take a full )(64-bit )1(displacement)0( is loading or storing, using )2(MOV)0(, )2(AL)0(, )2(AX)0(, )2(EAX)0( or)]636 norm1 +[2(RAX)0( \(but no other registers\) to an absolute 64-bit address. Since this is a relatively rarely used instruction)]625 norm0 +[(\(64-bit code generally uses relative addressing\), the programmer has to explicitly declare the displacement)]614 norm0 +[(size as )2(QWORD)0(:)]603 norm2 +[2( default abs )]586 code1 +[2()]575 code0 +[2( mov eax,[foo] ; 32-bit absolute disp, sign-extended )]564 code0 +[2( mov eax,[a32 foo] ; 32-bit absolute disp, zero-extended )]553 code0 +[2( mov eax,[qword foo] ; 64-bit absolute disp )]542 code0 +[2()]531 code0 +[2( default rel )]520 code0 +[2()]509 code0 +[2( mov eax,[foo] ; 32-bit relative disp )]498 code0 +[2( mov eax,[a32 foo] ; d:o, address truncated to 32 bits\(!\) )]487 code0 +[2( mov eax,[qword foo] ; error )]476 code0 +[2( mov eax,[abs qword foo] ; 64-bit absolute disp)]465 code2 +[(A sign-extended absolute displacement can access from \2262 GB to +2 GB; a zero-extended absolute)]448 norm1 +[(displacement can access from 0 to 4 GB.)]437 norm2 +[{/section-11.3 xa}(Interfacing to 64-bit C Programs \(Unix\))](11.3)415.6 head3 +[(On Unix, the 64-bit ABI is defined by the document:)]398.6 norm3 +[{(http://www.x86-64.org/documentation/abi.pdf)wl}2(http://www.x86-64.org/documentation/abi.pdf){el}]381.6 norm3 +[(Although written for AT&T-syntax assembly, the concepts apply equally well for NASM-style assembly.)]364.6 norm1 +[(What follows is a simplified summary.)]353.6 norm2 +[(The first six integer arguments \(from the left\) are passed in )2(RDI)0(, )2(RSI)0(, )2(RDX)0(, )2(RCX)0(, )2(R8)0(, and )2(R9)0(, in that order.)]336.6 norm1 +[(Additional integer arguments are passed on the stack. These registers, plus )2(RAX)0(, )2(R10)0( and )2(R11)0( are destroyed)]325.6 norm0 +[(by function calls, and thus are available for use by the function without saving.)]314.6 norm2 +[(Integer return values are passed in )2(RAX)0( and )2(RDX)0(, in that order.)]297.6 norm3 +[(Floating point is done using SSE registers, except for )2(long double)0(. Floating-point arguments are passed)]280.6 norm1 +[(in )2(XMM0)0( to )2(XMM7)0(; return is )2(XMM0)0( and )2(XMM1)0(. )2(long double)0( are passed on the stack, and returned in )2(ST0)]269.6 norm0 +[(and )2(ST1)0(.)]258.6 norm2 +[(All SSE and x87 registers are destroyed by function calls.)]241.6 norm3 +[(On 64-bit Unix, )2(long)0( is 64 bits.)]224.6 norm3 +[(Integer and SSE register arguments are counted separately, so for the case of)]207.6 norm3 +[2( void foo\(long a, double b, int c\))]190.6 code3 +[2(a)0( is passed in )2(RDI)0(, )2(b)0( in )2(XMM0)0(, and )2(c)0( in )2(ESI)0(.)]173.6 norm3 +[{/section-11.4 xa}(Interfacing to 64-bit C Programs \(Win64\))](11.4)152.2 head3 +[(The Win64 ABI is described at:)]135.2 norm3 +[{(http://msdn2.microsoft.com/en-gb/library/ms794533.aspx)wl}2(http://msdn2.microsoft.com/en-gb/library/ms794533.aspx){el}]118.2 norm3 +[(What follows is a simplified summary.)]101.2 norm3 +(114)pageeven +restore showpage +%%Page: 115 115 +%%BeginPageSetup +save +%%EndPageSetup +/115 pa +[(The first four integer arguments are passed in )2(RCX)0(, )2(RDX)0(, )2(R8)0( and )2(R9)0(, in that order. Additional integer)]681 norm1 +[(arguments are passed on the stack. These registers, plus )2(RAX)0(, )2(R10)0( and )2(R11)0( are destroyed by function calls,)]670 norm0 +[(and thus are available for use by the function without saving.)]659 norm2 +[(Integer return values are passed in )2(RAX)0( only.)]642 norm3 +[(Floating point is done using SSE registers, except for )2(long double)0(. Floating-point arguments are passed)]625 norm1 +[(in )2(XMM0)0( to )2(XMM3)0(; return is )2(XMM0)0( only.)]614 norm2 +[(On Win64, )2(long)0( is 32 bits; )2(long long)0( or )2(_int64)0( is 64 bits.)]597 norm3 +[(Integer and SSE register arguments are counted together, so for the case of)]580 norm3 +[2( void foo\(long long a, double b, int c\))]563 code3 +[2(a)0( is passed in )2(RCX)0(, )2(b)0( in )2(XMM1)0(, and )2(c)0( in )2(R8D)0(.)]546 norm3 +(115)pageodd +restore showpage +%%Page: 116 116 +%%BeginPageSetup +save +%%EndPageSetup +/116 pa +[{/chapter-12 xa}(Chapter 12: Troubleshooting)]642.8 chap3 +[(This chapter describes some of the common problems that users have been known to encounter with NASM,)]607.8 norm1 +[(and answers them. It also gives instructions for reporting bugs in NASM if you find a difficulty that isn't)]596.8 norm0 +[(listed here.)]585.8 norm2 +[{/section-12.1 xa}(Common Problems)](12.1)564.4 head3 +[{/section-12.1.1 xa}(NASM Generates )(Inefficient Code)](12.1.1)545.2 subh3 +[(We sometimes get `bug' reports about NASM generating inefficient, or even `wrong', code on instructions)]528.2 norm1 +[(such as )2(ADD ESP,8)0(. This is a deliberate design feature, connected to predictability of output: NASM, on)]517.2 norm0 +[(seeing )2(ADD ESP,8)0(, will generate the form of the instruction which leaves room for a 32-bit offset. You)]506.2 norm0 +[(need to code )2(ADD ESP,BYTE 8)0( if you want the space-efficient form of the instruction. This isn't a bug, it's)]495.2 norm0 +[(user error: if you prefer to have NASM produce the more efficient code automatically enable optimization)]484.2 norm0 +[(with the )2(-O)0( option \(see ){/section-2.1.22 xl}(section 2.1.22){el}(\).)]473.2 norm2 +[{/section-12.1.2 xa}(My Jumps are Out of Range)](12.1.2)454 subh3 +[(Similarly, people complain that when they issue )(conditional jumps \(which are )2(SHORT)0( by default\) that try to)]437 norm1 +[(jump too far, NASM reports `short jump out of range' instead of making the jumps longer.)]426 norm2 +[(This, again, is partly a predictability issue, but in fact has a more practical reason as well. NASM has no)]409 norm1 +[(means of being told what type of processor the code it is generating will be run on; so it cannot decide for)]398 norm0 +[(itself that it should generate )2(Jcc NEAR)0( type instructions, because it doesn't know that it's working for a 386)]387 norm0 +[(or above. Alternatively, it could replace the out-of-range short )2(JNE)0( instruction with a very short )2(JE)]376 norm0 +[(instruction that jumps over a )2(JMP NEAR)0(; this is a sensible solution for processors below a 386, but hardly)]365 norm0 +[(efficient on processors which have good branch prediction )1(and)0( could have used )2(JNE NEAR)0( instead. So, once)]354 norm0 +[(again, it's up to the user, not the assembler, to decide what instructions should be generated. See ){/section-2.1.22 xl}(section){el}]343 norm0 +[{/section-2.1.22 xl}(2.1.22){el}(.)]332 norm2 +[{/section-12.1.3 xa}2(ORG)0( Doesn't Work)](12.1.3)312.8 subh3 +[(People writing )(boot sector programs in the )2(bin)0( format often complain that )2(ORG)0( doesn't work the way they'd)]295.8 norm1 +[(like: in order to place the )2(0xAA55)0( signature word at the end of a 512-byte boot sector, people who are used)]284.8 norm0 +[(to MASM tend to code)]273.8 norm2 +[2( ORG 0 )]256.8 code1 +[2()]245.8 code0 +[2( ; some boot sector code )]234.8 code0 +[2()]223.8 code0 +[2( ORG 510 )]212.8 code0 +[2( DW 0xAA55)]201.8 code2 +[(This is not the intended use of the )2(ORG)0( directive in NASM, and will not work. The correct way to solve this)]184.8 norm1 +[(problem in NASM is to use the )2(TIMES)0( directive, like this:)]173.8 norm2 +[2( ORG 0 )]156.8 code1 +[2()]145.8 code0 +[2( ; some boot sector code )]134.8 code0 +[2()]123.8 code0 +[2( TIMES 510-\($-$$\) DB 0 )]112.8 code0 +[2( DW 0xAA55)]101.8 code2 +(116)pageeven +restore showpage +%%Page: 117 117 +%%BeginPageSetup +save +%%EndPageSetup +/117 pa +[(The )2(TIMES)0( directive will insert exactly enough zero bytes into the output to move the assembly point up to)]681 norm1 +[(510. This method also has the advantage that if you accidentally fill your boot sector too full, NASM will)]670 norm0 +[(catch the problem at assembly time and report it, so you won't end up with a boot sector that you have to)]659 norm0 +[(disassemble to find out what's wrong with it.)]648 norm2 +[{/section-12.1.4 xa}2(TIMES)0( Doesn't Work)](12.1.4)628.8 subh3 +[(The other common problem with the above code is people who write the )2(TIMES)0( line as)]611.8 norm3 +[2( TIMES 510-$ DB 0)]594.8 code3 +[(by reasoning that )2($)0( should be a pure number, just like 510, so the difference between them is also a pure)]577.8 norm1 +[(number and can happily be fed to )2(TIMES)0(.)]566.8 norm2 +[(NASM is a )1(modular)0( assembler: the various component parts are designed to be easily separable for re-use, so)]549.8 norm1 +[(they don't exchange information unnecessarily. In consequence, the )2(bin)0( output format, even though it has)]538.8 norm0 +[(been told by the )2(ORG)0( directive that the )2(.text)0( section should start at 0, does not pass that information back to)]527.8 norm0 +[(the expression evaluator. So from the evaluator's point of view, )2($)0( isn't a pure number: it's an offset from a)]516.8 norm0 +[(section base. Therefore the difference between )2($)0( and 510 is also not a pure number, but involves a section)]505.8 norm0 +[(base. Values involving section bases cannot be passed as arguments to )2(TIMES)0(.)]494.8 norm2 +[(The solution, as in the previous section, is to code the )2(TIMES)0( line in the form)]477.8 norm3 +[2( TIMES 510-\($-$$\) DB 0)]460.8 code3 +[(in which )2($)0( and )2($$)0( are offsets from the same section base, and so their difference is a pure number. This will)]443.8 norm1 +[(solve the problem and generate sensible code.)]432.8 norm2 +[{/section-12.2 xa}(Bugs)](12.2)411.4 head3 +[(We have never yet released a version of NASM with any )1(known)0( bugs. That doesn't usually stop there being)]394.4 norm1 +[(plenty we didn't know about, though. Any that you find should be reported firstly via the )2(bugtracker)0( at)]383.4 norm0 +[{(https://sourceforge.net/projects/nasm/)wl}2(https://sourceforge.net/projects/nasm/){el}0( \(click on "Bugs"\), or if that fails then through one of)]372.4 norm0 +[(the contacts in ){/section-1.2 xl}(section 1.2){el}(.)]361.4 norm2 +[(Please read ){/section-2.2 xl}(section 2.2){el}( first, and don't report the bug if it's listed in there as a deliberate feature. \(If you think)]344.4 norm1 +[(the feature is badly thought out, feel free to send us reasons why you think it should be changed, but don't just)]333.4 norm0 +[(send us mail saying `This is a bug' if the documentation says we did it on purpose.\) Then read ){/section-12.1 xl}(section 12.1){el}(,)]322.4 norm0 +[(and don't bother reporting the bug if it's listed there.)]311.4 norm2 +[(If you do report a bug, )1(please)0( give us all of the following information:)]294.4 norm3 +[(What operating system you're running NASM under. DOS, Linux, NetBSD, Win16, Win32, VMS \(I'd be)]277.4 bull1 +[(impressed\), whatever.)]266.4 bull2 +[(If you're running NASM under DOS or Win32, tell us whether you've compiled your own executable from)]249.4 bull1 +[(the DOS source archive, or whether you were using the standard distribution binaries out of the archive. If)]238.4 bull0 +[(you were using a locally built executable, try to reproduce the problem using one of the standard binaries,)]227.4 bull0 +[(as this will make it easier for us to reproduce your problem prior to fixing it.)]216.4 bull2 +[(Which version of NASM you're using, and exactly how you invoked it. Give us the precise command line,)]199.4 bull1 +[(and the contents of the )2(NASMENV)0( environment variable if any.)]188.4 bull2 +[(Which versions of any supplementary programs you're using, and how you invoked them. If the problem)]171.4 bull1 +[(only becomes visible at link time, tell us what linker you're using, what version of it you've got, and the)]160.4 bull0 +[(exact linker command line. If the problem involves linking against object files generated by a compiler, tell)]149.4 bull0 +[(us what compiler, what version, and what command line or options you used. \(If you're compiling in an)]138.4 bull0 +[(IDE, please try to reproduce the problem with the command-line version of the compiler.\))]127.4 bull2 +(117)pageodd +restore showpage +%%Page: 118 118 +%%BeginPageSetup +save +%%EndPageSetup +/118 pa +[(If at all possible, send us a NASM source file which exhibits the problem. If this causes copyright)]681 bull1 +[(problems \(e.g. you can only reproduce the bug in restricted-distribution code\) then bear in mind the)]670 bull0 +[(following two points: firstly, we guarantee that any source code sent to us for the purposes of debugging)]659 bull0 +[(NASM will be used )1(only)0( for the purposes of debugging NASM, and that we will delete all our copies of it)]648 bull0 +[(as soon as we have found and fixed the bug or bugs in question; and secondly, we would prefer )1(not)0( to be)]637 bull0 +[(mailed large chunks of code anyway. The smaller the file, the better. A three-line sample file that does)]626 bull0 +[(nothing useful )1(except)0( demonstrate the problem is much easier to work with than a fully fledged)]615 bull0 +[(ten-thousand-line program. \(Of course, some errors )1(do)0( only crop up in large files, so this may not be)]604 bull0 +[(possible.\))]593 bull2 +[(A description of what the problem actually )1(is)0(. `It doesn't work' is )1(not)0( a helpful description! Please describe)]576 bull1 +[(exactly what is happening that shouldn't be, or what isn't happening that should. Examples might be:)]565 bull0 +[(`NASM generates an error message saying Line 3 for an error that's actually on Line 5'; `NASM generates)]554 bull0 +[(an error message that I believe it shouldn't be generating at all'; `NASM fails to generate an error message)]543 bull0 +[(that I believe it )1(should)0( be generating'; `the object file produced from this source code crashes my linker';)]532 bull0 +[(`the ninth byte of the output file is 66 and I think it should be 77 instead'.)]521 bull2 +[(If you believe the output file from NASM to be faulty, send it to us. That allows us to determine whether)]504 bull1 +[(our own copy of NASM generates the same file, or whether the problem is related to portability issues)]493 bull0 +[(between our development platforms and yours. We can handle binary files mailed to us as MIME)]482 bull0 +[(attachments, uuencoded, and even BinHex. Alternatively, we may be able to provide an FTP site you can)]471 bull0 +[(upload the suspect files to; but mailing them is easier for us.)]460 bull2 +[(Any other information or data files that might be helpful. If, for example, the problem involves NASM)]443 bull1 +[(failing to generate an object file while TASM can generate an equivalent file without trouble, then send us)]432 bull0 +[1(both)0( object files, so we can see what TASM is doing differently from us.)]421 bull2 +(118)pageeven +restore showpage +%%Page: 119 119 +%%BeginPageSetup +save +%%EndPageSetup +/119 pa +[{/appendix-A xa}(Appendix A: )(Ndisasm)]642.8 appn3 +[(The Netwide Disassembler, NDISASM)]601.8 norm3 +[{/section-A.1 xa}(Introduction)](A.1)580.4 head3 +[(The Netwide Disassembler is a small companion program to the Netwide Assembler, NASM. It seemed a)]563.4 norm1 +[(shame to have an x86 assembler, complete with a full instruction table, and not make as much use of it as)]552.4 norm0 +[(possible, so here's a disassembler which shares the instruction table \(and some other bits of code\) with NASM.)]541.4 norm2 +[(The Netwide Disassembler does nothing except to produce disassemblies of )1(binary)0( source files. NDISASM)]524.4 norm1 +[(does not have any understanding of object file formats, like )2(objdump)0(, and it will not understand )2(DOS .EXE)]513.4 norm0 +[(files like )2(debug)0( will. It just disassembles.)]502.4 norm2 +[{/section-A.2 xa}(Getting Started: Installation)](A.2)481 head3 +[(See ){/section-1.3 xl}(section 1.3){el}( for installation instructions. NDISASM, like NASM, has a )2(man page)0( which you may want)]464 norm1 +[(to put somewhere useful, if you are on a Unix system.)]453 norm2 +[{/section-A.3 xa}(Running NDISASM)](A.3)431.6 head3 +[(To disassemble a file, you will typically use a command of the form)]414.6 norm3 +[2( ndisasm -b {16|32|64} filename)]397.6 code3 +[(NDISASM can disassemble 16-, 32- or 64-bit code equally easily, provided of course that you remember to)]380.6 norm1 +[(specify which it is to work with. If no )2(-b)0( switch is present, NDISASM works in 16-bit mode by default. The)]369.6 norm0 +[2(-u)0( switch \(for USE32\) also invokes 32-bit mode.)]358.6 norm2 +[(Two more command line options are )2(-r)0( which reports the version number of NDISASM you are running, and)]341.6 norm1 +[2(-h)0( which gives a short summary of command line options.)]330.6 norm2 +[{/section-A.3.1 xa}(COM Files: Specifying an Origin)](A.3.1)311.4 subh3 +[(To disassemble a )2(DOS .COM)0( file correctly, a disassembler must assume that the first instruction in the file is)]294.4 norm1 +[(loaded at address )2(0x100)0(, rather than at zero. NDISASM, which assumes by default that any file you give it is)]283.4 norm0 +[(loaded at zero, will therefore need to be informed of this.)]272.4 norm2 +[(The )2(-o)0( option allows you to declare a different origin for the file you are disassembling. Its argument may be)]255.4 norm1 +[(expressed in any of the NASM numeric formats: decimal by default, if it begins with `)2($)0(' or `)2(0x)0(' or ends in)]244.4 norm0 +[(`)2(H)0(' it's )2(hex)0(, if it ends in `)2(Q)0(' it's )2(octal)0(, and if it ends in `)2(B)0(' it's )2(binary)0(.)]233.4 norm2 +[(Hence, to disassemble a )2(.COM)0( file:)]216.4 norm3 +[2( ndisasm -o100h filename.com)]199.4 code3 +[(will do the trick.)]182.4 norm3 +[{/section-A.3.2 xa}(Code Following Data: Synchronisation)](A.3.2)163.2 subh3 +[(Suppose you are disassembling a file which contains some data which isn't machine code, and )1(then)0( contains)]146.2 norm1 +[(some machine code. NDISASM will faithfully plough through the data section, producing machine)]135.2 norm0 +[(instructions wherever it can \(although most of them will look bizarre, and some may have unusual prefixes,)]124.2 norm0 +[(e.g. `)2(FS OR AX,0x240A)0('\), and generating `DB' instructions ever so often if it's totally stumped. Then it)]113.2 norm0 +[(will reach the code section.)]102.2 norm2 +(119)pageodd +restore showpage +%%Page: 120 120 +%%BeginPageSetup +save +%%EndPageSetup +/120 pa +[(Supposing NDISASM has just finished generating a strange machine instruction from part of the data section,)]681 norm1 +[(and its file position is now one byte )1(before)0( the beginning of the code section. It's entirely possible that another)]670 norm0 +[(spurious instruction will get generated, starting with the final byte of the data section, and then the correct first)]659 norm0 +[(instruction in the code section will not be seen because the starting point skipped over it. This isn't really ideal.)]648 norm2 +[(To avoid this, you can specify a `)2(synchronisation)0(' point, or indeed as many synchronisation points as)]631 norm1 +[(you like \(although NDISASM can only handle 2147483647 sync points internally\). The definition of a sync)]620 norm0 +[(point is this: NDISASM guarantees to hit sync points exactly during disassembly. If it is thinking about)]609 norm0 +[(generating an instruction which would cause it to jump over a sync point, it will discard that instruction and)]598 norm0 +[(output a `)2(db)0(' instead. So it )1(will)0( start disassembly exactly from the sync point, and so you )1(will)0( see all the)]587 norm0 +[(instructions in your code section.)]576 norm2 +[(Sync points are specified using the )2(-s)0( option: they are measured in terms of the program origin, not the file)]559 norm1 +[(position. So if you want to synchronize after 32 bytes of a )2(.COM)0( file, you would have to do)]548 norm2 +[2( ndisasm -o100h -s120h file.com)]531 code3 +[(rather than)]514 norm3 +[2( ndisasm -o100h -s20h file.com)]497 code3 +[(As stated above, you can specify multiple sync markers if you need to, just by repeating the )2(-s)0( option.)]480 norm3 +[{/section-A.3.3 xa}(Mixed Code and Data: Automatic \(Intelligent\) Synchronisation )](A.3.3)460.8 subh3 +[(Suppose you are disassembling the boot sector of a )2(DOS)0( floppy \(maybe it has a virus, and you need to)]443.8 norm1 +[(understand the virus so that you know what kinds of damage it might have done you\). Typically, this will)]432.8 norm0 +[(contain a )2(JMP)0( instruction, then some data, then the rest of the code. So there is a very good chance of)]421.8 norm0 +[(NDISASM being )1(misaligned)0( when the data ends and the code begins. Hence a sync point is needed.)]410.8 norm2 +[(On the other hand, why should you have to specify the sync point manually? What you'd do in order to find)]393.8 norm1 +[(where the sync point would be, surely, would be to read the )2(JMP)0( instruction, and then to use its target address)]382.8 norm0 +[(as a sync point. So can NDISASM do that for you?)]371.8 norm2 +[(The answer, of course, is yes: using either of the synonymous switches )2(-a)0( \(for automatic sync\) or )2(-i)0( \(for)]354.8 norm1 +[(intelligent sync\) will enable )2(auto-sync)0( mode. Auto-sync mode automatically generates a sync point for)]343.8 norm0 +[(any forward-referring PC-relative jump or call instruction that NDISASM encounters. \(Since NDISASM is)]332.8 norm0 +[(one-pass, if it encounters a PC-relative jump whose target has already been processed, there isn't much it can)]321.8 norm0 +[(do about it...\))]310.8 norm2 +[(Only PC-relative jumps are processed, since an absolute jump is either through a register \(in which case)]293.8 norm1 +[(NDISASM doesn't know what the register contains\) or involves a segment address \(in which case the target)]282.8 norm0 +[(code isn't in the same segment that NDISASM is working in, and so the sync point can't be placed anywhere)]271.8 norm0 +[(useful\).)]260.8 norm2 +[(For some kinds of file, this mechanism will automatically put sync points in all the right places, and save you)]243.8 norm1 +[(from having to place any sync points manually. However, it should be stressed that auto-sync mode is )1(not)]232.8 norm0 +[(guaranteed to catch all the sync points, and you may still have to place some manually.)]221.8 norm2 +[(Auto-sync mode doesn't prevent you from declaring manual sync points: it just adds automatically generated)]204.8 norm1 +[(ones to the ones you provide. It's perfectly feasible to specify )2(-i)0( )1(and)0( some )2(-s)0( options.)]193.8 norm2 +[(Another caveat with auto-sync mode is that if, by some unpleasant fluke, something in your data section)]176.8 norm1 +[(should disassemble to a PC-relative call or jump instruction, NDISASM may obediently place a sync point in)]165.8 norm0 +[(a totally random place, for example in the middle of one of the instructions in your code section. So you may)]154.8 norm0 +[(end up with a wrong disassembly even if you use auto-sync. Again, there isn't much I can do about this. If)]143.8 norm0 +[(you have problems, you'll have to use manual sync points, or use the )2(-k)0( option \(documented below\) to)]132.8 norm0 +[(suppress disassembly of the data area.)]121.8 norm2 +(120)pageeven +restore showpage +%%Page: 121 121 +%%BeginPageSetup +save +%%EndPageSetup +/121 pa +[{/section-A.3.4 xa}(Other Options)](A.3.4)678.8 subh3 +[(The )2(-e)0( option skips a header on the file, by ignoring the first N bytes. This means that the header is )1(not)]661.8 norm1 +[(counted towards the disassembly offset: if you give )2(-e10 -o10)0(, disassembly will start at byte 10 in the file,)]650.8 norm0 +[(and this will be given offset 10, not 20.)]639.8 norm2 +[(The )2(-k)0( option is provided with two comma-separated numeric arguments, the first of which is an assembly)]622.8 norm1 +[(offset and the second is a number of bytes to skip. This )1(will)0( count the skipped bytes towards the assembly)]611.8 norm0 +[(offset: its use is to suppress disassembly of a data section which wouldn't contain anything you wanted to see)]600.8 norm0 +[(anyway.)]589.8 norm2 +[{/section-A.4 xa}(Bugs and Improvements)](A.4)568.4 head3 +[(There are no known bugs. However, any you find, with patches if possible, should be sent to)]551.4 norm1 +[{(mailto:nasm-bugs@lists.sourceforge.net)wl}2(nasm-bugs@lists.sourceforge.net){el}0(, or to the developer's site at)]540.4 norm0 +[{(https://sourceforge.net/projects/nasm/)wl}2(https://sourceforge.net/projects/nasm/){el}0( and we'll try to fix them. Feel free to send)]529.4 norm0 +[(contributions and new features as well.)]518.4 norm2 +(121)pageodd +restore showpage +%%Page: 122 122 +%%BeginPageSetup +save +%%EndPageSetup +/122 pa +[{/appendix-B xa}(Appendix B: )(Instruction List)]642.8 appn3 +[{/section-B.1 xa}(Introduction)](B.1)597.4 head3 +[(The following sections show the instructions which NASM currently supports. For each instruction, there is a)]580.4 norm1 +[(separate entry for each supported addressing mode. The third column shows the processor type in which the)]569.4 norm0 +[(instruction was introduced and, when appropriate, one or more usage flags.)]558.4 norm2 +[{/section-B.1.1 xa}(Special instructions...)](B.1.1)539.2 subh3 +[2(DB )]522.2 code1 +[2(DW )]511.2 code0 +[2(DD )]500.2 code0 +[2(DQ )]489.2 code0 +[2(DT )]478.2 code0 +[2(DO )]467.2 code0 +[2(DY )]456.2 code0 +[2(RESB imm 8086 )]445.2 code0 +[2(RESW )]434.2 code0 +[2(RESD )]423.2 code0 +[2(RESQ )]412.2 code0 +[2(REST )]401.2 code0 +[2(RESO )]390.2 code0 +[2(RESY )]379.2 code2 +[{/section-B.1.2 xa}(Conventional instructions)](B.1.2)360 subh3 +[2(AAA 8086,NOLONG )]343 code1 +[2(AAD 8086,NOLONG )]332 code0 +[2(AAD imm 8086,NOLONG )]321 code0 +[2(AAM 8086,NOLONG )]310 code0 +[2(AAM imm 8086,NOLONG )]299 code0 +[2(AAS 8086,NOLONG )]288 code0 +[2(ADC mem,reg8 8086 )]277 code0 +[2(ADC reg8,reg8 8086 )]266 code0 +[2(ADC mem,reg16 8086 )]255 code0 +[2(ADC reg16,reg16 8086 )]244 code0 +[2(ADC mem,reg32 386 )]233 code0 +[2(ADC reg32,reg32 386 )]222 code0 +[2(ADC mem,reg64 X64 )]211 code0 +[2(ADC reg64,reg64 X64 )]200 code0 +[2(ADC reg8,mem 8086 )]189 code0 +[2(ADC reg8,reg8 8086 )]178 code0 +[2(ADC reg16,mem 8086 )]167 code0 +[2(ADC reg16,reg16 8086 )]156 code0 +[2(ADC reg32,mem 386 )]145 code0 +[2(ADC reg32,reg32 386 )]134 code0 +[2(ADC reg64,mem X64 )]123 code0 +[2(ADC reg64,reg64 X64 )]112 code0 +[2(ADC rm16,imm8 8086 )]101 code0 +(122)pageeven +restore showpage +%%Page: 123 123 +%%BeginPageSetup +save +%%EndPageSetup +/123 pa +[2(ADC rm32,imm8 386 )]681 code0 +[2(ADC rm64,imm8 X64 )]670 code0 +[2(ADC reg_al,imm 8086 )]659 code0 +[2(ADC reg_ax,sbyte16 8086 )]648 code0 +[2(ADC reg_ax,imm 8086 )]637 code0 +[2(ADC reg_eax,sbyte32 386 )]626 code0 +[2(ADC reg_eax,imm 386 )]615 code0 +[2(ADC reg_rax,sbyte64 X64 )]604 code0 +[2(ADC reg_rax,imm X64 )]593 code0 +[2(ADC rm8,imm 8086 )]582 code0 +[2(ADC rm16,imm 8086 )]571 code0 +[2(ADC rm32,imm 386 )]560 code0 +[2(ADC rm64,imm X64 )]549 code0 +[2(ADC mem,imm8 8086 )]538 code0 +[2(ADC mem,imm16 8086 )]527 code0 +[2(ADC mem,imm32 386 )]516 code0 +[2(ADD mem,reg8 8086 )]505 code0 +[2(ADD reg8,reg8 8086 )]494 code0 +[2(ADD mem,reg16 8086 )]483 code0 +[2(ADD reg16,reg16 8086 )]472 code0 +[2(ADD mem,reg32 386 )]461 code0 +[2(ADD reg32,reg32 386 )]450 code0 +[2(ADD mem,reg64 X64 )]439 code0 +[2(ADD reg64,reg64 X64 )]428 code0 +[2(ADD reg8,mem 8086 )]417 code0 +[2(ADD reg8,reg8 8086 )]406 code0 +[2(ADD reg16,mem 8086 )]395 code0 +[2(ADD reg16,reg16 8086 )]384 code0 +[2(ADD reg32,mem 386 )]373 code0 +[2(ADD reg32,reg32 386 )]362 code0 +[2(ADD reg64,mem X64 )]351 code0 +[2(ADD reg64,reg64 X64 )]340 code0 +[2(ADD rm16,imm8 8086 )]329 code0 +[2(ADD rm32,imm8 386 )]318 code0 +[2(ADD rm64,imm8 X64 )]307 code0 +[2(ADD reg_al,imm 8086 )]296 code0 +[2(ADD reg_ax,sbyte16 8086 )]285 code0 +[2(ADD reg_ax,imm 8086 )]274 code0 +[2(ADD reg_eax,sbyte32 386 )]263 code0 +[2(ADD reg_eax,imm 386 )]252 code0 +[2(ADD reg_rax,sbyte64 X64 )]241 code0 +[2(ADD reg_rax,imm X64 )]230 code0 +[2(ADD rm8,imm 8086 )]219 code0 +[2(ADD rm16,imm 8086 )]208 code0 +[2(ADD rm32,imm 386 )]197 code0 +[2(ADD rm64,imm X64 )]186 code0 +[2(ADD mem,imm8 8086 )]175 code0 +[2(ADD mem,imm16 8086 )]164 code0 +[2(ADD mem,imm32 386 )]153 code0 +[2(AND mem,reg8 8086 )]142 code0 +[2(AND reg8,reg8 8086 )]131 code0 +[2(AND mem,reg16 8086 )]120 code0 +[2(AND reg16,reg16 8086 )]109 code0 +(123)pageodd +restore showpage +%%Page: 124 124 +%%BeginPageSetup +save +%%EndPageSetup +/124 pa +[2(AND mem,reg32 386 )]681 code0 +[2(AND reg32,reg32 386 )]670 code0 +[2(AND mem,reg64 X64 )]659 code0 +[2(AND reg64,reg64 X64 )]648 code0 +[2(AND reg8,mem 8086 )]637 code0 +[2(AND reg8,reg8 8086 )]626 code0 +[2(AND reg16,mem 8086 )]615 code0 +[2(AND reg16,reg16 8086 )]604 code0 +[2(AND reg32,mem 386 )]593 code0 +[2(AND reg32,reg32 386 )]582 code0 +[2(AND reg64,mem X64 )]571 code0 +[2(AND reg64,reg64 X64 )]560 code0 +[2(AND rm16,imm8 8086 )]549 code0 +[2(AND rm32,imm8 386 )]538 code0 +[2(AND rm64,imm8 X64 )]527 code0 +[2(AND reg_al,imm 8086 )]516 code0 +[2(AND reg_ax,sbyte16 8086 )]505 code0 +[2(AND reg_ax,imm 8086 )]494 code0 +[2(AND reg_eax,sbyte32 386 )]483 code0 +[2(AND reg_eax,imm 386 )]472 code0 +[2(AND reg_rax,sbyte64 X64 )]461 code0 +[2(AND reg_rax,imm X64 )]450 code0 +[2(AND rm8,imm 8086 )]439 code0 +[2(AND rm16,imm 8086 )]428 code0 +[2(AND rm32,imm 386 )]417 code0 +[2(AND rm64,imm X64 )]406 code0 +[2(AND mem,imm8 8086 )]395 code0 +[2(AND mem,imm16 8086 )]384 code0 +[2(AND mem,imm32 386 )]373 code0 +[2(ARPL mem,reg16 286,PROT,NOLONG )]362 code0 +[2(ARPL reg16,reg16 286,PROT,NOLONG )]351 code0 +[2(BB0_RESET PENT,CYRIX,ND )]340 code0 +[2(BB1_RESET PENT,CYRIX,ND )]329 code0 +[2(BOUND reg16,mem 186,NOLONG )]318 code0 +[2(BOUND reg32,mem 386,NOLONG )]307 code0 +[2(BSF reg16,mem 386 )]296 code0 +[2(BSF reg16,reg16 386 )]285 code0 +[2(BSF reg32,mem 386 )]274 code0 +[2(BSF reg32,reg32 386 )]263 code0 +[2(BSF reg64,mem X64 )]252 code0 +[2(BSF reg64,reg64 X64 )]241 code0 +[2(BSR reg16,mem 386 )]230 code0 +[2(BSR reg16,reg16 386 )]219 code0 +[2(BSR reg32,mem 386 )]208 code0 +[2(BSR reg32,reg32 386 )]197 code0 +[2(BSR reg64,mem X64 )]186 code0 +[2(BSR reg64,reg64 X64 )]175 code0 +[2(BSWAP reg32 486 )]164 code0 +[2(BSWAP reg64 X64 )]153 code0 +[2(BT mem,reg16 386 )]142 code0 +[2(BT reg16,reg16 386 )]131 code0 +[2(BT mem,reg32 386 )]120 code0 +[2(BT reg32,reg32 386 )]109 code0 +(124)pageeven +restore showpage +%%Page: 125 125 +%%BeginPageSetup +save +%%EndPageSetup +/125 pa +[2(BT mem,reg64 X64 )]681 code0 +[2(BT reg64,reg64 X64 )]670 code0 +[2(BT rm16,imm 386 )]659 code0 +[2(BT rm32,imm 386 )]648 code0 +[2(BT rm64,imm X64 )]637 code0 +[2(BTC mem,reg16 386 )]626 code0 +[2(BTC reg16,reg16 386 )]615 code0 +[2(BTC mem,reg32 386 )]604 code0 +[2(BTC reg32,reg32 386 )]593 code0 +[2(BTC mem,reg64 X64 )]582 code0 +[2(BTC reg64,reg64 X64 )]571 code0 +[2(BTC rm16,imm 386 )]560 code0 +[2(BTC rm32,imm 386 )]549 code0 +[2(BTC rm64,imm X64 )]538 code0 +[2(BTR mem,reg16 386 )]527 code0 +[2(BTR reg16,reg16 386 )]516 code0 +[2(BTR mem,reg32 386 )]505 code0 +[2(BTR reg32,reg32 386 )]494 code0 +[2(BTR mem,reg64 X64 )]483 code0 +[2(BTR reg64,reg64 X64 )]472 code0 +[2(BTR rm16,imm 386 )]461 code0 +[2(BTR rm32,imm 386 )]450 code0 +[2(BTR rm64,imm X64 )]439 code0 +[2(BTS mem,reg16 386 )]428 code0 +[2(BTS reg16,reg16 386 )]417 code0 +[2(BTS mem,reg32 386 )]406 code0 +[2(BTS reg32,reg32 386 )]395 code0 +[2(BTS mem,reg64 X64 )]384 code0 +[2(BTS reg64,reg64 X64 )]373 code0 +[2(BTS rm16,imm 386 )]362 code0 +[2(BTS rm32,imm 386 )]351 code0 +[2(BTS rm64,imm X64 )]340 code0 +[2(CALL imm 8086 )]329 code0 +[2(CALL imm|near 8086 )]318 code0 +[2(CALL imm|far 8086,ND,NOLONG )]307 code0 +[2(CALL imm16 8086 )]296 code0 +[2(CALL imm16|near 8086 )]285 code0 +[2(CALL imm16|far 8086,ND,NOLONG )]274 code0 +[2(CALL imm32 386 )]263 code0 +[2(CALL imm32|near 386 )]252 code0 +[2(CALL imm32|far 386,ND,NOLONG )]241 code0 +[2(CALL imm:imm 8086,NOLONG )]230 code0 +[2(CALL imm16:imm 8086,NOLONG )]219 code0 +[2(CALL imm:imm16 8086,NOLONG )]208 code0 +[2(CALL imm32:imm 386,NOLONG )]197 code0 +[2(CALL imm:imm32 386,NOLONG )]186 code0 +[2(CALL mem|far 8086,NOLONG )]175 code0 +[2(CALL mem|far X64 )]164 code0 +[2(CALL mem16|far 8086 )]153 code0 +[2(CALL mem32|far 386 )]142 code0 +[2(CALL mem64|far X64 )]131 code0 +[2(CALL mem|near 8086 )]120 code0 +[2(CALL mem16|near 8086 )]109 code0 +(125)pageodd +restore showpage +%%Page: 126 126 +%%BeginPageSetup +save +%%EndPageSetup +/126 pa +[2(CALL mem32|near 386,NOLONG )]681 code0 +[2(CALL mem64|near X64 )]670 code0 +[2(CALL reg16 8086 )]659 code0 +[2(CALL reg32 386,NOLONG )]648 code0 +[2(CALL reg64 X64 )]637 code0 +[2(CALL mem 8086 )]626 code0 +[2(CALL mem16 8086 )]615 code0 +[2(CALL mem32 386,NOLONG )]604 code0 +[2(CALL mem64 X64 )]593 code0 +[2(CBW 8086 )]582 code0 +[2(CDQ 386 )]571 code0 +[2(CDQE X64 )]560 code0 +[2(CLC 8086 )]549 code0 +[2(CLD 8086 )]538 code0 +[2(CLGI X64,AMD )]527 code0 +[2(CLI 8086 )]516 code0 +[2(CLTS 286,PRIV )]505 code0 +[2(CMC 8086 )]494 code0 +[2(CMP mem,reg8 8086 )]483 code0 +[2(CMP reg8,reg8 8086 )]472 code0 +[2(CMP mem,reg16 8086 )]461 code0 +[2(CMP reg16,reg16 8086 )]450 code0 +[2(CMP mem,reg32 386 )]439 code0 +[2(CMP reg32,reg32 386 )]428 code0 +[2(CMP mem,reg64 X64 )]417 code0 +[2(CMP reg64,reg64 X64 )]406 code0 +[2(CMP reg8,mem 8086 )]395 code0 +[2(CMP reg8,reg8 8086 )]384 code0 +[2(CMP reg16,mem 8086 )]373 code0 +[2(CMP reg16,reg16 8086 )]362 code0 +[2(CMP reg32,mem 386 )]351 code0 +[2(CMP reg32,reg32 386 )]340 code0 +[2(CMP reg64,mem X64 )]329 code0 +[2(CMP reg64,reg64 X64 )]318 code0 +[2(CMP rm16,imm8 8086 )]307 code0 +[2(CMP rm32,imm8 386 )]296 code0 +[2(CMP rm64,imm8 X64 )]285 code0 +[2(CMP reg_al,imm 8086 )]274 code0 +[2(CMP reg_ax,sbyte16 8086 )]263 code0 +[2(CMP reg_ax,imm 8086 )]252 code0 +[2(CMP reg_eax,sbyte32 386 )]241 code0 +[2(CMP reg_eax,imm 386 )]230 code0 +[2(CMP reg_rax,sbyte64 X64 )]219 code0 +[2(CMP reg_rax,imm X64 )]208 code0 +[2(CMP rm8,imm 8086 )]197 code0 +[2(CMP rm16,imm 8086 )]186 code0 +[2(CMP rm32,imm 386 )]175 code0 +[2(CMP rm64,imm X64 )]164 code0 +[2(CMP mem,imm8 8086 )]153 code0 +[2(CMP mem,imm16 8086 )]142 code0 +[2(CMP mem,imm32 386 )]131 code0 +[2(CMPSB 8086 )]120 code0 +[2(CMPSD 386 )]109 code0 +(126)pageeven +restore showpage +%%Page: 127 127 +%%BeginPageSetup +save +%%EndPageSetup +/127 pa +[2(CMPSQ X64 )]681 code0 +[2(CMPSW 8086 )]670 code0 +[2(CMPXCHG mem,reg8 PENT )]659 code0 +[2(CMPXCHG reg8,reg8 PENT )]648 code0 +[2(CMPXCHG mem,reg16 PENT )]637 code0 +[2(CMPXCHG reg16,reg16 PENT )]626 code0 +[2(CMPXCHG mem,reg32 PENT )]615 code0 +[2(CMPXCHG reg32,reg32 PENT )]604 code0 +[2(CMPXCHG mem,reg64 X64 )]593 code0 +[2(CMPXCHG reg64,reg64 X64 )]582 code0 +[2(CMPXCHG486 mem,reg8 486,UNDOC,ND )]571 code0 +[2(CMPXCHG486 reg8,reg8 486,UNDOC,ND )]560 code0 +[2(CMPXCHG486 mem,reg16 486,UNDOC,ND )]549 code0 +[2(CMPXCHG486 reg16,reg16 486,UNDOC,ND )]538 code0 +[2(CMPXCHG486 mem,reg32 486,UNDOC,ND )]527 code0 +[2(CMPXCHG486 reg32,reg32 486,UNDOC,ND )]516 code0 +[2(CMPXCHG8B mem PENT )]505 code0 +[2(CMPXCHG16B mem X64 )]494 code0 +[2(CPUID PENT )]483 code0 +[2(CPU_READ PENT,CYRIX )]472 code0 +[2(CPU_WRITE PENT,CYRIX )]461 code0 +[2(CQO X64 )]450 code0 +[2(CWD 8086 )]439 code0 +[2(CWDE 386 )]428 code0 +[2(DAA 8086,NOLONG )]417 code0 +[2(DAS 8086,NOLONG )]406 code0 +[2(DEC reg16 8086,NOLONG )]395 code0 +[2(DEC reg32 386,NOLONG )]384 code0 +[2(DEC rm8 8086 )]373 code0 +[2(DEC rm16 8086 )]362 code0 +[2(DEC rm32 386 )]351 code0 +[2(DEC rm64 X64 )]340 code0 +[2(DIV rm8 8086 )]329 code0 +[2(DIV rm16 8086 )]318 code0 +[2(DIV rm32 386 )]307 code0 +[2(DIV rm64 X64 )]296 code0 +[2(DMINT P6,CYRIX )]285 code0 +[2(EMMS PENT,MMX )]274 code0 +[2(ENTER imm,imm 186 )]263 code0 +[2(EQU imm 8086 )]252 code0 +[2(EQU imm:imm 8086 )]241 code0 +[2(F2XM1 8086,FPU )]230 code0 +[2(FABS 8086,FPU )]219 code0 +[2(FADD mem32 8086,FPU )]208 code0 +[2(FADD mem64 8086,FPU )]197 code0 +[2(FADD fpureg|to 8086,FPU )]186 code0 +[2(FADD fpureg 8086,FPU )]175 code0 +[2(FADD fpureg,fpu0 8086,FPU )]164 code0 +[2(FADD fpu0,fpureg 8086,FPU )]153 code0 +[2(FADD 8086,FPU,ND )]142 code0 +[2(FADDP fpureg 8086,FPU )]131 code0 +[2(FADDP fpureg,fpu0 8086,FPU )]120 code0 +[2(FADDP 8086,FPU,ND )]109 code0 +(127)pageodd +restore showpage +%%Page: 128 128 +%%BeginPageSetup +save +%%EndPageSetup +/128 pa +[2(FBLD mem80 8086,FPU )]681 code0 +[2(FBLD mem 8086,FPU )]670 code0 +[2(FBSTP mem80 8086,FPU )]659 code0 +[2(FBSTP mem 8086,FPU )]648 code0 +[2(FCHS 8086,FPU )]637 code0 +[2(FCLEX 8086,FPU )]626 code0 +[2(FCMOVB fpureg P6,FPU )]615 code0 +[2(FCMOVB fpu0,fpureg P6,FPU )]604 code0 +[2(FCMOVB P6,FPU,ND )]593 code0 +[2(FCMOVBE fpureg P6,FPU )]582 code0 +[2(FCMOVBE fpu0,fpureg P6,FPU )]571 code0 +[2(FCMOVBE P6,FPU,ND )]560 code0 +[2(FCMOVE fpureg P6,FPU )]549 code0 +[2(FCMOVE fpu0,fpureg P6,FPU )]538 code0 +[2(FCMOVE P6,FPU,ND )]527 code0 +[2(FCMOVNB fpureg P6,FPU )]516 code0 +[2(FCMOVNB fpu0,fpureg P6,FPU )]505 code0 +[2(FCMOVNB P6,FPU,ND )]494 code0 +[2(FCMOVNBE fpureg P6,FPU )]483 code0 +[2(FCMOVNBE fpu0,fpureg P6,FPU )]472 code0 +[2(FCMOVNBE P6,FPU,ND )]461 code0 +[2(FCMOVNE fpureg P6,FPU )]450 code0 +[2(FCMOVNE fpu0,fpureg P6,FPU )]439 code0 +[2(FCMOVNE P6,FPU,ND )]428 code0 +[2(FCMOVNU fpureg P6,FPU )]417 code0 +[2(FCMOVNU fpu0,fpureg P6,FPU )]406 code0 +[2(FCMOVNU P6,FPU,ND )]395 code0 +[2(FCMOVU fpureg P6,FPU )]384 code0 +[2(FCMOVU fpu0,fpureg P6,FPU )]373 code0 +[2(FCMOVU P6,FPU,ND )]362 code0 +[2(FCOM mem32 8086,FPU )]351 code0 +[2(FCOM mem64 8086,FPU )]340 code0 +[2(FCOM fpureg 8086,FPU )]329 code0 +[2(FCOM fpu0,fpureg 8086,FPU )]318 code0 +[2(FCOM 8086,FPU,ND )]307 code0 +[2(FCOMI fpureg P6,FPU )]296 code0 +[2(FCOMI fpu0,fpureg P6,FPU )]285 code0 +[2(FCOMI P6,FPU,ND )]274 code0 +[2(FCOMIP fpureg P6,FPU )]263 code0 +[2(FCOMIP fpu0,fpureg P6,FPU )]252 code0 +[2(FCOMIP P6,FPU,ND )]241 code0 +[2(FCOMP mem32 8086,FPU )]230 code0 +[2(FCOMP mem64 8086,FPU )]219 code0 +[2(FCOMP fpureg 8086,FPU )]208 code0 +[2(FCOMP fpu0,fpureg 8086,FPU )]197 code0 +[2(FCOMP 8086,FPU,ND )]186 code0 +[2(FCOMPP 8086,FPU )]175 code0 +[2(FCOS 386,FPU )]164 code0 +[2(FDECSTP 8086,FPU )]153 code0 +[2(FDISI 8086,FPU )]142 code0 +[2(FDIV mem32 8086,FPU )]131 code0 +[2(FDIV mem64 8086,FPU )]120 code0 +[2(FDIV fpureg|to 8086,FPU )]109 code0 +(128)pageeven +restore showpage +%%Page: 129 129 +%%BeginPageSetup +save +%%EndPageSetup +/129 pa +[2(FDIV fpureg 8086,FPU )]681 code0 +[2(FDIV fpureg,fpu0 8086,FPU )]670 code0 +[2(FDIV fpu0,fpureg 8086,FPU )]659 code0 +[2(FDIV 8086,FPU,ND )]648 code0 +[2(FDIVP fpureg 8086,FPU )]637 code0 +[2(FDIVP fpureg,fpu0 8086,FPU )]626 code0 +[2(FDIVP 8086,FPU,ND )]615 code0 +[2(FDIVR mem32 8086,FPU )]604 code0 +[2(FDIVR mem64 8086,FPU )]593 code0 +[2(FDIVR fpureg|to 8086,FPU )]582 code0 +[2(FDIVR fpureg,fpu0 8086,FPU )]571 code0 +[2(FDIVR fpureg 8086,FPU )]560 code0 +[2(FDIVR fpu0,fpureg 8086,FPU )]549 code0 +[2(FDIVR 8086,FPU,ND )]538 code0 +[2(FDIVRP fpureg 8086,FPU )]527 code0 +[2(FDIVRP fpureg,fpu0 8086,FPU )]516 code0 +[2(FDIVRP 8086,FPU,ND )]505 code0 +[2(FEMMS PENT,3DNOW )]494 code0 +[2(FENI 8086,FPU )]483 code0 +[2(FFREE fpureg 8086,FPU )]472 code0 +[2(FFREE 8086,FPU )]461 code0 +[2(FFREEP fpureg 286,FPU,UNDOC )]450 code0 +[2(FFREEP 286,FPU,UNDOC )]439 code0 +[2(FIADD mem32 8086,FPU )]428 code0 +[2(FIADD mem16 8086,FPU )]417 code0 +[2(FICOM mem32 8086,FPU )]406 code0 +[2(FICOM mem16 8086,FPU )]395 code0 +[2(FICOMP mem32 8086,FPU )]384 code0 +[2(FICOMP mem16 8086,FPU )]373 code0 +[2(FIDIV mem32 8086,FPU )]362 code0 +[2(FIDIV mem16 8086,FPU )]351 code0 +[2(FIDIVR mem32 8086,FPU )]340 code0 +[2(FIDIVR mem16 8086,FPU )]329 code0 +[2(FILD mem32 8086,FPU )]318 code0 +[2(FILD mem16 8086,FPU )]307 code0 +[2(FILD mem64 8086,FPU )]296 code0 +[2(FIMUL mem32 8086,FPU )]285 code0 +[2(FIMUL mem16 8086,FPU )]274 code0 +[2(FINCSTP 8086,FPU )]263 code0 +[2(FINIT 8086,FPU )]252 code0 +[2(FIST mem32 8086,FPU )]241 code0 +[2(FIST mem16 8086,FPU )]230 code0 +[2(FISTP mem32 8086,FPU )]219 code0 +[2(FISTP mem16 8086,FPU )]208 code0 +[2(FISTP mem64 8086,FPU )]197 code0 +[2(FISTTP mem16 PRESCOTT,FPU )]186 code0 +[2(FISTTP mem32 PRESCOTT,FPU )]175 code0 +[2(FISTTP mem64 PRESCOTT,FPU )]164 code0 +[2(FISUB mem32 8086,FPU )]153 code0 +[2(FISUB mem16 8086,FPU )]142 code0 +[2(FISUBR mem32 8086,FPU )]131 code0 +[2(FISUBR mem16 8086,FPU )]120 code0 +[2(FLD mem32 8086,FPU )]109 code0 +(129)pageodd +restore showpage +%%Page: 130 130 +%%BeginPageSetup +save +%%EndPageSetup +/130 pa +[2(FLD mem64 8086,FPU )]681 code0 +[2(FLD mem80 8086,FPU )]670 code0 +[2(FLD fpureg 8086,FPU )]659 code0 +[2(FLD 8086,FPU,ND )]648 code0 +[2(FLD1 8086,FPU )]637 code0 +[2(FLDCW mem 8086,FPU,SW )]626 code0 +[2(FLDENV mem 8086,FPU )]615 code0 +[2(FLDL2E 8086,FPU )]604 code0 +[2(FLDL2T 8086,FPU )]593 code0 +[2(FLDLG2 8086,FPU )]582 code0 +[2(FLDLN2 8086,FPU )]571 code0 +[2(FLDPI 8086,FPU )]560 code0 +[2(FLDZ 8086,FPU )]549 code0 +[2(FMUL mem32 8086,FPU )]538 code0 +[2(FMUL mem64 8086,FPU )]527 code0 +[2(FMUL fpureg|to 8086,FPU )]516 code0 +[2(FMUL fpureg,fpu0 8086,FPU )]505 code0 +[2(FMUL fpureg 8086,FPU )]494 code0 +[2(FMUL fpu0,fpureg 8086,FPU )]483 code0 +[2(FMUL 8086,FPU,ND )]472 code0 +[2(FMULP fpureg 8086,FPU )]461 code0 +[2(FMULP fpureg,fpu0 8086,FPU )]450 code0 +[2(FMULP 8086,FPU,ND )]439 code0 +[2(FNCLEX 8086,FPU )]428 code0 +[2(FNDISI 8086,FPU )]417 code0 +[2(FNENI 8086,FPU )]406 code0 +[2(FNINIT 8086,FPU )]395 code0 +[2(FNOP 8086,FPU )]384 code0 +[2(FNSAVE mem 8086,FPU )]373 code0 +[2(FNSTCW mem 8086,FPU,SW )]362 code0 +[2(FNSTENV mem 8086,FPU )]351 code0 +[2(FNSTSW mem 8086,FPU,SW )]340 code0 +[2(FNSTSW reg_ax 286,FPU )]329 code0 +[2(FPATAN 8086,FPU )]318 code0 +[2(FPREM 8086,FPU )]307 code0 +[2(FPREM1 386,FPU )]296 code0 +[2(FPTAN 8086,FPU )]285 code0 +[2(FRNDINT 8086,FPU )]274 code0 +[2(FRSTOR mem 8086,FPU )]263 code0 +[2(FSAVE mem 8086,FPU )]252 code0 +[2(FSCALE 8086,FPU )]241 code0 +[2(FSETPM 286,FPU )]230 code0 +[2(FSIN 386,FPU )]219 code0 +[2(FSINCOS 386,FPU )]208 code0 +[2(FSQRT 8086,FPU )]197 code0 +[2(FST mem32 8086,FPU )]186 code0 +[2(FST mem64 8086,FPU )]175 code0 +[2(FST fpureg 8086,FPU )]164 code0 +[2(FST 8086,FPU,ND )]153 code0 +[2(FSTCW mem 8086,FPU,SW )]142 code0 +[2(FSTENV mem 8086,FPU )]131 code0 +[2(FSTP mem32 8086,FPU )]120 code0 +[2(FSTP mem64 8086,FPU )]109 code0 +(130)pageeven +restore showpage +%%Page: 131 131 +%%BeginPageSetup +save +%%EndPageSetup +/131 pa +[2(FSTP mem80 8086,FPU )]681 code0 +[2(FSTP fpureg 8086,FPU )]670 code0 +[2(FSTP 8086,FPU,ND )]659 code0 +[2(FSTSW mem 8086,FPU,SW )]648 code0 +[2(FSTSW reg_ax 286,FPU )]637 code0 +[2(FSUB mem32 8086,FPU )]626 code0 +[2(FSUB mem64 8086,FPU )]615 code0 +[2(FSUB fpureg|to 8086,FPU )]604 code0 +[2(FSUB fpureg,fpu0 8086,FPU )]593 code0 +[2(FSUB fpureg 8086,FPU )]582 code0 +[2(FSUB fpu0,fpureg 8086,FPU )]571 code0 +[2(FSUB 8086,FPU,ND )]560 code0 +[2(FSUBP fpureg 8086,FPU )]549 code0 +[2(FSUBP fpureg,fpu0 8086,FPU )]538 code0 +[2(FSUBP 8086,FPU,ND )]527 code0 +[2(FSUBR mem32 8086,FPU )]516 code0 +[2(FSUBR mem64 8086,FPU )]505 code0 +[2(FSUBR fpureg|to 8086,FPU )]494 code0 +[2(FSUBR fpureg,fpu0 8086,FPU )]483 code0 +[2(FSUBR fpureg 8086,FPU )]472 code0 +[2(FSUBR fpu0,fpureg 8086,FPU )]461 code0 +[2(FSUBR 8086,FPU,ND )]450 code0 +[2(FSUBRP fpureg 8086,FPU )]439 code0 +[2(FSUBRP fpureg,fpu0 8086,FPU )]428 code0 +[2(FSUBRP 8086,FPU,ND )]417 code0 +[2(FTST 8086,FPU )]406 code0 +[2(FUCOM fpureg 386,FPU )]395 code0 +[2(FUCOM fpu0,fpureg 386,FPU )]384 code0 +[2(FUCOM 386,FPU,ND )]373 code0 +[2(FUCOMI fpureg P6,FPU )]362 code0 +[2(FUCOMI fpu0,fpureg P6,FPU )]351 code0 +[2(FUCOMI P6,FPU,ND )]340 code0 +[2(FUCOMIP fpureg P6,FPU )]329 code0 +[2(FUCOMIP fpu0,fpureg P6,FPU )]318 code0 +[2(FUCOMIP P6,FPU,ND )]307 code0 +[2(FUCOMP fpureg 386,FPU )]296 code0 +[2(FUCOMP fpu0,fpureg 386,FPU )]285 code0 +[2(FUCOMP 386,FPU,ND )]274 code0 +[2(FUCOMPP 386,FPU )]263 code0 +[2(FXAM 8086,FPU )]252 code0 +[2(FXCH fpureg 8086,FPU )]241 code0 +[2(FXCH fpureg,fpu0 8086,FPU )]230 code0 +[2(FXCH fpu0,fpureg 8086,FPU )]219 code0 +[2(FXCH 8086,FPU,ND )]208 code0 +[2(FXTRACT 8086,FPU )]197 code0 +[2(FYL2X 8086,FPU )]186 code0 +[2(FYL2XP1 8086,FPU )]175 code0 +[2(HLT 8086,PRIV )]164 code0 +[2(IBTS mem,reg16 386,SW,UNDOC,ND )]153 code0 +[2(IBTS reg16,reg16 386,UNDOC,ND )]142 code0 +[2(IBTS mem,reg32 386,SD,UNDOC,ND )]131 code0 +[2(IBTS reg32,reg32 386,UNDOC,ND )]120 code0 +[2(ICEBP 386,ND )]109 code0 +(131)pageodd +restore showpage +%%Page: 132 132 +%%BeginPageSetup +save +%%EndPageSetup +/132 pa +[2(IDIV rm8 8086 )]681 code0 +[2(IDIV rm16 8086 )]670 code0 +[2(IDIV rm32 386 )]659 code0 +[2(IDIV rm64 X64 )]648 code0 +[2(IMUL rm8 8086 )]637 code0 +[2(IMUL rm16 8086 )]626 code0 +[2(IMUL rm32 386 )]615 code0 +[2(IMUL rm64 X64 )]604 code0 +[2(IMUL reg16,mem 386 )]593 code0 +[2(IMUL reg16,reg16 386 )]582 code0 +[2(IMUL reg32,mem 386 )]571 code0 +[2(IMUL reg32,reg32 386 )]560 code0 +[2(IMUL reg64,mem X64 )]549 code0 +[2(IMUL reg64,reg64 X64 )]538 code0 +[2(IMUL reg16,mem,imm8 186 )]527 code0 +[2(IMUL reg16,mem,sbyte16 186,ND )]516 code0 +[2(IMUL reg16,mem,imm16 186 )]505 code0 +[2(IMUL reg16,mem,imm 186,ND )]494 code0 +[2(IMUL reg16,reg16,imm8 186 )]483 code0 +[2(IMUL reg16,reg16,sbyte16 186,ND )]472 code0 +[2(IMUL reg16,reg16,imm16 186 )]461 code0 +[2(IMUL reg16,reg16,imm 186,ND )]450 code0 +[2(IMUL reg32,mem,imm8 386 )]439 code0 +[2(IMUL reg32,mem,sbyte32 386,ND )]428 code0 +[2(IMUL reg32,mem,imm32 386 )]417 code0 +[2(IMUL reg32,mem,imm 386,ND )]406 code0 +[2(IMUL reg32,reg32,imm8 386 )]395 code0 +[2(IMUL reg32,reg32,sbyte32 386,ND )]384 code0 +[2(IMUL reg32,reg32,imm32 386 )]373 code0 +[2(IMUL reg32,reg32,imm 386,ND )]362 code0 +[2(IMUL reg64,mem,imm8 X64 )]351 code0 +[2(IMUL reg64,mem,sbyte64 X64,ND )]340 code0 +[2(IMUL reg64,mem,imm32 X64 )]329 code0 +[2(IMUL reg64,mem,imm X64,ND )]318 code0 +[2(IMUL reg64,reg64,imm8 X64 )]307 code0 +[2(IMUL reg64,reg64,sbyte64 X64,ND )]296 code0 +[2(IMUL reg64,reg64,imm32 X64 )]285 code0 +[2(IMUL reg64,reg64,imm X64,ND )]274 code0 +[2(IMUL reg16,imm8 186 )]263 code0 +[2(IMUL reg16,sbyte16 186,ND )]252 code0 +[2(IMUL reg16,imm16 186 )]241 code0 +[2(IMUL reg16,imm 186,ND )]230 code0 +[2(IMUL reg32,imm8 386 )]219 code0 +[2(IMUL reg32,sbyte32 386,ND )]208 code0 +[2(IMUL reg32,imm32 386 )]197 code0 +[2(IMUL reg32,imm 386,ND )]186 code0 +[2(IMUL reg64,imm8 X64 )]175 code0 +[2(IMUL reg64,sbyte64 X64,ND )]164 code0 +[2(IMUL reg64,imm32 X64 )]153 code0 +[2(IMUL reg64,imm X64,ND )]142 code0 +[2(IN reg_al,imm 8086 )]131 code0 +[2(IN reg_ax,imm 8086 )]120 code0 +[2(IN reg_eax,imm 386 )]109 code0 +(132)pageeven +restore showpage +%%Page: 133 133 +%%BeginPageSetup +save +%%EndPageSetup +/133 pa +[2(IN reg_al,reg_dx 8086 )]681 code0 +[2(IN reg_ax,reg_dx 8086 )]670 code0 +[2(IN reg_eax,reg_dx 386 )]659 code0 +[2(INC reg16 8086,NOLONG )]648 code0 +[2(INC reg32 386,NOLONG )]637 code0 +[2(INC rm8 8086 )]626 code0 +[2(INC rm16 8086 )]615 code0 +[2(INC rm32 386 )]604 code0 +[2(INC rm64 X64 )]593 code0 +[2(INCBIN )]582 code0 +[2(INSB 186 )]571 code0 +[2(INSD 386 )]560 code0 +[2(INSW 186 )]549 code0 +[2(INT imm 8086 )]538 code0 +[2(INT01 386,ND )]527 code0 +[2(INT1 386 )]516 code0 +[2(INT03 8086,ND )]505 code0 +[2(INT3 8086 )]494 code0 +[2(INTO 8086,NOLONG )]483 code0 +[2(INVD 486,PRIV )]472 code0 +[2(INVLPG mem 486,PRIV )]461 code0 +[2(INVLPGA reg_ax,reg_ecx X86_64,AMD,NOLONG )]450 code0 +[2(INVLPGA reg_eax,reg_ecx X86_64,AMD )]439 code0 +[2(INVLPGA reg_rax,reg_ecx X64,AMD )]428 code0 +[2(INVLPGA X86_64,AMD )]417 code0 +[2(IRET 8086 )]406 code0 +[2(IRETD 386 )]395 code0 +[2(IRETQ X64 )]384 code0 +[2(IRETW 8086 )]373 code0 +[2(JCXZ imm 8086,NOLONG )]362 code0 +[2(JECXZ imm 386 )]351 code0 +[2(JRCXZ imm X64 )]340 code0 +[2(JMP imm|short 8086 )]329 code0 +[2(JMP imm 8086,ND )]318 code0 +[2(JMP imm 8086 )]307 code0 +[2(JMP imm|near 8086,ND )]296 code0 +[2(JMP imm|far 8086,ND,NOLONG )]285 code0 +[2(JMP imm16 8086 )]274 code0 +[2(JMP imm16|near 8086,ND )]263 code0 +[2(JMP imm16|far 8086,ND,NOLONG )]252 code0 +[2(JMP imm32 386 )]241 code0 +[2(JMP imm32|near 386,ND )]230 code0 +[2(JMP imm32|far 386,ND,NOLONG )]219 code0 +[2(JMP imm:imm 8086,NOLONG )]208 code0 +[2(JMP imm16:imm 8086,NOLONG )]197 code0 +[2(JMP imm:imm16 8086,NOLONG )]186 code0 +[2(JMP imm32:imm 386,NOLONG )]175 code0 +[2(JMP imm:imm32 386,NOLONG )]164 code0 +[2(JMP mem|far 8086,NOLONG )]153 code0 +[2(JMP mem|far X64 )]142 code0 +[2(JMP mem16|far 8086 )]131 code0 +[2(JMP mem32|far 386 )]120 code0 +[2(JMP mem64|far X64 )]109 code0 +(133)pageodd +restore showpage +%%Page: 134 134 +%%BeginPageSetup +save +%%EndPageSetup +/134 pa +[2(JMP mem|near 8086 )]681 code0 +[2(JMP mem16|near 8086 )]670 code0 +[2(JMP mem32|near 386,NOLONG )]659 code0 +[2(JMP mem64|near X64 )]648 code0 +[2(JMP reg16 8086 )]637 code0 +[2(JMP reg32 386,NOLONG )]626 code0 +[2(JMP reg64 X64 )]615 code0 +[2(JMP mem 8086 )]604 code0 +[2(JMP mem16 8086 )]593 code0 +[2(JMP mem32 386,NOLONG )]582 code0 +[2(JMP mem64 X64 )]571 code0 +[2(JMPE imm IA64 )]560 code0 +[2(JMPE imm16 IA64 )]549 code0 +[2(JMPE imm32 IA64 )]538 code0 +[2(JMPE rm16 IA64 )]527 code0 +[2(JMPE rm32 IA64 )]516 code0 +[2(LAHF 8086 )]505 code0 +[2(LAR reg16,mem 286,PROT,SW )]494 code0 +[2(LAR reg16,reg16 286,PROT )]483 code0 +[2(LAR reg16,reg32 386,PROT )]472 code0 +[2(LAR reg16,reg64 X64,PROT,ND )]461 code0 +[2(LAR reg32,mem 386,PROT,SW )]450 code0 +[2(LAR reg32,reg16 386,PROT )]439 code0 +[2(LAR reg32,reg32 386,PROT )]428 code0 +[2(LAR reg32,reg64 X64,PROT,ND )]417 code0 +[2(LAR reg64,mem X64,PROT,SW )]406 code0 +[2(LAR reg64,reg16 X64,PROT )]395 code0 +[2(LAR reg64,reg32 X64,PROT )]384 code0 +[2(LAR reg64,reg64 X64,PROT )]373 code0 +[2(LDS reg16,mem 8086,NOLONG )]362 code0 +[2(LDS reg32,mem 386,NOLONG )]351 code0 +[2(LEA reg16,mem 8086 )]340 code0 +[2(LEA reg32,mem 386 )]329 code0 +[2(LEA reg64,mem X64 )]318 code0 +[2(LEAVE 186 )]307 code0 +[2(LES reg16,mem 8086,NOLONG )]296 code0 +[2(LES reg32,mem 386,NOLONG )]285 code0 +[2(LFENCE X64,AMD )]274 code0 +[2(LFS reg16,mem 386 )]263 code0 +[2(LFS reg32,mem 386 )]252 code0 +[2(LGDT mem 286,PRIV )]241 code0 +[2(LGS reg16,mem 386 )]230 code0 +[2(LGS reg32,mem 386 )]219 code0 +[2(LIDT mem 286,PRIV )]208 code0 +[2(LLDT mem 286,PROT,PRIV )]197 code0 +[2(LLDT mem16 286,PROT,PRIV )]186 code0 +[2(LLDT reg16 286,PROT,PRIV )]175 code0 +[2(LMSW mem 286,PRIV )]164 code0 +[2(LMSW mem16 286,PRIV )]153 code0 +[2(LMSW reg16 286,PRIV )]142 code0 +[2(LOADALL 386,UNDOC )]131 code0 +[2(LOADALL286 286,UNDOC )]120 code0 +[2(LODSB 8086 )]109 code0 +(134)pageeven +restore showpage +%%Page: 135 135 +%%BeginPageSetup +save +%%EndPageSetup +/135 pa +[2(LODSD 386 )]681 code0 +[2(LODSQ X64 )]670 code0 +[2(LODSW 8086 )]659 code0 +[2(LOOP imm 8086 )]648 code0 +[2(LOOP imm,reg_cx 8086,NOLONG )]637 code0 +[2(LOOP imm,reg_ecx 386 )]626 code0 +[2(LOOP imm,reg_rcx X64 )]615 code0 +[2(LOOPE imm 8086 )]604 code0 +[2(LOOPE imm,reg_cx 8086,NOLONG )]593 code0 +[2(LOOPE imm,reg_ecx 386 )]582 code0 +[2(LOOPE imm,reg_rcx X64 )]571 code0 +[2(LOOPNE imm 8086 )]560 code0 +[2(LOOPNE imm,reg_cx 8086,NOLONG )]549 code0 +[2(LOOPNE imm,reg_ecx 386 )]538 code0 +[2(LOOPNE imm,reg_rcx X64 )]527 code0 +[2(LOOPNZ imm 8086 )]516 code0 +[2(LOOPNZ imm,reg_cx 8086,NOLONG )]505 code0 +[2(LOOPNZ imm,reg_ecx 386 )]494 code0 +[2(LOOPNZ imm,reg_rcx X64 )]483 code0 +[2(LOOPZ imm 8086 )]472 code0 +[2(LOOPZ imm,reg_cx 8086,NOLONG )]461 code0 +[2(LOOPZ imm,reg_ecx 386 )]450 code0 +[2(LOOPZ imm,reg_rcx X64 )]439 code0 +[2(LSL reg16,mem 286,PROT,SW )]428 code0 +[2(LSL reg16,reg16 286,PROT )]417 code0 +[2(LSL reg16,reg32 386,PROT )]406 code0 +[2(LSL reg16,reg64 X64,PROT,ND )]395 code0 +[2(LSL reg32,mem 386,PROT,SW )]384 code0 +[2(LSL reg32,reg16 386,PROT )]373 code0 +[2(LSL reg32,reg32 386,PROT )]362 code0 +[2(LSL reg32,reg64 X64,PROT,ND )]351 code0 +[2(LSL reg64,mem X64,PROT,SW )]340 code0 +[2(LSL reg64,reg16 X64,PROT )]329 code0 +[2(LSL reg64,reg32 X64,PROT )]318 code0 +[2(LSL reg64,reg64 X64,PROT )]307 code0 +[2(LSS reg16,mem 386 )]296 code0 +[2(LSS reg32,mem 386 )]285 code0 +[2(LTR mem 286,PROT,PRIV )]274 code0 +[2(LTR mem16 286,PROT,PRIV )]263 code0 +[2(LTR reg16 286,PROT,PRIV )]252 code0 +[2(MFENCE X64,AMD )]241 code0 +[2(MONITOR PRESCOTT )]230 code0 +[2(MONITOR reg_eax,reg_ecx,reg_edx PRESCOTT,ND )]219 code0 +[2(MONITOR reg_rax,reg_ecx,reg_edx X64,ND )]208 code0 +[2(MOV mem,reg_sreg 8086 )]197 code0 +[2(MOV reg16,reg_sreg 8086 )]186 code0 +[2(MOV reg32,reg_sreg 386 )]175 code0 +[2(MOV reg_sreg,mem 8086 )]164 code0 +[2(MOV reg_sreg,reg16 8086 )]153 code0 +[2(MOV reg_sreg,reg32 386 )]142 code0 +[2(MOV reg_al,mem_offs 8086 )]131 code0 +[2(MOV reg_ax,mem_offs 8086 )]120 code0 +[2(MOV reg_eax,mem_offs 386 )]109 code0 +(135)pageodd +restore showpage +%%Page: 136 136 +%%BeginPageSetup +save +%%EndPageSetup +/136 pa +[2(MOV reg_rax,mem_offs X64 )]681 code0 +[2(MOV mem_offs,reg_al 8086 )]670 code0 +[2(MOV mem_offs,reg_ax 8086 )]659 code0 +[2(MOV mem_offs,reg_eax 386 )]648 code0 +[2(MOV mem_offs,reg_rax X64 )]637 code0 +[2(MOV reg32,reg_creg 386,PRIV,NOLONG )]626 code0 +[2(MOV reg64,reg_creg X64,PRIV )]615 code0 +[2(MOV reg_creg,reg32 386,PRIV,NOLONG )]604 code0 +[2(MOV reg_creg,reg64 X64,PRIV )]593 code0 +[2(MOV reg32,reg_dreg 386,PRIV,NOLONG )]582 code0 +[2(MOV reg64,reg_dreg X64,PRIV )]571 code0 +[2(MOV reg_dreg,reg32 386,PRIV,NOLONG )]560 code0 +[2(MOV reg_dreg,reg64 X64,PRIV )]549 code0 +[2(MOV reg32,reg_treg 386,NOLONG,ND )]538 code0 +[2(MOV reg_treg,reg32 386,NOLONG,ND )]527 code0 +[2(MOV mem,reg8 8086 )]516 code0 +[2(MOV reg8,reg8 8086 )]505 code0 +[2(MOV mem,reg16 8086 )]494 code0 +[2(MOV reg16,reg16 8086 )]483 code0 +[2(MOV mem,reg32 386 )]472 code0 +[2(MOV reg32,reg32 386 )]461 code0 +[2(MOV mem,reg64 X64 )]450 code0 +[2(MOV reg64,reg64 X64 )]439 code0 +[2(MOV reg8,mem 8086 )]428 code0 +[2(MOV reg8,reg8 8086 )]417 code0 +[2(MOV reg16,mem 8086 )]406 code0 +[2(MOV reg16,reg16 8086 )]395 code0 +[2(MOV reg32,mem 386 )]384 code0 +[2(MOV reg32,reg32 386 )]373 code0 +[2(MOV reg64,mem X64 )]362 code0 +[2(MOV reg64,reg64 X64 )]351 code0 +[2(MOV reg8,imm 8086 )]340 code0 +[2(MOV reg16,imm 8086 )]329 code0 +[2(MOV reg32,imm 386 )]318 code0 +[2(MOV reg64,imm X64 )]307 code0 +[2(MOV reg64,imm32 X64 )]296 code0 +[2(MOV rm8,imm 8086 )]285 code0 +[2(MOV rm16,imm 8086 )]274 code0 +[2(MOV rm32,imm 386 )]263 code0 +[2(MOV rm64,imm X64 )]252 code0 +[2(MOV mem,imm8 8086 )]241 code0 +[2(MOV mem,imm16 8086 )]230 code0 +[2(MOV mem,imm32 386 )]219 code0 +[2(MOVD mmxreg,mem PENT,MMX,SD )]208 code0 +[2(MOVD mmxreg,reg32 PENT,MMX )]197 code0 +[2(MOVD mem,mmxreg PENT,MMX,SD )]186 code0 +[2(MOVD reg32,mmxreg PENT,MMX )]175 code0 +[2(MOVD xmmreg,mem X64,SD )]164 code0 +[2(MOVD xmmreg,reg32 X64 )]153 code0 +[2(MOVD mem,xmmreg X64,SD )]142 code0 +[2(MOVD reg32,xmmreg X64,SSE )]131 code0 +[2(MOVQ mmxreg,mmxrm PENT,MMX )]120 code0 +[2(MOVQ mmxrm,mmxreg PENT,MMX )]109 code0 +(136)pageeven +restore showpage +%%Page: 137 137 +%%BeginPageSetup +save +%%EndPageSetup +/137 pa +[2(MOVQ mmxreg,rm64 X64,MMX )]681 code0 +[2(MOVQ rm64,mmxreg X64,MMX )]670 code0 +[2(MOVSB 8086 )]659 code0 +[2(MOVSD 386 )]648 code0 +[2(MOVSQ X64 )]637 code0 +[2(MOVSW 8086 )]626 code0 +[2(MOVSX reg16,mem 386 )]615 code0 +[2(MOVSX reg16,reg8 386 )]604 code0 +[2(MOVSX reg32,rm8 386 )]593 code0 +[2(MOVSX reg32,rm16 386 )]582 code0 +[2(MOVSX reg64,rm8 X64 )]571 code0 +[2(MOVSX reg64,rm16 X64 )]560 code0 +[2(MOVSXD reg64,rm32 X64 )]549 code0 +[2(MOVSX reg64,rm32 X64,ND )]538 code0 +[2(MOVZX reg16,mem 386 )]527 code0 +[2(MOVZX reg16,reg8 386 )]516 code0 +[2(MOVZX reg32,rm8 386 )]505 code0 +[2(MOVZX reg32,rm16 386 )]494 code0 +[2(MOVZX reg64,rm8 X64 )]483 code0 +[2(MOVZX reg64,rm16 X64 )]472 code0 +[2(MUL rm8 8086 )]461 code0 +[2(MUL rm16 8086 )]450 code0 +[2(MUL rm32 386 )]439 code0 +[2(MUL rm64 X64 )]428 code0 +[2(MWAIT PRESCOTT )]417 code0 +[2(MWAIT reg_eax,reg_ecx PRESCOTT,ND )]406 code0 +[2(NEG rm8 8086 )]395 code0 +[2(NEG rm16 8086 )]384 code0 +[2(NEG rm32 386 )]373 code0 +[2(NEG rm64 X64 )]362 code0 +[2(NOP 8086 )]351 code0 +[2(NOP rm16 P6 )]340 code0 +[2(NOP rm32 P6 )]329 code0 +[2(NOP rm64 X64 )]318 code0 +[2(NOT rm8 8086 )]307 code0 +[2(NOT rm16 8086 )]296 code0 +[2(NOT rm32 386 )]285 code0 +[2(NOT rm64 X64 )]274 code0 +[2(OR mem,reg8 8086 )]263 code0 +[2(OR reg8,reg8 8086 )]252 code0 +[2(OR mem,reg16 8086 )]241 code0 +[2(OR reg16,reg16 8086 )]230 code0 +[2(OR mem,reg32 386 )]219 code0 +[2(OR reg32,reg32 386 )]208 code0 +[2(OR mem,reg64 X64 )]197 code0 +[2(OR reg64,reg64 X64 )]186 code0 +[2(OR reg8,mem 8086 )]175 code0 +[2(OR reg8,reg8 8086 )]164 code0 +[2(OR reg16,mem 8086 )]153 code0 +[2(OR reg16,reg16 8086 )]142 code0 +[2(OR reg32,mem 386 )]131 code0 +[2(OR reg32,reg32 386 )]120 code0 +[2(OR reg64,mem X64 )]109 code0 +(137)pageodd +restore showpage +%%Page: 138 138 +%%BeginPageSetup +save +%%EndPageSetup +/138 pa +[2(OR reg64,reg64 X64 )]681 code0 +[2(OR rm16,imm8 8086 )]670 code0 +[2(OR rm32,imm8 386 )]659 code0 +[2(OR rm64,imm8 X64 )]648 code0 +[2(OR reg_al,imm 8086 )]637 code0 +[2(OR reg_ax,sbyte16 8086 )]626 code0 +[2(OR reg_ax,imm 8086 )]615 code0 +[2(OR reg_eax,sbyte32 386 )]604 code0 +[2(OR reg_eax,imm 386 )]593 code0 +[2(OR reg_rax,sbyte64 X64 )]582 code0 +[2(OR reg_rax,imm X64 )]571 code0 +[2(OR rm8,imm 8086 )]560 code0 +[2(OR rm16,imm 8086 )]549 code0 +[2(OR rm32,imm 386 )]538 code0 +[2(OR rm64,imm X64 )]527 code0 +[2(OR mem,imm8 8086 )]516 code0 +[2(OR mem,imm16 8086 )]505 code0 +[2(OR mem,imm32 386 )]494 code0 +[2(OUT imm,reg_al 8086 )]483 code0 +[2(OUT imm,reg_ax 8086 )]472 code0 +[2(OUT imm,reg_eax 386 )]461 code0 +[2(OUT reg_dx,reg_al 8086 )]450 code0 +[2(OUT reg_dx,reg_ax 8086 )]439 code0 +[2(OUT reg_dx,reg_eax 386 )]428 code0 +[2(OUTSB 186 )]417 code0 +[2(OUTSD 386 )]406 code0 +[2(OUTSW 186 )]395 code0 +[2(PACKSSDW mmxreg,mmxrm PENT,MMX )]384 code0 +[2(PACKSSWB mmxreg,mmxrm PENT,MMX )]373 code0 +[2(PACKUSWB mmxreg,mmxrm PENT,MMX )]362 code0 +[2(PADDB mmxreg,mmxrm PENT,MMX )]351 code0 +[2(PADDD mmxreg,mmxrm PENT,MMX )]340 code0 +[2(PADDSB mmxreg,mmxrm PENT,MMX )]329 code0 +[2(PADDSIW mmxreg,mmxrm PENT,MMX,CYRIX )]318 code0 +[2(PADDSW mmxreg,mmxrm PENT,MMX )]307 code0 +[2(PADDUSB mmxreg,mmxrm PENT,MMX )]296 code0 +[2(PADDUSW mmxreg,mmxrm PENT,MMX )]285 code0 +[2(PADDW mmxreg,mmxrm PENT,MMX )]274 code0 +[2(PAND mmxreg,mmxrm PENT,MMX )]263 code0 +[2(PANDN mmxreg,mmxrm PENT,MMX )]252 code0 +[2(PAUSE 8086 )]241 code0 +[2(PAVEB mmxreg,mmxrm PENT,MMX,CYRIX )]230 code0 +[2(PAVGUSB mmxreg,mmxrm PENT,3DNOW )]219 code0 +[2(PCMPEQB mmxreg,mmxrm PENT,MMX )]208 code0 +[2(PCMPEQD mmxreg,mmxrm PENT,MMX )]197 code0 +[2(PCMPEQW mmxreg,mmxrm PENT,MMX )]186 code0 +[2(PCMPGTB mmxreg,mmxrm PENT,MMX )]175 code0 +[2(PCMPGTD mmxreg,mmxrm PENT,MMX )]164 code0 +[2(PCMPGTW mmxreg,mmxrm PENT,MMX )]153 code0 +[2(PDISTIB mmxreg,mem PENT,MMX,CYRIX )]142 code0 +[2(PF2ID mmxreg,mmxrm PENT,3DNOW )]131 code0 +[2(PFACC mmxreg,mmxrm PENT,3DNOW )]120 code0 +[2(PFADD mmxreg,mmxrm PENT,3DNOW )]109 code0 +(138)pageeven +restore showpage +%%Page: 139 139 +%%BeginPageSetup +save +%%EndPageSetup +/139 pa +[2(PFCMPEQ mmxreg,mmxrm PENT,3DNOW )]681 code0 +[2(PFCMPGE mmxreg,mmxrm PENT,3DNOW )]670 code0 +[2(PFCMPGT mmxreg,mmxrm PENT,3DNOW )]659 code0 +[2(PFMAX mmxreg,mmxrm PENT,3DNOW )]648 code0 +[2(PFMIN mmxreg,mmxrm PENT,3DNOW )]637 code0 +[2(PFMUL mmxreg,mmxrm PENT,3DNOW )]626 code0 +[2(PFRCP mmxreg,mmxrm PENT,3DNOW )]615 code0 +[2(PFRCPIT1 mmxreg,mmxrm PENT,3DNOW )]604 code0 +[2(PFRCPIT2 mmxreg,mmxrm PENT,3DNOW )]593 code0 +[2(PFRSQIT1 mmxreg,mmxrm PENT,3DNOW )]582 code0 +[2(PFRSQRT mmxreg,mmxrm PENT,3DNOW )]571 code0 +[2(PFSUB mmxreg,mmxrm PENT,3DNOW )]560 code0 +[2(PFSUBR mmxreg,mmxrm PENT,3DNOW )]549 code0 +[2(PI2FD mmxreg,mmxrm PENT,3DNOW )]538 code0 +[2(PMACHRIW mmxreg,mem PENT,MMX,CYRIX )]527 code0 +[2(PMADDWD mmxreg,mmxrm PENT,MMX )]516 code0 +[2(PMAGW mmxreg,mmxrm PENT,MMX,CYRIX )]505 code0 +[2(PMULHRIW mmxreg,mmxrm PENT,MMX,CYRIX )]494 code0 +[2(PMULHRWA mmxreg,mmxrm PENT,3DNOW )]483 code0 +[2(PMULHRWC mmxreg,mmxrm PENT,MMX,CYRIX )]472 code0 +[2(PMULHW mmxreg,mmxrm PENT,MMX )]461 code0 +[2(PMULLW mmxreg,mmxrm PENT,MMX )]450 code0 +[2(PMVGEZB mmxreg,mem PENT,MMX,CYRIX )]439 code0 +[2(PMVLZB mmxreg,mem PENT,MMX,CYRIX )]428 code0 +[2(PMVNZB mmxreg,mem PENT,MMX,CYRIX )]417 code0 +[2(PMVZB mmxreg,mem PENT,MMX,CYRIX )]406 code0 +[2(POP reg16 8086 )]395 code0 +[2(POP reg32 386,NOLONG )]384 code0 +[2(POP reg64 X64 )]373 code0 +[2(POP rm16 8086 )]362 code0 +[2(POP rm32 386,NOLONG )]351 code0 +[2(POP rm64 X64 )]340 code0 +[2(POP reg_cs 8086,UNDOC,ND )]329 code0 +[2(POP reg_dess 8086,NOLONG )]318 code0 +[2(POP reg_fsgs 386 )]307 code0 +[2(POPA 186,NOLONG )]296 code0 +[2(POPAD 386,NOLONG )]285 code0 +[2(POPAW 186,NOLONG )]274 code0 +[2(POPF 8086 )]263 code0 +[2(POPFD 386,NOLONG )]252 code0 +[2(POPFQ X64 )]241 code0 +[2(POPFW 8086 )]230 code0 +[2(POR mmxreg,mmxrm PENT,MMX )]219 code0 +[2(PREFETCH mem PENT,3DNOW )]208 code0 +[2(PREFETCHW mem PENT,3DNOW )]197 code0 +[2(PSLLD mmxreg,mmxrm PENT,MMX )]186 code0 +[2(PSLLD mmxreg,imm PENT,MMX )]175 code0 +[2(PSLLQ mmxreg,mmxrm PENT,MMX )]164 code0 +[2(PSLLQ mmxreg,imm PENT,MMX )]153 code0 +[2(PSLLW mmxreg,mmxrm PENT,MMX )]142 code0 +[2(PSLLW mmxreg,imm PENT,MMX )]131 code0 +[2(PSRAD mmxreg,mmxrm PENT,MMX )]120 code0 +[2(PSRAD mmxreg,imm PENT,MMX )]109 code0 +(139)pageodd +restore showpage +%%Page: 140 140 +%%BeginPageSetup +save +%%EndPageSetup +/140 pa +[2(PSRAW mmxreg,mmxrm PENT,MMX )]681 code0 +[2(PSRAW mmxreg,imm PENT,MMX )]670 code0 +[2(PSRLD mmxreg,mmxrm PENT,MMX )]659 code0 +[2(PSRLD mmxreg,imm PENT,MMX )]648 code0 +[2(PSRLQ mmxreg,mmxrm PENT,MMX )]637 code0 +[2(PSRLQ mmxreg,imm PENT,MMX )]626 code0 +[2(PSRLW mmxreg,mmxrm PENT,MMX )]615 code0 +[2(PSRLW mmxreg,imm PENT,MMX )]604 code0 +[2(PSUBB mmxreg,mmxrm PENT,MMX )]593 code0 +[2(PSUBD mmxreg,mmxrm PENT,MMX )]582 code0 +[2(PSUBSB mmxreg,mmxrm PENT,MMX )]571 code0 +[2(PSUBSIW mmxreg,mmxrm PENT,MMX,CYRIX )]560 code0 +[2(PSUBSW mmxreg,mmxrm PENT,MMX )]549 code0 +[2(PSUBUSB mmxreg,mmxrm PENT,MMX )]538 code0 +[2(PSUBUSW mmxreg,mmxrm PENT,MMX )]527 code0 +[2(PSUBW mmxreg,mmxrm PENT,MMX )]516 code0 +[2(PUNPCKHBW mmxreg,mmxrm PENT,MMX )]505 code0 +[2(PUNPCKHDQ mmxreg,mmxrm PENT,MMX )]494 code0 +[2(PUNPCKHWD mmxreg,mmxrm PENT,MMX )]483 code0 +[2(PUNPCKLBW mmxreg,mmxrm PENT,MMX )]472 code0 +[2(PUNPCKLDQ mmxreg,mmxrm PENT,MMX )]461 code0 +[2(PUNPCKLWD mmxreg,mmxrm PENT,MMX )]450 code0 +[2(PUSH reg16 8086 )]439 code0 +[2(PUSH reg32 386,NOLONG )]428 code0 +[2(PUSH reg64 X64 )]417 code0 +[2(PUSH rm16 8086 )]406 code0 +[2(PUSH rm32 386,NOLONG )]395 code0 +[2(PUSH rm64 X64 )]384 code0 +[2(PUSH reg_cs 8086,NOLONG )]373 code0 +[2(PUSH reg_dess 8086,NOLONG )]362 code0 +[2(PUSH reg_fsgs 386 )]351 code0 +[2(PUSH imm8 186 )]340 code0 +[2(PUSH imm16 186,AR0,SZ )]329 code0 +[2(PUSH imm32 386,NOLONG,AR0,SZ )]318 code0 +[2(PUSH imm32 386,NOLONG,SD )]307 code0 +[2(PUSH imm64 X64,AR0,SZ )]296 code0 +[2(PUSHA 186,NOLONG )]285 code0 +[2(PUSHAD 386,NOLONG )]274 code0 +[2(PUSHAW 186,NOLONG )]263 code0 +[2(PUSHF 8086 )]252 code0 +[2(PUSHFD 386,NOLONG )]241 code0 +[2(PUSHFQ X64 )]230 code0 +[2(PUSHFW 8086 )]219 code0 +[2(PXOR mmxreg,mmxrm PENT,MMX )]208 code0 +[2(RCL rm8,unity 8086 )]197 code0 +[2(RCL rm8,reg_cl 8086 )]186 code0 +[2(RCL rm8,imm 186 )]175 code0 +[2(RCL rm16,unity 8086 )]164 code0 +[2(RCL rm16,reg_cl 8086 )]153 code0 +[2(RCL rm16,imm 186 )]142 code0 +[2(RCL rm32,unity 386 )]131 code0 +[2(RCL rm32,reg_cl 386 )]120 code0 +[2(RCL rm32,imm 386 )]109 code0 +(140)pageeven +restore showpage +%%Page: 141 141 +%%BeginPageSetup +save +%%EndPageSetup +/141 pa +[2(RCL rm64,unity X64 )]681 code0 +[2(RCL rm64,reg_cl X64 )]670 code0 +[2(RCL rm64,imm X64 )]659 code0 +[2(RCR rm8,unity 8086 )]648 code0 +[2(RCR rm8,reg_cl 8086 )]637 code0 +[2(RCR rm8,imm 186 )]626 code0 +[2(RCR rm16,unity 8086 )]615 code0 +[2(RCR rm16,reg_cl 8086 )]604 code0 +[2(RCR rm16,imm 186 )]593 code0 +[2(RCR rm32,unity 386 )]582 code0 +[2(RCR rm32,reg_cl 386 )]571 code0 +[2(RCR rm32,imm 386 )]560 code0 +[2(RCR rm64,unity X64 )]549 code0 +[2(RCR rm64,reg_cl X64 )]538 code0 +[2(RCR rm64,imm X64 )]527 code0 +[2(RDSHR rm32 P6,CYRIXM )]516 code0 +[2(RDMSR PENT,PRIV )]505 code0 +[2(RDPMC P6 )]494 code0 +[2(RDTSC PENT )]483 code0 +[2(RDTSCP X86_64 )]472 code0 +[2(RET 8086 )]461 code0 +[2(RET imm 8086,SW )]450 code0 +[2(RETF 8086 )]439 code0 +[2(RETF imm 8086,SW )]428 code0 +[2(RETN 8086 )]417 code0 +[2(RETN imm 8086,SW )]406 code0 +[2(ROL rm8,unity 8086 )]395 code0 +[2(ROL rm8,reg_cl 8086 )]384 code0 +[2(ROL rm8,imm 186 )]373 code0 +[2(ROL rm16,unity 8086 )]362 code0 +[2(ROL rm16,reg_cl 8086 )]351 code0 +[2(ROL rm16,imm 186 )]340 code0 +[2(ROL rm32,unity 386 )]329 code0 +[2(ROL rm32,reg_cl 386 )]318 code0 +[2(ROL rm32,imm 386 )]307 code0 +[2(ROL rm64,unity X64 )]296 code0 +[2(ROL rm64,reg_cl X64 )]285 code0 +[2(ROL rm64,imm X64 )]274 code0 +[2(ROR rm8,unity 8086 )]263 code0 +[2(ROR rm8,reg_cl 8086 )]252 code0 +[2(ROR rm8,imm 186 )]241 code0 +[2(ROR rm16,unity 8086 )]230 code0 +[2(ROR rm16,reg_cl 8086 )]219 code0 +[2(ROR rm16,imm 186 )]208 code0 +[2(ROR rm32,unity 386 )]197 code0 +[2(ROR rm32,reg_cl 386 )]186 code0 +[2(ROR rm32,imm 386 )]175 code0 +[2(ROR rm64,unity X64 )]164 code0 +[2(ROR rm64,reg_cl X64 )]153 code0 +[2(ROR rm64,imm X64 )]142 code0 +[2(RDM P6,CYRIX,ND )]131 code0 +[2(RSDC reg_sreg,mem80 486,CYRIXM )]120 code0 +[2(RSLDT mem80 486,CYRIXM )]109 code0 +(141)pageodd +restore showpage +%%Page: 142 142 +%%BeginPageSetup +save +%%EndPageSetup +/142 pa +[2(RSM PENTM )]681 code0 +[2(RSTS mem80 486,CYRIXM )]670 code0 +[2(SAHF 8086 )]659 code0 +[2(SAL rm8,unity 8086,ND )]648 code0 +[2(SAL rm8,reg_cl 8086,ND )]637 code0 +[2(SAL rm8,imm 186,ND )]626 code0 +[2(SAL rm16,unity 8086,ND )]615 code0 +[2(SAL rm16,reg_cl 8086,ND )]604 code0 +[2(SAL rm16,imm 186,ND )]593 code0 +[2(SAL rm32,unity 386,ND )]582 code0 +[2(SAL rm32,reg_cl 386,ND )]571 code0 +[2(SAL rm32,imm 386,ND )]560 code0 +[2(SAL rm64,unity X64,ND )]549 code0 +[2(SAL rm64,reg_cl X64,ND )]538 code0 +[2(SAL rm64,imm X64,ND )]527 code0 +[2(SALC 8086,UNDOC )]516 code0 +[2(SAR rm8,unity 8086 )]505 code0 +[2(SAR rm8,reg_cl 8086 )]494 code0 +[2(SAR rm8,imm 186 )]483 code0 +[2(SAR rm16,unity 8086 )]472 code0 +[2(SAR rm16,reg_cl 8086 )]461 code0 +[2(SAR rm16,imm 186 )]450 code0 +[2(SAR rm32,unity 386 )]439 code0 +[2(SAR rm32,reg_cl 386 )]428 code0 +[2(SAR rm32,imm 386 )]417 code0 +[2(SAR rm64,unity X64 )]406 code0 +[2(SAR rm64,reg_cl X64 )]395 code0 +[2(SAR rm64,imm X64 )]384 code0 +[2(SBB mem,reg8 8086 )]373 code0 +[2(SBB reg8,reg8 8086 )]362 code0 +[2(SBB mem,reg16 8086 )]351 code0 +[2(SBB reg16,reg16 8086 )]340 code0 +[2(SBB mem,reg32 386 )]329 code0 +[2(SBB reg32,reg32 386 )]318 code0 +[2(SBB mem,reg64 X64 )]307 code0 +[2(SBB reg64,reg64 X64 )]296 code0 +[2(SBB reg8,mem 8086 )]285 code0 +[2(SBB reg8,reg8 8086 )]274 code0 +[2(SBB reg16,mem 8086 )]263 code0 +[2(SBB reg16,reg16 8086 )]252 code0 +[2(SBB reg32,mem 386 )]241 code0 +[2(SBB reg32,reg32 386 )]230 code0 +[2(SBB reg64,mem X64 )]219 code0 +[2(SBB reg64,reg64 X64 )]208 code0 +[2(SBB rm16,imm8 8086 )]197 code0 +[2(SBB rm32,imm8 386 )]186 code0 +[2(SBB rm64,imm8 X64 )]175 code0 +[2(SBB reg_al,imm 8086 )]164 code0 +[2(SBB reg_ax,sbyte16 8086 )]153 code0 +[2(SBB reg_ax,imm 8086 )]142 code0 +[2(SBB reg_eax,sbyte32 386 )]131 code0 +[2(SBB reg_eax,imm 386 )]120 code0 +[2(SBB reg_rax,sbyte64 X64 )]109 code0 +(142)pageeven +restore showpage +%%Page: 143 143 +%%BeginPageSetup +save +%%EndPageSetup +/143 pa +[2(SBB reg_rax,imm X64 )]681 code0 +[2(SBB rm8,imm 8086 )]670 code0 +[2(SBB rm16,imm 8086 )]659 code0 +[2(SBB rm32,imm 386 )]648 code0 +[2(SBB rm64,imm X64 )]637 code0 +[2(SBB mem,imm8 8086 )]626 code0 +[2(SBB mem,imm16 8086 )]615 code0 +[2(SBB mem,imm32 386 )]604 code0 +[2(SCASB 8086 )]593 code0 +[2(SCASD 386 )]582 code0 +[2(SCASQ X64 )]571 code0 +[2(SCASW 8086 )]560 code0 +[2(SFENCE X64,AMD )]549 code0 +[2(SGDT mem 286 )]538 code0 +[2(SHL rm8,unity 8086 )]527 code0 +[2(SHL rm8,reg_cl 8086 )]516 code0 +[2(SHL rm8,imm 186 )]505 code0 +[2(SHL rm16,unity 8086 )]494 code0 +[2(SHL rm16,reg_cl 8086 )]483 code0 +[2(SHL rm16,imm 186 )]472 code0 +[2(SHL rm32,unity 386 )]461 code0 +[2(SHL rm32,reg_cl 386 )]450 code0 +[2(SHL rm32,imm 386 )]439 code0 +[2(SHL rm64,unity X64 )]428 code0 +[2(SHL rm64,reg_cl X64 )]417 code0 +[2(SHL rm64,imm X64 )]406 code0 +[2(SHLD mem,reg16,imm 3862 )]395 code0 +[2(SHLD reg16,reg16,imm 3862 )]384 code0 +[2(SHLD mem,reg32,imm 3862 )]373 code0 +[2(SHLD reg32,reg32,imm 3862 )]362 code0 +[2(SHLD mem,reg64,imm X642 )]351 code0 +[2(SHLD reg64,reg64,imm X642 )]340 code0 +[2(SHLD mem,reg16,reg_cl 386 )]329 code0 +[2(SHLD reg16,reg16,reg_cl 386 )]318 code0 +[2(SHLD mem,reg32,reg_cl 386 )]307 code0 +[2(SHLD reg32,reg32,reg_cl 386 )]296 code0 +[2(SHLD mem,reg64,reg_cl X64 )]285 code0 +[2(SHLD reg64,reg64,reg_cl X64 )]274 code0 +[2(SHR rm8,unity 8086 )]263 code0 +[2(SHR rm8,reg_cl 8086 )]252 code0 +[2(SHR rm8,imm 186 )]241 code0 +[2(SHR rm16,unity 8086 )]230 code0 +[2(SHR rm16,reg_cl 8086 )]219 code0 +[2(SHR rm16,imm 186 )]208 code0 +[2(SHR rm32,unity 386 )]197 code0 +[2(SHR rm32,reg_cl 386 )]186 code0 +[2(SHR rm32,imm 386 )]175 code0 +[2(SHR rm64,unity X64 )]164 code0 +[2(SHR rm64,reg_cl X64 )]153 code0 +[2(SHR rm64,imm X64 )]142 code0 +[2(SHRD mem,reg16,imm 3862 )]131 code0 +[2(SHRD reg16,reg16,imm 3862 )]120 code0 +[2(SHRD mem,reg32,imm 3862 )]109 code0 +(143)pageodd +restore showpage +%%Page: 144 144 +%%BeginPageSetup +save +%%EndPageSetup +/144 pa +[2(SHRD reg32,reg32,imm 3862 )]681 code0 +[2(SHRD mem,reg64,imm X642 )]670 code0 +[2(SHRD reg64,reg64,imm X642 )]659 code0 +[2(SHRD mem,reg16,reg_cl 386 )]648 code0 +[2(SHRD reg16,reg16,reg_cl 386 )]637 code0 +[2(SHRD mem,reg32,reg_cl 386 )]626 code0 +[2(SHRD reg32,reg32,reg_cl 386 )]615 code0 +[2(SHRD mem,reg64,reg_cl X64 )]604 code0 +[2(SHRD reg64,reg64,reg_cl X64 )]593 code0 +[2(SIDT mem 286 )]582 code0 +[2(SLDT mem 286 )]571 code0 +[2(SLDT mem16 286 )]560 code0 +[2(SLDT reg16 286 )]549 code0 +[2(SLDT reg32 386 )]538 code0 +[2(SLDT reg64 X64,ND )]527 code0 +[2(SLDT reg64 X64 )]516 code0 +[2(SKINIT X64 )]505 code0 +[2(SMI 386,UNDOC )]494 code0 +[2(SMINT P6,CYRIX,ND )]483 code0 +[2(SMINTOLD 486,CYRIX,ND )]472 code0 +[2(SMSW mem 286 )]461 code0 +[2(SMSW mem16 286 )]450 code0 +[2(SMSW reg16 286 )]439 code0 +[2(SMSW reg32 386 )]428 code0 +[2(STC 8086 )]417 code0 +[2(STD 8086 )]406 code0 +[2(STGI X64 )]395 code0 +[2(STI 8086 )]384 code0 +[2(STOSB 8086 )]373 code0 +[2(STOSD 386 )]362 code0 +[2(STOSQ X64 )]351 code0 +[2(STOSW 8086 )]340 code0 +[2(STR mem 286,PROT )]329 code0 +[2(STR mem16 286,PROT )]318 code0 +[2(STR reg16 286,PROT )]307 code0 +[2(STR reg32 386,PROT )]296 code0 +[2(STR reg64 X64 )]285 code0 +[2(SUB mem,reg8 8086 )]274 code0 +[2(SUB reg8,reg8 8086 )]263 code0 +[2(SUB mem,reg16 8086 )]252 code0 +[2(SUB reg16,reg16 8086 )]241 code0 +[2(SUB mem,reg32 386 )]230 code0 +[2(SUB reg32,reg32 386 )]219 code0 +[2(SUB mem,reg64 X64 )]208 code0 +[2(SUB reg64,reg64 X64 )]197 code0 +[2(SUB reg8,mem 8086 )]186 code0 +[2(SUB reg8,reg8 8086 )]175 code0 +[2(SUB reg16,mem 8086 )]164 code0 +[2(SUB reg16,reg16 8086 )]153 code0 +[2(SUB reg32,mem 386 )]142 code0 +[2(SUB reg32,reg32 386 )]131 code0 +[2(SUB reg64,mem X64 )]120 code0 +[2(SUB reg64,reg64 X64 )]109 code0 +(144)pageeven +restore showpage +%%Page: 145 145 +%%BeginPageSetup +save +%%EndPageSetup +/145 pa +[2(SUB rm16,imm8 8086 )]681 code0 +[2(SUB rm32,imm8 386 )]670 code0 +[2(SUB rm64,imm8 X64 )]659 code0 +[2(SUB reg_al,imm 8086 )]648 code0 +[2(SUB reg_ax,sbyte16 8086 )]637 code0 +[2(SUB reg_ax,imm 8086 )]626 code0 +[2(SUB reg_eax,sbyte32 386 )]615 code0 +[2(SUB reg_eax,imm 386 )]604 code0 +[2(SUB reg_rax,sbyte64 X64 )]593 code0 +[2(SUB reg_rax,imm X64 )]582 code0 +[2(SUB rm8,imm 8086 )]571 code0 +[2(SUB rm16,imm 8086 )]560 code0 +[2(SUB rm32,imm 386 )]549 code0 +[2(SUB rm64,imm X64 )]538 code0 +[2(SUB mem,imm8 8086 )]527 code0 +[2(SUB mem,imm16 8086 )]516 code0 +[2(SUB mem,imm32 386 )]505 code0 +[2(SVDC mem80,reg_sreg 486,CYRIXM )]494 code0 +[2(SVLDT mem80 486,CYRIXM,ND )]483 code0 +[2(SVTS mem80 486,CYRIXM )]472 code0 +[2(SWAPGS X64 )]461 code0 +[2(SYSCALL P6,AMD )]450 code0 +[2(SYSENTER P6 )]439 code0 +[2(SYSEXIT P6,PRIV )]428 code0 +[2(SYSRET P6,PRIV,AMD )]417 code0 +[2(TEST mem,reg8 8086 )]406 code0 +[2(TEST reg8,reg8 8086 )]395 code0 +[2(TEST mem,reg16 8086 )]384 code0 +[2(TEST reg16,reg16 8086 )]373 code0 +[2(TEST mem,reg32 386 )]362 code0 +[2(TEST reg32,reg32 386 )]351 code0 +[2(TEST mem,reg64 X64 )]340 code0 +[2(TEST reg64,reg64 X64 )]329 code0 +[2(TEST reg8,mem 8086 )]318 code0 +[2(TEST reg16,mem 8086 )]307 code0 +[2(TEST reg32,mem 386 )]296 code0 +[2(TEST reg64,mem X64 )]285 code0 +[2(TEST reg_al,imm 8086 )]274 code0 +[2(TEST reg_ax,imm 8086 )]263 code0 +[2(TEST reg_eax,imm 386 )]252 code0 +[2(TEST reg_rax,imm X64 )]241 code0 +[2(TEST rm8,imm 8086 )]230 code0 +[2(TEST rm16,imm 8086 )]219 code0 +[2(TEST rm32,imm 386 )]208 code0 +[2(TEST rm64,imm X64 )]197 code0 +[2(TEST mem,imm8 8086 )]186 code0 +[2(TEST mem,imm16 8086 )]175 code0 +[2(TEST mem,imm32 386 )]164 code0 +[2(UD0 186,UNDOC )]153 code0 +[2(UD1 186,UNDOC )]142 code0 +[2(UD2B 186,UNDOC,ND )]131 code0 +[2(UD2 186 )]120 code0 +[2(UD2A 186,ND )]109 code0 +(145)pageodd +restore showpage +%%Page: 146 146 +%%BeginPageSetup +save +%%EndPageSetup +/146 pa +[2(UMOV mem,reg8 386,UNDOC,ND )]681 code0 +[2(UMOV reg8,reg8 386,UNDOC,ND )]670 code0 +[2(UMOV mem,reg16 386,UNDOC,ND )]659 code0 +[2(UMOV reg16,reg16 386,UNDOC,ND )]648 code0 +[2(UMOV mem,reg32 386,UNDOC,ND )]637 code0 +[2(UMOV reg32,reg32 386,UNDOC,ND )]626 code0 +[2(UMOV reg8,mem 386,UNDOC,ND )]615 code0 +[2(UMOV reg8,reg8 386,UNDOC,ND )]604 code0 +[2(UMOV reg16,mem 386,UNDOC,ND )]593 code0 +[2(UMOV reg16,reg16 386,UNDOC,ND )]582 code0 +[2(UMOV reg32,mem 386,UNDOC,ND )]571 code0 +[2(UMOV reg32,reg32 386,UNDOC,ND )]560 code0 +[2(VERR mem 286,PROT )]549 code0 +[2(VERR mem16 286,PROT )]538 code0 +[2(VERR reg16 286,PROT )]527 code0 +[2(VERW mem 286,PROT )]516 code0 +[2(VERW mem16 286,PROT )]505 code0 +[2(VERW reg16 286,PROT )]494 code0 +[2(FWAIT 8086 )]483 code0 +[2(WBINVD 486,PRIV )]472 code0 +[2(WRSHR rm32 P6,CYRIXM )]461 code0 +[2(WRMSR PENT,PRIV )]450 code0 +[2(XADD mem,reg8 486 )]439 code0 +[2(XADD reg8,reg8 486 )]428 code0 +[2(XADD mem,reg16 486 )]417 code0 +[2(XADD reg16,reg16 486 )]406 code0 +[2(XADD mem,reg32 486 )]395 code0 +[2(XADD reg32,reg32 486 )]384 code0 +[2(XADD mem,reg64 X64 )]373 code0 +[2(XADD reg64,reg64 X64 )]362 code0 +[2(XBTS reg16,mem 386,SW,UNDOC,ND )]351 code0 +[2(XBTS reg16,reg16 386,UNDOC,ND )]340 code0 +[2(XBTS reg32,mem 386,SD,UNDOC,ND )]329 code0 +[2(XBTS reg32,reg32 386,UNDOC,ND )]318 code0 +[2(XCHG reg_ax,reg16 8086 )]307 code0 +[2(XCHG reg_eax,reg32na 386 )]296 code0 +[2(XCHG reg_rax,reg64 X64 )]285 code0 +[2(XCHG reg16,reg_ax 8086 )]274 code0 +[2(XCHG reg32na,reg_eax 386 )]263 code0 +[2(XCHG reg64,reg_rax X64 )]252 code0 +[2(XCHG reg_eax,reg_eax 386,NOLONG )]241 code0 +[2(XCHG reg8,mem 8086 )]230 code0 +[2(XCHG reg8,reg8 8086 )]219 code0 +[2(XCHG reg16,mem 8086 )]208 code0 +[2(XCHG reg16,reg16 8086 )]197 code0 +[2(XCHG reg32,mem 386 )]186 code0 +[2(XCHG reg32,reg32 386 )]175 code0 +[2(XCHG reg64,mem X64 )]164 code0 +[2(XCHG reg64,reg64 X64 )]153 code0 +[2(XCHG mem,reg8 8086 )]142 code0 +[2(XCHG reg8,reg8 8086 )]131 code0 +[2(XCHG mem,reg16 8086 )]120 code0 +[2(XCHG reg16,reg16 8086 )]109 code0 +(146)pageeven +restore showpage +%%Page: 147 147 +%%BeginPageSetup +save +%%EndPageSetup +/147 pa +[2(XCHG mem,reg32 386 )]681 code0 +[2(XCHG reg32,reg32 386 )]670 code0 +[2(XCHG mem,reg64 X64 )]659 code0 +[2(XCHG reg64,reg64 X64 )]648 code0 +[2(XLATB 8086 )]637 code0 +[2(XLAT 8086 )]626 code0 +[2(XOR mem,reg8 8086 )]615 code0 +[2(XOR reg8,reg8 8086 )]604 code0 +[2(XOR mem,reg16 8086 )]593 code0 +[2(XOR reg16,reg16 8086 )]582 code0 +[2(XOR mem,reg32 386 )]571 code0 +[2(XOR reg32,reg32 386 )]560 code0 +[2(XOR mem,reg64 X64 )]549 code0 +[2(XOR reg64,reg64 X64 )]538 code0 +[2(XOR reg8,mem 8086 )]527 code0 +[2(XOR reg8,reg8 8086 )]516 code0 +[2(XOR reg16,mem 8086 )]505 code0 +[2(XOR reg16,reg16 8086 )]494 code0 +[2(XOR reg32,mem 386 )]483 code0 +[2(XOR reg32,reg32 386 )]472 code0 +[2(XOR reg64,mem X64 )]461 code0 +[2(XOR reg64,reg64 X64 )]450 code0 +[2(XOR rm16,imm8 8086 )]439 code0 +[2(XOR rm32,imm8 386 )]428 code0 +[2(XOR rm64,imm8 X64 )]417 code0 +[2(XOR reg_al,imm 8086 )]406 code0 +[2(XOR reg_ax,sbyte16 8086 )]395 code0 +[2(XOR reg_ax,imm 8086 )]384 code0 +[2(XOR reg_eax,sbyte32 386 )]373 code0 +[2(XOR reg_eax,imm 386 )]362 code0 +[2(XOR reg_rax,sbyte64 X64 )]351 code0 +[2(XOR reg_rax,imm X64 )]340 code0 +[2(XOR rm8,imm 8086 )]329 code0 +[2(XOR rm16,imm 8086 )]318 code0 +[2(XOR rm32,imm 386 )]307 code0 +[2(XOR rm64,imm X64 )]296 code0 +[2(XOR mem,imm8 8086 )]285 code0 +[2(XOR mem,imm16 8086 )]274 code0 +[2(XOR mem,imm32 386 )]263 code0 +[2(CMOVcc reg16,mem P6 )]252 code0 +[2(CMOVcc reg16,reg16 P6 )]241 code0 +[2(CMOVcc reg32,mem P6 )]230 code0 +[2(CMOVcc reg32,reg32 P6 )]219 code0 +[2(CMOVcc reg64,mem X64 )]208 code0 +[2(CMOVcc reg64,reg64 X64 )]197 code0 +[2(Jcc imm|near 386 )]186 code0 +[2(Jcc imm16|near 386 )]175 code0 +[2(Jcc imm32|near 386 )]164 code0 +[2(Jcc imm|short 8086,ND )]153 code0 +[2(Jcc imm 8086,ND )]142 code0 +[2(Jcc imm 386,ND )]131 code0 +[2(Jcc imm 8086,ND )]120 code0 +[2(Jcc imm 8086 )]109 code0 +(147)pageodd +restore showpage +%%Page: 148 148 +%%BeginPageSetup +save +%%EndPageSetup +/148 pa +[2(SETcc mem 386 )]681 code0 +[2(SETcc reg8 386)]670 code2 +[{/section-B.1.3 xa}(Katmai Streaming SIMD instructions \(SSE \226\226 a.k.a. KNI, XMM, MMX2\))](B.1.3)650.8 subh3 +[2(ADDPS xmmreg,xmmrm KATMAI,SSE )]633.8 code1 +[2(ADDSS xmmreg,xmmrm KATMAI,SSE,SD )]622.8 code0 +[2(ANDNPS xmmreg,xmmrm KATMAI,SSE )]611.8 code0 +[2(ANDPS xmmreg,xmmrm KATMAI,SSE )]600.8 code0 +[2(CMPEQPS xmmreg,xmmrm KATMAI,SSE )]589.8 code0 +[2(CMPEQSS xmmreg,xmmrm KATMAI,SSE )]578.8 code0 +[2(CMPLEPS xmmreg,xmmrm KATMAI,SSE )]567.8 code0 +[2(CMPLESS xmmreg,xmmrm KATMAI,SSE )]556.8 code0 +[2(CMPLTPS xmmreg,xmmrm KATMAI,SSE )]545.8 code0 +[2(CMPLTSS xmmreg,xmmrm KATMAI,SSE )]534.8 code0 +[2(CMPNEQPS xmmreg,xmmrm KATMAI,SSE )]523.8 code0 +[2(CMPNEQSS xmmreg,xmmrm KATMAI,SSE )]512.8 code0 +[2(CMPNLEPS xmmreg,xmmrm KATMAI,SSE )]501.8 code0 +[2(CMPNLESS xmmreg,xmmrm KATMAI,SSE )]490.8 code0 +[2(CMPNLTPS xmmreg,xmmrm KATMAI,SSE )]479.8 code0 +[2(CMPNLTSS xmmreg,xmmrm KATMAI,SSE )]468.8 code0 +[2(CMPORDPS xmmreg,xmmrm KATMAI,SSE )]457.8 code0 +[2(CMPORDSS xmmreg,xmmrm KATMAI,SSE )]446.8 code0 +[2(CMPUNORDPS xmmreg,xmmrm KATMAI,SSE )]435.8 code0 +[2(CMPUNORDSS xmmreg,xmmrm KATMAI,SSE )]424.8 code0 +[2(CMPPS xmmreg,mem,imm KATMAI,SSE )]413.8 code0 +[2(CMPPS xmmreg,xmmreg,imm KATMAI,SSE )]402.8 code0 +[2(CMPSS xmmreg,mem,imm KATMAI,SSE )]391.8 code0 +[2(CMPSS xmmreg,xmmreg,imm KATMAI,SSE )]380.8 code0 +[2(COMISS xmmreg,xmmrm KATMAI,SSE )]369.8 code0 +[2(CVTPI2PS xmmreg,mmxrm KATMAI,SSE,MMX )]358.8 code0 +[2(CVTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX )]347.8 code0 +[2(CVTSI2SS xmmreg,mem KATMAI,SSE,SD,AR1,ND )]336.8 code0 +[2(CVTSI2SS xmmreg,rm32 KATMAI,SSE,SD,AR1 )]325.8 code0 +[2(CVTSI2SS xmmreg,rm64 X64,SSE,AR1 )]314.8 code0 +[2(CVTSS2SI reg32,xmmreg KATMAI,SSE,SD,AR1 )]303.8 code0 +[2(CVTSS2SI reg32,mem KATMAI,SSE,SD,AR1 )]292.8 code0 +[2(CVTSS2SI reg64,xmmreg X64,SSE,SD,AR1 )]281.8 code0 +[2(CVTSS2SI reg64,mem X64,SSE,SD,AR1 )]270.8 code0 +[2(CVTTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX )]259.8 code0 +[2(CVTTSS2SI reg32,xmmrm KATMAI,SSE,SD,AR1 )]248.8 code0 +[2(CVTTSS2SI reg64,xmmrm X64,SSE,SD,AR1 )]237.8 code0 +[2(DIVPS xmmreg,xmmrm KATMAI,SSE )]226.8 code0 +[2(DIVSS xmmreg,xmmrm KATMAI,SSE )]215.8 code0 +[2(LDMXCSR mem KATMAI,SSE,SD )]204.8 code0 +[2(MAXPS xmmreg,xmmrm KATMAI,SSE )]193.8 code0 +[2(MAXSS xmmreg,xmmrm KATMAI,SSE )]182.8 code0 +[2(MINPS xmmreg,xmmrm KATMAI,SSE )]171.8 code0 +[2(MINSS xmmreg,xmmrm KATMAI,SSE )]160.8 code0 +[2(MOVAPS xmmreg,mem KATMAI,SSE )]149.8 code0 +[2(MOVAPS mem,xmmreg KATMAI,SSE )]138.8 code0 +[2(MOVAPS xmmreg,xmmreg KATMAI,SSE )]127.8 code0 +[2(MOVAPS xmmreg,xmmreg KATMAI,SSE )]116.8 code0 +[2(MOVHPS xmmreg,mem KATMAI,SSE )]105.8 code0 +(148)pageeven +restore showpage +%%Page: 149 149 +%%BeginPageSetup +save +%%EndPageSetup +/149 pa +[2(MOVHPS mem,xmmreg KATMAI,SSE )]681 code0 +[2(MOVLHPS xmmreg,xmmreg KATMAI,SSE )]670 code0 +[2(MOVLPS xmmreg,mem KATMAI,SSE )]659 code0 +[2(MOVLPS mem,xmmreg KATMAI,SSE )]648 code0 +[2(MOVHLPS xmmreg,xmmreg KATMAI,SSE )]637 code0 +[2(MOVMSKPS reg32,xmmreg KATMAI,SSE )]626 code0 +[2(MOVMSKPS reg64,xmmreg X64,SSE )]615 code0 +[2(MOVNTPS mem,xmmreg KATMAI,SSE )]604 code0 +[2(MOVSS xmmreg,mem KATMAI,SSE )]593 code0 +[2(MOVSS mem,xmmreg KATMAI,SSE )]582 code0 +[2(MOVSS xmmreg,xmmreg KATMAI,SSE )]571 code0 +[2(MOVSS xmmreg,xmmreg KATMAI,SSE )]560 code0 +[2(MOVUPS xmmreg,mem KATMAI,SSE )]549 code0 +[2(MOVUPS mem,xmmreg KATMAI,SSE )]538 code0 +[2(MOVUPS xmmreg,xmmreg KATMAI,SSE )]527 code0 +[2(MOVUPS xmmreg,xmmreg KATMAI,SSE )]516 code0 +[2(MULPS xmmreg,xmmrm KATMAI,SSE )]505 code0 +[2(MULSS xmmreg,xmmrm KATMAI,SSE )]494 code0 +[2(ORPS xmmreg,xmmrm KATMAI,SSE )]483 code0 +[2(RCPPS xmmreg,xmmrm KATMAI,SSE )]472 code0 +[2(RCPSS xmmreg,xmmrm KATMAI,SSE )]461 code0 +[2(RSQRTPS xmmreg,xmmrm KATMAI,SSE )]450 code0 +[2(RSQRTSS xmmreg,xmmrm KATMAI,SSE )]439 code0 +[2(SHUFPS xmmreg,mem,imm KATMAI,SSE )]428 code0 +[2(SHUFPS xmmreg,xmmreg,imm KATMAI,SSE )]417 code0 +[2(SQRTPS xmmreg,xmmrm KATMAI,SSE )]406 code0 +[2(SQRTSS xmmreg,xmmrm KATMAI,SSE )]395 code0 +[2(STMXCSR mem KATMAI,SSE,SD )]384 code0 +[2(SUBPS xmmreg,xmmrm KATMAI,SSE )]373 code0 +[2(SUBSS xmmreg,xmmrm KATMAI,SSE )]362 code0 +[2(UCOMISS xmmreg,xmmrm KATMAI,SSE )]351 code0 +[2(UNPCKHPS xmmreg,xmmrm KATMAI,SSE )]340 code0 +[2(UNPCKLPS xmmreg,xmmrm KATMAI,SSE )]329 code0 +[2(XORPS xmmreg,xmmrm KATMAI,SSE)]318 code2 +[{/section-B.1.4 xa}(Introduced in Deschutes but necessary for SSE support)](B.1.4)298.8 subh3 +[2(FXRSTOR mem P6,SSE,FPU )]281.8 code1 +[2(FXSAVE mem P6,SSE,FPU)]270.8 code2 +[{/section-B.1.5 xa}(XSAVE group \(AVX and extended state\))](B.1.5)251.6 subh3 +[2(XGETBV NEHALEM )]234.6 code1 +[2(XSETBV NEHALEM,PRIV )]223.6 code0 +[2(XSAVE mem NEHALEM )]212.6 code0 +[2(XRSTOR mem NEHALEM)]201.6 code2 +[{/section-B.1.6 xa}(Generic memory operations)](B.1.6)182.4 subh3 +[2(PREFETCHNTA mem KATMAI )]165.4 code1 +[2(PREFETCHT0 mem KATMAI )]154.4 code0 +[2(PREFETCHT1 mem KATMAI )]143.4 code0 +[2(PREFETCHT2 mem KATMAI )]132.4 code0 +[2(SFENCE KATMAI)]121.4 code2 +(149)pageodd +restore showpage +%%Page: 150 150 +%%BeginPageSetup +save +%%EndPageSetup +/150 pa +[{/section-B.1.7 xa}(New MMX instructions introduced in Katmai)](B.1.7)678.8 subh3 +[2(MASKMOVQ mmxreg,mmxreg KATMAI,MMX )]661.8 code1 +[2(MOVNTQ mem,mmxreg KATMAI,MMX )]650.8 code0 +[2(PAVGB mmxreg,mmxrm KATMAI,MMX )]639.8 code0 +[2(PAVGW mmxreg,mmxrm KATMAI,MMX )]628.8 code0 +[2(PEXTRW reg32,mmxreg,imm KATMAI,MMX )]617.8 code0 +[2(PINSRW mmxreg,mem,imm KATMAI,MMX )]606.8 code0 +[2(PINSRW mmxreg,rm16,imm KATMAI,MMX )]595.8 code0 +[2(PINSRW mmxreg,reg32,imm KATMAI,MMX )]584.8 code0 +[2(PMAXSW mmxreg,mmxrm KATMAI,MMX )]573.8 code0 +[2(PMAXUB mmxreg,mmxrm KATMAI,MMX )]562.8 code0 +[2(PMINSW mmxreg,mmxrm KATMAI,MMX )]551.8 code0 +[2(PMINUB mmxreg,mmxrm KATMAI,MMX )]540.8 code0 +[2(PMOVMSKB reg32,mmxreg KATMAI,MMX )]529.8 code0 +[2(PMULHUW mmxreg,mmxrm KATMAI,MMX )]518.8 code0 +[2(PSADBW mmxreg,mmxrm KATMAI,MMX )]507.8 code0 +[2(PSHUFW mmxreg,mmxrm,imm KATMAI,MMX2)]496.8 code2 +[{/section-B.1.8 xa}(AMD Enhanced 3DNow! \(Athlon\) instructions)](B.1.8)477.6 subh3 +[2(PF2IW mmxreg,mmxrm PENT,3DNOW )]460.6 code1 +[2(PFNACC mmxreg,mmxrm PENT,3DNOW )]449.6 code0 +[2(PFPNACC mmxreg,mmxrm PENT,3DNOW )]438.6 code0 +[2(PI2FW mmxreg,mmxrm PENT,3DNOW )]427.6 code0 +[2(PSWAPD mmxreg,mmxrm PENT,3DNOW)]416.6 code2 +[{/section-B.1.9 xa}(Willamette SSE2 Cacheability Instructions)](B.1.9)397.4 subh3 +[2(MASKMOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 )]380.4 code1 +[2(CLFLUSH mem WILLAMETTE,SSE2 )]369.4 code0 +[2(MOVNTDQ mem,xmmreg WILLAMETTE,SSE2,SO )]358.4 code0 +[2(MOVNTI mem,reg32 WILLAMETTE,SD )]347.4 code0 +[2(MOVNTI mem,reg64 X64 )]336.4 code0 +[2(MOVNTPD mem,xmmreg WILLAMETTE,SSE2,SO )]325.4 code0 +[2(LFENCE WILLAMETTE,SSE2 )]314.4 code0 +[2(MFENCE WILLAMETTE,SSE2)]303.4 code2 +[{/section-B.1.10 xa}(Willamette MMX instructions \(SSE2 SIMD Integer Instructions\))](B.1.10)284.2 subh3 +[2(MOVD mem,xmmreg WILLAMETTE,SSE2,SD )]267.2 code1 +[2(MOVD xmmreg,mem WILLAMETTE,SSE2,SD )]256.2 code0 +[2(MOVD xmmreg,rm32 WILLAMETTE,SSE2 )]245.2 code0 +[2(MOVD rm32,xmmreg WILLAMETTE,SSE2 )]234.2 code0 +[2(MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 )]223.2 code0 +[2(MOVDQA mem,xmmreg WILLAMETTE,SSE2,SO )]212.2 code0 +[2(MOVDQA xmmreg,mem WILLAMETTE,SSE2,SO )]201.2 code0 +[2(MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 )]190.2 code0 +[2(MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 )]179.2 code0 +[2(MOVDQU mem,xmmreg WILLAMETTE,SSE2,SO )]168.2 code0 +[2(MOVDQU xmmreg,mem WILLAMETTE,SSE2,SO )]157.2 code0 +[2(MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 )]146.2 code0 +[2(MOVDQ2Q mmxreg,xmmreg WILLAMETTE,SSE2 )]135.2 code0 +[2(MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 )]124.2 code0 +[2(MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 )]113.2 code0 +[2(MOVQ mem,xmmreg WILLAMETTE,SSE2 )]102.2 code0 +(150)pageeven +restore showpage +%%Page: 151 151 +%%BeginPageSetup +save +%%EndPageSetup +/151 pa +[2(MOVQ xmmreg,mem WILLAMETTE,SSE2 )]681 code0 +[2(MOVQ xmmreg,rm64 X64,SSE2 )]670 code0 +[2(MOVQ rm64,xmmreg X64,SSE2 )]659 code0 +[2(MOVQ2DQ xmmreg,mmxreg WILLAMETTE,SSE2 )]648 code0 +[2(PACKSSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]637 code0 +[2(PACKSSDW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]626 code0 +[2(PACKUSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]615 code0 +[2(PADDB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]604 code0 +[2(PADDW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]593 code0 +[2(PADDD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]582 code0 +[2(PADDQ mmxreg,mmxrm WILLAMETTE,MMX )]571 code0 +[2(PADDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]560 code0 +[2(PADDSB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]549 code0 +[2(PADDSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]538 code0 +[2(PADDUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]527 code0 +[2(PADDUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]516 code0 +[2(PAND xmmreg,xmmrm WILLAMETTE,SSE2,SO )]505 code0 +[2(PANDN xmmreg,xmmrm WILLAMETTE,SSE2,SO )]494 code0 +[2(PAVGB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]483 code0 +[2(PAVGW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]472 code0 +[2(PCMPEQB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]461 code0 +[2(PCMPEQW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]450 code0 +[2(PCMPEQD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]439 code0 +[2(PCMPGTB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]428 code0 +[2(PCMPGTW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]417 code0 +[2(PCMPGTD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]406 code0 +[2(PEXTRW reg32,xmmreg,imm WILLAMETTE,SSE2 )]395 code0 +[2(PINSRW xmmreg,reg16,imm WILLAMETTE,SSE2 )]384 code0 +[2(PINSRW xmmreg,reg32,imm WILLAMETTE,SSE2,ND )]373 code0 +[2(PINSRW xmmreg,mem,imm WILLAMETTE,SSE2 )]362 code0 +[2(PINSRW xmmreg,mem16,imm WILLAMETTE,SSE2 )]351 code0 +[2(PMADDWD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]340 code0 +[2(PMAXSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]329 code0 +[2(PMAXUB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]318 code0 +[2(PMINSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]307 code0 +[2(PMINUB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]296 code0 +[2(PMOVMSKB reg32,xmmreg WILLAMETTE,SSE2 )]285 code0 +[2(PMULHUW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]274 code0 +[2(PMULHW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]263 code0 +[2(PMULLW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]252 code0 +[2(PMULUDQ mmxreg,mmxrm WILLAMETTE,SSE2,SO )]241 code0 +[2(PMULUDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]230 code0 +[2(POR xmmreg,xmmrm WILLAMETTE,SSE2,SO )]219 code0 +[2(PSADBW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]208 code0 +[2(PSHUFD xmmreg,xmmreg,imm WILLAMETTE,SSE2 )]197 code0 +[2(PSHUFD xmmreg,mem,imm WILLAMETTE,SSE22 )]186 code0 +[2(PSHUFHW xmmreg,xmmreg,imm WILLAMETTE,SSE2 )]175 code0 +[2(PSHUFHW xmmreg,mem,imm WILLAMETTE,SSE22 )]164 code0 +[2(PSHUFLW xmmreg,xmmreg,imm WILLAMETTE,SSE2 )]153 code0 +[2(PSHUFLW xmmreg,mem,imm WILLAMETTE,SSE22 )]142 code0 +[2(PSLLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 )]131 code0 +[2(PSLLW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]120 code0 +[2(PSLLW xmmreg,imm WILLAMETTE,SSE2,AR1 )]109 code0 +(151)pageodd +restore showpage +%%Page: 152 152 +%%BeginPageSetup +save +%%EndPageSetup +/152 pa +[2(PSLLD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]681 code0 +[2(PSLLD xmmreg,imm WILLAMETTE,SSE2,AR1 )]670 code0 +[2(PSLLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]659 code0 +[2(PSLLQ xmmreg,imm WILLAMETTE,SSE2,AR1 )]648 code0 +[2(PSRAW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]637 code0 +[2(PSRAW xmmreg,imm WILLAMETTE,SSE2,AR1 )]626 code0 +[2(PSRAD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]615 code0 +[2(PSRAD xmmreg,imm WILLAMETTE,SSE2,AR1 )]604 code0 +[2(PSRLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 )]593 code0 +[2(PSRLW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]582 code0 +[2(PSRLW xmmreg,imm WILLAMETTE,SSE2,AR1 )]571 code0 +[2(PSRLD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]560 code0 +[2(PSRLD xmmreg,imm WILLAMETTE,SSE2,AR1 )]549 code0 +[2(PSRLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]538 code0 +[2(PSRLQ xmmreg,imm WILLAMETTE,SSE2,AR1 )]527 code0 +[2(PSUBB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]516 code0 +[2(PSUBW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]505 code0 +[2(PSUBD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]494 code0 +[2(PSUBQ mmxreg,mmxrm WILLAMETTE,SSE2,SO )]483 code0 +[2(PSUBQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]472 code0 +[2(PSUBSB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]461 code0 +[2(PSUBSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]450 code0 +[2(PSUBUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO )]439 code0 +[2(PSUBUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]428 code0 +[2(PUNPCKHBW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]417 code0 +[2(PUNPCKHWD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]406 code0 +[2(PUNPCKHDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]395 code0 +[2(PUNPCKHQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]384 code0 +[2(PUNPCKLBW xmmreg,xmmrm WILLAMETTE,SSE2,SO )]373 code0 +[2(PUNPCKLWD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]362 code0 +[2(PUNPCKLDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]351 code0 +[2(PUNPCKLQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]340 code0 +[2(PXOR xmmreg,xmmrm WILLAMETTE,SSE2,SO)]329 code2 +[{/section-B.1.11 xa}(Willamette Streaming SIMD instructions \(SSE2\))](B.1.11)309.8 subh3 +[2(ADDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]292.8 code1 +[2(ADDSD xmmreg,xmmrm WILLAMETTE,SSE2 )]281.8 code0 +[2(ANDNPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]270.8 code0 +[2(ANDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]259.8 code0 +[2(CMPEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]248.8 code0 +[2(CMPEQSD xmmreg,xmmrm WILLAMETTE,SSE2 )]237.8 code0 +[2(CMPLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]226.8 code0 +[2(CMPLESD xmmreg,xmmrm WILLAMETTE,SSE2 )]215.8 code0 +[2(CMPLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]204.8 code0 +[2(CMPLTSD xmmreg,xmmrm WILLAMETTE,SSE2 )]193.8 code0 +[2(CMPNEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]182.8 code0 +[2(CMPNEQSD xmmreg,xmmrm WILLAMETTE,SSE2 )]171.8 code0 +[2(CMPNLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]160.8 code0 +[2(CMPNLESD xmmreg,xmmrm WILLAMETTE,SSE2 )]149.8 code0 +[2(CMPNLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]138.8 code0 +[2(CMPNLTSD xmmreg,xmmrm WILLAMETTE,SSE2 )]127.8 code0 +[2(CMPORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]116.8 code0 +[2(CMPORDSD xmmreg,xmmrm WILLAMETTE,SSE2 )]105.8 code0 +(152)pageeven +restore showpage +%%Page: 153 153 +%%BeginPageSetup +save +%%EndPageSetup +/153 pa +[2(CMPUNORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]681 code0 +[2(CMPUNORDSD xmmreg,xmmrm WILLAMETTE,SSE2 )]670 code0 +[2(CMPPD xmmreg,xmmrm,imm WILLAMETTE,SSE22 )]659 code0 +[2(CMPSD xmmreg,xmmrm,imm WILLAMETTE,SSE2 )]648 code0 +[2(COMISD xmmreg,xmmrm WILLAMETTE,SSE2 )]637 code0 +[2(CVTDQ2PD xmmreg,xmmrm WILLAMETTE,SSE2 )]626 code0 +[2(CVTDQ2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO )]615 code0 +[2(CVTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]604 code0 +[2(CVTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO )]593 code0 +[2(CVTPD2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO )]582 code0 +[2(CVTPI2PD xmmreg,mmxrm WILLAMETTE,SSE2 )]571 code0 +[2(CVTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]560 code0 +[2(CVTPS2PD xmmreg,xmmrm WILLAMETTE,SSE2 )]549 code0 +[2(CVTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 )]538 code0 +[2(CVTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 )]527 code0 +[2(CVTSD2SI reg64,xmmreg X64,SSE2,AR1 )]516 code0 +[2(CVTSD2SI reg64,mem X64,SSE2,AR1 )]505 code0 +[2(CVTSD2SS xmmreg,xmmrm WILLAMETTE,SSE2 )]494 code0 +[2(CVTSI2SD xmmreg,mem WILLAMETTE,SSE2,SD,AR1,ND )]483 code0 +[2(CVTSI2SD xmmreg,rm32 WILLAMETTE,SSE2,SD,AR1 )]472 code0 +[2(CVTSI2SD xmmreg,rm64 X64,SSE2,AR1 )]461 code0 +[2(CVTSS2SD xmmreg,xmmrm WILLAMETTE,SSE2,SD )]450 code0 +[2(CVTTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO )]439 code0 +[2(CVTTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]428 code0 +[2(CVTTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO )]417 code0 +[2(CVTTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 )]406 code0 +[2(CVTTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 )]395 code0 +[2(CVTTSD2SI reg64,xmmreg X64,SSE2,AR1 )]384 code0 +[2(CVTTSD2SI reg64,mem X64,SSE2,AR1 )]373 code0 +[2(DIVPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]362 code0 +[2(DIVSD xmmreg,xmmrm WILLAMETTE,SSE2 )]351 code0 +[2(MAXPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]340 code0 +[2(MAXSD xmmreg,xmmrm WILLAMETTE,SSE2 )]329 code0 +[2(MINPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]318 code0 +[2(MINSD xmmreg,xmmrm WILLAMETTE,SSE2 )]307 code0 +[2(MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 )]296 code0 +[2(MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 )]285 code0 +[2(MOVAPD mem,xmmreg WILLAMETTE,SSE2,SO )]274 code0 +[2(MOVAPD xmmreg,mem WILLAMETTE,SSE2,SO )]263 code0 +[2(MOVHPD mem,xmmreg WILLAMETTE,SSE2 )]252 code0 +[2(MOVHPD xmmreg,mem WILLAMETTE,SSE2 )]241 code0 +[2(MOVLPD mem,xmmreg WILLAMETTE,SSE2 )]230 code0 +[2(MOVLPD xmmreg,mem WILLAMETTE,SSE2 )]219 code0 +[2(MOVMSKPD reg32,xmmreg WILLAMETTE,SSE2 )]208 code0 +[2(MOVMSKPD reg64,xmmreg X64,SSE2 )]197 code0 +[2(MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 )]186 code0 +[2(MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 )]175 code0 +[2(MOVSD mem,xmmreg WILLAMETTE,SSE2 )]164 code0 +[2(MOVSD xmmreg,mem WILLAMETTE,SSE2 )]153 code0 +[2(MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 )]142 code0 +[2(MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 )]131 code0 +[2(MOVUPD mem,xmmreg WILLAMETTE,SSE2,SO )]120 code0 +[2(MOVUPD xmmreg,mem WILLAMETTE,SSE2,SO )]109 code0 +(153)pageodd +restore showpage +%%Page: 154 154 +%%BeginPageSetup +save +%%EndPageSetup +/154 pa +[2(MULPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]681 code0 +[2(MULSD xmmreg,xmmrm WILLAMETTE,SSE2 )]670 code0 +[2(ORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]659 code0 +[2(SHUFPD xmmreg,xmmreg,imm WILLAMETTE,SSE2 )]648 code0 +[2(SHUFPD xmmreg,mem,imm WILLAMETTE,SSE2 )]637 code0 +[2(SQRTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]626 code0 +[2(SQRTSD xmmreg,xmmrm WILLAMETTE,SSE2 )]615 code0 +[2(SUBPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]604 code0 +[2(SUBSD xmmreg,xmmrm WILLAMETTE,SSE2 )]593 code0 +[2(UCOMISD xmmreg,xmmrm WILLAMETTE,SSE2 )]582 code0 +[2(UNPCKHPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]571 code0 +[2(UNPCKLPD xmmreg,xmmrm WILLAMETTE,SSE2,SO )]560 code0 +[2(XORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO)]549 code2 +[{/section-B.1.12 xa}(Prescott New Instructions \(SSE3\))](B.1.12)529.8 subh3 +[2(ADDSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO )]512.8 code1 +[2(ADDSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO )]501.8 code0 +[2(HADDPD xmmreg,xmmrm PRESCOTT,SSE3,SO )]490.8 code0 +[2(HADDPS xmmreg,xmmrm PRESCOTT,SSE3,SO )]479.8 code0 +[2(HSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO )]468.8 code0 +[2(HSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO )]457.8 code0 +[2(LDDQU xmmreg,mem PRESCOTT,SSE3,SO )]446.8 code0 +[2(MOVDDUP xmmreg,xmmrm PRESCOTT,SSE3 )]435.8 code0 +[2(MOVSHDUP xmmreg,xmmrm PRESCOTT,SSE3 )]424.8 code0 +[2(MOVSLDUP xmmreg,xmmrm PRESCOTT,SSE3)]413.8 code2 +[{/section-B.1.13 xa}(VMX Instructions)](B.1.13)394.6 subh3 +[2(VMCALL VMX )]377.6 code1 +[2(VMCLEAR mem VMX )]366.6 code0 +[2(VMLAUNCH VMX )]355.6 code0 +[2(VMLOAD X64,VMX )]344.6 code0 +[2(VMMCALL X64,VMX )]333.6 code0 +[2(VMPTRLD mem VMX )]322.6 code0 +[2(VMPTRST mem VMX )]311.6 code0 +[2(VMREAD rm32,reg32 VMX,NOLONG,SD )]300.6 code0 +[2(VMREAD rm64,reg64 X64,VMX )]289.6 code0 +[2(VMRESUME VMX )]278.6 code0 +[2(VMRUN X64,VMX )]267.6 code0 +[2(VMSAVE X64,VMX )]256.6 code0 +[2(VMWRITE reg32,rm32 VMX,NOLONG,SD )]245.6 code0 +[2(VMWRITE reg64,rm64 X64,VMX )]234.6 code0 +[2(VMXOFF VMX )]223.6 code0 +[2(VMXON mem VMX)]212.6 code2 +[{/section-B.1.14 xa}(Extended Page Tables VMX instructions)](B.1.14)193.4 subh3 +[2(INVEPT reg32,mem VMX,SO,NOLONG )]176.4 code1 +[2(INVEPT reg64,mem VMX,SO,LONG )]165.4 code0 +[2(INVVPID reg32,mem VMX,SO,NOLONG )]154.4 code0 +[2(INVVPID reg64,mem VMX,SO,LONG)]143.4 code2 +(154)pageeven +restore showpage +%%Page: 155 155 +%%BeginPageSetup +save +%%EndPageSetup +/155 pa +[{/section-B.1.15 xa}(Tejas New Instructions \(SSSE3\))](B.1.15)678.8 subh3 +[2(PABSB mmxreg,mmxrm SSSE3,MMX )]661.8 code1 +[2(PABSB xmmreg,xmmrm SSSE3 )]650.8 code0 +[2(PABSW mmxreg,mmxrm SSSE3,MMX )]639.8 code0 +[2(PABSW xmmreg,xmmrm SSSE3 )]628.8 code0 +[2(PABSD mmxreg,mmxrm SSSE3,MMX )]617.8 code0 +[2(PABSD xmmreg,xmmrm SSSE3 )]606.8 code0 +[2(PALIGNR mmxreg,mmxrm,imm SSSE3,MMX )]595.8 code0 +[2(PALIGNR xmmreg,xmmrm,imm SSSE3 )]584.8 code0 +[2(PHADDW mmxreg,mmxrm SSSE3,MMX )]573.8 code0 +[2(PHADDW xmmreg,xmmrm SSSE3 )]562.8 code0 +[2(PHADDD mmxreg,mmxrm SSSE3,MMX )]551.8 code0 +[2(PHADDD xmmreg,xmmrm SSSE3 )]540.8 code0 +[2(PHADDSW mmxreg,mmxrm SSSE3,MMX )]529.8 code0 +[2(PHADDSW xmmreg,xmmrm SSSE3 )]518.8 code0 +[2(PHSUBW mmxreg,mmxrm SSSE3,MMX )]507.8 code0 +[2(PHSUBW xmmreg,xmmrm SSSE3 )]496.8 code0 +[2(PHSUBD mmxreg,mmxrm SSSE3,MMX )]485.8 code0 +[2(PHSUBD xmmreg,xmmrm SSSE3 )]474.8 code0 +[2(PHSUBSW mmxreg,mmxrm SSSE3,MMX )]463.8 code0 +[2(PHSUBSW xmmreg,xmmrm SSSE3 )]452.8 code0 +[2(PMADDUBSW mmxreg,mmxrm SSSE3,MMX )]441.8 code0 +[2(PMADDUBSW xmmreg,xmmrm SSSE3 )]430.8 code0 +[2(PMULHRSW mmxreg,mmxrm SSSE3,MMX )]419.8 code0 +[2(PMULHRSW xmmreg,xmmrm SSSE3 )]408.8 code0 +[2(PSHUFB mmxreg,mmxrm SSSE3,MMX )]397.8 code0 +[2(PSHUFB xmmreg,xmmrm SSSE3 )]386.8 code0 +[2(PSIGNB mmxreg,mmxrm SSSE3,MMX )]375.8 code0 +[2(PSIGNB xmmreg,xmmrm SSSE3 )]364.8 code0 +[2(PSIGNW mmxreg,mmxrm SSSE3,MMX )]353.8 code0 +[2(PSIGNW xmmreg,xmmrm SSSE3 )]342.8 code0 +[2(PSIGND mmxreg,mmxrm SSSE3,MMX )]331.8 code0 +[2(PSIGND xmmreg,xmmrm SSSE3)]320.8 code2 +[{/section-B.1.16 xa}(AMD SSE4A)](B.1.16)301.6 subh3 +[2(EXTRQ xmmreg,imm,imm SSE4A,AMD )]284.6 code1 +[2(EXTRQ xmmreg,xmmreg SSE4A,AMD )]273.6 code0 +[2(INSERTQ xmmreg,xmmreg,imm,imm SSE4A,AMD )]262.6 code0 +[2(INSERTQ xmmreg,xmmreg SSE4A,AMD )]251.6 code0 +[2(MOVNTSD mem,xmmreg SSE4A,AMD )]240.6 code0 +[2(MOVNTSS mem,xmmreg SSE4A,AMD,SD)]229.6 code2 +[{/section-B.1.17 xa}(New instructions in Barcelona)](B.1.17)210.4 subh3 +[2(LZCNT reg16,rm16 P6,AMD )]193.4 code1 +[2(LZCNT reg32,rm32 P6,AMD )]182.4 code0 +[2(LZCNT reg64,rm64 X64,AMD)]171.4 code2 +[{/section-B.1.18 xa}(Penryn New Instructions \(SSE4.1\))](B.1.18)152.2 subh3 +[2(BLENDPD xmmreg,xmmrm,imm SSE41 )]135.2 code1 +[2(BLENDPS xmmreg,xmmrm,imm SSE41 )]124.2 code0 +[2(BLENDVPD xmmreg,xmmrm,xmm0 SSE41 )]113.2 code0 +[2(BLENDVPS xmmreg,xmmrm,xmm0 SSE41 )]102.2 code0 +(155)pageodd +restore showpage +%%Page: 156 156 +%%BeginPageSetup +save +%%EndPageSetup +/156 pa +[2(DPPD xmmreg,xmmrm,imm SSE41 )]681 code0 +[2(DPPS xmmreg,xmmrm,imm SSE41 )]670 code0 +[2(EXTRACTPS rm32,xmmreg,imm SSE41 )]659 code0 +[2(EXTRACTPS reg64,xmmreg,imm SSE41,X64 )]648 code0 +[2(INSERTPS xmmreg,xmmrm,imm SSE41,SD )]637 code0 +[2(MOVNTDQA xmmreg,mem SSE41 )]626 code0 +[2(MPSADBW xmmreg,xmmrm,imm SSE41 )]615 code0 +[2(PACKUSDW xmmreg,xmmrm SSE41 )]604 code0 +[2(PBLENDVB xmmreg,xmmrm,xmm0 SSE41 )]593 code0 +[2(PBLENDW xmmreg,xmmrm,imm SSE41 )]582 code0 +[2(PCMPEQQ xmmreg,xmmrm SSE41 )]571 code0 +[2(PEXTRB reg32,xmmreg,imm SSE41 )]560 code0 +[2(PEXTRB mem8,xmmreg,imm SSE41 )]549 code0 +[2(PEXTRB reg64,xmmreg,imm SSE41,X64 )]538 code0 +[2(PEXTRD rm32,xmmreg,imm SSE41 )]527 code0 +[2(PEXTRQ rm64,xmmreg,imm SSE41,X64 )]516 code0 +[2(PEXTRW reg32,xmmreg,imm SSE41 )]505 code0 +[2(PEXTRW mem16,xmmreg,imm SSE41 )]494 code0 +[2(PEXTRW reg64,xmmreg,imm SSE41,X64 )]483 code0 +[2(PHMINPOSUW xmmreg,xmmrm SSE41 )]472 code0 +[2(PINSRB xmmreg,mem,imm SSE41 )]461 code0 +[2(PINSRB xmmreg,rm8,imm SSE41 )]450 code0 +[2(PINSRB xmmreg,reg32,imm SSE41 )]439 code0 +[2(PINSRD xmmreg,mem,imm SSE41 )]428 code0 +[2(PINSRD xmmreg,rm32,imm SSE41 )]417 code0 +[2(PINSRQ xmmreg,mem,imm SSE41,X64 )]406 code0 +[2(PINSRQ xmmreg,rm64,imm SSE41,X64 )]395 code0 +[2(PMAXSB xmmreg,xmmrm SSE41 )]384 code0 +[2(PMAXSD xmmreg,xmmrm SSE41 )]373 code0 +[2(PMAXUD xmmreg,xmmrm SSE41 )]362 code0 +[2(PMAXUW xmmreg,xmmrm SSE41 )]351 code0 +[2(PMINSB xmmreg,xmmrm SSE41 )]340 code0 +[2(PMINSD xmmreg,xmmrm SSE41 )]329 code0 +[2(PMINUD xmmreg,xmmrm SSE41 )]318 code0 +[2(PMINUW xmmreg,xmmrm SSE41 )]307 code0 +[2(PMOVSXBW xmmreg,xmmrm SSE41 )]296 code0 +[2(PMOVSXBD xmmreg,xmmrm SSE41,SD )]285 code0 +[2(PMOVSXBQ xmmreg,xmmrm SSE41,SW )]274 code0 +[2(PMOVSXWD xmmreg,xmmrm SSE41 )]263 code0 +[2(PMOVSXWQ xmmreg,xmmrm SSE41,SD )]252 code0 +[2(PMOVSXDQ xmmreg,xmmrm SSE41 )]241 code0 +[2(PMOVZXBW xmmreg,xmmrm SSE41 )]230 code0 +[2(PMOVZXBD xmmreg,xmmrm SSE41,SD )]219 code0 +[2(PMOVZXBQ xmmreg,xmmrm SSE41,SW )]208 code0 +[2(PMOVZXWD xmmreg,xmmrm SSE41 )]197 code0 +[2(PMOVZXWQ xmmreg,xmmrm SSE41,SD )]186 code0 +[2(PMOVZXDQ xmmreg,xmmrm SSE41 )]175 code0 +[2(PMULDQ xmmreg,xmmrm SSE41 )]164 code0 +[2(PMULLD xmmreg,xmmrm SSE41 )]153 code0 +[2(PTEST xmmreg,xmmrm SSE41 )]142 code0 +[2(ROUNDPD xmmreg,xmmrm,imm SSE41 )]131 code0 +[2(ROUNDPS xmmreg,xmmrm,imm SSE41 )]120 code0 +(156)pageeven +restore showpage +%%Page: 157 157 +%%BeginPageSetup +save +%%EndPageSetup +/157 pa +[2(ROUNDSD xmmreg,xmmrm,imm SSE41 )]681 code0 +[2(ROUNDSS xmmreg,xmmrm,imm SSE41)]670 code2 +[{/section-B.1.19 xa}(Nehalem New Instructions \(SSE4.2\))](B.1.19)650.8 subh3 +[2(CRC32 reg32,rm8 SSE42 )]633.8 code1 +[2(CRC32 reg32,rm16 SSE42 )]622.8 code0 +[2(CRC32 reg32,rm32 SSE42 )]611.8 code0 +[2(CRC32 reg64,rm8 SSE42,X64 )]600.8 code0 +[2(CRC32 reg64,rm64 SSE42,X64 )]589.8 code0 +[2(PCMPESTRI xmmreg,xmmrm,imm SSE42 )]578.8 code0 +[2(PCMPESTRM xmmreg,xmmrm,imm SSE42 )]567.8 code0 +[2(PCMPISTRI xmmreg,xmmrm,imm SSE42 )]556.8 code0 +[2(PCMPISTRM xmmreg,xmmrm,imm SSE42 )]545.8 code0 +[2(PCMPGTQ xmmreg,xmmrm SSE42 )]534.8 code0 +[2(POPCNT reg16,rm16 NEHALEM,SW )]523.8 code0 +[2(POPCNT reg32,rm32 NEHALEM,SD )]512.8 code0 +[2(POPCNT reg64,rm64 NEHALEM,X64)]501.8 code2 +[{/section-B.1.20 xa}(Intel SMX)](B.1.20)482.6 subh3 +[2(GETSEC KATMAI)]465.6 code3 +[{/section-B.1.21 xa}(Geode \(Cyrix\) 3DNow! additions)](B.1.21)446.4 subh3 +[2(PFRCPV mmxreg,mmxrm PENT,3DNOW,CYRIX )]429.4 code1 +[2(PFRSQRTV mmxreg,mmxrm PENT,3DNOW,CYRIX)]418.4 code2 +[{/section-B.1.22 xa}(Intel new instructions in ???)](B.1.22)399.2 subh3 +[2(MOVBE reg16,mem16 NEHALEM )]382.2 code1 +[2(MOVBE reg32,mem32 NEHALEM )]371.2 code0 +[2(MOVBE reg64,mem64 NEHALEM )]360.2 code0 +[2(MOVBE mem16,reg16 NEHALEM )]349.2 code0 +[2(MOVBE mem32,reg32 NEHALEM )]338.2 code0 +[2(MOVBE mem64,reg64 NEHALEM)]327.2 code2 +[{/section-B.1.23 xa}(Intel AES instructions)](B.1.23)308 subh3 +[2(AESENC xmmreg,xmmrm128 SSE,WESTMERE )]291 code1 +[2(AESENCLAST xmmreg,xmmrm128 SSE,WESTMERE )]280 code0 +[2(AESDEC xmmreg,xmmrm128 SSE,WESTMERE )]269 code0 +[2(AESDECLAST xmmreg,xmmrm128 SSE,WESTMERE )]258 code0 +[2(AESIMC xmmreg,xmmrm128 SSE,WESTMERE )]247 code0 +[2(AESKEYGENASSIST xmmreg,xmmrm128,imm8 SSE,WESTMERE)]236 code2 +[{/section-B.1.24 xa}(Intel AVX AES instructions)](B.1.24)216.8 subh3 +[2(VAESENC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]199.8 code1 +[2(VAESENCLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]188.8 code0 +[2(VAESDEC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]177.8 code0 +[2(VAESDECLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]166.8 code0 +[2(VAESIMC xmmreg,xmmrm128 AVX,SANDYBRIDGE )]155.8 code0 +[2(VAESKEYGENASSIST xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE)]144.8 code2 +(157)pageodd +restore showpage +%%Page: 158 158 +%%BeginPageSetup +save +%%EndPageSetup +/158 pa +[{/section-B.1.25 xa}(Intel AVX instructions)](B.1.25)678.8 subh3 +[2(VADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]661.8 code1 +[2(VADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]650.8 code0 +[2(VADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]639.8 code0 +[2(VADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]628.8 code0 +[2(VADDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]617.8 code0 +[2(VADDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]606.8 code0 +[2(VADDSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]595.8 code0 +[2(VADDSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]584.8 code0 +[2(VADDSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]573.8 code0 +[2(VADDSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]562.8 code0 +[2(VANDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]551.8 code0 +[2(VANDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]540.8 code0 +[2(VANDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]529.8 code0 +[2(VANDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]518.8 code0 +[2(VANDNPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]507.8 code0 +[2(VANDNPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]496.8 code0 +[2(VANDNPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]485.8 code0 +[2(VANDNPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]474.8 code0 +[2(VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]463.8 code0 +[2(VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]452.8 code0 +[2(VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]441.8 code0 +[2(VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]430.8 code0 +[2(VBLENDVPD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]419.8 code0 +[2(VBLENDVPD xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE )]408.8 code0 +[2(VBLENDVPD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]397.8 code0 +[2(VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE )]386.8 code0 +[2(VBLENDVPS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]375.8 code0 +[2(VBLENDVPS xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE )]364.8 code0 +[2(VBLENDVPS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]353.8 code0 +[2(VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE )]342.8 code0 +[2(VBROADCASTSS xmmreg,mem32 AVX,SANDYBRIDGE )]331.8 code0 +[2(VBROADCASTSS ymmreg,mem32 AVX,SANDYBRIDGE )]320.8 code0 +[2(VBROADCASTSD ymmreg,mem64 AVX,SANDYBRIDGE )]309.8 code0 +[2(VBROADCASTF128 ymmreg,mem128 AVX,SANDYBRIDGE )]298.8 code0 +[2(VCMPEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]287.8 code0 +[2(VCMPEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]276.8 code0 +[2(VCMPLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]265.8 code0 +[2(VCMPLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]254.8 code0 +[2(VCMPLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]243.8 code0 +[2(VCMPLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]232.8 code0 +[2(VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]221.8 code0 +[2(VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]210.8 code0 +[2(VCMPNEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]199.8 code0 +[2(VCMPNEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]188.8 code0 +[2(VCMPNLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]177.8 code0 +[2(VCMPNLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]166.8 code0 +[2(VCMPNLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]155.8 code0 +[2(VCMPNLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]144.8 code0 +[2(VCMPORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]133.8 code0 +[2(VCMPORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]122.8 code0 +[2(VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]111.8 code0 +[2(VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]100.8 code0 +(158)pageeven +restore showpage +%%Page: 159 159 +%%BeginPageSetup +save +%%EndPageSetup +/159 pa +[2(VCMPNGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]681 code0 +[2(VCMPNGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]670 code0 +[2(VCMPNGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]659 code0 +[2(VCMPNGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]648 code0 +[2(VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]637 code0 +[2(VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]626 code0 +[2(VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]615 code0 +[2(VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]604 code0 +[2(VCMPGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]593 code0 +[2(VCMPGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]582 code0 +[2(VCMPGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]571 code0 +[2(VCMPGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]560 code0 +[2(VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]549 code0 +[2(VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]538 code0 +[2(VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]527 code0 +[2(VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]516 code0 +[2(VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]505 code0 +[2(VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]494 code0 +[2(VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]483 code0 +[2(VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]472 code0 +[2(VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]461 code0 +[2(VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]450 code0 +[2(VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]439 code0 +[2(VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]428 code0 +[2(VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]417 code0 +[2(VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]406 code0 +[2(VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]395 code0 +[2(VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]384 code0 +[2(VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]373 code0 +[2(VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]362 code0 +[2(VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]351 code0 +[2(VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]340 code0 +[2(VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]329 code0 +[2(VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]318 code0 +[2(VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]307 code0 +[2(VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]296 code0 +[2(VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]285 code0 +[2(VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]274 code0 +[2(VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]263 code0 +[2(VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]252 code0 +[2(VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]241 code0 +[2(VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]230 code0 +[2(VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]219 code0 +[2(VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]208 code0 +[2(VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]197 code0 +[2(VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]186 code0 +[2(VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]175 code0 +[2(VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]164 code0 +[2(VCMPEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]153 code0 +[2(VCMPEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]142 code0 +[2(VCMPLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]131 code0 +[2(VCMPLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]120 code0 +[2(VCMPLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]109 code0 +(159)pageodd +restore showpage +%%Page: 160 160 +%%BeginPageSetup +save +%%EndPageSetup +/160 pa +[2(VCMPLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]681 code0 +[2(VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]670 code0 +[2(VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]659 code0 +[2(VCMPNEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]648 code0 +[2(VCMPNEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]637 code0 +[2(VCMPNLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]626 code0 +[2(VCMPNLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]615 code0 +[2(VCMPNLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]604 code0 +[2(VCMPNLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]593 code0 +[2(VCMPORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]582 code0 +[2(VCMPORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]571 code0 +[2(VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]560 code0 +[2(VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]549 code0 +[2(VCMPNGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]538 code0 +[2(VCMPNGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]527 code0 +[2(VCMPNGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]516 code0 +[2(VCMPNGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]505 code0 +[2(VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]494 code0 +[2(VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]483 code0 +[2(VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]472 code0 +[2(VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]461 code0 +[2(VCMPGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]450 code0 +[2(VCMPGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]439 code0 +[2(VCMPGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]428 code0 +[2(VCMPGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]417 code0 +[2(VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]406 code0 +[2(VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]395 code0 +[2(VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]384 code0 +[2(VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]373 code0 +[2(VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]362 code0 +[2(VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]351 code0 +[2(VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]340 code0 +[2(VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]329 code0 +[2(VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]318 code0 +[2(VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]307 code0 +[2(VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]296 code0 +[2(VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]285 code0 +[2(VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]274 code0 +[2(VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]263 code0 +[2(VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]252 code0 +[2(VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]241 code0 +[2(VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]230 code0 +[2(VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]219 code0 +[2(VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]197 code0 +[2(VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]186 code0 +[2(VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]175 code0 +[2(VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]164 code0 +[2(VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]153 code0 +[2(VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]142 code0 +[2(VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]131 code0 +[2(VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]120 code0 +[2(VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]109 code0 +(160)pageeven +restore showpage +%%Page: 161 161 +%%BeginPageSetup +save +%%EndPageSetup +/161 pa +[2(VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]681 code0 +[2(VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]670 code0 +[2(VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]659 code0 +[2(VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]648 code0 +[2(VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]637 code0 +[2(VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]626 code0 +[2(VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]615 code0 +[2(VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]604 code0 +[2(VCMPEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]593 code0 +[2(VCMPLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]582 code0 +[2(VCMPLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]571 code0 +[2(VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]560 code0 +[2(VCMPNEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]549 code0 +[2(VCMPNLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]538 code0 +[2(VCMPNLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]527 code0 +[2(VCMPORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]516 code0 +[2(VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]505 code0 +[2(VCMPNGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]494 code0 +[2(VCMPNGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]483 code0 +[2(VCMPFALSESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]472 code0 +[2(VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]461 code0 +[2(VCMPGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]450 code0 +[2(VCMPGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]439 code0 +[2(VCMPTRUESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]428 code0 +[2(VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]417 code0 +[2(VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]406 code0 +[2(VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]395 code0 +[2(VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]384 code0 +[2(VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]373 code0 +[2(VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]362 code0 +[2(VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]351 code0 +[2(VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]340 code0 +[2(VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]329 code0 +[2(VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]318 code0 +[2(VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]307 code0 +[2(VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]296 code0 +[2(VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]285 code0 +[2(VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]274 code0 +[2(VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]263 code0 +[2(VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]252 code0 +[2(VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE )]241 code0 +[2(VCMPEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]230 code0 +[2(VCMPLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]219 code0 +[2(VCMPLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]208 code0 +[2(VCMPUNORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]197 code0 +[2(VCMPNEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]186 code0 +[2(VCMPNLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]175 code0 +[2(VCMPNLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]164 code0 +[2(VCMPORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]153 code0 +[2(VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]142 code0 +[2(VCMPNGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]131 code0 +[2(VCMPNGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]120 code0 +[2(VCMPFALSESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]109 code0 +(161)pageodd +restore showpage +%%Page: 162 162 +%%BeginPageSetup +save +%%EndPageSetup +/162 pa +[2(VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]681 code0 +[2(VCMPGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]670 code0 +[2(VCMPGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]659 code0 +[2(VCMPTRUESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]648 code0 +[2(VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]637 code0 +[2(VCMPLT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]626 code0 +[2(VCMPLE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]615 code0 +[2(VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]604 code0 +[2(VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]593 code0 +[2(VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]582 code0 +[2(VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]571 code0 +[2(VCMPORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]560 code0 +[2(VCMPEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]549 code0 +[2(VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]538 code0 +[2(VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]527 code0 +[2(VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]516 code0 +[2(VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]505 code0 +[2(VCMPGE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]494 code0 +[2(VCMPGT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]483 code0 +[2(VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]472 code0 +[2(VCMPSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE )]461 code0 +[2(VCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]450 code0 +[2(VCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE )]439 code0 +[2(VCVTDQ2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]428 code0 +[2(VCVTDQ2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE )]417 code0 +[2(VCVTDQ2PS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]406 code0 +[2(VCVTDQ2PS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]395 code0 +[2(VCVTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE )]384 code0 +[2(VCVTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO )]373 code0 +[2(VCVTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE )]362 code0 +[2(VCVTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY )]351 code0 +[2(VCVTPD2PS xmmreg,xmmreg AVX,SANDYBRIDGE )]340 code0 +[2(VCVTPD2PS xmmreg,mem128 AVX,SANDYBRIDGE,SO )]329 code0 +[2(VCVTPD2PS xmmreg,ymmreg AVX,SANDYBRIDGE )]318 code0 +[2(VCVTPD2PS xmmreg,mem256 AVX,SANDYBRIDGE,SY )]307 code0 +[2(VCVTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE )]296 code0 +[2(VCVTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE )]285 code0 +[2(VCVTPS2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]274 code0 +[2(VCVTPS2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE )]263 code0 +[2(VCVTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE )]252 code0 +[2(VCVTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG )]241 code0 +[2(VCVTSD2SS xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]230 code0 +[2(VCVTSI2SD xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD )]219 code0 +[2(VCVTSI2SD xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD )]208 code0 +[2(VCVTSI2SD xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG )]197 code0 +[2(VCVTSI2SS xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD )]186 code0 +[2(VCVTSI2SS xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD )]175 code0 +[2(VCVTSI2SS xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG )]164 code0 +[2(VCVTSS2SD xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]153 code0 +[2(VCVTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE )]142 code0 +[2(VCVTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG )]131 code0 +[2(VCVTTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE )]120 code0 +[2(VCVTTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO )]109 code0 +(162)pageeven +restore showpage +%%Page: 163 163 +%%BeginPageSetup +save +%%EndPageSetup +/163 pa +[2(VCVTTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE )]681 code0 +[2(VCVTTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY )]670 code0 +[2(VCVTTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE )]659 code0 +[2(VCVTTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE )]648 code0 +[2(VCVTTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE )]637 code0 +[2(VCVTTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG )]626 code0 +[2(VCVTTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE )]615 code0 +[2(VCVTTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG )]604 code0 +[2(VDIVPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]593 code0 +[2(VDIVPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]582 code0 +[2(VDIVPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]571 code0 +[2(VDIVPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]560 code0 +[2(VDIVSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]549 code0 +[2(VDIVSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]538 code0 +[2(VDPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]527 code0 +[2(VDPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]516 code0 +[2(VDPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]505 code0 +[2(VEXTRACTF128 xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE )]494 code0 +[2(VEXTRACTPS rm32,xmmreg,imm8 AVX,SANDYBRIDGE )]483 code0 +[2(VHADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]472 code0 +[2(VHADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]461 code0 +[2(VHADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]450 code0 +[2(VHADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]439 code0 +[2(VHSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]428 code0 +[2(VHSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]417 code0 +[2(VHSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]406 code0 +[2(VHSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]395 code0 +[2(VINSERTF128 ymmreg,ymmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]384 code0 +[2(VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE )]373 code0 +[2(VLDDQU xmmreg,mem128 AVX,SANDYBRIDGE )]362 code0 +[2(VLDQQU ymmreg,mem256 AVX,SANDYBRIDGE )]351 code0 +[2(VLDDQU ymmreg,mem256 AVX,SANDYBRIDGE )]340 code0 +[2(VLDMXCSR mem32 AVX,SANDYBRIDGE )]329 code0 +[2(VMASKMOVDQU xmmreg,xmmreg AVX,SANDYBRIDGE )]318 code0 +[2(VMASKMOVPS xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE )]307 code0 +[2(VMASKMOVPS ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE )]296 code0 +[2(VMASKMOVPS mem128,xmmreg,xmmreg AVX,SANDYBRIDGE,SO )]285 code0 +[2(VMASKMOVPS mem256,xmmreg,xmmreg AVX,SANDYBRIDGE,SY )]274 code0 +[2(VMASKMOVPD xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE )]263 code0 +[2(VMASKMOVPD ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE )]252 code0 +[2(VMASKMOVPD mem128,xmmreg,xmmreg AVX,SANDYBRIDGE )]241 code0 +[2(VMASKMOVPD mem256,ymmreg,ymmreg AVX,SANDYBRIDGE )]230 code0 +[2(VMAXPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]219 code0 +[2(VMAXPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]208 code0 +[2(VMAXPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]197 code0 +[2(VMAXPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]186 code0 +[2(VMAXSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]175 code0 +[2(VMAXSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]164 code0 +[2(VMINPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]153 code0 +[2(VMINPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]142 code0 +[2(VMINPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]131 code0 +[2(VMINPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]120 code0 +[2(VMINSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]109 code0 +(163)pageodd +restore showpage +%%Page: 164 164 +%%BeginPageSetup +save +%%EndPageSetup +/164 pa +[2(VMINSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]681 code0 +[2(VMOVAPD xmmreg,xmmrm128 AVX,SANDYBRIDGE )]670 code0 +[2(VMOVAPD xmmrm128,xmmreg AVX,SANDYBRIDGE )]659 code0 +[2(VMOVAPD ymmreg,ymmrm256 AVX,SANDYBRIDGE )]648 code0 +[2(VMOVAPD ymmrm256,ymmreg AVX,SANDYBRIDGE )]637 code0 +[2(VMOVAPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]626 code0 +[2(VMOVAPS xmmrm128,xmmreg AVX,SANDYBRIDGE )]615 code0 +[2(VMOVAPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]604 code0 +[2(VMOVAPS ymmrm256,ymmreg AVX,SANDYBRIDGE )]593 code0 +[2(VMOVQ xmmreg,xmmrm64 AVX,SANDYBRIDGE )]582 code0 +[2(VMOVQ xmmrm64,xmmreg AVX,SANDYBRIDGE )]571 code0 +[2(VMOVQ xmmreg,rm64 AVX,SANDYBRIDGE,LONG )]560 code0 +[2(VMOVQ rm64,xmmreg AVX,SANDYBRIDGE,LONG )]549 code0 +[2(VMOVD xmmreg,rm32 AVX,SANDYBRIDGE )]538 code0 +[2(VMOVD rm32,xmmreg AVX,SANDYBRIDGE )]527 code0 +[2(VMOVDDUP xmmreg,xmmrm64 AVX,SANDYBRIDGE )]516 code0 +[2(VMOVDDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE )]505 code0 +[2(VMOVDQA xmmreg,xmmrm128 AVX,SANDYBRIDGE )]494 code0 +[2(VMOVDQA xmmrm128,xmmreg AVX,SANDYBRIDGE )]483 code0 +[2(VMOVQQA ymmreg,ymmrm256 AVX,SANDYBRIDGE )]472 code0 +[2(VMOVQQA ymmrm256,ymmreg AVX,SANDYBRIDGE )]461 code0 +[2(VMOVDQA ymmreg,ymmrm AVX,SANDYBRIDGE )]450 code0 +[2(VMOVDQA ymmrm256,ymmreg AVX,SANDYBRIDGE )]439 code0 +[2(VMOVDQU xmmreg,xmmrm128 AVX,SANDYBRIDGE )]428 code0 +[2(VMOVDQU xmmrm128,xmmreg AVX,SANDYBRIDGE )]417 code0 +[2(VMOVQQU ymmreg,ymmrm256 AVX,SANDYBRIDGE )]406 code0 +[2(VMOVQQU ymmrm256,ymmreg AVX,SANDYBRIDGE )]395 code0 +[2(VMOVDQU ymmreg,ymmrm256 AVX,SANDYBRIDGE )]384 code0 +[2(VMOVDQU ymmrm256,ymmreg AVX,SANDYBRIDGE )]373 code0 +[2(VMOVHLPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]362 code0 +[2(VMOVHPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE )]351 code0 +[2(VMOVHPD mem64,xmmreg AVX,SANDYBRIDGE )]340 code0 +[2(VMOVHPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE )]329 code0 +[2(VMOVHPS mem64,xmmreg AVX,SANDYBRIDGE )]318 code0 +[2(VMOVLHPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]307 code0 +[2(VMOVLPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE )]296 code0 +[2(VMOVLPD mem64,xmmreg AVX,SANDYBRIDGE )]285 code0 +[2(VMOVLPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE )]274 code0 +[2(VMOVLPS mem64,xmmreg AVX,SANDYBRIDGE )]263 code0 +[2(VMOVMSKPD reg64,xmmreg AVX,SANDYBRIDGE,LONG )]252 code0 +[2(VMOVMSKPD reg32,xmmreg AVX,SANDYBRIDGE )]241 code0 +[2(VMOVMSKPD reg64,ymmreg AVX,SANDYBRIDGE,LONG )]230 code0 +[2(VMOVMSKPD reg32,ymmreg AVX,SANDYBRIDGE )]219 code0 +[2(VMOVMSKPS reg64,xmmreg AVX,SANDYBRIDGE,LONG )]208 code0 +[2(VMOVMSKPS reg32,xmmreg AVX,SANDYBRIDGE )]197 code0 +[2(VMOVMSKPS reg64,ymmreg AVX,SANDYBRIDGE,LONG )]186 code0 +[2(VMOVMSKPS reg32,ymmreg AVX,SANDYBRIDGE )]175 code0 +[2(VMOVNTDQ mem128,xmmreg AVX,SANDYBRIDGE )]164 code0 +[2(VMOVNTQQ mem256,ymmreg AVX,SANDYBRIDGE )]153 code0 +[2(VMOVNTDQ mem256,ymmreg AVX,SANDYBRIDGE )]142 code0 +[2(VMOVNTDQA xmmreg,mem128 AVX,SANDYBRIDGE )]131 code0 +[2(VMOVNTPD mem128,xmmreg AVX,SANDYBRIDGE )]120 code0 +[2(VMOVNTPD mem256,ymmreg AVX,SANDYBRIDGE )]109 code0 +(164)pageeven +restore showpage +%%Page: 165 165 +%%BeginPageSetup +save +%%EndPageSetup +/165 pa +[2(VMOVNTPS mem128,xmmreg AVX,SANDYBRIDGE )]681 code0 +[2(VMOVNTPS mem128,ymmreg AVX,SANDYBRIDGE )]670 code0 +[2(VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]659 code0 +[2(VMOVSD xmmreg,mem64 AVX,SANDYBRIDGE )]648 code0 +[2(VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]637 code0 +[2(VMOVSD mem64,xmmreg AVX,SANDYBRIDGE )]626 code0 +[2(VMOVSHDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE )]615 code0 +[2(VMOVSHDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE )]604 code0 +[2(VMOVSLDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE )]593 code0 +[2(VMOVSLDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE )]582 code0 +[2(VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]571 code0 +[2(VMOVSS xmmreg,mem64 AVX,SANDYBRIDGE )]560 code0 +[2(VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE )]549 code0 +[2(VMOVSS mem64,xmmreg AVX,SANDYBRIDGE )]538 code0 +[2(VMOVUPD xmmreg,xmmrm128 AVX,SANDYBRIDGE )]527 code0 +[2(VMOVUPD xmmrm128,xmmreg AVX,SANDYBRIDGE )]516 code0 +[2(VMOVUPD ymmreg,ymmrm256 AVX,SANDYBRIDGE )]505 code0 +[2(VMOVUPD ymmrm256,ymmreg AVX,SANDYBRIDGE )]494 code0 +[2(VMOVUPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]483 code0 +[2(VMOVUPS xmmrm128,xmmreg AVX,SANDYBRIDGE )]472 code0 +[2(VMOVUPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]461 code0 +[2(VMOVUPS ymmrm256,ymmreg AVX,SANDYBRIDGE )]450 code0 +[2(VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]439 code0 +[2(VMULPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]428 code0 +[2(VMULPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]417 code0 +[2(VMULPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]406 code0 +[2(VMULPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]395 code0 +[2(VMULSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]384 code0 +[2(VMULSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]373 code0 +[2(VORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]362 code0 +[2(VORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]351 code0 +[2(VORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]340 code0 +[2(VORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]329 code0 +[2(VPABSB xmmreg,xmmrm128 AVX,SANDYBRIDGE )]318 code0 +[2(VPABSW xmmreg,xmmrm128 AVX,SANDYBRIDGE )]307 code0 +[2(VPABSD xmmreg,xmmrm128 AVX,SANDYBRIDGE )]296 code0 +[2(VPACKSSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]285 code0 +[2(VPACKSSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]274 code0 +[2(VPACKUSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]263 code0 +[2(VPACKUSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]252 code0 +[2(VPADDB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]241 code0 +[2(VPADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]230 code0 +[2(VPADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]219 code0 +[2(VPADDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VPADDSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]197 code0 +[2(VPADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]186 code0 +[2(VPADDUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]175 code0 +[2(VPADDUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]164 code0 +[2(VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]153 code0 +[2(VPAND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]142 code0 +[2(VPANDN xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]131 code0 +[2(VPAVGB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]120 code0 +[2(VPAVGW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]109 code0 +(165)pageodd +restore showpage +%%Page: 166 166 +%%BeginPageSetup +save +%%EndPageSetup +/166 pa +[2(VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg AVX,SANDYBRIDGE )]681 code0 +[2(VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]670 code0 +[2(VPCMPESTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]659 code0 +[2(VPCMPESTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]648 code0 +[2(VPCMPISTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]637 code0 +[2(VPCMPISTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]626 code0 +[2(VPCMPEQB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]615 code0 +[2(VPCMPEQW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]604 code0 +[2(VPCMPEQD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]593 code0 +[2(VPCMPEQQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]582 code0 +[2(VPCMPGTB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]571 code0 +[2(VPCMPGTW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]560 code0 +[2(VPCMPGTD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]549 code0 +[2(VPCMPGTQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]538 code0 +[2(VPERMILPD xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]527 code0 +[2(VPERMILPD ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]516 code0 +[2(VPERMILPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]505 code0 +[2(VPERMILPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]494 code0 +[2(VPERMILTD2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]483 code0 +[2(VPERMILTD2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]472 code0 +[2(VPERMILTD2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]461 code0 +[2(VPERMILTD2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]450 code0 +[2(VPERMILMO2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]439 code0 +[2(VPERMILMO2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]428 code0 +[2(VPERMILMO2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]417 code0 +[2(VPERMILMO2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]406 code0 +[2(VPERMILMZ2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]395 code0 +[2(VPERMILMZ2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]384 code0 +[2(VPERMILMZ2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]373 code0 +[2(VPERMILMZ2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]362 code0 +[2(VPERMIL2PD xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE )]351 code0 +[2(VPERMIL2PD xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]340 code0 +[2(VPERMIL2PD ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE )]329 code0 +[2(VPERMIL2PD ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]318 code0 +[2(VPERMILPS xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]307 code0 +[2(VPERMILPS ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]296 code0 +[2(VPERMILPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]285 code0 +[2(VPERMILPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]274 code0 +[2(VPERMILTD2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]263 code0 +[2(VPERMILTD2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]252 code0 +[2(VPERMILTD2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]241 code0 +[2(VPERMILTD2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]230 code0 +[2(VPERMILMO2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]219 code0 +[2(VPERMILMO2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VPERMILMO2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]197 code0 +[2(VPERMILMO2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]186 code0 +[2(VPERMILMZ2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE )]175 code0 +[2(VPERMILMZ2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE )]164 code0 +[2(VPERMILMZ2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE )]153 code0 +[2(VPERMILMZ2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE )]142 code0 +[2(VPERMIL2PS xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE )]131 code0 +[2(VPERMIL2PS xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]120 code0 +[2(VPERMIL2PS ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE )]109 code0 +(166)pageeven +restore showpage +%%Page: 167 167 +%%BeginPageSetup +save +%%EndPageSetup +/167 pa +[2(VPERMIL2PS ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]681 code0 +[2(VPERM2F128 ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]670 code0 +[2(VPEXTRB reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG )]659 code0 +[2(VPEXTRB reg32,xmmreg,imm8 AVX,SANDYBRIDGE )]648 code0 +[2(VPEXTRB mem8,xmmreg,imm8 AVX,SANDYBRIDGE )]637 code0 +[2(VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG )]626 code0 +[2(VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE )]615 code0 +[2(VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE )]604 code0 +[2(VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG )]593 code0 +[2(VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE )]582 code0 +[2(VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE )]571 code0 +[2(VPEXTRD reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG )]560 code0 +[2(VPEXTRD rm32,xmmreg,imm8 AVX,SANDYBRIDGE )]549 code0 +[2(VPEXTRQ rm64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG )]538 code0 +[2(VPHADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]527 code0 +[2(VPHADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]516 code0 +[2(VPHADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]505 code0 +[2(VPHMINPOSUW xmmreg,xmmrm128 AVX,SANDYBRIDGE )]494 code0 +[2(VPHSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]483 code0 +[2(VPHSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]472 code0 +[2(VPHSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]461 code0 +[2(VPINSRB xmmreg,xmmreg*,mem8,imm8 AVX,SANDYBRIDGE )]450 code0 +[2(VPINSRB xmmreg,xmmreg*,rm8,imm8 AVX,SANDYBRIDGE )]439 code0 +[2(VPINSRB xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE )]428 code0 +[2(VPINSRW xmmreg,xmmreg*,mem16,imm8 AVX,SANDYBRIDGE )]417 code0 +[2(VPINSRW xmmreg,xmmreg*,rm16,imm8 AVX,SANDYBRIDGE )]406 code0 +[2(VPINSRW xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE )]395 code0 +[2(VPINSRD xmmreg,xmmreg*,mem32,imm8 AVX,SANDYBRIDGE )]384 code0 +[2(VPINSRD xmmreg,xmmreg*,rm32,imm8 AVX,SANDYBRIDGE )]373 code0 +[2(VPINSRQ xmmreg,xmmreg*,mem64,imm8 AVX,SANDYBRIDGE,LONG )]362 code0 +[2(VPINSRQ xmmreg,xmmreg*,rm64,imm8 AVX,SANDYBRIDGE,LONG )]351 code0 +[2(VPMADDWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]340 code0 +[2(VPMADDUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]329 code0 +[2(VPMAXSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]318 code0 +[2(VPMAXSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]307 code0 +[2(VPMAXSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]296 code0 +[2(VPMAXUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]285 code0 +[2(VPMAXUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]274 code0 +[2(VPMAXUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]263 code0 +[2(VPMINSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]252 code0 +[2(VPMINSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]241 code0 +[2(VPMINSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]230 code0 +[2(VPMINUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]219 code0 +[2(VPMINUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VPMINUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]197 code0 +[2(VPMOVMSKB reg64,xmmreg AVX,SANDYBRIDGE,LONG )]186 code0 +[2(VPMOVMSKB reg32,xmmreg AVX,SANDYBRIDGE )]175 code0 +[2(VPMOVSXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE )]164 code0 +[2(VPMOVSXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE )]153 code0 +[2(VPMOVSXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE )]142 code0 +[2(VPMOVSXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]131 code0 +[2(VPMOVSXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE )]120 code0 +[2(VPMOVSXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE )]109 code0 +(167)pageodd +restore showpage +%%Page: 168 168 +%%BeginPageSetup +save +%%EndPageSetup +/168 pa +[2(VPMOVZXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE )]681 code0 +[2(VPMOVZXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE )]670 code0 +[2(VPMOVZXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE )]659 code0 +[2(VPMOVZXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]648 code0 +[2(VPMOVZXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE )]637 code0 +[2(VPMOVZXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE )]626 code0 +[2(VPMULHUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]615 code0 +[2(VPMULHRSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]604 code0 +[2(VPMULHW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]593 code0 +[2(VPMULLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]582 code0 +[2(VPMULLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]571 code0 +[2(VPMULUDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]560 code0 +[2(VPMULDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]549 code0 +[2(VPOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]538 code0 +[2(VPSADBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]527 code0 +[2(VPSHUFB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]516 code0 +[2(VPSHUFD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]505 code0 +[2(VPSHUFHW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]494 code0 +[2(VPSHUFLW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]483 code0 +[2(VPSIGNB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]472 code0 +[2(VPSIGNW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]461 code0 +[2(VPSIGND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]450 code0 +[2(VPSLLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]439 code0 +[2(VPSRLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]428 code0 +[2(VPSLLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]417 code0 +[2(VPSLLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]406 code0 +[2(VPSLLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]395 code0 +[2(VPSLLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]384 code0 +[2(VPSLLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]373 code0 +[2(VPSLLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]362 code0 +[2(VPSRAW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]351 code0 +[2(VPSRAW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]340 code0 +[2(VPSRAD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]329 code0 +[2(VPSRAD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]318 code0 +[2(VPSRLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]307 code0 +[2(VPSRLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]296 code0 +[2(VPSRLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]285 code0 +[2(VPSRLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]274 code0 +[2(VPSRLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]263 code0 +[2(VPSRLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE )]252 code0 +[2(VPTEST xmmreg,xmmrm128 AVX,SANDYBRIDGE )]241 code0 +[2(VPTEST ymmreg,ymmrm256 AVX,SANDYBRIDGE )]230 code0 +[2(VPSUBB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]219 code0 +[2(VPSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VPSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]197 code0 +[2(VPSUBQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]186 code0 +[2(VPSUBSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]175 code0 +[2(VPSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]164 code0 +[2(VPSUBUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]153 code0 +[2(VPSUBUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]142 code0 +[2(VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]131 code0 +[2(VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]120 code0 +[2(VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]109 code0 +(168)pageeven +restore showpage +%%Page: 169 169 +%%BeginPageSetup +save +%%EndPageSetup +/169 pa +[2(VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]681 code0 +[2(VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]670 code0 +[2(VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]659 code0 +[2(VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]648 code0 +[2(VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]637 code0 +[2(VPXOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]626 code0 +[2(VRCPPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]615 code0 +[2(VRCPPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]604 code0 +[2(VRCPSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]593 code0 +[2(VRSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]582 code0 +[2(VRSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]571 code0 +[2(VRSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]560 code0 +[2(VROUNDPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]549 code0 +[2(VROUNDPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]538 code0 +[2(VROUNDPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE )]527 code0 +[2(VROUNDPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE )]516 code0 +[2(VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE )]505 code0 +[2(VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE )]494 code0 +[2(VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]483 code0 +[2(VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]472 code0 +[2(VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE )]461 code0 +[2(VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE )]450 code0 +[2(VSQRTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE )]439 code0 +[2(VSQRTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE )]428 code0 +[2(VSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]417 code0 +[2(VSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]406 code0 +[2(VSQRTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]395 code0 +[2(VSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]384 code0 +[2(VSTMXCSR mem32 AVX,SANDYBRIDGE )]373 code0 +[2(VSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]362 code0 +[2(VSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]351 code0 +[2(VSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]340 code0 +[2(VSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]329 code0 +[2(VSUBSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE )]318 code0 +[2(VSUBSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE )]307 code0 +[2(VTESTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE )]296 code0 +[2(VTESTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE )]285 code0 +[2(VTESTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE )]274 code0 +[2(VTESTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE )]263 code0 +[2(VUCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE )]252 code0 +[2(VUCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE )]241 code0 +[2(VUNPCKHPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]230 code0 +[2(VUNPCKHPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]219 code0 +[2(VUNPCKHPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]208 code0 +[2(VUNPCKHPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]197 code0 +[2(VUNPCKLPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]186 code0 +[2(VUNPCKLPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]175 code0 +[2(VUNPCKLPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]164 code0 +[2(VUNPCKLPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]153 code0 +[2(VXORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]142 code0 +[2(VXORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]131 code0 +[2(VXORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]120 code0 +[2(VXORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE )]109 code0 +(169)pageodd +restore showpage +%%Page: 170 170 +%%BeginPageSetup +save +%%EndPageSetup +/170 pa +[2(VZEROALL AVX,SANDYBRIDGE )]681 code0 +[2(VZEROUPPER AVX,SANDYBRIDGE)]670 code2 +[{/section-B.1.26 xa}(Intel Carry-Less Multiplication instructions \(CLMUL\))](B.1.26)650.8 subh3 +[2(PCLMULLQLQDQ xmmreg,xmmrm128 SSE,WESTMERE )]633.8 code1 +[2(PCLMULHQLQDQ xmmreg,xmmrm128 SSE,WESTMERE )]622.8 code0 +[2(PCLMULLQHQDQ xmmreg,xmmrm128 SSE,WESTMERE )]611.8 code0 +[2(PCLMULHQHQDQ xmmreg,xmmrm128 SSE,WESTMERE )]600.8 code0 +[2(PCLMULQDQ xmmreg,xmmrm128,imm8 SSE,WESTMERE)]589.8 code2 +[{/section-B.1.27 xa}(Intel AVX Carry-Less Multiplication instructions \(CLMUL\))](B.1.27)570.6 subh3 +[2(VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]553.6 code1 +[2(VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]542.6 code0 +[2(VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]531.6 code0 +[2(VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE )]520.6 code0 +[2(VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE)]509.6 code2 +[{/section-B.1.28 xa}(Intel Fused Multiply-Add instructions \(FMA\))](B.1.28)490.4 subh3 +[2(VFMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]473.4 code1 +[2(VFMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]462.4 code0 +[2(VFMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]451.4 code0 +[2(VFMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]440.4 code0 +[2(VFMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]429.4 code0 +[2(VFMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]418.4 code0 +[2(VFMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]407.4 code0 +[2(VFMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]396.4 code0 +[2(VFMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]385.4 code0 +[2(VFMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]374.4 code0 +[2(VFMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]363.4 code0 +[2(VFMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]352.4 code0 +[2(VFMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]341.4 code0 +[2(VFMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]330.4 code0 +[2(VFMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]319.4 code0 +[2(VFMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]308.4 code0 +[2(VFMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]297.4 code0 +[2(VFMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]286.4 code0 +[2(VFMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]275.4 code0 +[2(VFMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]264.4 code0 +[2(VFMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]253.4 code0 +[2(VFMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]242.4 code0 +[2(VFMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]231.4 code0 +[2(VFMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]220.4 code0 +[2(VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]209.4 code0 +[2(VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]198.4 code0 +[2(VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]187.4 code0 +[2(VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]176.4 code0 +[2(VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]165.4 code0 +[2(VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]154.4 code0 +[2(VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]143.4 code0 +[2(VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]132.4 code0 +[2(VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]121.4 code0 +[2(VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]110.4 code0 +(170)pageeven +restore showpage +%%Page: 171 171 +%%BeginPageSetup +save +%%EndPageSetup +/171 pa +[2(VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]681 code0 +[2(VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]670 code0 +[2(VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]659 code0 +[2(VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]648 code0 +[2(VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]637 code0 +[2(VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]626 code0 +[2(VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]615 code0 +[2(VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]604 code0 +[2(VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]593 code0 +[2(VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]582 code0 +[2(VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]571 code0 +[2(VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]560 code0 +[2(VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]549 code0 +[2(VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]538 code0 +[2(VFMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]527 code0 +[2(VFMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]516 code0 +[2(VFMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]505 code0 +[2(VFMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]494 code0 +[2(VFMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]483 code0 +[2(VFMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]472 code0 +[2(VFMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]461 code0 +[2(VFMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]450 code0 +[2(VFMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]439 code0 +[2(VFMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]428 code0 +[2(VFMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]417 code0 +[2(VFMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]406 code0 +[2(VFMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]395 code0 +[2(VFMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]384 code0 +[2(VFMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]373 code0 +[2(VFMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]362 code0 +[2(VFMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]351 code0 +[2(VFMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]340 code0 +[2(VFMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]329 code0 +[2(VFMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]318 code0 +[2(VFMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]307 code0 +[2(VFMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]296 code0 +[2(VFMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]285 code0 +[2(VFMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]274 code0 +[2(VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]263 code0 +[2(VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]252 code0 +[2(VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]241 code0 +[2(VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]230 code0 +[2(VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]219 code0 +[2(VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]208 code0 +[2(VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]197 code0 +[2(VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]186 code0 +[2(VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]175 code0 +[2(VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]164 code0 +[2(VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]153 code0 +[2(VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]142 code0 +[2(VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]131 code0 +[2(VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]120 code0 +[2(VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]109 code0 +(171)pageodd +restore showpage +%%Page: 172 172 +%%BeginPageSetup +save +%%EndPageSetup +/172 pa +[2(VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]681 code0 +[2(VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]670 code0 +[2(VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]659 code0 +[2(VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]648 code0 +[2(VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]637 code0 +[2(VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]626 code0 +[2(VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]615 code0 +[2(VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]604 code0 +[2(VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]593 code0 +[2(VFNMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]582 code0 +[2(VFNMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]571 code0 +[2(VFNMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]560 code0 +[2(VFNMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]549 code0 +[2(VFNMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]538 code0 +[2(VFNMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]527 code0 +[2(VFNMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]516 code0 +[2(VFNMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]505 code0 +[2(VFNMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]494 code0 +[2(VFNMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]483 code0 +[2(VFNMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]472 code0 +[2(VFNMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]461 code0 +[2(VFNMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]450 code0 +[2(VFNMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]439 code0 +[2(VFNMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]428 code0 +[2(VFNMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]417 code0 +[2(VFNMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]406 code0 +[2(VFNMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]395 code0 +[2(VFNMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]384 code0 +[2(VFNMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]373 code0 +[2(VFNMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]362 code0 +[2(VFNMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]351 code0 +[2(VFNMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]340 code0 +[2(VFNMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]329 code0 +[2(VFNMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]318 code0 +[2(VFNMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]307 code0 +[2(VFNMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]296 code0 +[2(VFNMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]285 code0 +[2(VFNMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]274 code0 +[2(VFNMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]263 code0 +[2(VFNMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]252 code0 +[2(VFNMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]241 code0 +[2(VFNMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]230 code0 +[2(VFNMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]219 code0 +[2(VFNMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]208 code0 +[2(VFNMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]197 code0 +[2(VFNMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]186 code0 +[2(VFNMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]175 code0 +[2(VFNMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]164 code0 +[2(VFNMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]153 code0 +[2(VFNMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]142 code0 +[2(VFNMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]131 code0 +[2(VFNMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]120 code0 +[2(VFNMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]109 code0 +(172)pageeven +restore showpage +%%Page: 173 173 +%%BeginPageSetup +save +%%EndPageSetup +/173 pa +[2(VFNMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]681 code0 +[2(VFNMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]670 code0 +[2(VFNMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE )]659 code0 +[2(VFNMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE )]648 code0 +[2(VFMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]637 code0 +[2(VFMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]626 code0 +[2(VFMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]615 code0 +[2(VFMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]604 code0 +[2(VFMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]593 code0 +[2(VFMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]582 code0 +[2(VFMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]571 code0 +[2(VFMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]560 code0 +[2(VFMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]549 code0 +[2(VFMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]538 code0 +[2(VFMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]527 code0 +[2(VFMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]516 code0 +[2(VFMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]505 code0 +[2(VFMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]494 code0 +[2(VFMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]483 code0 +[2(VFMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]472 code0 +[2(VFMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]461 code0 +[2(VFMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]450 code0 +[2(VFMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]439 code0 +[2(VFMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]428 code0 +[2(VFMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]417 code0 +[2(VFMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]406 code0 +[2(VFMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]395 code0 +[2(VFMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]384 code0 +[2(VFNMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]373 code0 +[2(VFNMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]362 code0 +[2(VFNMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]351 code0 +[2(VFNMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]340 code0 +[2(VFNMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]329 code0 +[2(VFNMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]318 code0 +[2(VFNMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]307 code0 +[2(VFNMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]296 code0 +[2(VFNMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]285 code0 +[2(VFNMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]274 code0 +[2(VFNMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]263 code0 +[2(VFNMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]252 code0 +[2(VFNMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]241 code0 +[2(VFNMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]230 code0 +[2(VFNMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]219 code0 +[2(VFNMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]208 code0 +[2(VFNMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]197 code0 +[2(VFNMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]186 code0 +[2(VFNMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]175 code0 +[2(VFNMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]164 code0 +[2(VFNMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]153 code0 +[2(VFNMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE )]142 code0 +[2(VFNMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE )]131 code0 +[2(VFNMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE)]120 code2 +(173)pageodd +restore showpage +%%Page: 174 174 +%%BeginPageSetup +save +%%EndPageSetup +/174 pa +[{/section-B.1.29 xa}(VIA \(Centaur\) security instructions)](B.1.29)678.8 subh3 +[2(XSTORE PENT,CYRIX )]661.8 code1 +[2(XCRYPTECB PENT,CYRIX )]650.8 code0 +[2(XCRYPTCBC PENT,CYRIX )]639.8 code0 +[2(XCRYPTCTR PENT,CYRIX )]628.8 code0 +[2(XCRYPTCFB PENT,CYRIX )]617.8 code0 +[2(XCRYPTOFB PENT,CYRIX )]606.8 code0 +[2(MONTMUL PENT,CYRIX )]595.8 code0 +[2(XSHA1 PENT,CYRIX )]584.8 code0 +[2(XSHA256 PENT,CYRIX)]573.8 code2 +[{/section-B.1.30 xa}(AMD Lightweight Profiling \(LWP\) instructions)](B.1.30)554.6 subh3 +[2(LLWPCB reg16 AMD )]537.6 code1 +[2(LLWPCB reg32 AMD,386 )]526.6 code0 +[2(LLWPCB reg64 AMD,X64 )]515.6 code0 +[2(SLWPCB reg16 AMD )]504.6 code0 +[2(SLWPCB reg32 AMD,386 )]493.6 code0 +[2(SLWPCB reg64 AMD,X64 )]482.6 code0 +[2(LWPVAL reg16,rm32,imm16 AMD,386 )]471.6 code0 +[2(LWPVAL reg32,rm32,imm32 AMD,386 )]460.6 code0 +[2(LWPVAL reg64,rm32,imm32 AMD,X64 )]449.6 code0 +[2(LWPINS reg16,rm32,imm16 AMD,386 )]438.6 code0 +[2(LWPINS reg32,rm32,imm32 AMD,386 )]427.6 code0 +[2(LWPINS reg64,rm32,imm32 AMD,X64)]416.6 code2 +[{/section-B.1.31 xa}(AMD XOP, FMA4 and CVT16 instructions \(SSE5\))](B.1.31)397.4 subh3 +[2(VCVTPH2PS xmmreg,xmmrm64*,imm8 AMD,SSE5 )]380.4 code1 +[2(VCVTPH2PS ymmreg,xmmrm128,imm8 AMD,SSE5 )]369.4 code0 +[2(VCVTPH2PS ymmreg,ymmrm128*,imm8 AMD,SSE5 )]358.4 code0 +[2(VCVTPS2PH xmmrm64,xmmreg*,imm8 AMD,SSE5 )]347.4 code0 +[2(VCVTPS2PH xmmrm128,ymmreg,imm8 AMD,SSE5 )]336.4 code0 +[2(VCVTPS2PH ymmrm128,ymmreg*,imm8 AMD,SSE5 )]325.4 code0 +[2(VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]314.4 code0 +[2(VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]303.4 code0 +[2(VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]292.4 code0 +[2(VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]281.4 code0 +[2(VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]270.4 code0 +[2(VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]259.4 code0 +[2(VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]248.4 code0 +[2(VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]237.4 code0 +[2(VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 )]226.4 code0 +[2(VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 )]215.4 code0 +[2(VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 )]204.4 code0 +[2(VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 )]193.4 code0 +[2(VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]182.4 code0 +[2(VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]171.4 code0 +[2(VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]160.4 code0 +[2(VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]149.4 code0 +[2(VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]138.4 code0 +[2(VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]127.4 code0 +[2(VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]116.4 code0 +[2(VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]105.4 code0 +(174)pageeven +restore showpage +%%Page: 175 175 +%%BeginPageSetup +save +%%EndPageSetup +/175 pa +[2(VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]681 code0 +[2(VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]670 code0 +[2(VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]659 code0 +[2(VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]648 code0 +[2(VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]637 code0 +[2(VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]626 code0 +[2(VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]615 code0 +[2(VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]604 code0 +[2(VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]593 code0 +[2(VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]582 code0 +[2(VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]571 code0 +[2(VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]560 code0 +[2(VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]549 code0 +[2(VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]538 code0 +[2(VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]527 code0 +[2(VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]516 code0 +[2(VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 )]505 code0 +[2(VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 )]494 code0 +[2(VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 )]483 code0 +[2(VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 )]472 code0 +[2(VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]461 code0 +[2(VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]450 code0 +[2(VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]439 code0 +[2(VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]428 code0 +[2(VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]417 code0 +[2(VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]406 code0 +[2(VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]395 code0 +[2(VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]384 code0 +[2(VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 )]373 code0 +[2(VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 )]362 code0 +[2(VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 )]351 code0 +[2(VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 )]340 code0 +[2(VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]329 code0 +[2(VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]318 code0 +[2(VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]307 code0 +[2(VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]296 code0 +[2(VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]285 code0 +[2(VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]274 code0 +[2(VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]263 code0 +[2(VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]252 code0 +[2(VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 )]241 code0 +[2(VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 )]230 code0 +[2(VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 )]219 code0 +[2(VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 )]208 code0 +[2(VFRCZPD xmmreg,xmmrm128* AMD,SSE5 )]197 code0 +[2(VFRCZPD ymmreg,ymmrm256* AMD,SSE5 )]186 code0 +[2(VFRCZPS xmmreg,xmmrm128* AMD,SSE5 )]175 code0 +[2(VFRCZPS ymmreg,ymmrm256* AMD,SSE5 )]164 code0 +[2(VFRCZSD xmmreg,xmmrm64* AMD,SSE5 )]153 code0 +[2(VFRCZSS xmmreg,xmmrm32* AMD,SSE5 )]142 code0 +[2(VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]131 code0 +[2(VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 )]120 code0 +[2(VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]109 code0 +(175)pageodd +restore showpage +%%Page: 176 176 +%%BeginPageSetup +save +%%EndPageSetup +/176 pa +[2(VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 )]681 code0 +[2(VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]670 code0 +[2(VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]659 code0 +[2(VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]648 code0 +[2(VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]637 code0 +[2(VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]626 code0 +[2(VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]615 code0 +[2(VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]604 code0 +[2(VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 )]593 code0 +[2(VPHADDBD xmmreg,xmmrm128* AMD,SSE5 )]582 code0 +[2(VPHADDBQ xmmreg,xmmrm128* AMD,SSE5 )]571 code0 +[2(VPHADDBW xmmreg,xmmrm128* AMD,SSE5 )]560 code0 +[2(VPHADDDQ xmmreg,xmmrm128* AMD,SSE5 )]549 code0 +[2(VPHADDUBD xmmreg,xmmrm128* AMD,SSE5 )]538 code0 +[2(VPHADDUBQ xmmreg,xmmrm128* AMD,SSE5 )]527 code0 +[2(VPHADDUBW xmmreg,xmmrm128* AMD,SSE5 )]516 code0 +[2(VPHADDUDQ xmmreg,xmmrm128* AMD,SSE5 )]505 code0 +[2(VPHADDUWD xmmreg,xmmrm128* AMD,SSE5 )]494 code0 +[2(VPHADDUWQ xmmreg,xmmrm128* AMD,SSE5 )]483 code0 +[2(VPHADDWD xmmreg,xmmrm128* AMD,SSE5 )]472 code0 +[2(VPHADDWQ xmmreg,xmmrm128* AMD,SSE5 )]461 code0 +[2(VPHSUBBW xmmreg,xmmrm128* AMD,SSE5 )]450 code0 +[2(VPHSUBDQ xmmreg,xmmrm128* AMD,SSE5 )]439 code0 +[2(VPHSUBWD xmmreg,xmmrm128* AMD,SSE5 )]428 code0 +[2(VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]417 code0 +[2(VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]406 code0 +[2(VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]395 code0 +[2(VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]384 code0 +[2(VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]373 code0 +[2(VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]362 code0 +[2(VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]351 code0 +[2(VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]340 code0 +[2(VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]329 code0 +[2(VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]318 code0 +[2(VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]307 code0 +[2(VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]296 code0 +[2(VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 )]285 code0 +[2(VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 )]274 code0 +[2(VPROTB xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]263 code0 +[2(VPROTB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]252 code0 +[2(VPROTB xmmreg,xmmrm128*,imm8 AMD,SSE5 )]241 code0 +[2(VPROTD xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]230 code0 +[2(VPROTD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]219 code0 +[2(VPROTD xmmreg,xmmrm128*,imm8 AMD,SSE5 )]208 code0 +[2(VPROTQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]197 code0 +[2(VPROTQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]186 code0 +[2(VPROTQ xmmreg,xmmrm128*,imm8 AMD,SSE5 )]175 code0 +[2(VPROTW xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]164 code0 +[2(VPROTW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]153 code0 +[2(VPROTW xmmreg,xmmrm128*,imm8 AMD,SSE5 )]142 code0 +[2(VPSHAB xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]131 code0 +[2(VPSHAB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]120 code0 +[2(VPSHAD xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]109 code0 +(176)pageeven +restore showpage +%%Page: 177 177 +%%BeginPageSetup +save +%%EndPageSetup +/177 pa +[2(VPSHAD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]681 code0 +[2(VPSHAQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]670 code0 +[2(VPSHAQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]659 code0 +[2(VPSHAW xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]648 code0 +[2(VPSHAW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]637 code0 +[2(VPSHLB xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]626 code0 +[2(VPSHLB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]615 code0 +[2(VPSHLD xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]604 code0 +[2(VPSHLD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]593 code0 +[2(VPSHLQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]582 code0 +[2(VPSHLQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 )]571 code0 +[2(VPSHLW xmmreg,xmmrm128*,xmmreg AMD,SSE5 )]560 code0 +[2(VPSHLW xmmreg,xmmreg*,xmmrm128 AMD,SSE5)]549 code2 +[{/section-B.1.32 xa}(Systematic names for the hinting nop instructions)](B.1.32)529.8 subh3 +[2(HINT_NOP0 rm16 P6,UNDOC )]512.8 code1 +[2(HINT_NOP0 rm32 P6,UNDOC )]501.8 code0 +[2(HINT_NOP0 rm64 X64,UNDOC )]490.8 code0 +[2(HINT_NOP1 rm16 P6,UNDOC )]479.8 code0 +[2(HINT_NOP1 rm32 P6,UNDOC )]468.8 code0 +[2(HINT_NOP1 rm64 X64,UNDOC )]457.8 code0 +[2(HINT_NOP2 rm16 P6,UNDOC )]446.8 code0 +[2(HINT_NOP2 rm32 P6,UNDOC )]435.8 code0 +[2(HINT_NOP2 rm64 X64,UNDOC )]424.8 code0 +[2(HINT_NOP3 rm16 P6,UNDOC )]413.8 code0 +[2(HINT_NOP3 rm32 P6,UNDOC )]402.8 code0 +[2(HINT_NOP3 rm64 X64,UNDOC )]391.8 code0 +[2(HINT_NOP4 rm16 P6,UNDOC )]380.8 code0 +[2(HINT_NOP4 rm32 P6,UNDOC )]369.8 code0 +[2(HINT_NOP4 rm64 X64,UNDOC )]358.8 code0 +[2(HINT_NOP5 rm16 P6,UNDOC )]347.8 code0 +[2(HINT_NOP5 rm32 P6,UNDOC )]336.8 code0 +[2(HINT_NOP5 rm64 X64,UNDOC )]325.8 code0 +[2(HINT_NOP6 rm16 P6,UNDOC )]314.8 code0 +[2(HINT_NOP6 rm32 P6,UNDOC )]303.8 code0 +[2(HINT_NOP6 rm64 X64,UNDOC )]292.8 code0 +[2(HINT_NOP7 rm16 P6,UNDOC )]281.8 code0 +[2(HINT_NOP7 rm32 P6,UNDOC )]270.8 code0 +[2(HINT_NOP7 rm64 X64,UNDOC )]259.8 code0 +[2(HINT_NOP8 rm16 P6,UNDOC )]248.8 code0 +[2(HINT_NOP8 rm32 P6,UNDOC )]237.8 code0 +[2(HINT_NOP8 rm64 X64,UNDOC )]226.8 code0 +[2(HINT_NOP9 rm16 P6,UNDOC )]215.8 code0 +[2(HINT_NOP9 rm32 P6,UNDOC )]204.8 code0 +[2(HINT_NOP9 rm64 X64,UNDOC )]193.8 code0 +[2(HINT_NOP10 rm16 P6,UNDOC )]182.8 code0 +[2(HINT_NOP10 rm32 P6,UNDOC )]171.8 code0 +[2(HINT_NOP10 rm64 X64,UNDOC )]160.8 code0 +[2(HINT_NOP11 rm16 P6,UNDOC )]149.8 code0 +[2(HINT_NOP11 rm32 P6,UNDOC )]138.8 code0 +[2(HINT_NOP11 rm64 X64,UNDOC )]127.8 code0 +[2(HINT_NOP12 rm16 P6,UNDOC )]116.8 code0 +[2(HINT_NOP12 rm32 P6,UNDOC )]105.8 code0 +(177)pageodd +restore showpage +%%Page: 178 178 +%%BeginPageSetup +save +%%EndPageSetup +/178 pa +[2(HINT_NOP12 rm64 X64,UNDOC )]681 code0 +[2(HINT_NOP13 rm16 P6,UNDOC )]670 code0 +[2(HINT_NOP13 rm32 P6,UNDOC )]659 code0 +[2(HINT_NOP13 rm64 X64,UNDOC )]648 code0 +[2(HINT_NOP14 rm16 P6,UNDOC )]637 code0 +[2(HINT_NOP14 rm32 P6,UNDOC )]626 code0 +[2(HINT_NOP14 rm64 X64,UNDOC )]615 code0 +[2(HINT_NOP15 rm16 P6,UNDOC )]604 code0 +[2(HINT_NOP15 rm32 P6,UNDOC )]593 code0 +[2(HINT_NOP15 rm64 X64,UNDOC )]582 code0 +[2(HINT_NOP16 rm16 P6,UNDOC )]571 code0 +[2(HINT_NOP16 rm32 P6,UNDOC )]560 code0 +[2(HINT_NOP16 rm64 X64,UNDOC )]549 code0 +[2(HINT_NOP17 rm16 P6,UNDOC )]538 code0 +[2(HINT_NOP17 rm32 P6,UNDOC )]527 code0 +[2(HINT_NOP17 rm64 X64,UNDOC )]516 code0 +[2(HINT_NOP18 rm16 P6,UNDOC )]505 code0 +[2(HINT_NOP18 rm32 P6,UNDOC )]494 code0 +[2(HINT_NOP18 rm64 X64,UNDOC )]483 code0 +[2(HINT_NOP19 rm16 P6,UNDOC )]472 code0 +[2(HINT_NOP19 rm32 P6,UNDOC )]461 code0 +[2(HINT_NOP19 rm64 X64,UNDOC )]450 code0 +[2(HINT_NOP20 rm16 P6,UNDOC )]439 code0 +[2(HINT_NOP20 rm32 P6,UNDOC )]428 code0 +[2(HINT_NOP20 rm64 X64,UNDOC )]417 code0 +[2(HINT_NOP21 rm16 P6,UNDOC )]406 code0 +[2(HINT_NOP21 rm32 P6,UNDOC )]395 code0 +[2(HINT_NOP21 rm64 X64,UNDOC )]384 code0 +[2(HINT_NOP22 rm16 P6,UNDOC )]373 code0 +[2(HINT_NOP22 rm32 P6,UNDOC )]362 code0 +[2(HINT_NOP22 rm64 X64,UNDOC )]351 code0 +[2(HINT_NOP23 rm16 P6,UNDOC )]340 code0 +[2(HINT_NOP23 rm32 P6,UNDOC )]329 code0 +[2(HINT_NOP23 rm64 X64,UNDOC )]318 code0 +[2(HINT_NOP24 rm16 P6,UNDOC )]307 code0 +[2(HINT_NOP24 rm32 P6,UNDOC )]296 code0 +[2(HINT_NOP24 rm64 X64,UNDOC )]285 code0 +[2(HINT_NOP25 rm16 P6,UNDOC )]274 code0 +[2(HINT_NOP25 rm32 P6,UNDOC )]263 code0 +[2(HINT_NOP25 rm64 X64,UNDOC )]252 code0 +[2(HINT_NOP26 rm16 P6,UNDOC )]241 code0 +[2(HINT_NOP26 rm32 P6,UNDOC )]230 code0 +[2(HINT_NOP26 rm64 X64,UNDOC )]219 code0 +[2(HINT_NOP27 rm16 P6,UNDOC )]208 code0 +[2(HINT_NOP27 rm32 P6,UNDOC )]197 code0 +[2(HINT_NOP27 rm64 X64,UNDOC )]186 code0 +[2(HINT_NOP28 rm16 P6,UNDOC )]175 code0 +[2(HINT_NOP28 rm32 P6,UNDOC )]164 code0 +[2(HINT_NOP28 rm64 X64,UNDOC )]153 code0 +[2(HINT_NOP29 rm16 P6,UNDOC )]142 code0 +[2(HINT_NOP29 rm32 P6,UNDOC )]131 code0 +[2(HINT_NOP29 rm64 X64,UNDOC )]120 code0 +[2(HINT_NOP30 rm16 P6,UNDOC )]109 code0 +(178)pageeven +restore showpage +%%Page: 179 179 +%%BeginPageSetup +save +%%EndPageSetup +/179 pa +[2(HINT_NOP30 rm32 P6,UNDOC )]681 code0 +[2(HINT_NOP30 rm64 X64,UNDOC )]670 code0 +[2(HINT_NOP31 rm16 P6,UNDOC )]659 code0 +[2(HINT_NOP31 rm32 P6,UNDOC )]648 code0 +[2(HINT_NOP31 rm64 X64,UNDOC )]637 code0 +[2(HINT_NOP32 rm16 P6,UNDOC )]626 code0 +[2(HINT_NOP32 rm32 P6,UNDOC )]615 code0 +[2(HINT_NOP32 rm64 X64,UNDOC )]604 code0 +[2(HINT_NOP33 rm16 P6,UNDOC )]593 code0 +[2(HINT_NOP33 rm32 P6,UNDOC )]582 code0 +[2(HINT_NOP33 rm64 X64,UNDOC )]571 code0 +[2(HINT_NOP34 rm16 P6,UNDOC )]560 code0 +[2(HINT_NOP34 rm32 P6,UNDOC )]549 code0 +[2(HINT_NOP34 rm64 X64,UNDOC )]538 code0 +[2(HINT_NOP35 rm16 P6,UNDOC )]527 code0 +[2(HINT_NOP35 rm32 P6,UNDOC )]516 code0 +[2(HINT_NOP35 rm64 X64,UNDOC )]505 code0 +[2(HINT_NOP36 rm16 P6,UNDOC )]494 code0 +[2(HINT_NOP36 rm32 P6,UNDOC )]483 code0 +[2(HINT_NOP36 rm64 X64,UNDOC )]472 code0 +[2(HINT_NOP37 rm16 P6,UNDOC )]461 code0 +[2(HINT_NOP37 rm32 P6,UNDOC )]450 code0 +[2(HINT_NOP37 rm64 X64,UNDOC )]439 code0 +[2(HINT_NOP38 rm16 P6,UNDOC )]428 code0 +[2(HINT_NOP38 rm32 P6,UNDOC )]417 code0 +[2(HINT_NOP38 rm64 X64,UNDOC )]406 code0 +[2(HINT_NOP39 rm16 P6,UNDOC )]395 code0 +[2(HINT_NOP39 rm32 P6,UNDOC )]384 code0 +[2(HINT_NOP39 rm64 X64,UNDOC )]373 code0 +[2(HINT_NOP40 rm16 P6,UNDOC )]362 code0 +[2(HINT_NOP40 rm32 P6,UNDOC )]351 code0 +[2(HINT_NOP40 rm64 X64,UNDOC )]340 code0 +[2(HINT_NOP41 rm16 P6,UNDOC )]329 code0 +[2(HINT_NOP41 rm32 P6,UNDOC )]318 code0 +[2(HINT_NOP41 rm64 X64,UNDOC )]307 code0 +[2(HINT_NOP42 rm16 P6,UNDOC )]296 code0 +[2(HINT_NOP42 rm32 P6,UNDOC )]285 code0 +[2(HINT_NOP42 rm64 X64,UNDOC )]274 code0 +[2(HINT_NOP43 rm16 P6,UNDOC )]263 code0 +[2(HINT_NOP43 rm32 P6,UNDOC )]252 code0 +[2(HINT_NOP43 rm64 X64,UNDOC )]241 code0 +[2(HINT_NOP44 rm16 P6,UNDOC )]230 code0 +[2(HINT_NOP44 rm32 P6,UNDOC )]219 code0 +[2(HINT_NOP44 rm64 X64,UNDOC )]208 code0 +[2(HINT_NOP45 rm16 P6,UNDOC )]197 code0 +[2(HINT_NOP45 rm32 P6,UNDOC )]186 code0 +[2(HINT_NOP45 rm64 X64,UNDOC )]175 code0 +[2(HINT_NOP46 rm16 P6,UNDOC )]164 code0 +[2(HINT_NOP46 rm32 P6,UNDOC )]153 code0 +[2(HINT_NOP46 rm64 X64,UNDOC )]142 code0 +[2(HINT_NOP47 rm16 P6,UNDOC )]131 code0 +[2(HINT_NOP47 rm32 P6,UNDOC )]120 code0 +[2(HINT_NOP47 rm64 X64,UNDOC )]109 code0 +(179)pageodd +restore showpage +%%Page: 180 180 +%%BeginPageSetup +save +%%EndPageSetup +/180 pa +[2(HINT_NOP48 rm16 P6,UNDOC )]681 code0 +[2(HINT_NOP48 rm32 P6,UNDOC )]670 code0 +[2(HINT_NOP48 rm64 X64,UNDOC )]659 code0 +[2(HINT_NOP49 rm16 P6,UNDOC )]648 code0 +[2(HINT_NOP49 rm32 P6,UNDOC )]637 code0 +[2(HINT_NOP49 rm64 X64,UNDOC )]626 code0 +[2(HINT_NOP50 rm16 P6,UNDOC )]615 code0 +[2(HINT_NOP50 rm32 P6,UNDOC )]604 code0 +[2(HINT_NOP50 rm64 X64,UNDOC )]593 code0 +[2(HINT_NOP51 rm16 P6,UNDOC )]582 code0 +[2(HINT_NOP51 rm32 P6,UNDOC )]571 code0 +[2(HINT_NOP51 rm64 X64,UNDOC )]560 code0 +[2(HINT_NOP52 rm16 P6,UNDOC )]549 code0 +[2(HINT_NOP52 rm32 P6,UNDOC )]538 code0 +[2(HINT_NOP52 rm64 X64,UNDOC )]527 code0 +[2(HINT_NOP53 rm16 P6,UNDOC )]516 code0 +[2(HINT_NOP53 rm32 P6,UNDOC )]505 code0 +[2(HINT_NOP53 rm64 X64,UNDOC )]494 code0 +[2(HINT_NOP54 rm16 P6,UNDOC )]483 code0 +[2(HINT_NOP54 rm32 P6,UNDOC )]472 code0 +[2(HINT_NOP54 rm64 X64,UNDOC )]461 code0 +[2(HINT_NOP55 rm16 P6,UNDOC )]450 code0 +[2(HINT_NOP55 rm32 P6,UNDOC )]439 code0 +[2(HINT_NOP55 rm64 X64,UNDOC )]428 code0 +[2(HINT_NOP56 rm16 P6,UNDOC )]417 code0 +[2(HINT_NOP56 rm32 P6,UNDOC )]406 code0 +[2(HINT_NOP56 rm64 X64,UNDOC )]395 code0 +[2(HINT_NOP57 rm16 P6,UNDOC )]384 code0 +[2(HINT_NOP57 rm32 P6,UNDOC )]373 code0 +[2(HINT_NOP57 rm64 X64,UNDOC )]362 code0 +[2(HINT_NOP58 rm16 P6,UNDOC )]351 code0 +[2(HINT_NOP58 rm32 P6,UNDOC )]340 code0 +[2(HINT_NOP58 rm64 X64,UNDOC )]329 code0 +[2(HINT_NOP59 rm16 P6,UNDOC )]318 code0 +[2(HINT_NOP59 rm32 P6,UNDOC )]307 code0 +[2(HINT_NOP59 rm64 X64,UNDOC )]296 code0 +[2(HINT_NOP60 rm16 P6,UNDOC )]285 code0 +[2(HINT_NOP60 rm32 P6,UNDOC )]274 code0 +[2(HINT_NOP60 rm64 X64,UNDOC )]263 code0 +[2(HINT_NOP61 rm16 P6,UNDOC )]252 code0 +[2(HINT_NOP61 rm32 P6,UNDOC )]241 code0 +[2(HINT_NOP61 rm64 X64,UNDOC )]230 code0 +[2(HINT_NOP62 rm16 P6,UNDOC )]219 code0 +[2(HINT_NOP62 rm32 P6,UNDOC )]208 code0 +[2(HINT_NOP62 rm64 X64,UNDOC )]197 code0 +[2(HINT_NOP63 rm16 P6,UNDOC )]186 code0 +[2(HINT_NOP63 rm32 P6,UNDOC )]175 code0 +[2(HINT_NOP63 rm64 X64,UNDOC)]164 code2 +(180)pageeven +restore showpage +%%Page: 181 181 +%%BeginPageSetup +save +%%EndPageSetup +/181 pa +[{/appendix-C xa}(Appendix C: )(NASM Version History)]642.8 appn3 +[{/section-C.1 xa}(NASM 2 Series)](C.1)597.4 head3 +[(The NASM 2 series support x86-64, and is the production version of NASM since 2007.)]580.4 norm3 +[{/section-C.1.1 xa}(Version 2.08)](C.1.1)561.2 subh3 +[(A number of enhancements/fixes in macros area.)]544.2 bull3 +[(Support for arbitrarily terminating macro expansions )2(%exitmacro)0(. See ){/section-4.3.12 xl}(section 4.3.12){el}(.)]527.2 bull3 +[(Support for recursive macro expansion )2(%rmacro/irmacro)0(. See ){/section-4.3.1 xl}(section 4.3.1){el}(.)]510.2 bull3 +[(Support for converting strings to tokens. See ){/section-4.1.9 xl}(section 4.1.9){el}(.)]493.2 bull3 +[(Fuzzy operand size logic introduced.)]476.2 bull3 +[(Fix COFF stack overrun on too long export identifiers.)]459.2 bull3 +[(Fix Macho-O alignment bug.)]442.2 bull3 +[(Fix crashes with \226fwin32 on file with many exports.)]425.2 bull3 +[(Fix stack overrun for too long [DEBUG id].)]408.2 bull3 +[(Fix incorrect sbyte usage in IMUL \(hit only if optimization flag passed\).)]391.2 bull3 +[(Append ending token for )2(.stabs)0( records in the ELF output format.)]374.2 bull3 +[(New NSIS script which uses ModernUI and MultiUser approach.)]357.2 bull3 +[(Visual Studio 2008 NASM integration \(rules file\).)]340.2 bull3 +[(Warn a user if a constant is too long \(and as result will be stripped\).)]323.2 bull3 +[(The obsoleted pre-XOP AMD SSE5 instruction set which was never actualized was removed.)]306.2 bull3 +[(Fix stack overrun on too long error file name passed from the command line.)]289.2 bull3 +[(Bind symbols to the .text section by default \(ie in case if SECTION directive was omitted\) in the ELF)]272.2 bull1 +[(output format.)]261.2 bull2 +[(Fix sync points array index wrapping.)]244.2 bull3 +[(A few fixes for FMA4 and XOP instruction templates.)]227.2 bull3 +[(Add AMD Lightweight Profiling \(LWP\) instructions.)]210.2 bull3 +[{/section-C.1.2 xa}(Version 2.07)](C.1.2)191 subh3 +[(NASM is now under the 2-clause BSD license. See ){/section-1.1.2 xl}(section 1.1.2){el}(.)]174 bull3 +[(Fix the section type for the )2(.strtab)0( section in the )2(elf64)0( output format.)]157 bull3 +[(Fix the handling of )2(COMMON)0( directives in the )2(obj)0( output format.)]140 bull3 +[(New )2(ith)0( and )2(srec)0( output formats; these are variants of the )2(bin)0( output format which output Intel hex)]123 bull1 +[(and Motorola S-records, respectively. See ){/section-7.2 xl}(section 7.2){el}( and ){/section-7.3 xl}(section 7.3){el}(.)]112 bull2 +(181)pageodd +restore showpage +%%Page: 182 182 +%%BeginPageSetup +save +%%EndPageSetup +/182 pa +[2(rdf2ihx)0( replaced with an enhanced )2(rdf2bin)0(, which can output binary, COM, Intel hex or Motorola)]681 bull1 +[(S-records.)]670 bull2 +[(The Windows installer now puts the NASM directory first in the )2(PATH)0( of the "NASM Shell".)]653 bull3 +[(Revert the early expansion behavior of )2(%+)0( to pre-2.06 behavior: )2(%+)0( is only expanded late.)]636 bull3 +[(Yet another Mach-O alignment fix.)]619 bull3 +[(Don't delete the list file on errors. Also, include error and warning information in the list file.)]602 bull3 +[(Support for 64-bit Mach-O output, see ){/section-7.8 xl}(section 7.8){el}(.)]585 bull3 +[(Fix assert failure on certain operations that involve strings with high-bit bytes.)]568 bull3 +[{/section-C.1.3 xa}(Version 2.06)](C.1.3)548.8 subh3 +[(This release is dedicated to the memory of Charles A. Crayne, long time NASM developer as well as)]531.8 bull1 +[(moderator of )2(comp.lang.asm.x86)0( and author of the book )1(Serious Assembler)0(. We miss you, Chuck.)]520.8 bull2 +[(Support for indirect macro expansion \()2(%[...])0(\). See ){/section-4.1.3 xl}(section 4.1.3){el}(.)]503.8 bull3 +[2(%pop)0( can now take an argument, see ){/section-4.7.1 xl}(section 4.7.1){el}(.)]486.8 bull3 +[(The argument to )2(%use)0( is no longer macro-expanded. Use )2(%[...])0( if macro expansion is desired.)]469.8 bull3 +[(Support for thread-local storage in ELF32 and ELF64. See ){/section-7.9.4 xl}(section 7.9.4){el}(.)]452.8 bull3 +[(Fix crash on )2(%ifmacro)0( without an argument.)]435.8 bull3 +[(Correct the arguments to the )2(POPCNT)0( instruction.)]418.8 bull3 +[(Fix section alignment in the Mach-O format.)]401.8 bull3 +[(Update AVX support to version 5 of the Intel specification.)]384.8 bull3 +[(Fix the handling of accesses to context-local macros from higher levels in the context stack.)]367.8 bull3 +[(Treat )2(WAIT)0( as a prefix rather than as an instruction, thereby allowing constructs like )2(O16 FSAVE)0( to work)]350.8 bull1 +[(correctly.)]339.8 bull2 +[(Support for structures with a non-zero base offset. See ){/section-4.11.10 xl}(section 4.11.10){el}(.)]322.8 bull3 +[(Correctly handle preprocessor token concatenation \(see ){/section-4.3.8 xl}(section 4.3.8){el}(\) involving floating-point numbers.)]305.8 bull3 +[(The )2(PINSR)0( series of instructions have been corrected and rationalized.)]288.8 bull3 +[(Removed AMD SSE5, replaced with the new XOP/FMA4/CVT16 \(rev 3.03\) spec.)]271.8 bull3 +[(The ELF backends no longer automatically generate a )2(.comment)0( section.)]254.8 bull3 +[(Add additional "well-known" ELF sections with default attributes. See ){/section-7.9.2 xl}(section 7.9.2){el}(.)]237.8 bull3 +[{/section-C.1.4 xa}(Version 2.05.01)](C.1.4)218.6 subh3 +[(Fix the )2(-w)0(/)2(-W)0( option parsing, which was broken in NASM 2.05.)]201.6 bull3 +[{/section-C.1.5 xa}(Version 2.05)](C.1.5)182.4 subh3 +[(Fix redundant REX.W prefix on )2(JMP reg64)0(.)]165.4 bull3 +[(Make the behaviour of )2(-O0)0( match NASM 0.98 legacy behavior. See ){/section-2.1.22 xl}(section 2.1.22){el}(.)]148.4 bull3 +[2(-w-user)0( can be used to suppress the output of )2(%warning)0( directives. See ){/section-2.1.24 xl}(section 2.1.24){el}(.)]131.4 bull3 +[(Fix bug where )2(ALIGN)0( would issue a full alignment datum instead of zero bytes.)]114.4 bull3 +(182)pageeven +restore showpage +%%Page: 183 183 +%%BeginPageSetup +save +%%EndPageSetup +/183 pa +[(Fix offsets in list files.)]681 bull3 +[(Fix )2(%include)0( inside multi-line macros or loops.)]664 bull3 +[(Fix error where NASM would generate a spurious warning on valid optimizations of immediate values.)]647 bull3 +[(Fix arguments to a number of the )2(CVT)0( SSE instructions.)]630 bull3 +[(Fix RIP-relative offsets when the instruction carries an immediate.)]613 bull3 +[(Massive overhaul of the ELF64 backend for spec compliance.)]596 bull3 +[(Fix the Geode )2(PFRCPV)0( and )2(PFRSQRTV)0( instruction.)]579 bull3 +[(Fix the SSE 4.2 )2(CRC32)0( instruction.)]562 bull3 +[{/section-C.1.6 xa}(Version 2.04)](C.1.6)542.8 subh3 +[(Sanitize macro handing in the )2(%error)0( directive.)]525.8 bull3 +[(New )2(%warning)0( directive to issue user-controlled warnings.)]508.8 bull3 +[2(%error)0( directives are now deferred to the final assembly phase.)]491.8 bull3 +[(New )2(%fatal)0( directive to immediately terminate assembly.)]474.8 bull3 +[(New )2(%strcat)0( directive to join quoted strings together.)]457.8 bull3 +[(New )2(%use)0( macro directive to support standard macro directives. See ){/section-4.6.4 xl}(section 4.6.4){el}(.)]440.8 bull3 +[(Excess default parameters to )2(%macro)0( now issues a warning by default. See ){/section-4.3 xl}(section 4.3){el}(.)]423.8 bull3 +[(Fix )2(%ifn)0( and )2(%elifn)0(.)]406.8 bull3 +[(Fix nested )2(%else)0( clauses.)]389.8 bull3 +[(Correct the handling of nested )2(%rep)0(s.)]372.8 bull3 +[(New )2(%unmacro)0( directive to undeclare a multi-line macro. See ){/section-4.3.11 xl}(section 4.3.11){el}(.)]355.8 bull3 +[(Builtin macro )2(__PASS__)0( which expands to the current assembly pass. See ){/section-4.11.9 xl}(section 4.11.9){el}(.)]338.8 bull3 +[2(__utf16__)0( and )2(__utf32__)0( operators to generate UTF-16 and UTF-32 strings. See ){/section-3.4.5 xl}(section 3.4.5){el}(.)]321.8 bull3 +[(Fix bug in case-insensitive matching when compiled on platforms that don't use the )2(configure)0( script.)]304.8 bull1 +[(Of the official release binaries, that only affected the OS/2 binary.)]293.8 bull2 +[(Support for x87 packed BCD constants. See ){/section-3.4.7 xl}(section 3.4.7){el}(.)]276.8 bull3 +[(Correct the )2(LTR)0( and )2(SLDT)0( instructions in 64-bit mode.)]259.8 bull3 +[(Fix unnecessary REX.W prefix on indirect jumps in 64-bit mode.)]242.8 bull3 +[(Add AVX versions of the AES instructions \()2(VAES)0(...\).)]225.8 bull3 +[(Fix the 256-bit FMA instructions.)]208.8 bull3 +[(Add 256-bit AVX stores per the latest AVX spec.)]191.8 bull3 +[(VIA XCRYPT instructions can now be written either with or without )2(REP)0(, apparently different versions of)]174.8 bull1 +[(the VIA spec wrote them differently.)]163.8 bull2 +[(Add missing 64-bit )2(MOVNTI)0( instruction.)]146.8 bull3 +[(Fix the operand size of )2(VMREAD)0( and )2(VMWRITE)0(.)]129.8 bull3 +[(Numerous bug fixes, especially to the AES, AVX and VTX instructions.)]112.8 bull3 +(183)pageodd +restore showpage +%%Page: 184 184 +%%BeginPageSetup +save +%%EndPageSetup +/184 pa +[(The optimizer now always runs until it converges. It also runs even when disabled, but doesn't optimize.)]681 bull1 +[(This allows most forward references to be resolved properly.)]670 bull2 +[2(%push)0( no longer needs a context identifier; omitting the context identifier results in an anonymous context.)]653 bull3 +[{/section-C.1.7 xa}(Version 2.03.01)](C.1.7)633.8 subh3 +[(Fix buffer overflow in the listing module.)]616.8 bull3 +[(Fix the handling of hexadecimal escape codes in `...` strings.)]599.8 bull3 +[(The Postscript/PDF documentation has been reformatted.)]582.8 bull3 +[(The )2(-F)0( option now implies )2(-g)0(.)]565.8 bull3 +[{/section-C.1.8 xa}(Version 2.03)](C.1.8)546.6 subh3 +[(Add support for Intel AVX, CLMUL and FMA instructions, including YMM registers.)]529.6 bull3 +[2(dy)0(, )2(resy)0( and )2(yword)0( for 32-byte operands.)]512.6 bull3 +[(Fix some SSE5 instructions.)]495.6 bull3 +[(Intel )2(INVEPT)0(, )2(INVVPID)0( and )2(MOVBE)0( instructions.)]478.6 bull3 +[(Fix checking for critical expressions when the optimizer is enabled.)]461.6 bull3 +[(Support the DWARF debugging format for ELF targets.)]444.6 bull3 +[(Fix optimizations of signed bytes.)]427.6 bull3 +[(Fix operation on bigendian machines.)]410.6 bull3 +[(Fix buffer overflow in the preprocessor.)]393.6 bull3 +[2(SAFESEH)0( support for Win32, )2(IMAGEREL)0( for Win64 \(SEH\).)]376.6 bull3 +[2(%?)0( and )2(%??)0( to refer to the name of a macro itself. In particular, )2(%idefine keyword $%?)0( can be used)]359.6 bull1 +[(to make a keyword "disappear".)]348.6 bull2 +[(New options for dependency generation: )2(-MD)0(, )2(-MF)0(, )2(-MP)0(, )2(-MT)0(, )2(-MQ)0(.)]331.6 bull3 +[(New preprocessor directives )2(%pathsearch)0( and )2(%depend)0(; INCBIN reimplemented as a macro.)]314.6 bull3 +[2(%include)0( now resolves macros in a sane manner.)]297.6 bull3 +[2(%substr)0( can now be used to get other than one-character substrings.)]280.6 bull3 +[(New type of character/string constants, using backquotes \()2(`...`)0(\), which support C-style escape)]263.6 bull1 +[(sequences.)]252.6 bull2 +[2(%defstr)0( and )2(%idefstr)0( to stringize macro definitions before creation.)]235.6 bull3 +[(Fix forward references used in )2(EQU)0( statements.)]218.6 bull3 +[{/section-C.1.9 xa}(Version 2.02)](C.1.9)199.4 subh3 +[(Additional fixes for MMX operands with explicit )2(qword)0(, as well as \(hopefully\) SSE operands with)]182.4 bull1 +[2(oword)0(.)]171.4 bull2 +[(Fix handling of truncated strings with )2(DO)0(.)]154.4 bull3 +[(Fix segfaults due to memory overwrites when floating-point constants were used.)]137.4 bull3 +[(Fix segfaults due to missing include files.)]120.4 bull3 +[(Fix OpenWatcom Makefiles for DOS and OS/2.)]103.4 bull3 +(184)pageeven +restore showpage +%%Page: 185 185 +%%BeginPageSetup +save +%%EndPageSetup +/185 pa +[(Add autogenerated instruction list back into the documentation.)]681 bull3 +[(ELF: Fix segfault when generating stabs, and no symbols have been defined.)]664 bull3 +[(ELF: Experimental support for DWARF debugging information.)]647 bull3 +[(New compile date and time standard macros.)]630 bull3 +[2(%ifnum)0( now returns true for negative numbers.)]613 bull3 +[(New )2(%iftoken)0( test for a single token.)]596 bull3 +[(New )2(%ifempty)0( test for empty expansion.)]579 bull3 +[(Add support for the )2(XSAVE)0( instruction group.)]562 bull3 +[(Makefile for Netware/gcc.)]545 bull3 +[(Fix issue with some warnings getting emitted way too many times.)]528 bull3 +[(Autogenerated instruction list added to the documentation.)]511 bull3 +[{/section-C.1.10 xa}(Version 2.01)](C.1.10)491.8 subh3 +[(Fix the handling of MMX registers with explicit )2(qword)0( tags on memory \(broken in 2.00 due to 64-bit)]474.8 bull1 +[(changes.\))]463.8 bull2 +[(Fix the PREFETCH instructions.)]446.8 bull3 +[(Fix the documentation.)]429.8 bull3 +[(Fix debugging info when using )2(-f elf)0( \(backwards compatibility alias for )2(-f elf32)0(\).)]412.8 bull3 +[(Man pages for rdoff tools \(from the Debian project.\))]395.8 bull3 +[(ELF: handle large numbers of sections.)]378.8 bull3 +[(Fix corrupt output when the optimizer runs out of passes.)]361.8 bull3 +[{/section-C.1.11 xa}(Version 2.00)](C.1.11)342.6 subh3 +[(Added c99 data-type compliance.)]325.6 bull3 +[(Added general x86-64 support.)]308.6 bull3 +[(Added win64 \(x86-64 COFF\) output format.)]291.6 bull3 +[(Added )2(__BITS__)0( standard macro.)]274.6 bull3 +[(Renamed the )2(elf)0( output format to )2(elf32)0( for clarity.)]257.6 bull3 +[(Added )2(elf64)0( and )2(macho)0( \(MacOS X\) output formats.)]240.6 bull3 +[(Added Numeric constants in )2(dq)0( directive.)]223.6 bull3 +[(Added )2(oword)0(, )2(do)0( and )2(reso)0( pseudo operands.)]206.6 bull3 +[(Allow underscores in numbers.)]189.6 bull3 +[(Added 8-, 16- and 128-bit floating-point formats.)]172.6 bull3 +[(Added binary, octal and hexadecimal floating-point.)]155.6 bull3 +[(Correct the generation of floating-point constants.)]138.6 bull3 +[(Added floating-point option control.)]121.6 bull3 +[(Added Infinity and NaN floating point support.)]104.6 bull3 +(185)pageodd +restore showpage +%%Page: 186 186 +%%BeginPageSetup +save +%%EndPageSetup +/186 pa +[(Added ELF Symbol Visibility support.)]681 bull3 +[(Added setting OSABI value in ELF header directive.)]664 bull3 +[(Added Generate Makefile Dependencies option.)]647 bull3 +[(Added Unlimited Optimization Passes option.)]630 bull3 +[(Added )2(%IFN)0( and )2(%ELIFN)0( support.)]613 bull3 +[(Added Logical Negation Operator.)]596 bull3 +[(Enhanced Stack Relative Preprocessor Directives.)]579 bull3 +[(Enhanced ELF Debug Formats.)]562 bull3 +[(Enhanced Send Errors to a File option.)]545 bull3 +[(Added SSSE3, SSE4.1, SSE4.2, SSE5 support.)]528 bull3 +[(Added a large number of additional instructions.)]511 bull3 +[(Significant performance improvements.)]494 bull3 +[2(-w+warning)0( and )2(-w-warning)0( can now be written as \226Wwarning and \226Wno-warning, respectively.)]477 bull1 +[(See ){/section-2.1.24 xl}(section 2.1.24){el}(.)]466 bull2 +[(Add )2(-w+error)0( to treat warnings as errors. See ){/section-2.1.24 xl}(section 2.1.24){el}(.)]449 bull3 +[(Add )2(-w+all)0( and )2(-w-all)0( to enable or disable all suppressible warnings. See ){/section-2.1.24 xl}(section 2.1.24){el}(.)]432 bull3 +[{/section-C.2 xa}(NASM 0.98 Series)](C.2)410.6 head3 +[(The 0.98 series was the production versions of NASM from 1999 to 2007.)]393.6 norm3 +[{/section-C.2.1 xa}(Version 0.98.39)](C.2.1)374.4 subh3 +[(fix buffer overflow)]357.4 bull3 +[(fix outas86's )2(.bss)0( handling)]340.4 bull3 +[("make spotless" no longer deletes config.h.in.)]323.4 bull3 +[2(%\(el\)if\(n\)idn)0( insensitivity to string quotes difference \(#809300\).)]306.4 bull3 +[(\(nasm.c\))2(__OUTPUT_FORMAT__)0( changed to string value instead of symbol.)]289.4 bull3 +[{/section-C.2.2 xa}(Version 0.98.38)](C.2.2)270.2 subh3 +[(Add Makefile for 16-bit DOS binaries under OpenWatcom, and modify )2(mkdep.pl)0( to be able to generate)]253.2 bull1 +[(completely pathless dependencies, as required by OpenWatcom wmake \(it supports path searches, but not)]242.2 bull0 +[(explicit paths.\))]231.2 bull2 +[(Fix the )2(STR)0( instruction.)]214.2 bull3 +[(Fix the ELF output format, which was broken under certain circumstances due to the addition of stabs)]197.2 bull1 +[(support.)]186.2 bull2 +[(Quick-fix Borland format debug-info for )2(-f obj)]169.2 bull3 +[(Fix for )2(%rep)0( with no arguments \(#560568\))]152.2 bull3 +[(Fix concatenation of preprocessor function call \(#794686\))]135.2 bull3 +[(Fix long label causes coredump \(#677841\))]118.2 bull3 +[(Use autoheader as well as autoconf to keep configure from generating ridiculously long command lines.)]101.2 bull3 +(186)pageeven +restore showpage +%%Page: 187 187 +%%BeginPageSetup +save +%%EndPageSetup +/187 pa +[(Make sure that all of the formats which support debugging output actually will suppress debugging output)]681 bull1 +[(when )2(-g)0( not specified.)]670 bull2 +[{/section-C.2.3 xa}(Version 0.98.37)](C.2.3)650.8 subh3 +[(Paths given in )2(-I)0( switch searched for )2(incbin)0(\226ed as well as )2(%include)0(\226ed files.)]633.8 bull3 +[(Added stabs debugging for the ELF output format, patch from Martin Wawro.)]616.8 bull3 +[(Fix )2(output/outbin.c)0( to allow origin > 80000000h.)]599.8 bull3 +[(Make )2(-U)0( switch work.)]582.8 bull3 +[(Fix the use of relative offsets with explicit prefixes, e.g. )2(a32 loop foo)0(.)]565.8 bull3 +[(Remove )2(backslash\(\))0(.)]548.8 bull3 +[(Fix the )2(SMSW)0( and )2(SLDT)0( instructions.)]531.8 bull3 +[2(-O2)0( and )2(-O3)0( are no longer aliases for )2(-O10)0( and )2(-O15)0(. If you mean the latter, please say so! :\))]514.8 bull3 +[{/section-C.2.4 xa}(Version 0.98.36)](C.2.4)495.6 subh3 +[(Update rdoff \226 librarian/archiver \226 common rec \226 docs!)]478.6 bull3 +[(Fix signed/unsigned problems.)]461.6 bull3 +[(Fix )2(JMP FAR label)0( and )2(CALL FAR label)0(.)]444.6 bull3 +[(Add new multisection support \226 map files \226 fix align bug)]427.6 bull3 +[(Fix sysexit, movhps/movlps reg,reg bugs in insns.dat)]410.6 bull3 +[2(Q)0( or )2(O)0( suffixes indicate octal)]393.6 bull3 +[(Support Prescott new instructions \(PNI\).)]376.6 bull3 +[(Cyrix )2(XSTORE)0( instruction.)]359.6 bull3 +[{/section-C.2.5 xa}(Version 0.98.35)](C.2.5)340.4 subh3 +[(Fix build failure on 16-bit DOS \(Makefile.bc3 workaround for compiler bug.\))]323.4 bull3 +[(Fix dependencies and compiler warnings.)]306.4 bull3 +[(Add "const" in a number of places.)]289.4 bull3 +[(Add \226X option to specify error reporting format \(use \226Xvc to integrate with Microsoft Visual Studio.\))]272.4 bull3 +[(Minor changes for code legibility.)]255.4 bull3 +[(Drop use of tmpnam\(\) in rdoff \(security fix.\))]238.4 bull3 +[{/section-C.2.6 xa}(Version 0.98.34)](C.2.6)219.2 subh3 +[(Correct additional address-size vs. operand-size confusions.)]202.2 bull3 +[(Generate dependencies for all Makefiles automatically.)]185.2 bull3 +[(Add support for unimplemented \(but theoretically available\) registers such as tr0 and cr5. Segment)]168.2 bull1 +[(registers 6 and 7 are called segr6 and segr7 for the operations which they can be represented.)]157.2 bull2 +[(Correct some disassembler bugs related to redundant address-size prefixes. Some work still remains in this)]140.2 bull1 +[(area.)]129.2 bull2 +[(Correctly generate an error for things like "SEG eax".)]112.2 bull3 +(187)pageodd +restore showpage +%%Page: 188 188 +%%BeginPageSetup +save +%%EndPageSetup +/188 pa +[(Add the JMPE instruction, enabled by "CPU IA64".)]681 bull3 +[(Correct compilation on newer gcc/glibc platforms.)]664 bull3 +[(Issue an error on things like "jmp far eax".)]647 bull3 +[{/section-C.2.7 xa}(Version 0.98.33)](C.2.7)627.8 subh3 +[(New __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ standard macros to round out the)]610.8 bull1 +[(version-query macros. version.pl now understands X.YYplWW or X.YY.ZZplWW as a version number,)]599.8 bull0 +[(equivalent to X.YY.ZZ.WW \(or X.YY.0.WW, as appropriate\).)]588.8 bull2 +[(New keyword "strict" to disable the optimization of specific operands.)]571.8 bull3 +[(Fix the handing of size overrides with JMP instructions \(instructions such as "jmp dword foo".\))]554.8 bull3 +[(Fix the handling of "ABSOLUTE label", where "label" points into a relocatable segment.)]537.8 bull3 +[(Fix OBJ output format with lots of externs.)]520.8 bull3 +[(More documentation updates.)]503.8 bull3 +[(Add \226Ov option to get verbose information about optimizations.)]486.8 bull3 +[(Undo a braindead change which broke )2(%elif)0( directives.)]469.8 bull3 +[(Makefile updates.)]452.8 bull3 +[{/section-C.2.8 xa}(Version 0.98.32)](C.2.8)433.6 subh3 +[(Fix NASM crashing when )2(%macro)0( directives were left unterminated.)]416.6 bull3 +[(Lots of documentation updates.)]399.6 bull3 +[(Complete rewrite of the PostScript/PDF documentation generator.)]382.6 bull3 +[(The MS Visual C++ Makefile was updated and corrected.)]365.6 bull3 +[(Recognize .rodata as a standard section name in ELF.)]348.6 bull3 +[(Fix some obsolete Perl4-isms in Perl scripts.)]331.6 bull3 +[(Fix configure.in to work with autoconf 2.5x.)]314.6 bull3 +[(Fix a couple of "make cleaner" misses.)]297.6 bull3 +[(Make the normal "./configure && make" work with Cygwin.)]280.6 bull3 +[{/section-C.2.9 xa}(Version 0.98.31)](C.2.9)261.4 subh3 +[(Correctly build in a separate object directory again.)]244.4 bull3 +[(Derive all references to the version number from the version file.)]227.4 bull3 +[(New standard macros __NASM_SUBMINOR__ and __NASM_VER__ macros.)]210.4 bull3 +[(Lots of Makefile updates and bug fixes.)]193.4 bull3 +[(New )2(%ifmacro)0( directive to test for multiline macros.)]176.4 bull3 +[(Documentation updates.)]159.4 bull3 +[(Fixes for 16-bit OBJ format output.)]142.4 bull3 +[(Changed the NASM environment variable to NASMENV.)]125.4 bull3 +(188)pageeven +restore showpage +%%Page: 189 189 +%%BeginPageSetup +save +%%EndPageSetup +/189 pa +[{/section-C.2.10 xa}(Version 0.98.30)](C.2.10)678.8 subh3 +[(Changed doc files a lot: completely removed old READMExx and Wishlist files, incorporating all)]661.8 bull1 +[(information in CHANGES and TODO.)]650.8 bull2 +[(I waited a long time to rename zoutieee.c to \(original\) outieee.c)]633.8 bull3 +[(moved all output modules to output/ subdirectory.)]616.8 bull3 +[(Added 'make strip' target to strip debug info from nasm & ndisasm.)]599.8 bull3 +[(Added INSTALL file with installation instructions.)]582.8 bull3 +[(Added \226v option description to nasm man.)]565.8 bull3 +[(Added dist makefile target to produce source distributions.)]548.8 bull3 +[(16-bit support for ELF output format \(GNU extension, but useful.\))]531.8 bull3 +[{/section-C.2.11 xa}(Version 0.98.28)](C.2.11)512.6 subh3 +[(Fastcooked this for Debian's Woody release: Frank applied the INCBIN bug patch to 0.98.25alt and called)]495.6 bull1 +[(it 0.98.28 to not confuse poor little apt-get.)]484.6 bull2 +[{/section-C.2.12 xa}(Version 0.98.26)](C.2.12)465.4 subh3 +[(Reorganised files even better from 0.98.25alt)]448.4 bull3 +[{/section-C.2.13 xa}(Version 0.98.25alt)](C.2.13)429.2 subh3 +[(Prettified the source tree. Moved files to more reasonable places.)]412.2 bull3 +[(Added findleak.pl script to misc/ directory.)]395.2 bull3 +[(Attempted to fix doc.)]378.2 bull3 +[{/section-C.2.14 xa}(Version 0.98.25)](C.2.14)359 subh3 +[(Line continuation character )2(\\)0(.)]342 bull3 +[(Docs inadvertantly reverted \226 "dos packaging".)]325 bull3 +[{/section-C.2.15 xa}(Version 0.98.24p1)](C.2.15)305.8 subh3 +[(FIXME: Someone, document this please.)]288.8 bull3 +[{/section-C.2.16 xa}(Version 0.98.24)](C.2.16)269.6 subh3 +[(Documentation \226 Ndisasm doc added to Nasm.doc.)]252.6 bull3 +[{/section-C.2.17 xa}(Version 0.98.23)](C.2.17)233.4 subh3 +[(Attempted to remove rdoff version1)]216.4 bull3 +[(Lino Mastrodomenico's patches to preproc.c \(%$$ bug?\).)]199.4 bull3 +[{/section-C.2.18 xa}(Version 0.98.22)](C.2.18)180.2 subh3 +[(Update rdoff2 \226 attempt to remove v1.)]163.2 bull3 +[{/section-C.2.19 xa}(Version 0.98.21)](C.2.19)144 subh3 +[(Optimization fixes.)]127 bull3 +(189)pageodd +restore showpage +%%Page: 190 190 +%%BeginPageSetup +save +%%EndPageSetup +/190 pa +[{/section-C.2.20 xa}(Version 0.98.20)](C.2.20)678.8 subh3 +[(Optimization fixes.)]661.8 bull3 +[{/section-C.2.21 xa}(Version 0.98.19)](C.2.21)642.6 subh3 +[(H. J. Lu's patch back out.)]625.6 bull3 +[{/section-C.2.22 xa}(Version 0.98.18)](C.2.22)606.4 subh3 +[(Added ".rdata" to "-f win32".)]589.4 bull3 +[{/section-C.2.23 xa}(Version 0.98.17)](C.2.23)570.2 subh3 +[(H. J. Lu's "bogus elf" patch. \(Red Hat problem?\))]553.2 bull3 +[{/section-C.2.24 xa}(Version 0.98.16)](C.2.24)534 subh3 +[(Fix whitespace before "[section ..." bug.)]517 bull3 +[{/section-C.2.25 xa}(Version 0.98.15)](C.2.25)497.8 subh3 +[(Rdoff changes \(?\).)]480.8 bull3 +[(Fix fixes to memory leaks.)]463.8 bull3 +[{/section-C.2.26 xa}(Version 0.98.14)](C.2.26)444.6 subh3 +[(Fix memory leaks.)]427.6 bull3 +[{/section-C.2.27 xa}(Version 0.98.13)](C.2.27)408.4 subh3 +[(There was no 0.98.13)]391.4 bull3 +[{/section-C.2.28 xa}(Version 0.98.12)](C.2.28)372.2 subh3 +[(Update optimization \(new function of "-O1"\))]355.2 bull3 +[(Changes to test/bintest.asm \(?\).)]338.2 bull3 +[{/section-C.2.29 xa}(Version 0.98.11)](C.2.29)319 subh3 +[(Optimization changes.)]302 bull3 +[(Ndisasm fixed.)]285 bull3 +[{/section-C.2.30 xa}(Version 0.98.10)](C.2.30)265.8 subh3 +[(There was no 0.98.10)]248.8 bull3 +[{/section-C.2.31 xa}(Version 0.98.09)](C.2.31)229.6 subh3 +[(Add multiple sections support to "-f bin".)]212.6 bull3 +[(Changed GLOBAL_TEMP_BASE in outelf.c from 6 to 15.)]195.6 bull3 +[(Add "-v" as an alias to the "-r" switch.)]178.6 bull3 +[(Remove "#ifdef" from Tasm compatibility options.)]161.6 bull3 +[(Remove redundant size-overrides on "mov ds, ex", etc.)]144.6 bull3 +[(Fixes to SSE2, other insns.dat \(?\).)]127.6 bull3 +[(Enable uppercase "I" and "P" switches.)]110.6 bull3 +(190)pageeven +restore showpage +%%Page: 191 191 +%%BeginPageSetup +save +%%EndPageSetup +/191 pa +[(Case insinsitive "seg" and "wrt".)]681 bull3 +[(Update install.sh \(?\).)]664 bull3 +[(Allocate tokens in blocks.)]647 bull3 +[(Improve "invalid effective address" messages.)]630 bull3 +[{/section-C.2.32 xa}(Version 0.98.08)](C.2.32)610.8 subh3 +[(Add ")2(%strlen)0(" and ")2(%substr)0(" macro operators)]593.8 bull3 +[(Fixed broken c16.mac.)]576.8 bull3 +[(Unterminated string error reported.)]559.8 bull3 +[(Fixed bugs as per 0.98bf)]542.8 bull3 +[{/section-C.2.33 xa}(Version 0.98.09b with John Coffman patches released 28-Oct-2001)](C.2.33)523.6 subh3 +[(Changes from 0.98.07 release to 98.09b as of 28-Oct-2001)]506.6 norm3 +[(More closely compatible with 0.98 when \226O0 is implied or specified. Not strictly identical, since backward)]489.6 bull1 +[(branches in range of short offsets are recognized, and signed byte values with no explicit size specification)]478.6 bull0 +[(will be assembled as a single byte.)]467.6 bull2 +[(More forgiving with the PUSH instruction. 0.98 requires a size to be specified always. 0.98.09b will imply)]450.6 bull1 +[(the size from the current BITS setting \(16 or 32\).)]439.6 bull2 +[(Changed definition of the optimization flag:)]422.6 bull3 +[(\226O0 strict two-pass assembly, JMP and Jcc are handled more like 0.98, except that back- ward JMPs are)]405.6 norm1 +[(short, if possible.)]394.6 norm2 +[(\226O1 strict two-pass assembly, but forward branches are assembled with code guaranteed to reach; may)]377.6 norm1 +[(produce larger code than \226O0, but will produce successful assembly more often if branch offset sizes are not)]366.6 norm0 +[(specified.)]355.6 norm2 +[(\226O2 multi-pass optimization, minimize branch offsets; also will minimize signed immed- iate bytes,)]338.6 norm1 +[(overriding size specification.)]327.6 norm2 +[(\226O3 like \226O2, but more passes taken, if needed)]310.6 norm3 +[{/section-C.2.34 xa}(Version 0.98.07 released 01/28/01)](C.2.34)291.4 subh3 +[(Added Stepane Denis' SSE2 instructions to a *working* version of the code \226 some earlier versions were)]274.4 bull1 +[(based on broken code \226 sorry 'bout that. version "0.98.07")]263.4 bull2 +[(01/28/01)]246.4 norm3 +[(Cosmetic modifications to nasm.c, nasm.h, AUTHORS, MODIFIED)]229.4 bull3 +[{/section-C.2.35 xa}(Version 0.98.06f released 01/18/01)](C.2.35)210.2 subh3 +[(\226 Add "metalbrain"s jecxz bug fix in insns.dat \226 alter nasmdoc.src to match \226 version "0.98.06f")]193.2 bull3 +[{/section-C.2.36 xa}(Version 0.98.06e released 01/09/01)](C.2.36)174 subh3 +[(Removed the "outforms.h" file \226 it appears to be someone's old backup of "outform.h". version "0.98.06e")]157 bull3 +[(01/09/01)]140 norm3 +[(fbk \226 finally added the fix for the "multiple %includes bug", known since 7/27/99 \226 reported originally \(?\))]123 bull1 +[(and sent to us by Austin Lunnen \226 he reports that John Fine had a fix within the day. Here it is...)]112 bull2 +(191)pageodd +restore showpage +%%Page: 192 192 +%%BeginPageSetup +save +%%EndPageSetup +/192 pa +[(Nelson Rush resigns from the group. Big thanks to Nelson for his leadership and enthusiasm in getting)]681 bull1 +[(these changes incorporated into Nasm!)]670 bull2 +[(fbk \226 [list +], [list \226] directives \226 ineptly implemented, should be re-written or removed, perhaps.)]653 bull3 +[(Brian Raiter / fbk \226 "elfso bug" fix \226 applied to aoutb format as well \226 testing might be desirable...)]636 bull3 +[(08/07/00)]619 norm3 +[(James Seter \226 \226postfix, \226prefix command line switches.)]602 bull3 +[(Yuri Zaporogets \226 rdoff utility changes.)]585 bull3 +[{/section-C.2.37 xa}(Version 0.98p1)](C.2.37)565.8 subh3 +[(GAS-like palign \(Panos Minos\))]548.8 bull3 +[(FIXME: Someone, fill this in with details)]531.8 bull3 +[{/section-C.2.38 xa}(Version 0.98bf \(bug-fixed\))](C.2.38)512.6 subh3 +[(Fixed \226 elf and aoutb bug \226 shared libraries \226 multiple "%include" bug in "-f obj" \226 jcxz, jecxz bug \226)]495.6 bull1 +[(unrecognized option bug in ndisasm)]484.6 bull2 +[{/section-C.2.39 xa}(Version 0.98.03 with John Coffman's changes released 27-Jul-2000)](C.2.39)465.4 subh3 +[(Added signed byte optimizations for the 0x81/0x83 class of instructions: ADC, ADD, AND, CMP, OR,)]448.4 bull1 +[(SBB, SUB, XOR: when used as 'ADD reg16,imm' or 'ADD reg32,imm.' Also optimization of signed byte)]437.4 bull0 +[(form of 'PUSH imm' and 'IMUL reg,imm'/'IMUL reg,reg,imm.' No size specification is needed.)]426.4 bull2 +[(Added multi-pass JMP and Jcc offset optimization. Offsets on forward references will preferentially use)]409.4 bull1 +[(the short form, without the need to code a specific size \(short or near\) for the branch. Added instructions)]398.4 bull0 +[(for 'Jcc label' to use the form 'Jnotcc $+3/JMP label', in cases where a short offset is out of bounds. If)]387.4 bull0 +[(compiling for a 386 or higher CPU, then the 386 form of Jcc will be used instead.)]376.4 bull2 +[(This feature is controlled by a new command-line switch: "O", \(upper case letter O\). "-O0" reverts the)]359.4 norm1 +[(assembler to no extra optimization passes, "-O1" allows up to 5 extra passes, and "-O2"\(default\), allows up)]348.4 norm0 +[(to 10 extra optimization passes.)]337.4 norm2 +[(Added a new directive: 'cpu XXX', where XXX is any of: 8086, 186, 286, 386, 486, 586, pentium, 686,)]320.4 bull1 +[(PPro, P2, P3 or Katmai. All are case insensitive. All instructions will be selected only if they apply to the)]309.4 bull0 +[(selected cpu or lower. Corrected a couple of bugs in cpu-dependence in 'insns.dat'.)]298.4 bull2 +[(Added to 'standard.mac', the "use16" and "use32" forms of the "bits 16/32" directive. This is nothing new,)]281.4 bull1 +[(just conforms to a lot of other assemblers. \(minor\))]270.4 bull2 +[(Changed label allocation from 320/32 \(10000 labels @ 200K+\) to 32/37 \(1000 labels\); makes running)]253.4 bull1 +[(under DOS much easier. Since additional label space is allocated dynamically, this should have no effect)]242.4 bull0 +[(on large programs with lots of labels. The 37 is a prime, believed to be better for hashing. \(minor\))]231.4 bull2 +[{/section-C.2.40 xa}(Version 0.98.03)](C.2.40)212.2 subh3 +[("Integrated patchfile 0.98-0.98.01. I call this version 0.98.03 for historical reasons: 0.98.02 was trashed.")]195.2 norm1 +[(\226\226John Coffman <johninsd@san.rr.com>, 27-Jul-2000)]184.2 norm2 +[(Kendall Bennett's SciTech MGL changes)]167.2 bull3 +[(Note that you must define "TASM_COMPAT" at compile-time to get the Tasm Ideal Mode compatibility.)]150.2 bull3 +[(All changes can be compiled in and out using the TASM_COMPAT macros, and when compiled without)]133.2 bull1 +[(TASM_COMPAT defined we get the exact same binary as the unmodified 0.98 sources.)]122.2 bull2 +[(standard.mac, macros.c: Added macros to ignore TASM directives before first include)]105.2 bull3 +(192)pageeven +restore showpage +%%Page: 193 193 +%%BeginPageSetup +save +%%EndPageSetup +/193 pa +[(nasm.h: Added extern declaration for tasm_compatible_mode)]681 bull3 +[(nasm.c: Added global variable tasm_compatible_mode)]664 bull3 +[(Added command line switch for TASM compatible mode \(-t\))]647 bull3 +[(Changed version command line to reflect when compiled with TASM additions)]630 bull3 +[(Added response file processing to allow all arguments on a single line \(response file is @resp rather than)]613 bull1 +[(\226@resp for NASM format\).)]602 bull2 +[(labels.c: Changes islocal\(\) macro to support TASM style @@local labels.)]585 bull3 +[(Added islocalchar\(\) macro to support TASM style @@local labels.)]568 bull3 +[(parser.c: Added support for TASM style memory references \(ie: mov [DWORD eax],10 rather than the)]551 bull1 +[(NASM style mov DWORD [eax],10\).)]540 bull2 +[(preproc.c: Added new directives, )2(%arg)0(, )2(%local)0(, )2(%stacksize)0( to directives table)]523 bull3 +[(Added support for TASM style directives without a leading % symbol.)]506 bull3 +[(Integrated a block of changes from Andrew Zabolotny <bit@eltech.ru>:)]489 bull3 +[(A new keyword )2(%xdefine)0( and its case-insensitive counterpart )2(%ixdefine)0(. They work almost the)]472 bull1 +[(same way as )2(%define)0( and )2(%idefine)0( but expand the definition immediately, not on the invocation.)]461 bull0 +[(Something like a cross between )2(%define)0( and )2(%assign)0(. The "x" suffix stands for "eXpand", so)]450 bull0 +[("xdefine" can be deciphered as "expand-and-define". Thus you can do things like this:)]439 bull2 +[2( %assign ofs 0 )]422 code1 +[2()]411 code0 +[2( %macro arg 1 )]400 code0 +[2( %xdefine %1 dword [esp+ofs] )]389 code0 +[2( %assign ofs ofs+4 )]378 code0 +[2( %endmacro)]367 code2 +[(Changed the place where the expansion of %$name macros are expanded. Now they are converted into)]350 bull1 +[(..@ctxnum.name form when detokenizing, so there are no quirks as before when using %$name arguments)]339 bull0 +[(to macros, in macros etc. For example:)]328 bull2 +[2( %macro abc 1 )]311 code1 +[2( %define %1 hello )]300 code0 +[2( %endm )]289 code0 +[2()]278 code0 +[2( abc %$here )]267 code0 +[2( %$here)]256 code2 +[(Now last line will be expanded into "hello" as expected. This also allows for lots of goodies, a good example)]239 norm1 +[(are extended "proc" macros included in this archive.)]228 norm2 +[(Added a check for "cstk" in smacro_defined\(\) before calling get_ctx\(\) \226 this allows for things like:)]211 bull3 +[2( %ifdef %$abc )]194 code1 +[2( %endif)]183 code2 +[(to work without warnings even in no context.)]166 norm3 +[(Added a check for "cstk" in %if*ctx and %elif*ctx directives \226 this allows to use )2(%ifctx)0( without)]149 bull1 +[(excessive warnings. If there is no active context, )2(%ifctx)0( goes through "false" branch.)]138 bull2 +[(Removed "user error: " prefix with )2(%error)0( directive: it just clobbers the output and has absolutely no)]121 bull1 +[(functionality. Besides, this allows to write macros that does not differ from built-in functions in any way.)]110 bull2 +(193)pageodd +restore showpage +%%Page: 194 194 +%%BeginPageSetup +save +%%EndPageSetup +/194 pa +[(Added expansion of string that is output by )2(%error)0( directive. Now you can do things like:)]681 bull3 +[2( %define hello\(x\) Hello, x! )]664 code1 +[2()]653 code0 +[2( %define %$name andy )]642 code0 +[2( %error "hello\(%$name\)")]631 code2 +[(Same happened with )2(%include)0( directive.)]614 norm3 +[(Now all directives that expect an identifier will try to expand and concatenate everything without)]597 bull1 +[(whitespaces in between before usage. For example, with "unfixed" nasm the commands)]586 bull2 +[2( %define %$abc hello )]569 code1 +[2( %define __%$abc goodbye )]558 code0 +[2( __%$abc)]547 code2 +[(would produce "incorrect" output: last line will expand to)]530 norm3 +[2( hello goodbyehello)]513 code3 +[(Not quite what you expected, eh? :-\) The answer is that preprocessor treats the )2(%define)0( construct as if it)]496 norm1 +[(would be)]485 norm2 +[2( %define __ %$abc goodbye)]468 code3 +[(\(note the white space between __ and %$abc\). After my "fix" it will "correctly" expand into)]451 norm3 +[2( goodbye)]434 code3 +[(as expected. Note that I use quotes around words "correct", "incorrect" etc because this is rather a feature not)]417 norm1 +[(a bug; however current behaviour is more logical \(and allows more advanced macro usage :-\).)]406 norm2 +[(Same change was applied to: )2(%push)0(,)2(%macro)0(,)2(%imacro)0(,)2(%define)0(,)2(%idefine)0(,)2(%xdefine)0(,)2(%ixdefine)0(,)]389 norm1 +[2(%assign)0(,)2(%iassign)0(,)2(%undef)]378 norm2 +[(A new directive [WARNING {+|-}warning-id] have been added. It works only if the assembly phase is)]361 bull1 +[(enabled \(i.e. it doesn't work with nasm \226e\).)]350 bull2 +[(A new warning type: macro-selfref. By default this warning is disabled; when enabled NASM warns when)]333 bull1 +[(a macro self-references itself; for example the following source:)]322 bull2 +[2( [WARNING macro-selfref] )]305 code1 +[2()]294 code0 +[2( %macro push 1-* )]283 code0 +[2( %rep %0 )]272 code0 +[2( push %1 )]261 code0 +[2( %rotate 1 )]250 code0 +[2( %endrep )]239 code0 +[2( %endmacro )]228 code0 +[2()]217 code0 +[2( push eax,ebx,ecx)]206 code2 +[(will produce a warning, but if we remove the first line we won't see it anymore \(which is The Right Thing To)]189 norm1 +[(Do {tm} IMHO since C preprocessor eats such constructs without warnings at all\).)]178 norm2 +[(Added a "error" routine to preprocessor which always will set ERR_PASS1 bit in severity_code. This)]161 bull1 +[(removes annoying repeated errors on first and second passes from preprocessor.)]150 bull2 +[(Added the %+ operator in single-line macros for concatenating two identifiers. Usage example:)]133 bull3 +(194)pageeven +restore showpage +%%Page: 195 195 +%%BeginPageSetup +save +%%EndPageSetup +/195 pa +[2( %define _myfunc _otherfunc )]681 code1 +[2( %define cextern\(x\) _ %+ x )]670 code0 +[2( cextern \(myfunc\))]659 code2 +[(After first expansion, third line will become "_myfunc". After this expansion is performed again so it)]642 norm1 +[(becomes "_otherunc".)]631 norm2 +[(Now if preprocessor is in a non-emitting state, no warning or error will be emitted. Example:)]614 bull3 +[2( %if 1 )]597 code1 +[2( mov eax,ebx )]586 code0 +[2( %else )]575 code0 +[2( put anything you want between these two brackets, )]564 code0 +[2( even macro-parameter references %1 or local )]553 code0 +[2( labels %$zz or macro-local labels %%zz - no )]542 code0 +[2( warning will be emitted. )]531 code0 +[2( %endif)]520 code2 +[(Context-local variables on expansion as a last resort are looked up in outer contexts. For example, the)]503 bull1 +[(following piece:)]492 bull2 +[2( %push outer )]475 code1 +[2( %define %$a [esp] )]464 code0 +[2()]453 code0 +[2( %push inner )]442 code0 +[2( %$a )]431 code0 +[2( %pop )]420 code0 +[2( %pop)]409 code2 +[(will expand correctly the fourth line to [esp]; if we'll define another %$a inside the "inner" context, it will)]392 norm1 +[(take precedence over outer definition. However, this modification has been applied only to expand_smacro)]381 norm0 +[(and not to smacro_define: as a consequence expansion looks in outer contexts, but )2(%ifdef)0( won't look in)]370 norm0 +[(outer contexts.)]359 norm2 +[(This behaviour is needed because we don't want nested contexts to act on already defined local macros.)]342 norm1 +[(Example:)]331 norm2 +[2( %define %$arg1 [esp+4] )]314 code1 +[2( test eax,eax )]303 code0 +[2( if nz )]292 code0 +[2( mov eax,%$arg1 )]281 code0 +[2( endif)]270 code2 +[(In this example the "if" mmacro enters into the "if" context, so %$arg1 is not valid anymore inside "if". Of)]253 norm1 +[(course it could be worked around by using explicitely %$$arg1 but this is ugly IMHO.)]242 norm2 +[(Fixed memory leak in )2(%undef)0(. The origline wasn't freed before exiting on success.)]225 bull3 +[(Fixed trap in preprocessor when line expanded to empty set of tokens. This happens, for example, in the)]208 bull1 +[(following case:)]197 bull2 +[2( #define SOMETHING )]180 code1 +[2( SOMETHING)]169 code2 +[{/section-C.2.41 xa}(Version 0.98)](C.2.41)149.8 subh3 +[(All changes since NASM 0.98p3 have been produced by H. Peter Anvin <hpa@zytor.com>.)]132.8 norm3 +[(The documentation comment delimiter is)]115.8 bull3 +(195)pageodd +restore showpage +%%Page: 196 196 +%%BeginPageSetup +save +%%EndPageSetup +/196 pa +[(Allow EQU definitions to refer to external labels; reported by Pedro Gimeno.)]681 bull3 +[(Re-enable support for RDOFF v1; reported by Pedro Gimeno.)]664 bull3 +[(Updated License file per OK from Simon and Julian.)]647 bull3 +[{/section-C.2.42 xa}(Version 0.98p9)](C.2.42)627.8 subh3 +[(Update documentation \(although the instruction set reference will have to wait; I don't want to hold up the)]610.8 bull1 +[(0.98 release for it.\))]599.8 bull2 +[(Verified that the NASM implementation of the PEXTRW and PMOVMSKB instructions is correct. The)]582.8 bull1 +[(encoding differs from what the Intel manuals document, but the Pentium III behaviour matches NASM, not)]571.8 bull0 +[(the Intel manuals.)]560.8 bull2 +[(Fix handling of implicit sizes in PSHUFW and PINSRW, reported by Stefan Hoffmeister.)]543.8 bull3 +[(Resurrect the \226s option, which was removed when changing the diagnostic output to stdout.)]526.8 bull3 +[{/section-C.2.43 xa}(Version 0.98p8)](C.2.43)507.6 subh3 +[(Fix for "DB" when NASM is running on a bigendian machine.)]490.6 bull3 +[(Invoke insns.pl once for each output script, making Makefile.in legal for "make \226j".)]473.6 bull3 +[(Improve the Unix configure-based makefiles to make package creation easier.)]456.6 bull3 +[(Included an RPM .spec file for building RPM \(RedHat Package Manager\) packages on Linux or Unix)]439.6 bull1 +[(systems.)]428.6 bull2 +[(Fix Makefile dependency problems.)]411.6 bull3 +[(Change src/rdsrc.pl to include sectioning information in info output; required for install-info to work.)]394.6 bull3 +[(Updated the RDOFF distribution to version 2 from Jules; minor massaging to make it compile in my)]377.6 bull1 +[(environment.)]366.6 bull2 +[(Split doc files that can be built by anyone with a Perl interpreter off into a separate archive.)]349.6 bull3 +[("Dress rehearsal" release!)]332.6 bull3 +[{/section-C.2.44 xa}(Version 0.98p7)](C.2.44)313.4 subh3 +[(Fixed opcodes with a third byte-sized immediate argument to not complain if given "byte" on the)]296.4 bull1 +[(immediate.)]285.4 bull2 +[(Allow )2(%undef)0( to remove single-line macros with arguments. This matches the behaviour of #undef in the)]268.4 bull1 +[(C preprocessor.)]257.4 bull2 +[(Allow \226d, \226u, \226i and \226p to be specified as \226D, \226U, \226I and \226P for compatibility with most C compilers and)]240.4 bull1 +[(preprocessors. This allows Makefile options to be shared between cc and nasm, for example.)]229.4 bull2 +[(Minor cleanups.)]212.4 bull3 +[(Went through the list of Katmai instructions and hopefully fixed the \(rather few\) mistakes in it.)]195.4 bull3 +[(\(Hopefully\) fixed a number of disassembler bugs related to ambiguous instructions \(disambiguated by \226p\))]178.4 bull1 +[(and SSE instructions with REP.)]167.4 bull2 +[(Fix for bug reported by Mark Junger: "call dword 0x12345678" should work and may add an OSP)]150.4 bull1 +[(\(affected CALL, JMP, Jcc\).)]139.4 bull2 +[(Fix for environments when "stderr" isn't a compile-time constant.)]122.4 bull3 +(196)pageeven +restore showpage +%%Page: 197 197 +%%BeginPageSetup +save +%%EndPageSetup +/197 pa +[{/section-C.2.45 xa}(Version 0.98p6)](C.2.45)678.8 subh3 +[(Took officially over coordination of the 0.98 release; so drop the p3.x notation. Skipped p4 and p5 to avoid)]661.8 bull1 +[(confusion with John Fine's J4 and J5 releases.)]650.8 bull2 +[(Update the documentation; however, it still doesn't include documentation for the various new)]633.8 bull1 +[(instructions. I somehow wonder if it makes sense to have an instruction set reference in the assembler)]622.8 bull0 +[(manual when Intel et al have PDF versions of their manuals online.)]611.8 bull2 +[(Recognize "idt" or "centaur" for the \226p option to ndisasm.)]594.8 bull3 +[(Changed error messages back to stderr where they belong, but add an \226E option to redirect them elsewhere)]577.8 bull1 +[(\(the DOS shell cannot redirect stderr.\))]566.8 bull2 +[(\226M option to generate Makefile dependencies \(based on code from Alex Verstak.\))]549.8 bull3 +[2(%undef)0( preprocessor directive, and \226u option, that undefines a single-line macro.)]532.8 bull3 +[(OS/2 Makefile \(Mkfiles/Makefile.os2\) for Borland under OS/2; from Chuck Crayne.)]515.8 bull3 +[(Various minor bugfixes \(reported by\): \226 Dangling )2(%s)0( in preproc.c \(Martin Junker\))]498.8 bull3 +[(THERE ARE KNOWN BUGS IN SSE AND THE OTHER KATMAI INSTRUCTIONS. I am on a trip)]481.8 bull1 +[(and didn't bring the Katmai instruction reference, so I can't work on them right now.)]470.8 bull2 +[(Updated the License file per agreement with Simon and Jules to include a GPL distribution clause.)]453.8 bull3 +[{/section-C.2.46 xa}(Version 0.98p3.7)](C.2.46)434.6 subh3 +[(\(Hopefully\) fixed the canned Makefiles to include the outrdf2 and zoutieee modules.)]417.6 bull3 +[(Renamed changes.asm to changed.asm.)]400.6 bull3 +[{/section-C.2.47 xa}(Version 0.98p3.6)](C.2.47)381.4 subh3 +[(Fixed a bunch of instructions that were added in 0.98p3.5 which had memory operands, and the)]364.4 bull1 +[(address-size prefix was missing from the instruction pattern.)]353.4 bull2 +[{/section-C.2.48 xa}(Version 0.98p3.5)](C.2.48)334.2 subh3 +[(Merged in changes from John S. Fine's 0.98-J5 release. John's based 0.98-J5 on my 0.98p3.3 release; this)]317.2 bull1 +[(merges the changes.)]306.2 bull2 +[(Expanded the instructions flag field to a long so we can fit more flags; mark SSE \(KNI\) and AMD or)]289.2 bull1 +[(Katmai-specific instructions as such.)]278.2 bull2 +[(Fix the "PRIV" flag on a bunch of instructions, and create new "PROT" flag for protected-mode-only)]261.2 bull1 +[(instructions \(orthogonal to if the instruction is privileged!\) and new "SMM" flag for SMM-only)]250.2 bull0 +[(instructions.)]239.2 bull2 +[(Added AMD-only SYSCALL and SYSRET instructions.)]222.2 bull3 +[(Make SSE actually work, and add new Katmai MMX instructions.)]205.2 bull3 +[(Added a \226p \(preferred vendor\) option to ndisasm so that it can distinguish e.g. Cyrix opcodes also used in)]188.2 bull1 +[(SSE. For example:)]177.2 bull2 +[2( ndisasm -p cyrix aliased.bin )]160.2 code1 +[2( 00000000 670F514310 paddsiw mm0,[ebx+0x10] )]149.2 code0 +[2( 00000005 670F514320 paddsiw mm0,[ebx+0x20] )]138.2 code0 +[2( ndisasm -p intel aliased.bin )]127.2 code0 +[2( 00000000 670F514310 sqrtps xmm0,[ebx+0x10] )]116.2 code0 +[2( 00000005 670F514320 sqrtps xmm0,[ebx+0x20])]105.2 code2 +(197)pageodd +restore showpage +%%Page: 198 198 +%%BeginPageSetup +save +%%EndPageSetup +/198 pa +[(Added a bunch of Cyrix-specific instructions.)]681 bull3 +[{/section-C.2.49 xa}(Version 0.98p3.4)](C.2.49)661.8 subh3 +[(Made at least an attempt to modify all the additional Makefiles \(in the Mkfiles directory\). I can't test it, but)]644.8 bull1 +[(this was the best I could do.)]633.8 bull2 +[(DOS DJGPP+"Opus Make" Makefile from John S. Fine.)]616.8 bull3 +[(changes.asm changes from John S. Fine.)]599.8 bull3 +[{/section-C.2.50 xa}(Version 0.98p3.3)](C.2.50)580.6 subh3 +[(Patch from Conan Brink to allow nesting of )2(%rep)0( directives.)]563.6 bull3 +[(If we're going to allow INT01 as an alias for INT1/ICEBP \(one of Jules 0.98p3 changes\), then we should)]546.6 bull1 +[(allow INT03 as an alias for INT3 as well.)]535.6 bull2 +[(Updated changes.asm to include the latest changes.)]518.6 bull3 +[(Tried to clean up the <CR>s that had snuck in from a DOS/Windows environment into my Unix)]501.6 bull1 +[(environment, and try to make sure than DOS/Windows users get them back.)]490.6 bull2 +[(We would silently generate broken tools if insns.dat wasn't sorted properly. Change insns.pl so that the)]473.6 bull1 +[(order doesn't matter.)]462.6 bull2 +[(Fix bug in insns.pl \(introduced by me\) which would cause conditional instructions to have an extra "cc" in)]445.6 bull1 +[(disassembly, e.g. "jnz" disassembled as "jccnz".)]434.6 bull2 +[{/section-C.2.51 xa}(Version 0.98p3.2)](C.2.51)415.4 subh3 +[(Merged in John S. Fine's changes from his 0.98-J4 prerelease; see http://www.csoft.net/cz/johnfine/)]398.4 bull3 +[(Changed previous "spotless" Makefile target \(appropriate for distribution\) to "distclean", and added)]381.4 bull1 +[("cleaner" target which is same as "clean" except deletes files generated by Perl scripts; "spotless" is union.)]370.4 bull2 +[(Removed BASIC programs from distribution. Get a Perl interpreter instead \(see below.\))]353.4 bull3 +[(Calling this "pre-release 3.2" rather than "p3-hpa2" because of John's contributions.)]336.4 bull3 +[(Actually link in the IEEE output format \(zoutieee.c\); fix a bunch of compiler warnings in that file. Note I)]319.4 bull1 +[(don't know what IEEE output is supposed to look like, so these changes were made "blind".)]308.4 bull2 +[{/section-C.2.52 xa}(Version 0.98p3-hpa)](C.2.52)289.2 subh3 +[(Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully buildable version for Unix systems)]272.2 bull1 +[(\(Makefile.in updates, etc.\))]261.2 bull2 +[(Changed insns.pl to create the instruction tables in nasm.h and names.c, so that a new instruction can be)]244.2 bull1 +[(added by adding it *only* to insns.dat.)]233.2 bull2 +[(Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE, FXRSTOR, UD1, UD2 \(the)]216.2 bull1 +[(latter two are two opcodes that Intel guarantee will never be used; one of them is documented as UD2 in)]205.2 bull0 +[(Intel documentation, the other one just as "Undefined Opcode" \226\226 calling it UD1 seemed to make sense.\))]194.2 bull2 +[(MAX_SYMBOL was defined to be 9, but LOADALL286 and LOADALL386 are 10 characters long. Now)]177.2 bull1 +[(MAX_SYMBOL is derived from insns.dat.)]166.2 bull2 +[(A note on the BASIC programs included: forget them. insns.bas is already out of date. Get yourself a Perl)]149.2 bull1 +[(interpreter for your platform of choice at ){(http://www.cpan.org/ports/index.html)wl}(http://www.cpan.org/ports/index.html){el}(.)]138.2 bull2 +[{/section-C.2.53 xa}(Version 0.98 pre-release 3)](C.2.53)119 subh3 +[(added response file support, improved command line handling, new layout help screen)]102 bull3 +(198)pageeven +restore showpage +%%Page: 199 199 +%%BeginPageSetup +save +%%EndPageSetup +/199 pa +[(fixed limit checking bug, 'OUT byte nn, reg' bug, and a couple of rdoff related bugs, updated Wishlist;)]681 bull1 +[(0.98 Prerelease 3.)]670 bull2 +[{/section-C.2.54 xa}(Version 0.98 pre-release 2)](C.2.54)650.8 subh3 +[(fixed bug in outcoff.c to do with truncating section names longer than 8 characters, referencing beyond end)]633.8 bull1 +[(of string; 0.98 pre-release 2)]622.8 bull2 +[{/section-C.2.55 xa}(Version 0.98 pre-release 1)](C.2.55)603.6 subh3 +[(Fixed a bug whereby STRUC didn't work at all in RDF.)]586.6 bull3 +[(Fixed a problem with group specification in PUBDEFs in OBJ.)]569.6 bull3 +[(Improved ease of adding new output formats. Contribution due to Fox Cutter.)]552.6 bull3 +[(Fixed a bug in relocations in the `bin' format: was showing up when a relocatable reference crossed an)]535.6 bull1 +[(8192-byte boundary in any output section.)]524.6 bull2 +[(Fixed a bug in local labels: local-label lookups were inconsistent between passes one and two if an EQU)]507.6 bull1 +[(occurred between the definition of a global label and the subsequent use of a local label local to that global.)]496.6 bull2 +[(Fixed a seg-fault in the preprocessor \(again\) which happened when you use a blank line as the first line of)]479.6 bull1 +[(a multi-line macro definition and then defined a label on the same line as a call to that macro.)]468.6 bull2 +[(Fixed a stale-pointer bug in the handling of the NASM environment variable. Thanks to Thomas)]451.6 bull1 +[(McWilliams.)]440.6 bull2 +[(ELF had a hard limit on the number of sections which caused segfaults when transgressed. Fixed.)]423.6 bull3 +[(Added ability for ndisasm to read from stdin by using `-' as the filename.)]406.6 bull3 +[(ndisasm wasn't outputting the TO keyword. Fixed.)]389.6 bull3 +[(Fixed error cascade on bogus expression in )2(%if)0( \226 an error in evaluation was causing the entire )2(%if)0( to be)]372.6 bull1 +[(discarded, thus creating trouble later when the )2(%else)0( or )2(%endif)0( was encountered.)]361.6 bull2 +[(Forward reference tracking was instruction-granular not operand- granular, which was causing)]344.6 bull1 +[(286-specific code to be generated needlessly on code of the form `shr word [forwardref],1'. Thanks to Jim)]333.6 bull0 +[(Hague for sending a patch.)]322.6 bull2 +[(All messages now appear on stdout, as sending them to stderr serves no useful purpose other than to make)]305.6 bull1 +[(redirection difficult.)]294.6 bull2 +[(Fixed the problem with EQUs pointing to an external symbol \226 this now generates an error message.)]277.6 bull3 +[(Allowed multiple size prefixes to an operand, of which only the first is taken into account.)]260.6 bull3 +[(Incorporated John Fine's changes, including fixes of a large number of preprocessor bugs, some small)]243.6 bull1 +[(problems in OBJ, and a reworking of label handling to define labels before their line is assembled, rather)]232.6 bull0 +[(than after.)]221.6 bull2 +[(Reformatted a lot of the source code to be more readable. Included 'coding.txt' as a guideline for how to)]204.6 bull1 +[(format code for contributors.)]193.6 bull2 +[(Stopped nested )2(%reps)0( causing a panic \226 they now cause a slightly more friendly error message instead.)]176.6 bull3 +[(Fixed floating point constant problems \(patch by Pedro Gimeno\))]159.6 bull3 +[(Fixed the return value of insn_size\(\) not being checked for \2261, indicating an error.)]142.6 bull3 +[(Incorporated 3Dnow! instructions.)]125.6 bull3 +[(Fixed the 'mov eax, eax + ebx' bug.)]108.6 bull3 +(199)pageodd +restore showpage +%%Page: 200 200 +%%BeginPageSetup +save +%%EndPageSetup +/200 pa +[(Fixed the GLOBAL EQU bug in ELF. Released developers release 3.)]681 bull3 +[(Incorporated John Fine's command line parsing changes)]664 bull3 +[(Incorporated David Lindauer's OMF debug support)]647 bull3 +[(Made changes for LCC 4.0 support \()2(__NASM_CDecl__)0(, removed register size specification warning)]630 bull1 +[(when sizes agree\).)]619 bull2 +[{/section-C.3 xa}(NASM 0.9 Series)](C.3)597.6 head3 +[(Revisions before 0.98.)]580.6 norm3 +[{/section-C.3.1 xa}(Version 0.97 released December 1997)](C.3.1)561.4 subh3 +[(This was entirely a bug-fix release to 0.96, which seems to have got cursed. Silly me.)]544.4 bull3 +[(Fixed stupid mistake in OBJ which caused `MOV EAX,<constant>' to fail. Caused by an error in the)]527.4 bull1 +[(`MOV EAX,<segment>' support.)]516.4 bull2 +[(ndisasm hung at EOF when compiled with lcc on Linux because lcc on Linux somehow breaks feof\(\).)]499.4 bull1 +[(ndisasm now does not rely on feof\(\).)]488.4 bull2 +[(A heading in the documentation was missing due to a markup error in the indexing. Fixed.)]471.4 bull3 +[(Fixed failure to update all pointers on realloc\(\) within extended- operand code in parser.c. Was causing)]454.4 bull1 +[(wrong behaviour and seg faults on lines such as `dd 0.0,0.0,0.0,0.0,...')]443.4 bull2 +[(Fixed a subtle preprocessor bug whereby invoking one multi-line macro on the first line of the expansion)]426.4 bull1 +[(of another, when the second had been invoked with a label defined before it, didn't expand the inner macro.)]415.4 bull2 +[(Added internal.doc back in to the distribution archives \226 it was missing in 0.96 *blush*)]398.4 bull3 +[(Fixed bug causing 0.96 to be unable to assemble its own test files, specifically objtest.asm. *blush again*)]381.4 bull3 +[(Fixed seg-faults and bogus error messages caused by mismatching )2(%rep)0( and )2(%endrep)0( within multi-line)]364.4 bull1 +[(macro definitions.)]353.4 bull2 +[(Fixed a problem with buffer overrun in OBJ, which was causing corruption at ends of long PUBDEF)]336.4 bull1 +[(records.)]325.4 bull2 +[(Separated DOS archives into main-program and documentation to reduce download size.)]308.4 bull3 +[{/section-C.3.2 xa}(Version 0.96 released November 1997)](C.3.2)289.2 subh3 +[(Fixed a bug whereby, if `nasm sourcefile' would cause a filename collision warning and put output into)]272.2 bull1 +[(`nasm.out', then `nasm sourcefile \226o outputfile' still gave the warning even though the `-o' was honoured.)]261.2 bull0 +[(Fixed name pollution under Digital UNIX: one of its header files defined R_SP, which broke the enum in)]250.2 bull0 +[(nasm.h.)]239.2 bull2 +[(Fixed minor instruction table problems: FUCOM and FUCOMP didn't have two-operand forms;)]222.2 bull1 +[(NDISASM didn't recognise the longer register forms of PUSH and POP \(eg FF F3 for PUSH BX\); TEST)]211.2 bull0 +[(mem,imm32 was flagged as undocumented; the 32-bit forms of CMOV had 16-bit operand size prefixes;)]200.2 bull0 +[(`AAD imm' and `AAM imm' are no longer flagged as undocumented because the Intel Architecture)]189.2 bull0 +[(reference documents them.)]178.2 bull2 +[(Fixed a problem with the local-label mechanism, whereby strange types of symbol \(EQUs, auto-defined)]161.2 bull1 +[(OBJ segment base symbols\) interfered with the `previous global label' value and screwed up local labels.)]150.2 bull2 +[(Fixed a bug whereby the stub preprocessor didn't communicate with the listing file generator, so that the)]133.2 bull1 +[(\226a and \226l options in conjunction would produce a useless listing file.)]122.2 bull2 +(200)pageeven +restore showpage +%%Page: 201 201 +%%BeginPageSetup +save +%%EndPageSetup +/201 pa +[(Merged `os2' object file format back into `obj', after discovering that `obj' _also_ shouldn't have a link)]681 bull1 +[(pass separator in a module containing a non-trivial MODEND. Flat segments are now declared using the)]670 bull0 +[(FLAT attribute. `os2' is no longer a valid object format name: use `obj'.)]659 bull2 +[(Removed the fixed-size temporary storage in the evaluator. Very very long expressions \(like `mov)]642 bull1 +[(ax,1+1+1+1+...' for two hundred 1s or so\) should now no longer crash NASM.)]631 bull2 +[(Fixed a bug involving segfaults on disassembly of MMX instructions, by changing the meaning of one of)]614 bull1 +[(the operand-type flags in nasm.h. This may cause other apparently unrelated MMX problems; it needs to)]603 bull0 +[(be tested thoroughly.)]592 bull2 +[(Fixed some buffer overrun problems with large OBJ output files. Thanks to DJ Delorie for the bug report)]575 bull1 +[(and fix.)]564 bull2 +[(Made preprocess-only mode actually listen to the )2(%line)0( markers as it prints them, so that it can report)]547 bull1 +[(errors more sanely.)]536 bull2 +[(Re-designed the evaluator to keep more sensible track of expressions involving forward references: can)]519 bull1 +[(now cope with previously-nightmare situations such as:)]508 bull2 +[2( mov ax,foo | bar )]491 code1 +[2( foo equ 1 )]480 code0 +[2( bar equ 2)]469 code2 +[(Added the ALIGN and ALIGNB standard macros.)]452 bull3 +[(Added PIC support in ELF: use of WRT to obtain the four extra relocation types needed.)]435 bull3 +[(Added the ability for output file formats to define their own extensions to the GLOBAL, COMMON and)]418 bull1 +[(EXTERN directives.)]407 bull2 +[(Implemented common-variable alignment, and global-symbol type and size declarations, in ELF.)]390 bull3 +[(Implemented NEAR and FAR keywords for common variables, plus far-common element size)]373 bull1 +[(specification, in OBJ.)]362 bull2 +[(Added a feature whereby EXTERNs and COMMONs in OBJ can be given a default WRT specification)]345 bull1 +[(\(either a segment or a group\).)]334 bull2 +[(Transformed the Unix NASM archive into an auto-configuring package.)]317 bull3 +[(Added a sanity-check for people applying SEG to things which are already segment bases: this previously)]300 bull1 +[(went unnoticed by the SEG processing and caused OBJ-driver panics later.)]289 bull2 +[(Added the ability, in OBJ format, to deal with `MOV EAX,<segment>' type references: OBJ doesn't)]272 bull1 +[(directly support dword-size segment base fixups, but as long as the low two bytes of the constant term are)]261 bull0 +[(zero, a word-size fixup can be generated instead and it will work.)]250 bull2 +[(Added the ability to specify sections' alignment requirements in Win32 object files and pure binary files.)]233 bull3 +[(Added preprocess-time expression evaluation: the )2(%assign)0( \(and )2(%iassign)0(\) directive and the bare )2(%if)]216 bull1 +[(\(and )2(%elif)0(\) conditional. Added relational operators to the evaluator, for use only in )2(%if)0( constructs: the)]205 bull0 +[(standard relationals = < > <= >= <> \(and C-like synonyms == and !=\) plus low-precedence logical)]194 bull0 +[(operators &&, ^^ and ||.)]183 bull2 +[(Added a preprocessor repeat construct: )2(%rep)0( / )2(%exitrep)0( / )2(%endrep)0(.)]166 bull3 +[(Added the __FILE__ and __LINE__ standard macros.)]149 bull3 +[(Added a sanity check for number constants being greater than 0xFFFFFFFF. The warning can be disabled.)]132 bull3 +[(Added the %0 token whereby a variadic multi-line macro can tell how many parameters it's been given in)]115 bull1 +[(a specific invocation.)]104 bull2 +(201)pageodd +restore showpage +%%Page: 202 202 +%%BeginPageSetup +save +%%EndPageSetup +/202 pa +[(Added )2(%rotate)0(, allowing multi-line macro parameters to be cycled.)]681 bull3 +[(Added the `*' option for the maximum parameter count on multi-line macros, allowing them to take)]664 bull1 +[(arbitrarily many parameters.)]653 bull2 +[(Added the ability for the user-level forms of EXTERN, GLOBAL and COMMON to take more than one)]636 bull1 +[(argument.)]625 bull2 +[(Added the IMPORT and EXPORT directives in OBJ format, to deal with Windows DLLs.)]608 bull3 +[(Added some more preprocessor )2(%if)0( constructs: )2(%ifidn)0( / )2(%ifidni)0( \(exact textual identity\), and )2(%ifid)]591 bull1 +[(/ )2(%ifnum)0( / )2(%ifstr)0( \(token type testing\).)]580 bull2 +[(Added the ability to distinguish SHL AX,1 \(the 8086 version\) from SHL AX,BYTE 1 \(the)]563 bull1 +[(286-and-upwards version whose constant happens to be 1\).)]552 bull2 +[(Added NetBSD/FreeBSD/OpenBSD's variant of a.out format, complete with PIC shared library features.)]535 bull3 +[(Changed NASM's idiosyncratic handling of FCLEX, FDISI, FENI, FINIT, FSAVE, FSTCW, FSTENV,)]518 bull1 +[(and FSTSW to bring it into line with the otherwise accepted standard. The previous behaviour, though it)]507 bull0 +[(was a deliberate feature, was a deliberate feature based on a misunderstanding. Apologies for the)]496 bull0 +[(inconvenience.)]485 bull2 +[(Improved the flexibility of ABSOLUTE: you can now give it an expression rather than being restricted to a)]468 bull1 +[(constant, and it can take relocatable arguments as well.)]457 bull2 +[(Added the ability for a variable to be declared as EXTERN multiple times, and the subsequent definitions)]440 bull1 +[(are just ignored.)]429 bull2 +[(We now allow instruction prefixes \(CS, DS, LOCK, REPZ etc\) to be alone on a line \(without a following)]412 bull1 +[(instruction\).)]401 bull2 +[(Improved sanity checks on whether the arguments to EXTERN, GLOBAL and COMMON are valid)]384 bull1 +[(identifiers.)]373 bull2 +[(Added misc/exebin.mac to allow direct generation of .EXE files by hacking up an EXE header using DB)]356 bull1 +[(and DW; also added test/binexe.asm to demonstrate the use of this. Thanks to Yann Guidon for)]345 bull0 +[(contributing the EXE header code.)]334 bull2 +[(ndisasm forgot to check whether the input file had been successfully opened. Now it does. Doh!)]317 bull3 +[(Added the Cyrix extensions to the MMX instruction set.)]300 bull3 +[(Added a hinting mechanism to allow [EAX+EBX] and [EBX+EAX] to be assembled differently. This is)]283 bull1 +[(important since [ESI+EBP] and [EBP+ESI] have different default base segment registers.)]272 bull2 +[(Added support for the PharLap OMF extension for 4096-byte segment alignment.)]255 bull3 +[{/section-C.3.3 xa}(Version 0.95 released July 1997)](C.3.3)235.8 subh3 +[(Fixed yet another ELF bug. This one manifested if the user relied on the default segment, and attempted to)]218.8 bull1 +[(define global symbols without first explicitly declaring the target segment.)]207.8 bull2 +[(Added makefiles \(for NASM and the RDF tools\) to build Win32 console apps under Symantec C++.)]190.8 bull1 +[(Donated by Mark Junker.)]179.8 bull2 +[(Added `macros.bas' and `insns.bas', QBasic versions of the Perl scripts that convert `standard.mac' to)]162.8 bull1 +[(`macros.c' and convert `insns.dat' to `insnsa.c' and `insnsd.c'. Also thanks to Mark Junker.)]151.8 bull2 +[(Changed the diassembled forms of the conditional instructions so that JB is now emitted as JC, and other)]134.8 bull1 +[(similar changes. Suggested list by Ulrich Doewich.)]123.8 bull2 +[(Added `@' to the list of valid characters to begin an identifier with.)]106.8 bull3 +(202)pageeven +restore showpage +%%Page: 203 203 +%%BeginPageSetup +save +%%EndPageSetup +/203 pa +[(Documentary changes, notably the addition of the `Common Problems' section in nasm.doc.)]681 bull3 +[(Fixed a bug relating to 32-bit PC-relative fixups in OBJ.)]664 bull3 +[(Fixed a bug in perm_copy\(\) in labels.c which was causing exceptions in cleanup_labels\(\) on some systems.)]647 bull3 +[(Positivity sanity check in TIMES argument changed from a warning to an error following a further)]630 bull1 +[(complaint.)]619 bull2 +[(Changed the acceptable limits on byte and word operands to allow things like `~10111001b' to work.)]602 bull3 +[(Fixed a major problem in the preprocessor which caused seg-faults if macro definitions contained blank)]585 bull1 +[(lines or comment-only lines.)]574 bull2 +[(Fixed inadequate error checking on the commas separating the arguments to `db', `dw' etc.)]557 bull3 +[(Fixed a crippling bug in the handling of macros with operand counts defined with a `+' modifier.)]540 bull3 +[(Fixed a bug whereby object file formats which stored the input file name in the output file \(such as OBJ)]523 bull1 +[(and COFF\) weren't doing so correctly when the output file name was specified on the command line.)]512 bull2 +[(Removed [INC] and [INCLUDE] support for good, since they were obsolete anyway.)]495 bull3 +[(Fixed a bug in OBJ which caused all fixups to be output in 16-bit \(old-format\) FIXUPP records, rather)]478 bull1 +[(than putting the 32-bit ones in FIXUPP32 \(new-format\) records.)]467 bull2 +[(Added, tentatively, OS/2 object file support \(as a minor variant on OBJ\).)]450 bull3 +[(Updates to Fox Cutter's Borland C makefile, Makefile.bc2.)]433 bull3 +[(Removed a spurious second fclose\(\) on the output file.)]416 bull3 +[(Added the `-s' command line option to redirect all messages which would go to stderr \(errors, help text\) to)]399 bull1 +[(stdout instead.)]388 bull2 +[(Added the `-w' command line option to selectively suppress some classes of assembly warning messages.)]371 bull3 +[(Added the `-p' pre-include and `-d' pre-define command-line options.)]354 bull3 +[(Added an include file search path: the `-i' command line option.)]337 bull3 +[(Fixed a silly little preprocessor bug whereby starting a line with a `%!' environment-variable reference)]320 bull1 +[(caused an `unknown directive' error.)]309 bull2 +[(Added the long-awaited listing file support: the `-l' command line option.)]292 bull3 +[(Fixed a problem with OBJ format whereby, in the absence of any explicit segment definition, non-global)]275 bull1 +[(symbols declared in the implicit default segment generated spurious EXTDEF records in the output.)]264 bull2 +[(Added the NASM environment variable.)]247 bull3 +[(From this version forward, Win32 console-mode binaries will be included in the DOS distribution in)]230 bull1 +[(addition to the 16-bit binaries. Added Makefile.vc for this purpose.)]219 bull2 +[(Added `return 0;' to test/objlink.c to prevent compiler warnings.)]202 bull3 +[(Added the __NASM_MAJOR__ and __NASM_MINOR__ standard defines.)]185 bull3 +[(Added an alternative memory-reference syntax in which prefixing an operand with `&' is equivalent to)]168 bull1 +[(enclosing it in square brackets, at the request of Fox Cutter.)]157 bull2 +[(Errors in pass two now cause the program to return a non-zero error code, which they didn't before.)]140 bull3 +[(Fixed the single-line macro cycle detection, which didn't work at all on macros with no parameters)]123 bull1 +[(\(caused an infinite loop\). Also changed the behaviour of single-line macro cycle detection to work like)]112 bull0 +[(cpp, so that macros like `extrn' as given in the documentation can be implemented.)]101 bull2 +(203)pageodd +restore showpage +%%Page: 204 204 +%%BeginPageSetup +save +%%EndPageSetup +/204 pa +[(Fixed the implementation of WRT, which was too restrictive in that you couldn't do `mov ax,[di+abc wrt)]681 bull1 +[(dgroup]' because \(di+abc\) wasn't a relocatable reference.)]670 bull2 +[{/section-C.3.4 xa}(Version 0.94 released April 1997)](C.3.4)650.8 subh3 +[(Major item: added the macro processor.)]633.8 bull3 +[(Added undocumented instructions SMI, IBTS, XBTS and LOADALL286. Also reorganised CMPXCHG)]616.8 bull1 +[(instruction into early-486 and Pentium forms. Thanks to Thobias Jones for the information.)]605.8 bull2 +[(Fixed two more stupid bugs in ELF, which were causing `ld' to continue to seg-fault in a lot of non-trivial)]588.8 bull1 +[(cases.)]577.8 bull2 +[(Fixed a seg-fault in the label manager.)]560.8 bull3 +[(Stopped FBLD and FBSTP from _requiring_ the TWORD keyword, which is the only option for BCD)]543.8 bull1 +[(loads/stores in any case.)]532.8 bull2 +[(Ensured FLDCW, FSTCW and FSTSW can cope with the WORD keyword, if anyone bothers to provide)]515.8 bull1 +[(it. Previously they complained unless no keyword at all was present.)]504.8 bull2 +[(Some forms of FDIV/FDIVR and FSUB/FSUBR were still inverted: a vestige of a bug that I thought had)]487.8 bull1 +[(been fixed in 0.92. This was fixed, hopefully for good this time...)]476.8 bull2 +[(Another minor phase error \(insofar as a phase error can _ever_ be minor\) fixed, this one occurring in code)]459.8 bull1 +[(of the form)]448.8 bull2 +[2( rol ax,forward_reference )]431.8 code1 +[2( forward_reference equ 1)]420.8 code2 +[(The number supplied to TIMES is now sanity-checked for positivity, and also may be greater than 64K)]403.8 bull1 +[(\(which previously didn't work on 16-bit systems\).)]392.8 bull2 +[(Added Watcom C makefiles, and misc/pmw.bat, donated by Dominik Behr.)]375.8 bull3 +[(Added the INCBIN pseudo-opcode.)]358.8 bull3 +[(Due to the advent of the preprocessor, the [INCLUDE] and [INC] directives have become obsolete. They)]341.8 bull1 +[(are still supported in this version, with a warning, but won't be in the next.)]330.8 bull2 +[(Fixed a bug in OBJ format, which caused incorrect object records to be output when absolute labels were)]313.8 bull1 +[(made global.)]302.8 bull2 +[(Updates to RDOFF subdirectory, and changes to outrdf.c.)]285.8 bull3 +[{/section-C.3.5 xa}(Version 0.93 released January 1997)](C.3.5)266.6 subh3 +[(This release went out in a great hurry after semi-crippling bugs were found in 0.92.)]249.6 norm3 +[(Really )1(did)0( fix the stack overflows this time. *blush*)]232.6 bull3 +[(Had problems with EA instruction sizes changing between passes, when an offset contained a forward)]215.6 bull1 +[(reference and so 4 bytes were allocated for the offset in pass one; by pass two the symbol had been defined)]204.6 bull0 +[(and happened to be a small absolute value, so only 1 byte got allocated, causing instruction size mismatch)]193.6 bull0 +[(between passes and hence incorrect address calculations. Fixed.)]182.6 bull2 +[(Stupid bug in the revised ELF section generation fixed \(associated string-table section for .symtab was)]165.6 bull1 +[(hard-coded as 7, even when this didn't fit with the real section table\). Was causing `ld' to seg-fault under)]154.6 bull0 +[(Linux.)]143.6 bull2 +[(Included a new Borland C makefile, Makefile.bc2, donated by Fox Cutter <lmb@comtch.iea.com>.)]126.6 bull3 +(204)pageeven +restore showpage +%%Page: 205 205 +%%BeginPageSetup +save +%%EndPageSetup +/205 pa +[{/section-C.3.6 xa}(Version 0.92 released January 1997)](C.3.6)678.8 subh3 +[(The FDIVP/FDIVRP and FSUBP/FSUBRP pairs had been inverted: this was fixed. This also affected the)]661.8 bull1 +[(LCC driver.)]650.8 bull2 +[(Fixed a bug regarding 32-bit effective addresses of the form )2([other_register+ESP])0(.)]633.8 bull3 +[(Documentary changes, notably documentation of the fact that Borland Win32 compilers use `obj' rather)]616.8 bull1 +[(than `win32' object format.)]605.8 bull2 +[(Fixed the COMENT record in OBJ files, which was formatted incorrectly.)]588.8 bull3 +[(Fixed a bug causing segfaults in large RDF files.)]571.8 bull3 +[(OBJ format now strips initial periods from segment and group definitions, in order to avoid complications)]554.8 bull1 +[(with the local label syntax.)]543.8 bull2 +[(Fixed a bug in disassembling far calls and jumps in NDISASM.)]526.8 bull3 +[(Added support for user-defined sections in COFF and ELF files.)]509.8 bull3 +[(Compiled the DOS binaries with a sensible amount of stack, to prevent stack overflows on any arithmetic)]492.8 bull1 +[(expression containing parentheses.)]481.8 bull2 +[(Fixed a bug in handling of files that do not terminate in a newline.)]464.8 bull3 +[{/section-C.3.7 xa}(Version 0.91 released November 1996)](C.3.7)445.6 subh3 +[(Loads of bug fixes.)]428.6 bull3 +[(Support for RDF added.)]411.6 bull3 +[(Support for DBG debugging format added.)]394.6 bull3 +[(Support for 32-bit extensions to Microsoft OBJ format added.)]377.6 bull3 +[(Revised for Borland C: some variable names changed, makefile added.)]360.6 bull3 +[(LCC support revised to actually work.)]343.6 bull3 +[(JMP/CALL NEAR/FAR notation added.)]326.6 bull3 +[(`a16', `o16', `a32' and `o32' prefixes added.)]309.6 bull3 +[(Range checking on short jumps implemented.)]292.6 bull3 +[(MMX instruction support added.)]275.6 bull3 +[(Negative floating point constant support added.)]258.6 bull3 +[(Memory handling improved to bypass 64K barrier under DOS.)]241.6 bull3 +[2($)0( prefix to force treatment of reserved words as identifiers added.)]224.6 bull3 +[(Default-size mechanism for object formats added.)]207.6 bull3 +[(Compile-time configurability added.)]190.6 bull3 +[2(#)0(, )2(@)0(, )2(~)0( and c{?} are now valid characters in labels.)]173.6 bull3 +[2(-e)0( and )2(-k)0( options in NDISASM added.)]156.6 bull3 +[{/section-C.3.8 xa}(Version 0.90 released October 1996)](C.3.8)137.4 subh3 +[(First release version. First support for object file output. Other changes from previous version \(0.3x\) too)]120.4 norm1 +[(numerous to document.)]109.4 norm2 +(205)pageodd +restore showpage +%%Page: 206 206 +%%BeginPageSetup +save +%%EndPageSetup +/206 pa +[{/index xa}(Index)]642.8 chap3 +[2(!)0( operator, unary)][{/34 pl}(34){el}]607.8 0 idx03 +[2(!=)0( operator)][{/50 pl}(50){el}]596.8 0 idx03 +[2($$)0( token)][{/33 pl}(33,){el}( ){/86 pl}(86){el}]585.8 0 idx03 +[2($)][]574.8 0 idx03 +[(Here token)][{/33 pl}(33){el}]563.8 0 idx13 +[(prefix)][{/26 pl}(26,){el}( ){/29 pl}(29,){el}( ){/89 pl}(89){el}]552.8 0 idx13 +[2(%)0( operator)][{/33 pl}(33){el}]541.8 0 idx03 +[2(%!)][{/60 pl}(60){el}]530.8 0 idx03 +[2(%$)0( and )2(%$$)0( prefixes)][{/54 pl}(54,){el}( ){/55 pl}(55){el}]519.8 0 idx03 +[2(%%)0( operator)][{/33 pl}(33,){el}( ){/44 pl}(44){el}]508.8 0 idx03 +[2(%+)][{/39 pl}(39){el}]497.8 0 idx03 +[2(%?)][{/39 pl}(39){el}]486.8 0 idx03 +[2(%??)][{/39 pl}(39){el}]475.8 0 idx03 +[2(%[)][{/39 pl}(39){el}]464.8 0 idx03 +[2(&)0( operator)][{/33 pl}(33){el}]453.8 0 idx03 +[2(&&)0( operator)][{/50 pl}(50){el}]442.8 0 idx03 +[2(*)0( operator)][{/33 pl}(33){el}]431.8 0 idx03 +[2(+)0( modifier)][{/44 pl}(44){el}]420.8 0 idx03 +[2(+)0( operator)][]409.8 0 idx03 +[(binary)][{/33 pl}(33){el}]398.8 0 idx13 +[(unary)][{/34 pl}(34){el}]387.8 0 idx13 +[2(-)0( operator)][]376.8 0 idx03 +[(binary)][{/33 pl}(33){el}]365.8 0 idx13 +[(unary)][{/34 pl}(34){el}]354.8 0 idx13 +[2(..@)0( symbol prefix)][{/36 pl}(36,){el}( ){/44 pl}(44){el}]343.8 0 idx03 +[2(/)0( operator)][{/33 pl}(33){el}]332.8 0 idx03 +[2(//)0( operator)][{/33 pl}(33){el}]321.8 0 idx03 +[2(<)0( operator)][{/50 pl}(50){el}]310.8 0 idx03 +[2(<<)0( operator)][{/33 pl}(33){el}]299.8 0 idx03 +[2(<=)0( operator)][{/50 pl}(50){el}]288.8 0 idx03 +[2(<>)0( operator)][{/50 pl}(50){el}]277.8 0 idx03 +[2(=)0( operator)][{/50 pl}(50){el}]266.8 0 idx03 +[2(==)0( operator)][{/50 pl}(50){el}]255.8 0 idx03 +[2(>)0( operator)][{/50 pl}(50){el}]244.8 0 idx03 +[2(>=)0( operator)][{/50 pl}(50){el}]233.8 0 idx03 +[2(>>)0( operator)][{/33 pl}(33){el}]222.8 0 idx03 +[2(?)0( MASM syntax)][{/27 pl}(27){el}]211.8 0 idx03 +[2(^)0( operator)][{/33 pl}(33){el}]200.8 0 idx03 +[2(^^)0( operator)][{/50 pl}(50){el}]189.8 0 idx03 +[2(|)0( operator)][{/33 pl}(33){el}]178.8 0 idx03 +[2(||)0( operator)][{/50 pl}(50){el}]167.8 0 idx03 +[2(~)0( operator)][{/34 pl}(34){el}]156.8 0 idx03 +[2(%0)0( parameter count)][{/45 pl}(45){el}]145.8 0 idx03 +[2(%+1)0( and )2(%-1)0( syntax)][{/47 pl}(47){el}]134.8 0 idx03 +[(16-bit mode, versus 32-bit mode)][{/67 pl}(67){el}]123.8 0 idx03 +[(64-bit displacement)][{/114 pl}(114){el}]112.8 0 idx03 +[(64-bit immediate)][{/113 pl}(113){el}]101.8 0 idx03 +[2(-a)0( option)][{/21 pl}(21,){el}( ){/120 pl}(120){el}]607.8 1 idx03 +[2(A16)][{/26 pl}(26){el}]596.8 1 idx03 +[2(a16)][{/111 pl}(111){el}]585.8 1 idx03 +[2(A32)][{/26 pl}(26){el}]574.8 1 idx03 +[2(a32)][{/111 pl}(111){el}]563.8 1 idx03 +[2(A64)][{/26 pl}(26){el}]552.8 1 idx03 +[2(a64)][{/111 pl}(111){el}]541.8 1 idx03 +[2(a86)][{/14 pl}(14,){el}( ){/24 pl}(24,){el}( ){/25 pl}(25){el}]530.8 1 idx03 +[2(ABS)][{/29 pl}(29){el}]519.8 1 idx03 +[2(ABSOLUTE)][{/69 pl}(69,){el}( ){/76 pl}(76){el}]508.8 1 idx03 +[(addition)][{/33 pl}(33){el}]497.8 1 idx03 +[(addressing, mixed-size)][{/110 pl}(110){el}]486.8 1 idx03 +[(address-size prefixes)][{/26 pl}(26){el}]475.8 1 idx03 +[(algebra)][{/29 pl}(29){el}]464.8 1 idx03 +[2(ALIGN)][{/64 pl}(64,){el}( ){/66 pl}(66,){el}( ){/73 pl}(73,){el}( ){/76 pl}(76){el}]453.8 1 idx03 +[(smart)][{/66 pl}(66){el}]442.8 1 idx13 +[2(ALIGNB)][{/64 pl}(64){el}]431.8 1 idx03 +[(alignment)][]420.8 1 idx03 +[(in )2(bin)0( sections)][{/74 pl}(74){el}]409.8 1 idx13 +[(in )2(elf)0( sections)][{/85 pl}(85){el}]398.8 1 idx13 +[(in )2(obj)0( sections)][{/76 pl}(76){el}]387.8 1 idx13 +[(in )2(win32)0( sections)][{/79 pl}(79){el}]376.8 1 idx13 +[(of )2(elf)0( common variables)][{/87 pl}(87){el}]365.8 1 idx13 +[2(ALIGNMODE)][{/66 pl}(66){el}]354.8 1 idx03 +[2(__ALIGNMODE__)][{/66 pl}(66){el}]343.8 1 idx03 +[2(ALINK)][{/91 pl}(91){el}]332.8 1 idx03 +[2(alink.sourceforge.net)][{/91 pl}(91){el}]321.8 1 idx03 +[2(all)][{/23 pl}(23){el}]310.8 1 idx03 +[2(alloc)][{/85 pl}(85){el}]299.8 1 idx03 +[(alternate register names)][{/66 pl}(66){el}]288.8 1 idx03 +[2(alt.lang.asm)][{/14 pl}(14){el}]277.8 1 idx03 +[2(altreg)][{/66 pl}(66){el}]266.8 1 idx03 +[(ambiguity)][{/24 pl}(24){el}]255.8 1 idx03 +[2(a.out)][]244.8 1 idx03 +[(BSD version)][{/88 pl}(88){el}]233.8 1 idx13 +[(Linux version)][{/88 pl}(88){el}]222.8 1 idx13 +[2(aout)][{/88 pl}(88){el}]211.8 1 idx03 +[2(aoutb)][{/88 pl}(88,){el}( ){/106 pl}(106){el}]200.8 1 idx03 +[2(%arg)][{/57 pl}(57){el}]189.8 1 idx03 +[2(arg)][{/98 pl}(98,){el}( ){/105 pl}(105){el}]178.8 1 idx03 +[2(as86)][{/14 pl}(14,){el}( ){/88 pl}(88){el}]167.8 1 idx03 +[(assembler directives)][{/67 pl}(67){el}]156.8 1 idx03 +[(assembly-time options)][{/21 pl}(21){el}]145.8 1 idx03 +[2(%assign)][{/40 pl}(40){el}]134.8 1 idx03 +[2(ASSUME)][{/25 pl}(25){el}]123.8 1 idx03 +[2(AT)][{/63 pl}(63){el}]112.8 1 idx03 +[(Autoconf)][{/16 pl}(16){el}]101.8 1 idx03 +(206)pageeven +restore showpage +%%Page: 207 207 +%%BeginPageSetup +save +%%EndPageSetup +/207 pa +[2(autoexec.bat)][{/15 pl}(15){el}]681 0 idx03 +[2(auto-sync)][{/120 pl}(120){el}]670 0 idx03 +[2(-b)][{/119 pl}(119){el}]659 0 idx03 +[(bin)][{/18 pl}(18,){el}( ){/73 pl}(73){el}]648 0 idx03 +[(multisection)][{/74 pl}(74){el}]637 0 idx13 +[(binary)][{/29 pl}(29){el}]626 0 idx03 +[(binary files)][{/27 pl}(27){el}]615 0 idx03 +[(bit shift)][{/33 pl}(33){el}]604 0 idx03 +[2(BITS)][{/67 pl}(67,){el}( ){/73 pl}(73){el}]593 0 idx03 +[2(__BITS__)][{/61 pl}(61){el}]582 0 idx03 +[(bitwise AND)][{/33 pl}(33){el}]571 0 idx03 +[(bitwise OR)][{/33 pl}(33){el}]560 0 idx03 +[(bitwise XOR)][{/33 pl}(33){el}]549 0 idx03 +[(block IFs)][{/55 pl}(55){el}]538 0 idx03 +[(boot loader)][{/73 pl}(73){el}]527 0 idx03 +[(boot sector)][{/116 pl}(116){el}]516 0 idx03 +[(Borland)][]505 0 idx03 +[(Pascal)][{/99 pl}(99){el}]494 0 idx13 +[(Win32 compilers)][{/75 pl}(75){el}]483 0 idx13 +[(braces)][]472 0 idx03 +[(after )2(%)0( sign)][{/47 pl}(47){el}]461 0 idx13 +[(around macro parameters)][{/42 pl}(42){el}]450 0 idx13 +[(BSD)][{/106 pl}(106){el}]439 0 idx03 +[2(.bss)][{/85 pl}(85,){el}( ){/88 pl}(88,){el}( ){/89 pl}(89){el}]428 0 idx03 +[(bugs)][{/117 pl}(117){el}]417 0 idx03 +[2(bugtracker)][{/117 pl}(117){el}]406 0 idx03 +[2(BYTE)][{/116 pl}(116){el}]395 0 idx03 +[(C calling convention)][{/96 pl}(96,){el}( ){/103 pl}(103){el}]384 0 idx03 +[(C symbol names)][{/94 pl}(94){el}]373 0 idx03 +[2(c16.mac)][{/98 pl}(98,){el}( ){/101 pl}(101){el}]362 0 idx03 +[2(c32.mac)][{/105 pl}(105){el}]351 0 idx03 +[2(CALL FAR)][{/34 pl}(34){el}]340 0 idx03 +[(case sensitivity)][{/24 pl}(24,){el}( ){/37 pl}(37,){el}( ){/38 pl}(38,){el}( ){/40 pl}(40,){el}( ){/42 pl}(42,){el}( ){/43 pl}(43,){el}( ){/50 pl}(50,){el}( ){/77 pl}(77){el}]329 0 idx03 +[(changing sections)][{/68 pl}(68){el}]318 0 idx03 +[(character constant)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]307 0 idx03 +[(character strings)][{/30 pl}(30){el}]296 0 idx03 +[(circular references)][{/37 pl}(37){el}]285 0 idx03 +[2(CLASS)][{/76 pl}(76){el}]274 0 idx03 +[2(%clear)][{/60 pl}(60){el}]263 0 idx03 +[2(coff)][{/85 pl}(85){el}]252 0 idx03 +[(colon)][{/26 pl}(26){el}]241 0 idx03 +[2(.COM)][{/73 pl}(73,){el}( ){/93 pl}(93){el}]230 0 idx03 +[(command-line)][{/17 pl}(17,){el}( ){/73 pl}(73){el}]219 0 idx03 +[(commas in macro parameters)][{/45 pl}(45){el}]208 0 idx03 +[2(.comment)][{/85 pl}(85){el}]197 0 idx03 +[2(COMMON)][{/70 pl}(70,){el}( ){/75 pl}(75){el}]186 0 idx03 +[2(elf)0( extensions to)][{/87 pl}(87){el}]175 0 idx13 +[2(obj)0( extensions to)][{/78 pl}(78){el}]164 0 idx13 +[(Common Object File Format)][{/85 pl}(85){el}]153 0 idx03 +[(common variables)][{/70 pl}(70){el}]142 0 idx03 +[(alignment in )2(elf)][{/87 pl}(87){el}]131 0 idx13 +[(element size)][{/78 pl}(78){el}]120 0 idx13 +[2(comp.lang.asm.x86)][{/14 pl}(14,){el}( ){/15 pl}(15){el}]109 0 idx03 +[2(comp.os.msdos.programmer)][{/94 pl}(94){el}]681 1 idx03 +[(concatenating macro parameters)][{/46 pl}(46){el}]670 1 idx03 +[(concatenating strings)][{/41 pl}(41){el}]659 1 idx03 +[(condition codes as macro parameters)][{/47 pl}(47){el}]648 1 idx03 +[(conditional assembly)][{/49 pl}(49){el}]637 1 idx03 +[(conditional jumps)][{/116 pl}(116){el}]626 1 idx03 +[(conditional-return macro)][{/47 pl}(47){el}]615 1 idx03 +[2(configure)][{/16 pl}(16){el}]604 1 idx03 +[(constants)][{/29 pl}(29){el}]593 1 idx03 +[(context stack)][{/54 pl}(54,){el}( ){/55 pl}(55){el}]582 1 idx03 +[(context-local labels)][{/54 pl}(54){el}]571 1 idx03 +[(context-local single-line macros)][{/55 pl}(55){el}]560 1 idx03 +[(counting macro parameters)][{/45 pl}(45){el}]549 1 idx03 +[2(CPU)][{/71 pl}(71){el}]538 1 idx03 +[2(CPUID)][{/31 pl}(31){el}]527 1 idx03 +[(creating contexts)][{/54 pl}(54){el}]516 1 idx03 +[(critical expression)][{/27 pl}(27,){el}( ){/35 pl}(35,){el}( ){/40 pl}(40,){el}( ){/69 pl}(69){el}]505 1 idx03 +[2(-D)0( option)][{/20 pl}(20){el}]494 1 idx03 +[2(-d)0( option)][{/20 pl}(20){el}]483 1 idx03 +[(daily development snapshots)][{/15 pl}(15){el}]472 1 idx03 +[2(.data)][{/85 pl}(85,){el}( ){/88 pl}(88,){el}( ){/89 pl}(89){el}]461 1 idx03 +[2(_DATA)][{/96 pl}(96){el}]450 1 idx03 +[2(data)][{/87 pl}(87,){el}( ){/89 pl}(89){el}]439 1 idx03 +[(data structure)][{/98 pl}(98,){el}( ){/105 pl}(105){el}]428 1 idx03 +[2(__DATE__)][{/61 pl}(61){el}]417 1 idx03 +[2(__DATE_NUM__)][{/61 pl}(61){el}]406 1 idx03 +[2(DB)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]395 1 idx03 +[2(dbg)][{/90 pl}(90){el}]384 1 idx03 +[2(DD)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]373 1 idx03 +[(debug information)][{/19 pl}(19){el}]362 1 idx03 +[(debug information format)][{/19 pl}(19){el}]351 1 idx03 +[(declaring structures)][{/62 pl}(62){el}]340 1 idx03 +[2(DEFAULT)][{/68 pl}(68){el}]329 1 idx03 +[2(default)][{/87 pl}(87){el}]318 1 idx03 +[(default macro parameters)][{/45 pl}(45){el}]307 1 idx03 +[(default name)][{/73 pl}(73){el}]296 1 idx03 +[(default-)2(WRT)0( mechanism)][{/78 pl}(78){el}]285 1 idx03 +[2(%define)][{/20 pl}(20,){el}( ){/37 pl}(37){el}]274 1 idx03 +[(defining sections)][{/68 pl}(68){el}]263 1 idx03 +[2(%defstr)][{/41 pl}(41){el}]252 1 idx03 +[2(%deftok)][{/41 pl}(41){el}]241 1 idx03 +[2(%depend)][{/53 pl}(53){el}]230 1 idx03 +[(design goals)][{/24 pl}(24){el}]219 1 idx03 +[(DevPac)][{/27 pl}(27,){el}( ){/35 pl}(35){el}]208 1 idx03 +[(disabling listing expansion)][{/48 pl}(48){el}]197 1 idx03 +[(division)][{/33 pl}(33){el}]186 1 idx03 +[(DJGPP)][{/85 pl}(85,){el}( ){/103 pl}(103){el}]175 1 idx03 +[2(djlink)][{/91 pl}(91){el}]164 1 idx03 +[(DLL symbols)][]153 1 idx03 +[(exporting)][{/77 pl}(77){el}]142 1 idx13 +[(importing)][{/77 pl}(77){el}]131 1 idx13 +[2(DO)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]120 1 idx03 +[(DOS)][{/15 pl}(15,){el}( ){/20 pl}(20){el}]109 1 idx03 +(207)pageodd +restore showpage +%%Page: 208 208 +%%BeginPageSetup +save +%%EndPageSetup +/208 pa +[(DOS archive)][]681 0 idx03 +[(DOS source archive)][{/15 pl}(15){el}]670 0 idx03 +[2(DQ)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]659 0 idx03 +[2(.drectve)][{/79 pl}(79){el}]648 0 idx03 +[2(DT)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]637 0 idx03 +[2(DUP)][{/25 pl}(25,){el}( ){/28 pl}(28){el}]626 0 idx03 +[2(DW)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]615 0 idx03 +[2(DWORD)][{/27 pl}(27){el}]604 0 idx03 +[2(DY)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]593 0 idx03 +[2(-E)0( option)][{/21 pl}(21){el}]582 0 idx03 +[2(-e)0( option)][{/21 pl}(21,){el}( ){/121 pl}(121){el}]571 0 idx03 +[(effective addresses)][{/26 pl}(26,){el}( ){/28 pl}(28){el}]560 0 idx03 +[(element size, in common variables)][{/78 pl}(78){el}]549 0 idx03 +[(ELF)][{/85 pl}(85){el}]538 0 idx03 +[(shared libraries)][{/86 pl}(86){el}]527 0 idx13 +[(16-bit code and)][{/88 pl}(88){el}]516 0 idx13 +[(elf, debug formats and)][{/88 pl}(88){el}]505 0 idx03 +[2(elf32)][{/85 pl}(85){el}]494 0 idx03 +[2(elf64)][{/85 pl}(85){el}]483 0 idx03 +[2(%elif)][{/49 pl}(49,){el}( ){/50 pl}(50){el}]472 0 idx03 +[2(%elifctx)][{/50 pl}(50){el}]461 0 idx03 +[2(%elifdef)][{/49 pl}(49){el}]450 0 idx03 +[2(%elifempty)][{/52 pl}(52){el}]439 0 idx03 +[2(%elifid)][{/51 pl}(51){el}]428 0 idx03 +[2(%elifidn)][{/51 pl}(51){el}]417 0 idx03 +[2(%elifidni)][{/51 pl}(51){el}]406 0 idx03 +[2(%elifmacro)][{/50 pl}(50){el}]395 0 idx03 +[2(%elifn)][{/49 pl}(49,){el}( ){/50 pl}(50){el}]384 0 idx03 +[2(%elifnctx)][{/50 pl}(50){el}]373 0 idx03 +[2(%elifndef)][{/49 pl}(49){el}]362 0 idx03 +[2(%elifnempty)][{/52 pl}(52){el}]351 0 idx03 +[2(%elifnid)][{/51 pl}(51){el}]340 0 idx03 +[2(%elifnidn)][{/51 pl}(51){el}]329 0 idx03 +[2(%elifnidni)][{/51 pl}(51){el}]318 0 idx03 +[2(%elifnmacro)][{/50 pl}(50){el}]307 0 idx03 +[2(%elifnnum)][{/51 pl}(51){el}]296 0 idx03 +[2(%elifnstr)][{/51 pl}(51){el}]285 0 idx03 +[2(%elifntoken)][{/52 pl}(52){el}]274 0 idx03 +[2(%elifnum)][{/51 pl}(51){el}]263 0 idx03 +[2(%elifstr)][{/51 pl}(51){el}]252 0 idx03 +[2(%eliftoken)][{/52 pl}(52){el}]241 0 idx03 +[2(%else)][{/49 pl}(49){el}]230 0 idx03 +[2(endproc)][{/98 pl}(98,){el}( ){/105 pl}(105){el}]219 0 idx03 +[2(%endrep)][{/52 pl}(52){el}]208 0 idx03 +[2(ENDSTRUC)][{/62 pl}(62,){el}( ){/69 pl}(69){el}]197 0 idx03 +[(environment)][{/23 pl}(23){el}]186 0 idx03 +[2(EQU)][{/27 pl}(27,){el}( ){/28 pl}(28){el}]175 0 idx03 +[2(%error)][{/58 pl}(58){el}]164 0 idx03 +[2(error)][{/23 pl}(23){el}]153 0 idx03 +[(error messages)][{/20 pl}(20){el}]142 0 idx03 +[(error reporting format)][{/19 pl}(19){el}]131 0 idx03 +[(escape sequences)][{/30 pl}(30){el}]120 0 idx03 +[2(EVEN)][{/64 pl}(64){el}]109 0 idx03 +[(exact matches)][{/48 pl}(48){el}]681 1 idx03 +[2(.EXE)][{/75 pl}(75,){el}( ){/91 pl}(91){el}]670 1 idx03 +[2(EXE2BIN)][{/93 pl}(93){el}]659 1 idx03 +[2(EXE_begin)][{/92 pl}(92){el}]648 1 idx03 +[2(exebin.mac)][{/92 pl}(92){el}]637 1 idx03 +[2(exec)][{/85 pl}(85){el}]626 1 idx03 +[(Executable and Linkable Format)][{/85 pl}(85){el}]615 1 idx03 +[2(EXE_end)][{/92 pl}(92){el}]604 1 idx03 +[2(EXE_stack)][{/92 pl}(92){el}]593 1 idx03 +[2(%exitmacro)][{/48 pl}(48){el}]582 1 idx03 +[2(%exitrep)][{/52 pl}(52){el}]571 1 idx03 +[2(EXPORT)][{/77 pl}(77){el}]560 1 idx03 +[2(export)][{/89 pl}(89){el}]549 1 idx03 +[(exporting symbols)][{/70 pl}(70){el}]538 1 idx03 +[(expressions)][{/21 pl}(21,){el}( ){/33 pl}(33){el}]527 1 idx03 +[(extension)][{/17 pl}(17,){el}( ){/73 pl}(73){el}]516 1 idx03 +[2(EXTERN)][{/70 pl}(70){el}]505 1 idx03 +[2(obj)0( extensions to)][{/78 pl}(78){el}]494 1 idx13 +[2(rdf)0( extensions to)][{/89 pl}(89){el}]483 1 idx13 +[(extracting substrings)][{/42 pl}(42){el}]472 1 idx03 +[2(-F)0( option)][{/19 pl}(19){el}]461 1 idx03 +[2(-f)0( option)][{/18 pl}(18,){el}( ){/73 pl}(73){el}]450 1 idx03 +[(far call)][{/25 pl}(25){el}]439 1 idx03 +[(far common variables)][{/78 pl}(78){el}]428 1 idx03 +[(far pointer)][{/34 pl}(34){el}]417 1 idx03 +[2(FARCODE)][{/99 pl}(99,){el}( ){/101 pl}(101){el}]406 1 idx03 +[2(%fatal)][{/58 pl}(58){el}]395 1 idx03 +[2(__FILE__)][{/61 pl}(61){el}]384 1 idx03 +[2(FLAT)][{/76 pl}(76){el}]373 1 idx03 +[(flat memory model)][{/103 pl}(103){el}]362 1 idx03 +[(flat-form binary)][{/73 pl}(73){el}]351 1 idx03 +[2(FLOAT)][{/71 pl}(71){el}]340 1 idx03 +[2(__FLOAT__)][{/72 pl}(72){el}]329 1 idx03 +[2(__float128h__)][{/31 pl}(31){el}]318 1 idx03 +[2(__float128l__)][{/31 pl}(31){el}]307 1 idx03 +[2(__float16__)][{/31 pl}(31){el}]296 1 idx03 +[2(__float32__)][{/31 pl}(31){el}]285 1 idx03 +[2(__float64__)][{/31 pl}(31){el}]274 1 idx03 +[2(__float8__)][{/31 pl}(31){el}]263 1 idx03 +[2(__float80e__)][{/31 pl}(31){el}]252 1 idx03 +[2(__float80m__)][{/31 pl}(31){el}]241 1 idx03 +[2(__FLOAT_DAZ__)][{/72 pl}(72){el}]230 1 idx03 +[2(float-denorm)][{/22 pl}(22){el}]219 1 idx03 +[(floating-point)][]208 1 idx03 +[(constants)][{/31 pl}(31,){el}( ){/71 pl}(71){el}]197 1 idx13 +[(packed BCD constants)][{/33 pl}(33){el}]186 1 idx13 +[(floating-point)][{/25 pl}(25,){el}( ){/26 pl}(26,){el}( ){/27 pl}(27,){el}( ){/31 pl}(31){el}]175 1 idx03 +[2(float-overflow)][{/22 pl}(22){el}]164 1 idx03 +[2(__FLOAT_ROUND__)][{/72 pl}(72){el}]153 1 idx03 +[2(float-toolong)][{/23 pl}(23){el}]142 1 idx03 +[2(float-underflow)][{/23 pl}(23){el}]131 1 idx03 +[2(follows=)][{/74 pl}(74){el}]120 1 idx03 +[(format-specific directives)][{/67 pl}(67){el}]109 1 idx03 +(208)pageeven +restore showpage +%%Page: 209 209 +%%BeginPageSetup +save +%%EndPageSetup +/209 pa +[(frame pointer)][{/96 pl}(96,){el}( ){/100 pl}(100,){el}( ){/103 pl}(103){el}]681 0 idx03 +[(FreeBSD)][{/88 pl}(88,){el}( ){/106 pl}(106){el}]670 0 idx03 +[(FreeLink)][{/91 pl}(91){el}]659 0 idx03 +[2(ftp.simtel.net)][{/91 pl}(91){el}]648 0 idx03 +[2(function)][{/87 pl}(87,){el}( ){/89 pl}(89){el}]637 0 idx03 +[(functions)][]626 0 idx03 +[(C calling convention)][{/96 pl}(96,){el}( ){/103 pl}(103){el}]615 0 idx13 +[(Pascal calling convention)][{/100 pl}(100){el}]604 0 idx13 +[2(-g)0( option)][{/19 pl}(19){el}]593 0 idx03 +[2(gas)][{/14 pl}(14){el}]582 0 idx03 +[2(gcc)][{/14 pl}(14){el}]571 0 idx03 +[2(GLOBAL)][{/70 pl}(70){el}]560 0 idx03 +[2(aoutb)0( extensions to)][{/87 pl}(87){el}]549 0 idx13 +[2(elf)0( extensions to)][{/87 pl}(87){el}]538 0 idx13 +[2(rdf)0( extensions to)][{/89 pl}(89){el}]527 0 idx13 +[(global offset table)][{/106 pl}(106){el}]516 0 idx03 +[2(_GLOBAL_OFFSET_TABLE_)][{/86 pl}(86){el}]505 0 idx03 +[2(gnu-elf-extensions)][{/22 pl}(22){el}]494 0 idx03 +[2(..got)][{/86 pl}(86){el}]483 0 idx03 +[2(GOT)0( relocations)][{/107 pl}(107){el}]472 0 idx03 +[(GOT)][{/86 pl}(86,){el}( ){/106 pl}(106){el}]461 0 idx03 +[2(..gotoff)][{/86 pl}(86){el}]450 0 idx03 +[2(GOTOFF)0( relocations)][{/107 pl}(107){el}]439 0 idx03 +[2(..gotpc)][{/86 pl}(86){el}]428 0 idx03 +[2(GOTPC)0( relocations)][{/107 pl}(107){el}]417 0 idx03 +[2(..gottpoff)][{/87 pl}(87){el}]406 0 idx03 +[(graphics)][{/27 pl}(27){el}]395 0 idx03 +[(greedy macro parameters)][{/44 pl}(44){el}]384 0 idx03 +[2(GROUP)][{/76 pl}(76){el}]373 0 idx03 +[(groups)][{/34 pl}(34){el}]362 0 idx03 +[2(-h)][{/119 pl}(119){el}]351 0 idx03 +[(hexadecimal)][{/29 pl}(29){el}]340 0 idx03 +[2(hidden)][{/87 pl}(87){el}]329 0 idx03 +[(hybrid syntaxes)][{/24 pl}(24){el}]318 0 idx03 +[2(-I)0( option)][{/20 pl}(20){el}]307 0 idx03 +[2(-i)0( option)][{/20 pl}(20,){el}( ){/120 pl}(120){el}]296 0 idx03 +[2(%iassign)][{/40 pl}(40){el}]285 0 idx03 +[2(%idefine)][{/37 pl}(37){el}]274 0 idx03 +[2(%idefstr)][{/41 pl}(41){el}]263 0 idx03 +[2(%ideftok)][{/41 pl}(41){el}]252 0 idx03 +[2(IEND)][{/63 pl}(63){el}]241 0 idx03 +[2(%if)][{/49 pl}(49,){el}( ){/50 pl}(50){el}]230 0 idx03 +[2(%ifctx)][{/50 pl}(50,){el}( ){/55 pl}(55){el}]219 0 idx03 +[2(%ifdef)][{/49 pl}(49){el}]208 0 idx03 +[2(%ifempty)][{/52 pl}(52){el}]197 0 idx03 +[2(%ifid)][{/51 pl}(51){el}]186 0 idx03 +[2(%ifidn)][{/50 pl}(50){el}]175 0 idx03 +[2(%ifidni)][{/50 pl}(50){el}]164 0 idx03 +[2(%ifmacro)][{/49 pl}(49){el}]153 0 idx03 +[2(%ifn)][{/49 pl}(49,){el}( ){/50 pl}(50){el}]142 0 idx03 +[2(%ifnctx)][{/50 pl}(50){el}]131 0 idx03 +[2(%ifndef)][{/49 pl}(49){el}]120 0 idx03 +[2(%ifnempty)][{/52 pl}(52){el}]109 0 idx03 +[2(%ifnid)][{/51 pl}(51){el}]681 1 idx03 +[2(%ifnidn)][{/51 pl}(51){el}]670 1 idx03 +[2(%ifnidni)][{/51 pl}(51){el}]659 1 idx03 +[2(%ifnmacro)][{/50 pl}(50){el}]648 1 idx03 +[2(%ifnnum)][{/51 pl}(51){el}]637 1 idx03 +[2(%ifnstr)][{/51 pl}(51){el}]626 1 idx03 +[2(%ifntoken)][{/52 pl}(52){el}]615 1 idx03 +[2(%ifnum)][{/51 pl}(51){el}]604 1 idx03 +[2(%ifstr)][{/51 pl}(51){el}]593 1 idx03 +[2(%iftoken)][{/52 pl}(52){el}]582 1 idx03 +[2(%imacro)][{/42 pl}(42){el}]571 1 idx03 +[2(IMPORT)][{/77 pl}(77){el}]560 1 idx03 +[(import library)][{/77 pl}(77){el}]549 1 idx03 +[(importing symbols)][{/70 pl}(70){el}]538 1 idx03 +[2(INCBIN)][{/27 pl}(27,){el}( ){/31 pl}(31){el}]527 1 idx03 +[2(%include)][{/20 pl}(20,){el}( ){/53 pl}(53){el}]516 1 idx03 +[(include search path)][{/20 pl}(20){el}]505 1 idx03 +[(including other files)][{/53 pl}(53){el}]494 1 idx03 +[(inefficient code)][{/116 pl}(116){el}]483 1 idx03 +[(infinite loop)][{/33 pl}(33){el}]472 1 idx03 +[2(__Infinity__)][{/32 pl}(32){el}]461 1 idx03 +[(infinity)][{/32 pl}(32){el}]450 1 idx03 +[(informational section)][{/79 pl}(79){el}]439 1 idx03 +[2(INSTALL)][{/16 pl}(16){el}]428 1 idx03 +[(installing)][{/15 pl}(15){el}]417 1 idx03 +[(instances of structures)][{/63 pl}(63){el}]406 1 idx03 +[(instruction list)][{/122 pl}(122){el}]395 1 idx03 +[(intel hex)][{/74 pl}(74){el}]384 1 idx03 +[(Intel number formats)][{/32 pl}(32){el}]373 1 idx03 +[2(internal)][{/87 pl}(87){el}]362 1 idx03 +[2(%irmacro)][{/43 pl}(43){el}]351 1 idx03 +[2(ISTRUC)][{/63 pl}(63){el}]340 1 idx03 +[(iterating over macro parameters)][{/46 pl}(46){el}]329 1 idx03 +[2(ith)][{/74 pl}(74){el}]318 1 idx03 +[2(%ixdefine)][{/38 pl}(38){el}]307 1 idx03 +[2(Jcc NEAR)][{/116 pl}(116){el}]296 1 idx03 +[2(JMP DWORD)][{/110 pl}(110){el}]285 1 idx03 +[(jumps, mixed-size)][{/110 pl}(110){el}]274 1 idx03 +[2(-k)][{/121 pl}(121){el}]263 1 idx03 +[2(-l)0( option)][{/18 pl}(18){el}]252 1 idx03 +[(label prefix)][{/36 pl}(36){el}]241 1 idx03 +[2(.lbss)][{/85 pl}(85){el}]230 1 idx03 +[2(ld86)][{/88 pl}(88){el}]219 1 idx03 +[2(.ldata)][{/85 pl}(85){el}]208 1 idx03 +[2(LIBRARY)][{/89 pl}(89){el}]197 1 idx03 +[(license)][{/14 pl}(14){el}]186 1 idx03 +[2(%line)][{/59 pl}(59){el}]175 1 idx03 +[2(__LINE__)][{/61 pl}(61){el}]164 1 idx03 +[(linker, free)][{/91 pl}(91){el}]153 1 idx03 +[(Linux)][]142 1 idx03 +[2(a.out)][{/88 pl}(88){el}]131 1 idx13 +[2(as86)][{/88 pl}(88){el}]120 1 idx13 +[(ELF)][{/85 pl}(85){el}]109 1 idx13 +(209)pageodd +restore showpage +%%Page: 210 210 +%%BeginPageSetup +save +%%EndPageSetup +/210 pa +[(listing file)][{/18 pl}(18){el}]681 0 idx03 +[(little-endian)][{/31 pl}(31){el}]670 0 idx03 +[2(%local)][{/58 pl}(58){el}]659 0 idx03 +[(local labels)][{/35 pl}(35){el}]648 0 idx03 +[(logical AND)][{/50 pl}(50){el}]637 0 idx03 +[(logical negation)][{/34 pl}(34){el}]626 0 idx03 +[(logical OR)][{/50 pl}(50){el}]615 0 idx03 +[(logical XOR)][{/50 pl}(50){el}]604 0 idx03 +[2(.lrodata)][{/85 pl}(85){el}]593 0 idx03 +[2(-M)0( option)][{/18 pl}(18){el}]582 0 idx03 +[(Mach, object file format)][{/85 pl}(85){el}]571 0 idx03 +[(Mach-O)][{/85 pl}(85){el}]560 0 idx03 +[2(macho)][{/85 pl}(85){el}]549 0 idx03 +[2(macho32)][{/85 pl}(85){el}]538 0 idx03 +[2(macho64)][{/85 pl}(85){el}]527 0 idx03 +[(MacOS X)][{/85 pl}(85){el}]516 0 idx03 +[2(%macro)][{/42 pl}(42){el}]505 0 idx03 +[(macro indirection)][{/39 pl}(39){el}]494 0 idx03 +[(macro library)][{/20 pl}(20){el}]483 0 idx03 +[(macro processor)][{/37 pl}(37){el}]472 0 idx03 +[2(macro-defaults)][{/22 pl}(22){el}]461 0 idx03 +[(macro-local labels)][{/43 pl}(43){el}]450 0 idx03 +[2(macro-params)][{/22 pl}(22){el}]439 0 idx03 +[(macros)][{/28 pl}(28){el}]428 0 idx03 +[2(macro-selfref)][{/22 pl}(22){el}]417 0 idx03 +[2(make)][{/16 pl}(16){el}]406 0 idx03 +[(makefile dependencies)][{/18 pl}(18){el}]395 0 idx03 +[(makefiles)][{/15 pl}(15,){el}( ){/16 pl}(16){el}]384 0 idx03 +[(man pages)][{/16 pl}(16){el}]373 0 idx03 +[(map files)][{/74 pl}(74){el}]362 0 idx03 +[2(MASM)][{/14 pl}(14){el}]351 0 idx03 +[(MASM)][{/24 pl}(24,){el}( ){/28 pl}(28,){el}( ){/75 pl}(75){el}]340 0 idx03 +[2(-MD)0( option)][{/18 pl}(18){el}]329 0 idx03 +[(memory models)][{/25 pl}(25,){el}( ){/95 pl}(95){el}]318 0 idx03 +[(memory operand)][{/27 pl}(27){el}]307 0 idx03 +[(memory references)][{/24 pl}(24,){el}( ){/28 pl}(28){el}]296 0 idx03 +[2(-MF)0( option)][{/18 pl}(18){el}]285 0 idx03 +[2(-MG)0( option)][{/18 pl}(18){el}]274 0 idx03 +[(Microsoft OMF)][{/75 pl}(75){el}]263 0 idx03 +[(minifloat)][{/32 pl}(32){el}]252 0 idx03 +[(Minix)][{/88 pl}(88){el}]241 0 idx03 +[2(misc)0( subdirectory)][{/92 pl}(92,){el}( ){/98 pl}(98,){el}( ){/105 pl}(105){el}]230 0 idx03 +[(mixed-language program)][{/94 pl}(94){el}]219 0 idx03 +[(mixed-size addressing)][{/110 pl}(110){el}]208 0 idx03 +[(mixed-size instruction)][{/110 pl}(110){el}]197 0 idx03 +[(MMX registers)][]186 0 idx03 +[(ModR/M byte)][]175 0 idx03 +[2(MODULE)][{/89 pl}(89){el}]164 0 idx03 +[(modulo operators)][{/33 pl}(33){el}]153 0 idx03 +[(motorola s-records)][{/74 pl}(74){el}]142 0 idx03 +[2(-MP)0( option)][{/19 pl}(19){el}]131 0 idx03 +[2(-MQ)0( option)][{/19 pl}(19){el}]120 0 idx03 +[(MS-DOS)][{/73 pl}(73){el}]109 0 idx03 +[(MS-DOS device drivers)][{/94 pl}(94){el}]681 1 idx03 +[2(-MT)0( option)][{/19 pl}(19){el}]670 1 idx03 +[(multi-line macros)][{/22 pl}(22,){el}( ){/42 pl}(42){el}]659 1 idx03 +[(multipass optimization)][{/21 pl}(21){el}]648 1 idx03 +[(multiple section names)][{/73 pl}(73){el}]637 1 idx03 +[(multiplication)][{/33 pl}(33){el}]626 1 idx03 +[2(multipush)0( macro)][{/46 pl}(46){el}]615 1 idx03 +[(multisection)][{/74 pl}(74){el}]604 1 idx03 +[2(__NaN__)][{/32 pl}(32){el}]593 1 idx03 +[(NaN)][{/32 pl}(32){el}]582 1 idx03 +[(NASM version)][{/60 pl}(60){el}]571 1 idx03 +[(nasm version history)][{/181 pl}(181){el}]560 1 idx03 +[(nasm version id)][{/60 pl}(60){el}]549 1 idx03 +[(nasm version string)][{/60 pl}(60){el}]538 1 idx03 +[2(nasm.1)][{/16 pl}(16){el}]527 1 idx03 +[2(__NASMDEFSEG)][{/75 pl}(75){el}]516 1 idx03 +[2(nasm-devel)][{/15 pl}(15){el}]505 1 idx03 +[2(NASMENV)][{/23 pl}(23){el}]494 1 idx03 +[2(nasm.exe)][{/15 pl}(15){el}]483 1 idx03 +[2(nasm -hf)][{/18 pl}(18){el}]472 1 idx03 +[2(__NASM_MAJOR__)][{/60 pl}(60){el}]461 1 idx03 +[2(__NASM_MINOR__)][{/60 pl}(60){el}]450 1 idx03 +[2(nasm.out)][{/18 pl}(18){el}]439 1 idx03 +[2(___NASM_PATCHLEVEL__)][{/60 pl}(60){el}]428 1 idx03 +[2(__NASM_SNAPSHOT__)][{/60 pl}(60){el}]417 1 idx03 +[2(__NASM_SUBMINOR__)][{/60 pl}(60){el}]406 1 idx03 +[2(__NASM_VER__)][{/60 pl}(60){el}]395 1 idx03 +[2(__NASM_VERSION_ID__)][{/60 pl}(60){el}]384 1 idx03 +[2(nasm-XXX-dos.zip)][{/15 pl}(15){el}]373 1 idx03 +[2(nasm-XXX.tar.gz)][{/16 pl}(16){el}]362 1 idx03 +[2(nasm-XXX-win32.zip)][{/15 pl}(15){el}]351 1 idx03 +[2(nasm-XXX.zip)][{/15 pl}(15){el}]340 1 idx03 +[(ndisasm)][{/119 pl}(119){el}]329 1 idx03 +[2(ndisasm.1)][{/16 pl}(16){el}]318 1 idx03 +[2(ndisasm.exe)][{/15 pl}(15){el}]307 1 idx03 +[(near call)][{/25 pl}(25){el}]296 1 idx03 +[(near common variables)][{/78 pl}(78){el}]285 1 idx03 +[(NetBSD)][{/88 pl}(88,){el}( ){/106 pl}(106){el}]274 1 idx03 +[(new releases)][{/15 pl}(15){el}]263 1 idx03 +[2(noalloc)][{/85 pl}(85){el}]252 1 idx03 +[2(nobits)][{/74 pl}(74,){el}( ){/85 pl}(85){el}]241 1 idx03 +[2(noexec)][{/85 pl}(85){el}]230 1 idx03 +[2(.nolist)][{/48 pl}(48){el}]219 1 idx03 +[(`nowait')][{/25 pl}(25){el}]208 1 idx03 +[2(nowrite)][{/85 pl}(85){el}]197 1 idx03 +[2(number-overflow)][{/22 pl}(22){el}]186 1 idx03 +[(numeric constants)][{/27 pl}(27,){el}( ){/29 pl}(29){el}]175 1 idx03 +[2(-O)0( option)][{/21 pl}(21){el}]164 1 idx03 +[2(-o)0( option)][{/17 pl}(17,){el}( ){/119 pl}(119){el}]153 1 idx03 +[2(O16)][{/26 pl}(26){el}]142 1 idx03 +[2(o16)][{/111 pl}(111){el}]131 1 idx03 +[2(O32)][{/26 pl}(26){el}]120 1 idx03 +[2(o32)][{/112 pl}(112){el}]109 1 idx03 +(210)pageeven +restore showpage +%%Page: 211 211 +%%BeginPageSetup +save +%%EndPageSetup +/211 pa +[2(O64)][{/26 pl}(26){el}]681 0 idx03 +[2(.OBJ)][{/91 pl}(91){el}]670 0 idx03 +[2(obj)][{/75 pl}(75){el}]659 0 idx03 +[2(object)][{/87 pl}(87,){el}( ){/89 pl}(89){el}]648 0 idx03 +[(octal)][{/29 pl}(29){el}]637 0 idx03 +[2(OF_DBG)][{/90 pl}(90){el}]626 0 idx03 +[2(OF_DEFAULT)][{/18 pl}(18){el}]615 0 idx03 +[2(OFFSET)][{/24 pl}(24){el}]604 0 idx03 +[(OMF)][{/75 pl}(75){el}]593 0 idx03 +[(omitted parameters)][{/45 pl}(45){el}]582 0 idx03 +[(one's complement)][{/34 pl}(34){el}]571 0 idx03 +[(OpenBSD)][{/88 pl}(88,){el}( ){/106 pl}(106){el}]560 0 idx03 +[(operands)][{/26 pl}(26){el}]549 0 idx03 +[(operand-size prefixes)][{/26 pl}(26){el}]538 0 idx03 +[(operating system)][{/73 pl}(73){el}]527 0 idx03 +[(writing)][{/110 pl}(110){el}]516 0 idx13 +[(operators)][{/33 pl}(33){el}]505 0 idx03 +[2(ORG)][{/73 pl}(73,){el}( ){/93 pl}(93,){el}( ){/94 pl}(94,){el}( ){/116 pl}(116){el}]494 0 idx03 +[2(orphan-labels)][{/22 pl}(22,){el}( ){/26 pl}(26){el}]483 0 idx03 +[(OS/2)][{/75 pl}(75,){el}( ){/76 pl}(76){el}]472 0 idx03 +[2(osabi)][{/85 pl}(85){el}]461 0 idx03 +[(other preprocessor directives)][{/59 pl}(59){el}]450 0 idx03 +[(out of range, jumps)][{/116 pl}(116){el}]439 0 idx03 +[(output file format)][{/18 pl}(18){el}]428 0 idx03 +[(output formats)][{/73 pl}(73){el}]417 0 idx03 +[2(__OUTPUT_FORMAT__)][{/61 pl}(61){el}]406 0 idx03 +[(overlapping segments)][{/34 pl}(34){el}]395 0 idx03 +[2(OVERLAY)][{/76 pl}(76){el}]384 0 idx03 +[(overloading)][]373 0 idx03 +[(multi-line macros)][{/43 pl}(43){el}]362 0 idx13 +[(single-line macros)][{/38 pl}(38){el}]351 0 idx13 +[2(-P)0( option)][{/20 pl}(20){el}]340 0 idx03 +[2(-p)0( option)][{/20 pl}(20,){el}( ){/53 pl}(53){el}]329 0 idx03 +[(paradox)][{/35 pl}(35){el}]318 0 idx03 +[2(PASCAL)][{/101 pl}(101){el}]307 0 idx03 +[(Pascal calling convention)][{/100 pl}(100){el}]296 0 idx03 +[2(__PASS__)][{/62 pl}(62){el}]285 0 idx03 +[(passes, assembly)][]274 0 idx03 +[2(PATH)][{/15 pl}(15){el}]263 0 idx03 +[2(%pathsearch)][{/20 pl}(20,){el}( ){/53 pl}(53){el}]252 0 idx03 +[(period)][{/35 pl}(35){el}]241 0 idx03 +[(Perl)][{/15 pl}(15){el}]230 0 idx03 +[(perverse)][{/20 pl}(20){el}]219 0 idx03 +[(PharLap)][{/76 pl}(76){el}]208 0 idx03 +[(PIC)][{/86 pl}(86,){el}( ){/88 pl}(88,){el}( ){/106 pl}(106){el}]197 0 idx03 +[2(..plt)][{/86 pl}(86){el}]186 0 idx03 +[2(PLT)0( relocations)][{/86 pl}(86,){el}( ){/108 pl}(108,){el}( ){/109 pl}(109){el}]175 0 idx03 +[(plt relocations)][{/109 pl}(109){el}]164 0 idx03 +[2(%pop)][{/54 pl}(54){el}]153 0 idx03 +[(position-independent code)][{/86 pl}(86,){el}( ){/88 pl}(88,){el}( ){/106 pl}(106){el}]142 0 idx03 +[2(--postfix)][{/23 pl}(23){el}]131 0 idx03 +[(precedence)][{/33 pl}(33){el}]120 0 idx03 +[(pre-defining macros)][{/20 pl}(20,){el}( ){/38 pl}(38){el}]109 0 idx03 +[(preferred)][{/34 pl}(34){el}]681 1 idx03 +[2(--prefix)][{/23 pl}(23){el}]670 1 idx03 +[(pre-including files)][{/20 pl}(20){el}]659 1 idx03 +[(preprocess-only mode)][{/21 pl}(21){el}]648 1 idx03 +[(preprocessor)][{/21 pl}(21,){el}( ){/28 pl}(28,){el}( ){/33 pl}(33,){el}( ){/37 pl}(37){el}]637 1 idx03 +[(preprocessor expressions)][{/21 pl}(21){el}]626 1 idx03 +[(preprocessor loops)][{/52 pl}(52){el}]615 1 idx03 +[(preprocessor variables)][{/40 pl}(40){el}]604 1 idx03 +[(primitive directives)][{/67 pl}(67){el}]593 1 idx03 +[2(PRIVATE)][{/75 pl}(75){el}]582 1 idx03 +[2(proc)][{/89 pl}(89,){el}( ){/98 pl}(98,){el}( ){/105 pl}(105){el}]571 1 idx03 +[(procedure linkage table)][{/86 pl}(86,){el}( ){/108 pl}(108,){el}( ){/109 pl}(109){el}]560 1 idx03 +[(processor mode)][{/67 pl}(67){el}]549 1 idx03 +[2(progbits)][{/74 pl}(74,){el}( ){/85 pl}(85){el}]538 1 idx03 +[(program entry point)][{/78 pl}(78,){el}( ){/91 pl}(91){el}]527 1 idx03 +[(program origin)][{/73 pl}(73){el}]516 1 idx03 +[2(protected)][{/87 pl}(87){el}]505 1 idx03 +[(pseudo-instructions)][{/27 pl}(27){el}]494 1 idx03 +[2(PUBLIC)][{/70 pl}(70,){el}( ){/75 pl}(75){el}]483 1 idx03 +[(pure binary)][{/73 pl}(73){el}]472 1 idx03 +[2(%push)][{/54 pl}(54){el}]461 1 idx03 +[2(__QNaN__)][{/32 pl}(32){el}]450 1 idx03 +[(quick start)][{/24 pl}(24){el}]439 1 idx03 +[2(QWORD)][{/27 pl}(27){el}]428 1 idx03 +[2(-r)][{/119 pl}(119){el}]417 1 idx03 +[2(rdf)][{/88 pl}(88){el}]406 1 idx03 +[2(rdoff)0( subdirectory)][{/16 pl}(16,){el}( ){/88 pl}(88,){el}( ){/89 pl}(89){el}]395 1 idx03 +[(recursive multi-line macros)][{/43 pl}(43){el}]384 1 idx03 +[(redirecting errors)][{/20 pl}(20){el}]373 1 idx03 +[2(REL)][{/29 pl}(29,){el}( ){/68 pl}(68){el}]362 1 idx03 +[(relational operators)][{/50 pl}(50){el}]351 1 idx03 +[(release candidates)][{/15 pl}(15){el}]340 1 idx03 +[(Relocatable Dynamic Object File Format)][{/88 pl}(88){el}]329 1 idx03 +[(relocations, PIC-specific)][{/86 pl}(86){el}]318 1 idx03 +[(removing contexts)][{/54 pl}(54){el}]307 1 idx03 +[(renaming contexts)][{/55 pl}(55){el}]296 1 idx03 +[2(%rep)][{/28 pl}(28,){el}( ){/52 pl}(52){el}]285 1 idx03 +[(repeating)][{/28 pl}(28,){el}( ){/52 pl}(52){el}]274 1 idx03 +[2(%repl)][{/55 pl}(55){el}]263 1 idx03 +[(reporting bugs)][{/117 pl}(117){el}]252 1 idx03 +[2(RESB)][{/25 pl}(25,){el}( ){/27 pl}(27){el}]241 1 idx03 +[2(RESD)][{/27 pl}(27){el}]230 1 idx03 +[2(RESO)][{/27 pl}(27){el}]219 1 idx03 +[2(RESQ)][{/27 pl}(27){el}]208 1 idx03 +[2(REST)][{/27 pl}(27){el}]197 1 idx03 +[2(RESW)][{/27 pl}(27){el}]186 1 idx03 +[2(RESY)][{/27 pl}(27){el}]175 1 idx03 +[2(%rmacro)][{/43 pl}(43){el}]164 1 idx03 +[2(.rodata)][{/85 pl}(85){el}]153 1 idx03 +[2(%rotate)][{/46 pl}(46){el}]142 1 idx03 +[(rotating macro parameters)][{/46 pl}(46){el}]131 1 idx03 +[2(-s)0( option)][{/20 pl}(20,){el}( ){/120 pl}(120){el}]120 1 idx03 +[(searching for include files)][{/53 pl}(53){el}]109 1 idx03 +(211)pageodd +restore showpage +%%Page: 212 212 +%%BeginPageSetup +save +%%EndPageSetup +/212 pa +[2(__SECT__)][{/68 pl}(68,){el}( ){/69 pl}(69){el}]681 0 idx03 +[2(SECTION)][{/68 pl}(68){el}]670 0 idx03 +[2(elf)0( extensions to)][{/85 pl}(85){el}]659 0 idx13 +[2(win32)0( extensions to)][{/79 pl}(79){el}]648 0 idx13 +[(section alignment)][]637 0 idx03 +[(in )2(bin)][{/74 pl}(74){el}]626 0 idx13 +[(in )2(elf)][{/85 pl}(85){el}]615 0 idx13 +[(in )2(obj)][{/76 pl}(76){el}]604 0 idx13 +[(in )2(win32)][{/79 pl}(79){el}]593 0 idx13 +[(section, bin extensions to)][{/73 pl}(73){el}]582 0 idx03 +[2(SEG)][{/34 pl}(34,){el}( ){/75 pl}(75){el}]571 0 idx03 +[2(SEGMENT)][{/68 pl}(68){el}]560 0 idx03 +[2(elf)0( extensions to)][{/75 pl}(75){el}]549 0 idx13 +[(segment address)][{/34 pl}(34){el}]538 0 idx03 +[(segment alignment)][]527 0 idx03 +[(in )2(bin)][{/74 pl}(74){el}]516 0 idx13 +[(in )2(obj)][{/76 pl}(76){el}]505 0 idx13 +[(segment names, Borland Pascal)][{/101 pl}(101){el}]494 0 idx03 +[(segment override)][{/25 pl}(25,){el}( ){/26 pl}(26){el}]483 0 idx03 +[(segments)][{/34 pl}(34){el}]472 0 idx03 +[(groups of)][{/76 pl}(76){el}]461 0 idx13 +[(separator character)][{/23 pl}(23){el}]450 0 idx03 +[(shared libraries)][{/88 pl}(88,){el}( ){/106 pl}(106){el}]439 0 idx03 +[(shared library)][{/87 pl}(87){el}]428 0 idx03 +[2(shift)0( command)][{/46 pl}(46){el}]417 0 idx03 +[(SIB byte)][]406 0 idx03 +[(signed division)][{/33 pl}(33){el}]395 0 idx03 +[(signed modulo)][{/33 pl}(33){el}]384 0 idx03 +[(single-line macros)][{/37 pl}(37){el}]373 0 idx03 +[(size, of symbols)][{/87 pl}(87){el}]362 0 idx03 +[2(smartalign)][{/66 pl}(66){el}]351 0 idx03 +[2(__SNaN__)][{/32 pl}(32){el}]340 0 idx03 +[(snapshots, daily development)][{/15 pl}(15){el}]329 0 idx03 +[(Solaris x86)][{/85 pl}(85){el}]318 0 idx03 +[2(-soname)][{/109 pl}(109){el}]307 0 idx03 +[(sound)][{/27 pl}(27){el}]296 0 idx03 +[(source code)][{/15 pl}(15){el}]285 0 idx03 +[(source-listing file)][{/18 pl}(18){el}]274 0 idx03 +[(square brackets)][{/24 pl}(24,){el}( ){/28 pl}(28){el}]263 0 idx03 +[2(srec)][{/74 pl}(74){el}]252 0 idx03 +[2(STACK)][{/75 pl}(75){el}]241 0 idx03 +[(stack relative preprocessor directives)][{/57 pl}(57){el}]230 0 idx03 +[2(%stacksize)][{/57 pl}(57){el}]219 0 idx03 +[(standard macro packages)][{/66 pl}(66){el}]208 0 idx03 +[(standard macros)][{/60 pl}(60){el}]197 0 idx03 +[(standardized section names)][{/68 pl}(68,){el}( ){/79 pl}(79,){el}( ){/85 pl}(85,){el}( ){/88 pl}(88,){el}( ){/89 pl}(89){el}]186 0 idx03 +[2(..start)][{/78 pl}(78,){el}( ){/91 pl}(91){el}]175 0 idx03 +[2(start=)][{/74 pl}(74){el}]164 0 idx03 +[2(stderr)][{/20 pl}(20){el}]153 0 idx03 +[2(stdout)][{/20 pl}(20){el}]142 0 idx03 +[2(%strcat)][{/41 pl}(41){el}]131 0 idx03 +[2(STRICT)][{/34 pl}(34){el}]120 0 idx03 +[(string constant)][{/27 pl}(27){el}]109 0 idx03 +[(string constants)][{/31 pl}(31){el}]681 1 idx03 +[(string length)][{/41 pl}(41){el}]670 1 idx03 +[(string manipulation in macros)][{/41 pl}(41){el}]659 1 idx03 +[(strings)][{/30 pl}(30){el}]648 1 idx03 +[2(%strlen)][{/41 pl}(41){el}]637 1 idx03 +[2(STRUC)][{/62 pl}(62,){el}( ){/69 pl}(69,){el}( ){/98 pl}(98,){el}( ){/105 pl}(105){el}]626 1 idx03 +[(stub preprocessor)][{/21 pl}(21){el}]615 1 idx03 +[2(%substr)][{/42 pl}(42){el}]604 1 idx03 +[(subtraction)][{/33 pl}(33){el}]593 1 idx03 +[(suppressible warning)][{/22 pl}(22){el}]582 1 idx03 +[(suppressing preprocessing)][{/21 pl}(21){el}]571 1 idx03 +[(switching between sections)][{/68 pl}(68){el}]560 1 idx03 +[2(..sym)][{/86 pl}(86){el}]549 1 idx03 +[(symbol sizes, specifying)][{/87 pl}(87){el}]538 1 idx03 +[(symbol types, specifying)][{/87 pl}(87){el}]527 1 idx03 +[(symbols)][]516 1 idx03 +[(exporting from DLLs)][{/77 pl}(77){el}]505 1 idx13 +[(importing from DLLs)][{/77 pl}(77){el}]494 1 idx13 +[2(synchronisation)][{/120 pl}(120){el}]483 1 idx03 +[2(.SYS)][{/73 pl}(73,){el}( ){/94 pl}(94){el}]472 1 idx03 +[2(-t)][{/22 pl}(22){el}]461 1 idx03 +[2(TASM)][{/14 pl}(14,){el}( ){/22 pl}(22){el}]450 1 idx03 +[(tasm)][{/24 pl}(24,){el}( ){/75 pl}(75){el}]439 1 idx03 +[2(.tbss)][{/85 pl}(85){el}]428 1 idx03 +[2(TBYTE)][{/25 pl}(25){el}]417 1 idx03 +[2(.tdata)][{/85 pl}(85){el}]406 1 idx03 +[2(test)0( subdirectory)][{/91 pl}(91){el}]395 1 idx03 +[(testing)][]384 1 idx03 +[(arbitrary numeric expressions)][{/50 pl}(50){el}]373 1 idx13 +[(context stack)][{/50 pl}(50){el}]362 1 idx13 +[(exact text identity)][{/50 pl}(50){el}]351 1 idx13 +[(multi-line macro existence)][{/49 pl}(49){el}]340 1 idx13 +[(single-line macro existence)][{/49 pl}(49){el}]329 1 idx13 +[(token types)][{/51 pl}(51){el}]318 1 idx13 +[2(.text)][{/85 pl}(85,){el}( ){/88 pl}(88,){el}( ){/89 pl}(89){el}]307 1 idx03 +[2(_TEXT)][{/96 pl}(96){el}]296 1 idx03 +[(thread local storage)][{/87 pl}(87){el}]285 1 idx03 +[2(__TIME__)][{/61 pl}(61){el}]274 1 idx03 +[2(__TIME_NUM__)][{/61 pl}(61){el}]263 1 idx03 +[2(TIMES)][{/27 pl}(27,){el}( ){/28 pl}(28,){el}( ){/35 pl}(35,){el}( ){/116 pl}(116,){el}( ){/117 pl}(117){el}]252 1 idx03 +[2(TLINK)][{/93 pl}(93){el}]241 1 idx03 +[2(tls)][{/85 pl}(85,){el}( ){/87 pl}(87){el}]230 1 idx03 +[2(..tlsie)][{/87 pl}(87){el}]219 1 idx03 +[(trailing colon)][{/26 pl}(26){el}]208 1 idx03 +[2(TWORD)][{/25 pl}(25,){el}( ){/27 pl}(27){el}]197 1 idx03 +[(type, of symbols)][{/87 pl}(87){el}]186 1 idx03 +[2(-U)0( option)][{/21 pl}(21){el}]175 1 idx03 +[2(-u)0( option)][{/21 pl}(21,){el}( ){/119 pl}(119){el}]164 1 idx03 +[(unary operators)][{/34 pl}(34){el}]153 1 idx03 +[2(%undef)][{/21 pl}(21,){el}( ){/40 pl}(40){el}]142 1 idx03 +[(undefining macros)][{/21 pl}(21){el}]131 1 idx03 +[(underscore, in C symbols)][{/94 pl}(94){el}]120 1 idx03 +[(Unicode)][{/30 pl}(30,){el}( ){/31 pl}(31){el}]109 1 idx03 +(212)pageeven +restore showpage +%%Page: 213 213 +%%BeginPageSetup +save +%%EndPageSetup +/213 pa +[(uninitialized)][{/27 pl}(27){el}]681 0 idx03 +[(uninitialized storage)][{/25 pl}(25){el}]670 0 idx03 +[(Unix)][{/16 pl}(16){el}]659 0 idx03 +[(SCO)][{/85 pl}(85){el}]648 0 idx13 +[(source archive)][{/16 pl}(16){el}]637 0 idx13 +[(System V)][{/85 pl}(85){el}]626 0 idx13 +[(UnixWare)][{/85 pl}(85){el}]615 0 idx03 +[2(%unmacro)][{/48 pl}(48){el}]604 0 idx03 +[(unrolled loops)][{/28 pl}(28){el}]593 0 idx03 +[(unsigned division)][{/33 pl}(33){el}]582 0 idx03 +[(unsigned modulo)][{/33 pl}(33){el}]571 0 idx03 +[2(UPPERCASE)][{/24 pl}(24,){el}( ){/77 pl}(77){el}]560 0 idx03 +[2(%use)][{/54 pl}(54,){el}( ){/66 pl}(66){el}]549 0 idx03 +[2(__USE_*__)][{/62 pl}(62){el}]538 0 idx03 +[2(USE16)][{/68 pl}(68,){el}( ){/76 pl}(76){el}]527 0 idx03 +[2(USE32)][{/68 pl}(68,){el}( ){/76 pl}(76){el}]516 0 idx03 +[2(user)][{/23 pl}(23){el}]505 0 idx03 +[(user-defined errors)][{/58 pl}(58){el}]494 0 idx03 +[(user-level assembler directives)][{/60 pl}(60){el}]483 0 idx03 +[(user-level directives)][{/67 pl}(67){el}]472 0 idx03 +[2(__UTC_DATE__)][{/61 pl}(61){el}]461 0 idx03 +[2(__UTC_DATE_NUM__)][{/61 pl}(61){el}]450 0 idx03 +[2(__UTC_TIME__)][{/61 pl}(61){el}]439 0 idx03 +[2(__UTC_TIME_NUM__)][{/61 pl}(61){el}]428 0 idx03 +[(UTF-16)][{/31 pl}(31){el}]417 0 idx03 +[(UTF-32)][{/31 pl}(31){el}]406 0 idx03 +[(UTF-8)][{/30 pl}(30){el}]395 0 idx03 +[2(__utf16__)][{/31 pl}(31){el}]384 0 idx03 +[2(__utf32__)][{/31 pl}(31){el}]373 0 idx03 +[2(-v)0( option)][{/23 pl}(23){el}]362 0 idx03 +[(VAL)][{/91 pl}(91){el}]351 0 idx03 +[(valid characters)][{/26 pl}(26){el}]340 0 idx03 +[(variable types)][{/24 pl}(24){el}]329 0 idx03 +[(version)][{/23 pl}(23){el}]318 0 idx03 +[(version number of NASM)][{/60 pl}(60){el}]307 0 idx03 +[2(vfollows=)][{/74 pl}(74){el}]296 0 idx03 +[(Visual C++)][{/79 pl}(79){el}]285 0 idx03 +[2(vstart=)][{/74 pl}(74){el}]274 0 idx03 +[2(-W)0( option)][{/22 pl}(22){el}]263 0 idx03 +[2(-w)0( option)][{/22 pl}(22){el}]252 0 idx03 +[2(%warning)][{/58 pl}(58){el}]241 0 idx03 +[(warnings)][{/22 pl}(22){el}]230 0 idx03 +[2([warning *warning-name])][{/23 pl}(23){el}]219 0 idx03 +[2([warning +warning-name])][{/23 pl}(23){el}]208 0 idx03 +[2([warning -warning-name])][{/23 pl}(23){el}]197 0 idx03 +[(website)][{/15 pl}(15){el}]186 0 idx03 +[2(win64)][{/81 pl}(81,){el}( ){/113 pl}(113){el}]175 0 idx03 +[(Win64)][{/75 pl}(75,){el}( ){/79 pl}(79,){el}( ){/103 pl}(103){el}]164 0 idx03 +[(Windows)][{/91 pl}(91){el}]153 0 idx03 +[(Windows 95)][]142 0 idx03 +[(Windows NT)][]131 0 idx03 +[2(write)][{/85 pl}(85){el}]120 0 idx03 +[(writing operating systems)][{/110 pl}(110){el}]109 0 idx03 +[2(WRT)][{/34 pl}(34,){el}( ){/75 pl}(75,){el}( ){/86 pl}(86,){el}( ){/87 pl}(87,){el}( ){/88 pl}(88){el}]681 1 idx03 +[2(WRT ..got)][{/107 pl}(107){el}]670 1 idx03 +[2(WRT ..gotoff)][{/107 pl}(107){el}]659 1 idx03 +[2(WRT ..gotpc)][{/107 pl}(107){el}]648 1 idx03 +[2(WRT ..plt)][{/109 pl}(109){el}]637 1 idx03 +[2(WRT ..sym)][{/108 pl}(108){el}]626 1 idx03 +[(WWW page)][]615 1 idx03 +[2(www.cpan.org)][{/15 pl}(15){el}]604 1 idx03 +[2(www.delorie.com)][{/91 pl}(91){el}]593 1 idx03 +[2(www.pcorner.com)][{/91 pl}(91){el}]582 1 idx03 +[2(-X)0( option)][{/19 pl}(19){el}]571 1 idx03 +[2(x2ftp.oulu.fi)][{/91 pl}(91){el}]560 1 idx03 +[2(%xdefine)][{/38 pl}(38){el}]549 1 idx03 +[2(-y)0( option)][{/23 pl}(23){el}]538 1 idx03 +[2(-Z)0( option)][{/20 pl}(20){el}]527 1 idx03 +(213)pageodd +restore showpage +%%EOF diff --git a/doc/nasmdoc.txt b/doc/nasmdoc.txt new file mode 100644 index 0000000..5a7286b --- /dev/null +++ b/doc/nasmdoc.txt @@ -0,0 +1,12394 @@ + The Netwide Assembler: NASM + =========================== + +Chapter 1: Introduction +----------------------- + + 1.1 What Is NASM? + + The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler + designed for portability and modularity. It supports a range of + object file formats, including Linux and `*BSD' `a.out', `ELF', + `COFF', `Mach-O', Microsoft 16-bit `OBJ', `Win32' and `Win64'. It + will also output plain binary files. Its syntax is designed to be + simple and easy to understand, similar to Intel's but less complex. + It supports all currently known x86 architectural extensions, and + has strong support for macros. + + 1.1.1 Why Yet Another Assembler? + + The Netwide Assembler grew out of an idea on `comp.lang.asm.x86' (or + possibly `alt.lang.asm' - I forget which), which was essentially + that there didn't seem to be a good _free_ x86-series assembler + around, and that maybe someone ought to write one. + + (*) `a86' is good, but not free, and in particular you don't get any + 32-bit capability until you pay. It's DOS only, too. + + (*) `gas' is free, and ports over to DOS and Unix, but it's not very + good, since it's designed to be a back end to `gcc', which + always feeds it correct code. So its error checking is minimal. + Also, its syntax is horrible, from the point of view of anyone + trying to actually _write_ anything in it. Plus you can't write + 16-bit code in it (properly.) + + (*) `as86' is specific to Minix and Linux, and (my version at least) + doesn't seem to have much (or any) documentation. + + (*) `MASM' isn't very good, and it's (was) expensive, and it runs + only under DOS. + + (*) `TASM' is better, but still strives for MASM compatibility, + which means millions of directives and tons of red tape. And its + syntax is essentially MASM's, with the contradictions and quirks + that entails (although it sorts out some of those by means of + Ideal mode.) It's expensive too. And it's DOS-only. + + So here, for your coding pleasure, is NASM. At present it's still in + prototype stage - we don't promise that it can outperform any of + these assemblers. But please, _please_ send us bug reports, fixes, + helpful information, and anything else you can get your hands on + (and thanks to the many people who've done this already! You all + know who you are), and we'll improve it out of all recognition. + Again. + + 1.1.2 License Conditions + + Please see the file `LICENSE', supplied as part of any NASM + distribution archive, for the license conditions under which you may + use NASM. NASM is now under the so-called 2-clause BSD license, also + known as the simplified BSD license. + + Copyright 1996-2009 the NASM Authors - All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + (*) Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + (*) Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 1.2 Contact Information + + The current version of NASM (since about 0.98.08) is maintained by a + team of developers, accessible through the `nasm-devel' mailing list + (see below for the link). If you want to report a bug, please read + section 12.2 first. + + NASM has a website at `http://www.nasm.us/'. If it's not there, + google for us! + + New releases, release candidates, and daily development snapshots of + NASM are available from the official web site. + + Announcements are posted to `comp.lang.asm.x86', and to the web site + `http://www.freshmeat.net/'. + + If you want information about the current development status, please + subscribe to the `nasm-devel' email list; see link from the website. + + 1.3 Installation + + 1.3.1 Installing NASM under MS-DOS or Windows + + Once you've obtained the appropriate archive for NASM, + `nasm-XXX-dos.zip' or `nasm-XXX-win32.zip' (where `XXX' denotes the + version number of NASM contained in the archive), unpack it into its + own directory (for example `c:\nasm'). + + The archive will contain a set of executable files: the NASM + executable file `nasm.exe', the NDISASM executable file + `ndisasm.exe', and possibly additional utilities to handle the RDOFF + file format. + + The only file NASM needs to run is its own executable, so copy + `nasm.exe' to a directory on your PATH, or alternatively edit + `autoexec.bat' to add the `nasm' directory to your `PATH' (to do + that under Windows XP, go to Start > Control Panel > System > + Advanced > Environment Variables; these instructions may work under + other versions of Windows as well.) + + That's it - NASM is installed. You don't need the nasm directory to + be present to run NASM (unless you've added it to your `PATH'), so + you can delete it if you need to save space; however, you may want + to keep the documentation or test programs. + + If you've downloaded the DOS source archive, `nasm-XXX.zip', the + `nasm' directory will also contain the full NASM source code, and a + selection of Makefiles you can (hopefully) use to rebuild your copy + of NASM from scratch. See the file `INSTALL' in the source archive. + + Note that a number of files are generated from other files by Perl + scripts. Although the NASM source distribution includes these + generated files, you will need to rebuild them (and hence, will need + a Perl interpreter) if you change insns.dat, standard.mac or the + documentation. It is possible future source distributions may not + include these files at all. Ports of Perl for a variety of + platforms, including DOS and Windows, are available from + www.cpan.org. + + 1.3.2 Installing NASM under Unix + + Once you've obtained the Unix source archive for NASM, + `nasm-XXX.tar.gz' (where `XXX' denotes the version number of NASM + contained in the archive), unpack it into a directory such as + `/usr/local/src'. The archive, when unpacked, will create its own + subdirectory `nasm-XXX'. + + NASM is an auto-configuring package: once you've unpacked it, `cd' + to the directory it's been unpacked into and type `./configure'. + This shell script will find the best C compiler to use for building + NASM and set up Makefiles accordingly. + + Once NASM has auto-configured, you can type `make' to build the + `nasm' and `ndisasm' binaries, and then `make install' to install + them in `/usr/local/bin' and install the man pages `nasm.1' and + `ndisasm.1' in `/usr/local/man/man1'. Alternatively, you can give + options such as `--prefix' to the configure script (see the file + `INSTALL' for more details), or install the programs yourself. + + NASM also comes with a set of utilities for handling the `RDOFF' + custom object-file format, which are in the `rdoff' subdirectory of + the NASM archive. You can build these with `make rdf' and install + them with `make rdf_install', if you want them. + +Chapter 2: Running NASM +----------------------- + + 2.1 NASM Command-Line Syntax + + To assemble a file, you issue a command of the form + + nasm -f <format> <filename> [-o <output>] + + For example, + + nasm -f elf myfile.asm + + will assemble `myfile.asm' into an `ELF' object file `myfile.o'. And + + nasm -f bin myfile.asm -o myfile.com + + will assemble `myfile.asm' into a raw binary file `myfile.com'. + + To produce a listing file, with the hex codes output from NASM + displayed on the left of the original sources, use the `-l' option + to give a listing file name, for example: + + nasm -f coff myfile.asm -l myfile.lst + + To get further usage instructions from NASM, try typing + + nasm -h + + As `-hf', this will also list the available output file formats, and + what they are. + + If you use Linux but aren't sure whether your system is `a.out' or + `ELF', type + + file nasm + + (in the directory in which you put the NASM binary when you + installed it). If it says something like + + nasm: ELF 32-bit LSB executable i386 (386 and up) Version 1 + + then your system is `ELF', and you should use the option `-f elf' + when you want NASM to produce Linux object files. If it says + + nasm: Linux/i386 demand-paged executable (QMAGIC) + + or something similar, your system is `a.out', and you should use + `-f aout' instead (Linux `a.out' systems have long been obsolete, + and are rare these days.) + + Like Unix compilers and assemblers, NASM is silent unless it goes + wrong: you won't see any output at all, unless it gives error + messages. + + 2.1.1 The `-o' Option: Specifying the Output File Name + + NASM will normally choose the name of your output file for you; + precisely how it does this is dependent on the object file format. + For Microsoft object file formats (`obj', `win32' and `win64'), it + will remove the `.asm' extension (or whatever extension you like to + use - NASM doesn't care) from your source file name and substitute + `.obj'. For Unix object file formats (`aout', `as86', `coff', + `elf32', `elf64', `ieee', `macho32' and `macho64') it will + substitute `.o'. For `dbg', `rdf', `ith' and `srec', it will use + `.dbg', `.rdf', `.ith' and `.srec', respectively, and for the `bin' + format it will simply remove the extension, so that `myfile.asm' + produces the output file `myfile'. + + If the output file already exists, NASM will overwrite it, unless it + has the same name as the input file, in which case it will give a + warning and use `nasm.out' as the output file name instead. + + For situations in which this behaviour is unacceptable, NASM + provides the `-o' command-line option, which allows you to specify + your desired output file name. You invoke `-o' by following it with + the name you wish for the output file, either with or without an + intervening space. For example: + + nasm -f bin program.asm -o program.com + nasm -f bin driver.asm -odriver.sys + + Note that this is a small o, and is different from a capital O , + which is used to specify the number of optimisation passes required. + See section 2.1.22. + + 2.1.2 The `-f' Option: Specifying the Output File Format + + If you do not supply the `-f' option to NASM, it will choose an + output file format for you itself. In the distribution versions of + NASM, the default is always `bin'; if you've compiled your own copy + of NASM, you can redefine `OF_DEFAULT' at compile time and choose + what you want the default to be. + + Like `-o', the intervening space between `-f' and the output file + format is optional; so `-f elf' and `-felf' are both valid. + + A complete list of the available output file formats can be given by + issuing the command `nasm -hf'. + + 2.1.3 The `-l' Option: Generating a Listing File + + If you supply the `-l' option to NASM, followed (with the usual + optional space) by a file name, NASM will generate a source-listing + file for you, in which addresses and generated code are listed on + the left, and the actual source code, with expansions of multi-line + macros (except those which specifically request no expansion in + source listings: see section 4.3.10) on the right. For example: + + nasm -f elf myfile.asm -l myfile.lst + + If a list file is selected, you may turn off listing for a section + of your source with `[list -]', and turn it back on with `[list +]', + (the default, obviously). There is no "user form" (without the + brackets). This can be used to list only sections of interest, + avoiding excessively long listings. + + 2.1.4 The `-M' Option: Generate Makefile Dependencies + + This option can be used to generate makefile dependencies on stdout. + This can be redirected to a file for further processing. For + example: + + nasm -M myfile.asm > myfile.dep + + 2.1.5 The `-MG' Option: Generate Makefile Dependencies + + This option can be used to generate makefile dependencies on stdout. + This differs from the `-M' option in that if a nonexisting file is + encountered, it is assumed to be a generated file and is added to + the dependency list without a prefix. + + 2.1.6 The `-MF' Option: Set Makefile Dependency File + + This option can be used with the `-M' or `-MG' options to send the + output to a file, rather than to stdout. For example: + + nasm -M -MF myfile.dep myfile.asm + + 2.1.7 The `-MD' Option: Assemble and Generate Dependencies + + The `-MD' option acts as the combination of the `-M' and `-MF' + options (i.e. a filename has to be specified.) However, unlike the + `-M' or `-MG' options, `-MD' does _not_ inhibit the normal operation + of the assembler. Use this to automatically generate updated + dependencies with every assembly session. For example: + + nasm -f elf -o myfile.o -MD myfile.dep myfile.asm + + 2.1.8 The `-MT' Option: Dependency Target Name + + The `-MT' option can be used to override the default name of the + dependency target. This is normally the same as the output filename, + specified by the `-o' option. + + 2.1.9 The `-MQ' Option: Dependency Target Name (Quoted) + + The `-MQ' option acts as the `-MT' option, except it tries to quote + characters that have special meaning in Makefile syntax. This is not + foolproof, as not all characters with special meaning are quotable + in Make. + +2.1.10 The `-MP' Option: Emit phony targets + + When used with any of the dependency generation options, the `-MP' + option causes NASM to emit a phony target without dependencies for + each header file. This prevents Make from complaining if a header + file has been removed. + +2.1.11 The `-F' Option: Selecting a Debug Information Format + + This option is used to select the format of the debug information + emitted into the output file, to be used by a debugger (or _will_ + be). Prior to version 2.03.01, the use of this switch did _not_ + enable output of the selected debug info format. Use `-g', see + section 2.1.12, to enable output. Versions 2.03.01 and later + automatically enable `-g' if `-F' is specified. + + A complete list of the available debug file formats for an output + format can be seen by issuing the command `nasm -f <format> -y'. Not + all output formats currently support debugging output. See section + 2.1.26. + + This should not be confused with the `-f dbg' output format option + which is not built into NASM by default. For information on how to + enable it when building from the sources, see section 7.14. + +2.1.12 The `-g' Option: Enabling Debug Information. + + This option can be used to generate debugging information in the + specified format. See section 2.1.11. Using `-g' without `-F' + results in emitting debug info in the default format, if any, for + the selected output format. If no debug information is currently + implemented in the selected output format, `-g' is _silently + ignored_. + +2.1.13 The `-X' Option: Selecting an Error Reporting Format + + This option can be used to select an error reporting format for any + error messages that might be produced by NASM. + + Currently, two error reporting formats may be selected. They are the + `-Xvc' option and the `-Xgnu' option. The GNU format is the default + and looks like this: + + filename.asm:65: error: specific error message + + where `filename.asm' is the name of the source file in which the + error was detected, `65' is the source file line number on which the + error was detected, `error' is the severity of the error (this could + be `warning'), and `specific error message' is a more detailed text + message which should help pinpoint the exact problem. + + The other format, specified by `-Xvc' is the style used by Microsoft + Visual C++ and some other programs. It looks like this: + + filename.asm(65) : error: specific error message + + where the only difference is that the line number is in parentheses + instead of being delimited by colons. + + See also the `Visual C++' output format, section 7.5. + +2.1.14 The `-Z' Option: Send Errors to a File + + Under `MS-DOS' it can be difficult (though there are ways) to + redirect the standard-error output of a program to a file. Since + NASM usually produces its warning and error messages on `stderr', + this can make it hard to capture the errors if (for example) you + want to load them into an editor. + + NASM therefore provides the `-Z' option, taking a filename argument + which causes errors to be sent to the specified files rather than + standard error. Therefore you can redirect the errors into a file by + typing + + nasm -Z myfile.err -f obj myfile.asm + + In earlier versions of NASM, this option was called `-E', but it was + changed since `-E' is an option conventionally used for + preprocessing only, with disastrous results. See section 2.1.20. + +2.1.15 The `-s' Option: Send Errors to `stdout' + + The `-s' option redirects error messages to `stdout' rather than + `stderr', so it can be redirected under `MS-DOS'. To assemble the + file `myfile.asm' and pipe its output to the `more' program, you can + type: + + nasm -s -f obj myfile.asm | more + + See also the `-Z' option, section 2.1.14. + +2.1.16 The `-i' Option: Include File Search Directories + + When NASM sees the `%include' or `%pathsearch' directive in a source + file (see section 4.6.1, section 4.6.2 or section 3.2.3), it will + search for the given file not only in the current directory, but + also in any directories specified on the command line by the use of + the `-i' option. Therefore you can include files from a macro + library, for example, by typing + + nasm -ic:\macrolib\ -f obj myfile.asm + + (As usual, a space between `-i' and the path name is allowed, and + optional). + + NASM, in the interests of complete source-code portability, does not + understand the file naming conventions of the OS it is running on; + the string you provide as an argument to the `-i' option will be + prepended exactly as written to the name of the include file. + Therefore the trailing backslash in the above example is necessary. + Under Unix, a trailing forward slash is similarly necessary. + + (You can use this to your advantage, if you're really perverse, by + noting that the option `-ifoo' will cause `%include "bar.i"' to + search for the file `foobar.i'...) + + If you want to define a _standard_ include search path, similar to + `/usr/include' on Unix systems, you should place one or more `-i' + directives in the `NASMENV' environment variable (see section + 2.1.28). + + For Makefile compatibility with many C compilers, this option can + also be specified as `-I'. + +2.1.17 The `-p' Option: Pre-Include a File + + NASM allows you to specify files to be _pre-included_ into your + source file, by the use of the `-p' option. So running + + nasm myfile.asm -p myinc.inc + + is equivalent to running `nasm myfile.asm' and placing the directive + `%include "myinc.inc"' at the start of the file. + + For consistency with the `-I', `-D' and `-U' options, this option + can also be specified as `-P'. + +2.1.18 The `-d' Option: Pre-Define a Macro + + Just as the `-p' option gives an alternative to placing `%include' + directives at the start of a source file, the `-d' option gives an + alternative to placing a `%define' directive. You could code + + nasm myfile.asm -dFOO=100 + + as an alternative to placing the directive + + %define FOO 100 + + at the start of the file. You can miss off the macro value, as well: + the option `-dFOO' is equivalent to coding `%define FOO'. This form + of the directive may be useful for selecting assembly-time options + which are then tested using `%ifdef', for example `-dDEBUG'. + + For Makefile compatibility with many C compilers, this option can + also be specified as `-D'. + +2.1.19 The `-u' Option: Undefine a Macro + + The `-u' option undefines a macro that would otherwise have been + pre-defined, either automatically or by a `-p' or `-d' option + specified earlier on the command lines. + + For example, the following command line: + + nasm myfile.asm -dFOO=100 -uFOO + + would result in `FOO' _not_ being a predefined macro in the program. + This is useful to override options specified at a different point in + a Makefile. + + For Makefile compatibility with many C compilers, this option can + also be specified as `-U'. + +2.1.20 The `-E' Option: Preprocess Only + + NASM allows the preprocessor to be run on its own, up to a point. + Using the `-E' option (which requires no arguments) will cause NASM + to preprocess its input file, expand all the macro references, + remove all the comments and preprocessor directives, and print the + resulting file on standard output (or save it to a file, if the `-o' + option is also used). + + This option cannot be applied to programs which require the + preprocessor to evaluate expressions which depend on the values of + symbols: so code such as + + %assign tablesize ($-tablestart) + + will cause an error in preprocess-only mode. + + For compatiblity with older version of NASM, this option can also be + written `-e'. `-E' in older versions of NASM was the equivalent of + the current `-Z' option, section 2.1.14. + +2.1.21 The `-a' Option: Don't Preprocess At All + + If NASM is being used as the back end to a compiler, it might be + desirable to suppress preprocessing completely and assume the + compiler has already done it, to save time and increase compilation + speeds. The `-a' option, requiring no argument, instructs NASM to + replace its powerful preprocessor with a stub preprocessor which + does nothing. + +2.1.22 The `-O' Option: Specifying Multipass Optimization + + NASM defaults to not optimizing operands which can fit into a signed + byte. This means that if you want the shortest possible object code, + you have to enable optimization. + + Using the `-O' option, you can tell NASM to carry out different + levels of optimization. The syntax is: + + (*) `-O0': No optimization. All operands take their long forms, if a + short form is not specified, except conditional jumps. This is + intended to match NASM 0.98 behavior. + + (*) `-O1': Minimal optimization. As above, but immediate operands + which will fit in a signed byte are optimized, unless the long + form is specified. Conditional jumps default to the long form + unless otherwise specified. + + (*) `-Ox' (where `x' is the actual letter `x'): Multipass + optimization. Minimize branch offsets and signed immediate + bytes, overriding size specification unless the `strict' keyword + has been used (see section 3.7). For compatability with earlier + releases, the letter `x' may also be any number greater than + one. This number has no effect on the actual number of passes. + + The `-Ox' mode is recommended for most uses. + + Note that this is a capital `O', and is different from a small `o', + which is used to specify the output file name. See section 2.1.1. + +2.1.23 The `-t' Option: Enable TASM Compatibility Mode + + NASM includes a limited form of compatibility with Borland's `TASM'. + When NASM's `-t' option is used, the following changes are made: + + (*) local labels may be prefixed with `@@' instead of `.' + + (*) size override is supported within brackets. In TASM compatible + mode, a size override inside square brackets changes the size of + the operand, and not the address type of the operand as it does + in NASM syntax. E.g. `mov eax,[DWORD val]' is valid syntax in + TASM compatibility mode. Note that you lose the ability to + override the default address type for the instruction. + + (*) unprefixed forms of some directives supported (`arg', `elif', + `else', `endif', `if', `ifdef', `ifdifi', `ifndef', `include', + `local') + +2.1.24 The `-w' and `-W' Options: Enable or Disable Assembly Warnings + + NASM can observe many conditions during the course of assembly which + are worth mentioning to the user, but not a sufficiently severe + error to justify NASM refusing to generate an output file. These + conditions are reported like errors, but come up with the word + `warning' before the message. Warnings do not prevent NASM from + generating an output file and returning a success status to the + operating system. + + Some conditions are even less severe than that: they are only + sometimes worth mentioning to the user. Therefore NASM supports the + `-w' command-line option, which enables or disables certain classes + of assembly warning. Such warning classes are described by a name, + for example `orphan-labels'; you can enable warnings of this class + by the command-line option `-w+orphan-labels' and disable it by + `-w-orphan-labels'. + + The suppressible warning classes are: + + (*) `macro-params' covers warnings about multi-line macros being + invoked with the wrong number of parameters. This warning class + is enabled by default; see section 4.3.2 for an example of why + you might want to disable it. + + (*) `macro-selfref' warns if a macro references itself. This warning + class is disabled by default. + + (*) `macro-defaults' warns when a macro has more default parameters + than optional parameters. This warning class is enabled by + default; see section 4.3.5 for why you might want to disable it. + + (*) `orphan-labels' covers warnings about source lines which contain + no instruction but define a label without a trailing colon. NASM + warns about this somewhat obscure condition by default; see + section 3.1 for more information. + + (*) `number-overflow' covers warnings about numeric constants which + don't fit in 64 bits. This warning class is enabled by default. + + (*) `gnu-elf-extensions' warns if 8-bit or 16-bit relocations are + used in `-f elf' format. The GNU extensions allow this. This + warning class is disabled by default. + + (*) `float-overflow' warns about floating point overflow. Enabled by + default. + + (*) `float-denorm' warns about floating point denormals. Disabled by + default. + + (*) `float-underflow' warns about floating point underflow. Disabled + by default. + + (*) `float-toolong' warns about too many digits in floating-point + numbers. Enabled by default. + + (*) `user' controls `%warning' directives (see section 4.9). Enabled + by default. + + (*) `error' causes warnings to be treated as errors. Disabled by + default. + + (*) `all' is an alias for _all_ suppressible warning classes (not + including `error'). Thus, `-w+all' enables all available + warnings. + + In addition, you can set warning classes across sections. Warning + classes may be enabled with `[warning +warning-name]', disabled with + `[warning -warning-name]' or reset to their original value with + `[warning *warning-name]'. No "user form" (without the brackets) + exists. + + Since version 2.00, NASM has also supported the gcc-like syntax + `-Wwarning' and `-Wno-warning' instead of `-w+warning' and + `-w-warning', respectively. + +2.1.25 The `-v' Option: Display Version Info + + Typing `NASM -v' will display the version of NASM which you are + using, and the date on which it was compiled. + + You will need the version number if you report a bug. + +2.1.26 The `-y' Option: Display Available Debug Info Formats + + Typing `nasm -f <option> -y' will display a list of the available + debug info formats for the given output format. The default format + is indicated by an asterisk. For example: + + nasm -f elf -y + + valid debug formats for 'elf32' output format are + ('*' denotes default): + * stabs ELF32 (i386) stabs debug format for Linux + dwarf elf32 (i386) dwarf debug format for Linux + +2.1.27 The `--prefix' and `--postfix' Options. + + The `--prefix' and `--postfix' options prepend or append + (respectively) the given argument to all `global' or `extern' + variables. E.g. `--prefix _' will prepend the underscore to all + global and external variables, as C sometimes (but not always) likes + it. + +2.1.28 The `NASMENV' Environment Variable + + If you define an environment variable called `NASMENV', the program + will interpret it as a list of extra command-line options, which are + processed before the real command line. You can use this to define + standard search directories for include files, by putting `-i' + options in the `NASMENV' variable. + + The value of the variable is split up at white space, so that the + value `-s -ic:\nasmlib\' will be treated as two separate options. + However, that means that the value `-dNAME="my name"' won't do what + you might want, because it will be split at the space and the NASM + command-line processing will get confused by the two nonsensical + words `-dNAME="my' and `name"'. + + To get round this, NASM provides a feature whereby, if you begin the + `NASMENV' environment variable with some character that isn't a + minus sign, then NASM will treat this character as the separator + character for options. So setting the `NASMENV' variable to the + value `!-s!-ic:\nasmlib\' is equivalent to setting it to + `-s -ic:\nasmlib\', but `!-dNAME="my name"' will work. + + This environment variable was previously called `NASM'. This was + changed with version 0.98.31. + + 2.2 Quick Start for MASM Users + + If you're used to writing programs with MASM, or with TASM in MASM- + compatible (non-Ideal) mode, or with `a86', this section attempts to + outline the major differences between MASM's syntax and NASM's. If + you're not already used to MASM, it's probably worth skipping this + section. + + 2.2.1 NASM Is Case-Sensitive + + One simple difference is that NASM is case-sensitive. It makes a + difference whether you call your label `foo', `Foo' or `FOO'. If + you're assembling to `DOS' or `OS/2' `.OBJ' files, you can invoke + the `UPPERCASE' directive (documented in section 7.4) to ensure that + all symbols exported to other code modules are forced to be upper + case; but even then, _within_ a single module, NASM will distinguish + between labels differing only in case. + + 2.2.2 NASM Requires Square Brackets For Memory References + + NASM was designed with simplicity of syntax in mind. One of the + design goals of NASM is that it should be possible, as far as is + practical, for the user to look at a single line of NASM code and + tell what opcode is generated by it. You can't do this in MASM: if + you declare, for example, + + foo equ 1 + bar dw 2 + + then the two lines of code + + mov ax,foo + mov ax,bar + + generate completely different opcodes, despite having identical- + looking syntaxes. + + NASM avoids this undesirable situation by having a much simpler + syntax for memory references. The rule is simply that any access to + the _contents_ of a memory location requires square brackets around + the address, and any access to the _address_ of a variable doesn't. + So an instruction of the form `mov ax,foo' will _always_ refer to a + compile-time constant, whether it's an `EQU' or the address of a + variable; and to access the _contents_ of the variable `bar', you + must code `mov ax,[bar]'. + + This also means that NASM has no need for MASM's `OFFSET' keyword, + since the MASM code `mov ax,offset bar' means exactly the same thing + as NASM's `mov ax,bar'. If you're trying to get large amounts of + MASM code to assemble sensibly under NASM, you can always code + `%idefine offset' to make the preprocessor treat the `OFFSET' + keyword as a no-op. + + This issue is even more confusing in `a86', where declaring a label + with a trailing colon defines it to be a `label' as opposed to a + `variable' and causes `a86' to adopt NASM-style semantics; so in + `a86', `mov ax,var' has different behaviour depending on whether + `var' was declared as `var: dw 0' (a label) or `var dw 0' (a word- + size variable). NASM is very simple by comparison: _everything_ is a + label. + + NASM, in the interests of simplicity, also does not support the + hybrid syntaxes supported by MASM and its clones, such as + `mov ax,table[bx]', where a memory reference is denoted by one + portion outside square brackets and another portion inside. The + correct syntax for the above is `mov ax,[table+bx]'. Likewise, + `mov ax,es:[di]' is wrong and `mov ax,[es:di]' is right. + + 2.2.3 NASM Doesn't Store Variable Types + + NASM, by design, chooses not to remember the types of variables you + declare. Whereas MASM will remember, on seeing `var dw 0', that you + declared `var' as a word-size variable, and will then be able to + fill in the ambiguity in the size of the instruction `mov var,2', + NASM will deliberately remember nothing about the symbol `var' + except where it begins, and so you must explicitly code + `mov word [var],2'. + + For this reason, NASM doesn't support the `LODS', `MOVS', `STOS', + `SCAS', `CMPS', `INS', or `OUTS' instructions, but only supports the + forms such as `LODSB', `MOVSW', and `SCASD', which explicitly + specify the size of the components of the strings being manipulated. + + 2.2.4 NASM Doesn't `ASSUME' + + As part of NASM's drive for simplicity, it also does not support the + `ASSUME' directive. NASM will not keep track of what values you + choose to put in your segment registers, and will never + _automatically_ generate a segment override prefix. + + 2.2.5 NASM Doesn't Support Memory Models + + NASM also does not have any directives to support different 16-bit + memory models. The programmer has to keep track of which functions + are supposed to be called with a far call and which with a near + call, and is responsible for putting the correct form of `RET' + instruction (`RETN' or `RETF'; NASM accepts `RET' itself as an + alternate form for `RETN'); in addition, the programmer is + responsible for coding CALL FAR instructions where necessary when + calling _external_ functions, and must also keep track of which + external variable definitions are far and which are near. + + 2.2.6 Floating-Point Differences + + NASM uses different names to refer to floating-point registers from + MASM: where MASM would call them `ST(0)', `ST(1)' and so on, and + `a86' would call them simply `0', `1' and so on, NASM chooses to + call them `st0', `st1' etc. + + As of version 0.96, NASM now treats the instructions with `nowait' + forms in the same way as MASM-compatible assemblers. The + idiosyncratic treatment employed by 0.95 and earlier was based on a + misunderstanding by the authors. + + 2.2.7 Other Differences + + For historical reasons, NASM uses the keyword `TWORD' where MASM and + compatible assemblers use `TBYTE'. + + NASM does not declare uninitialized storage in the same way as MASM: + where a MASM programmer might use `stack db 64 dup (?)', NASM + requires `stack resb 64', intended to be read as `reserve 64 bytes'. + For a limited amount of compatibility, since NASM treats `?' as a + valid character in symbol names, you can code `? equ 0' and then + writing `dw ?' will at least do something vaguely useful. `DUP' is + still not a supported syntax, however. + + In addition to all of this, macros and directives work completely + differently to MASM. See chapter 4 and chapter 6 for further + details. + +Chapter 3: The NASM Language +---------------------------- + + 3.1 Layout of a NASM Source Line + + Like most assemblers, each NASM source line contains (unless it is a + macro, a preprocessor directive or an assembler directive: see + chapter 4 and chapter 6) some combination of the four fields + + label: instruction operands ; comment + + As usual, most of these fields are optional; the presence or absence + of any combination of a label, an instruction and a comment is + allowed. Of course, the operand field is either required or + forbidden by the presence and nature of the instruction field. + + NASM uses backslash (\) as the line continuation character; if a + line ends with backslash, the next line is considered to be a part + of the backslash-ended line. + + NASM places no restrictions on white space within a line: labels may + have white space before them, or instructions may have no space + before them, or anything. The colon after a label is also optional. + (Note that this means that if you intend to code `lodsb' alone on a + line, and type `lodab' by accident, then that's still a valid source + line which does nothing but define a label. Running NASM with the + command-line option `-w+orphan-labels' will cause it to warn you if + you define a label alone on a line without a trailing colon.) + + Valid characters in labels are letters, numbers, `_', `$', `#', `@', + `~', `.', and `?'. The only characters which may be used as the + _first_ character of an identifier are letters, `.' (with special + meaning: see section 3.9), `_' and `?'. An identifier may also be + prefixed with a `$' to indicate that it is intended to be read as an + identifier and not a reserved word; thus, if some other module you + are linking with defines a symbol called `eax', you can refer to + `$eax' in NASM code to distinguish the symbol from the register. + Maximum length of an identifier is 4095 characters. + + The instruction field may contain any machine instruction: Pentium + and P6 instructions, FPU instructions, MMX instructions and even + undocumented instructions are all supported. The instruction may be + prefixed by `LOCK', `REP', `REPE'/`REPZ' or `REPNE'/`REPNZ', in the + usual way. Explicit address-size and operand-size prefixes `A16', + `A32', `A64', `O16' and `O32', `O64' are provided - one example of + their use is given in chapter 10. You can also use the name of a + segment register as an instruction prefix: coding `es mov [bx],ax' + is equivalent to coding `mov [es:bx],ax'. We recommend the latter + syntax, since it is consistent with other syntactic features of the + language, but for instructions such as `LODSB', which has no + operands and yet can require a segment override, there is no clean + syntactic way to proceed apart from `es lodsb'. + + An instruction is not required to use a prefix: prefixes such as + `CS', `A32', `LOCK' or `REPE' can appear on a line by themselves, + and NASM will just generate the prefix bytes. + + In addition to actual machine instructions, NASM also supports a + number of pseudo-instructions, described in section 3.2. + + Instruction operands may take a number of forms: they can be + registers, described simply by the register name (e.g. `ax', `bp', + `ebx', `cr0': NASM does not use the `gas'-style syntax in which + register names must be prefixed by a `%' sign), or they can be + effective addresses (see section 3.3), constants (section 3.4) or + expressions (section 3.5). + + For x87 floating-point instructions, NASM accepts a wide range of + syntaxes: you can use two-operand forms like MASM supports, or you + can use NASM's native single-operand forms in most cases. For + example, you can code: + + fadd st1 ; this sets st0 := st0 + st1 + fadd st0,st1 ; so does this + + fadd st1,st0 ; this sets st1 := st1 + st0 + fadd to st1 ; so does this + + Almost any x87 floating-point instruction that references memory + must use one of the prefixes `DWORD', `QWORD' or `TWORD' to indicate + what size of memory operand it refers to. + + 3.2 Pseudo-Instructions + + Pseudo-instructions are things which, though not real x86 machine + instructions, are used in the instruction field anyway because + that's the most convenient place to put them. The current pseudo- + instructions are `DB', `DW', `DD', `DQ', `DT', `DO' and `DY'; their + uninitialized counterparts `RESB', `RESW', `RESD', `RESQ', `REST', + `RESO' and `RESY'; the `INCBIN' command, the `EQU' command, and the + `TIMES' prefix. + + 3.2.1 `DB' and Friends: Declaring Initialized Data + + `DB', `DW', `DD', `DQ', `DT', `DO' and `DY' are used, much as in + MASM, to declare initialized data in the output file. They can be + invoked in a wide range of ways: + + db 0x55 ; just the byte 0x55 + db 0x55,0x56,0x57 ; three bytes in succession + db 'a',0x55 ; character constants are OK + db 'hello',13,10,'$' ; so are string constants + dw 0x1234 ; 0x34 0x12 + dw 'a' ; 0x61 0x00 (it's just a number) + dw 'ab' ; 0x61 0x62 (character constant) + dw 'abc' ; 0x61 0x62 0x63 0x00 (string) + dd 0x12345678 ; 0x78 0x56 0x34 0x12 + dd 1.234567e20 ; floating-point constant + dq 0x123456789abcdef0 ; eight byte constant + dq 1.234567e20 ; double-precision float + dt 1.234567e20 ; extended-precision float + + `DT', `DO' and `DY' do not accept numeric constants as operands. + + 3.2.2 `RESB' and Friends: Declaring Uninitialized Data + + `RESB', `RESW', `RESD', `RESQ', `REST', `RESO' and `RESY' are + designed to be used in the BSS section of a module: they declare + _uninitialized_ storage space. Each takes a single operand, which is + the number of bytes, words, doublewords or whatever to reserve. As + stated in section 2.2.7, NASM does not support the MASM/TASM syntax + of reserving uninitialized space by writing `DW ?' or similar + things: this is what it does instead. The operand to a `RESB'-type + pseudo-instruction is a _critical expression_: see section 3.8. + + For example: + + buffer: resb 64 ; reserve 64 bytes + wordvar: resw 1 ; reserve a word + realarray resq 10 ; array of ten reals + ymmval: resy 1 ; one YMM register + + 3.2.3 `INCBIN': Including External Binary Files + + `INCBIN' is borrowed from the old Amiga assembler DevPac: it + includes a binary file verbatim into the output file. This can be + handy for (for example) including graphics and sound data directly + into a game executable file. It can be called in one of these three + ways: + + incbin "file.dat" ; include the whole file + incbin "file.dat",1024 ; skip the first 1024 bytes + incbin "file.dat",1024,512 ; skip the first 1024, and + ; actually include at most 512 + + `INCBIN' is both a directive and a standard macro; the standard + macro version searches for the file in the include file search path + and adds the file to the dependency lists. This macro can be + overridden if desired. + + 3.2.4 `EQU': Defining Constants + + `EQU' defines a symbol to a given constant value: when `EQU' is + used, the source line must contain a label. The action of `EQU' is + to define the given label name to the value of its (only) operand. + This definition is absolute, and cannot change later. So, for + example, + + message db 'hello, world' + msglen equ $-message + + defines `msglen' to be the constant 12. `msglen' may not then be + redefined later. This is not a preprocessor definition either: the + value of `msglen' is evaluated _once_, using the value of `$' (see + section 3.5 for an explanation of `$') at the point of definition, + rather than being evaluated wherever it is referenced and using the + value of `$' at the point of reference. + + 3.2.5 `TIMES': Repeating Instructions or Data + + The `TIMES' prefix causes the instruction to be assembled multiple + times. This is partly present as NASM's equivalent of the `DUP' + syntax supported by MASM-compatible assemblers, in that you can code + + zerobuf: times 64 db 0 + + or similar things; but `TIMES' is more versatile than that. The + argument to `TIMES' is not just a numeric constant, but a numeric + _expression_, so you can do things like + + buffer: db 'hello, world' + times 64-$+buffer db ' ' + + which will store exactly enough spaces to make the total length of + `buffer' up to 64. Finally, `TIMES' can be applied to ordinary + instructions, so you can code trivial unrolled loops in it: + + times 100 movsb + + Note that there is no effective difference between + `times 100 resb 1' and `resb 100', except that the latter will be + assembled about 100 times faster due to the internal structure of + the assembler. + + The operand to `TIMES' is a critical expression (section 3.8). + + Note also that `TIMES' can't be applied to macros: the reason for + this is that `TIMES' is processed after the macro phase, which + allows the argument to `TIMES' to contain expressions such as + `64-$+buffer' as above. To repeat more than one line of code, or a + complex macro, use the preprocessor `%rep' directive. + + 3.3 Effective Addresses + + An effective address is any operand to an instruction which + references memory. Effective addresses, in NASM, have a very simple + syntax: they consist of an expression evaluating to the desired + address, enclosed in square brackets. For example: + + wordvar dw 123 + mov ax,[wordvar] + mov ax,[wordvar+1] + mov ax,[es:wordvar+bx] + + Anything not conforming to this simple system is not a valid memory + reference in NASM, for example `es:wordvar[bx]'. + + More complicated effective addresses, such as those involving more + than one register, work in exactly the same way: + + mov eax,[ebx*2+ecx+offset] + mov ax,[bp+di+8] + + NASM is capable of doing algebra on these effective addresses, so + that things which don't necessarily _look_ legal are perfectly all + right: + + mov eax,[ebx*5] ; assembles as [ebx*4+ebx] + mov eax,[label1*2-label2] ; ie [label1+(label1-label2)] + + Some forms of effective address have more than one assembled form; + in most such cases NASM will generate the smallest form it can. For + example, there are distinct assembled forms for the 32-bit effective + addresses `[eax*2+0]' and `[eax+eax]', and NASM will generally + generate the latter on the grounds that the former requires four + bytes to store a zero offset. + + NASM has a hinting mechanism which will cause `[eax+ebx]' and + `[ebx+eax]' to generate different opcodes; this is occasionally + useful because `[esi+ebp]' and `[ebp+esi]' have different default + segment registers. + + However, you can force NASM to generate an effective address in a + particular form by the use of the keywords `BYTE', `WORD', `DWORD' + and `NOSPLIT'. If you need `[eax+3]' to be assembled using a double- + word offset field instead of the one byte NASM will normally + generate, you can code `[dword eax+3]'. Similarly, you can force + NASM to use a byte offset for a small value which it hasn't seen on + the first pass (see section 3.8 for an example of such a code + fragment) by using `[byte eax+offset]'. As special cases, + `[byte eax]' will code `[eax+0]' with a byte offset of zero, and + `[dword eax]' will code it with a double-word offset of zero. The + normal form, `[eax]', will be coded with no offset field. + + The form described in the previous paragraph is also useful if you + are trying to access data in a 32-bit segment from within 16 bit + code. For more information on this see the section on mixed-size + addressing (section 10.2). In particular, if you need to access data + with a known offset that is larger than will fit in a 16-bit value, + if you don't specify that it is a dword offset, nasm will cause the + high word of the offset to be lost. + + Similarly, NASM will split `[eax*2]' into `[eax+eax]' because that + allows the offset field to be absent and space to be saved; in fact, + it will also split `[eax*2+offset]' into `[eax+eax+offset]'. You can + combat this behaviour by the use of the `NOSPLIT' keyword: + `[nosplit eax*2]' will force `[eax*2+0]' to be generated literally. + + In 64-bit mode, NASM will by default generate absolute addresses. + The `REL' keyword makes it produce `RIP'-relative addresses. Since + this is frequently the normally desired behaviour, see the `DEFAULT' + directive (section 6.2). The keyword `ABS' overrides `REL'. + + 3.4 Constants + + NASM understands four different types of constant: numeric, + character, string and floating-point. + + 3.4.1 Numeric Constants + + A numeric constant is simply a number. NASM allows you to specify + numbers in a variety of number bases, in a variety of ways: you can + suffix `H' or `X', `Q' or `O', and `B' for hexadecimal, octal and + binary respectively, or you can prefix `0x' for hexadecimal in the + style of C, or you can prefix `$' for hexadecimal in the style of + Borland Pascal. Note, though, that the `$' prefix does double duty + as a prefix on identifiers (see section 3.1), so a hex number + prefixed with a `$' sign must have a digit after the `$' rather than + a letter. In addition, current versions of NASM accept the prefix + `0h' for hexadecimal, `0o' or `0q' for octal, and `0b' for binary. + Please note that unlike C, a `0' prefix by itself does _not_ imply + an octal constant! + + Numeric constants can have underscores (`_') interspersed to break + up long strings. + + Some examples (all producing exactly the same code): + + mov ax,200 ; decimal + mov ax,0200 ; still decimal + mov ax,0200d ; explicitly decimal + mov ax,0d200 ; also decimal + mov ax,0c8h ; hex + mov ax,$0c8 ; hex again: the 0 is required + mov ax,0xc8 ; hex yet again + mov ax,0hc8 ; still hex + mov ax,310q ; octal + mov ax,310o ; octal again + mov ax,0o310 ; octal yet again + mov ax,0q310 ; hex yet again + mov ax,11001000b ; binary + mov ax,1100_1000b ; same binary constant + mov ax,0b1100_1000 ; same binary constant yet again + + 3.4.2 Character Strings + + A character string consists of up to eight characters enclosed in + either single quotes (`'...''), double quotes (`"..."') or + backquotes (``...`'). Single or double quotes are equivalent to NASM + (except of course that surrounding the constant with single quotes + allows double quotes to appear within it and vice versa); the + contents of those are represented verbatim. Strings enclosed in + backquotes support C-style `\'-escapes for special characters. + + The following escape sequences are recognized by backquoted strings: + + \' single quote (') + \" double quote (") + \` backquote (`) + \\ backslash (\) + \? question mark (?) + \a BEL (ASCII 7) + \b BS (ASCII 8) + \t TAB (ASCII 9) + \n LF (ASCII 10) + \v VT (ASCII 11) + \f FF (ASCII 12) + \r CR (ASCII 13) + \e ESC (ASCII 27) + \377 Up to 3 octal digits - literal byte + \xFF Up to 2 hexadecimal digits - literal byte + \u1234 4 hexadecimal digits - Unicode character + \U12345678 8 hexadecimal digits - Unicode character + + All other escape sequences are reserved. Note that `\0', meaning a + `NUL' character (ASCII 0), is a special case of the octal escape + sequence. + + Unicode characters specified with `\u' or `\U' are converted to + UTF-8. For example, the following lines are all equivalent: + + db `\u263a` ; UTF-8 smiley face + db `\xe2\x98\xba` ; UTF-8 smiley face + db 0E2h, 098h, 0BAh ; UTF-8 smiley face + + 3.4.3 Character Constants + + A character constant consists of a string up to eight bytes long, + used in an expression context. It is treated as if it was an + integer. + + A character constant with more than one byte will be arranged with + little-endian order in mind: if you code + + mov eax,'abcd' + + then the constant generated is not `0x61626364', but `0x64636261', + so that if you were then to store the value into memory, it would + read `abcd' rather than `dcba'. This is also the sense of character + constants understood by the Pentium's `CPUID' instruction. + + 3.4.4 String Constants + + String constants are character strings used in the context of some + pseudo-instructions, namely the `DB' family and `INCBIN' (where it + represents a filename.) They are also used in certain preprocessor + directives. + + A string constant looks like a character constant, only longer. It + is treated as a concatenation of maximum-size character constants + for the conditions. So the following are equivalent: + + db 'hello' ; string constant + db 'h','e','l','l','o' ; equivalent character constants + + And the following are also equivalent: + + dd 'ninechars' ; doubleword string constant + dd 'nine','char','s' ; becomes three doublewords + db 'ninechars',0,0,0 ; and really looks like this + + Note that when used in a string-supporting context, quoted strings + are treated as a string constants even if they are short enough to + be a character constant, because otherwise `db 'ab'' would have the + same effect as `db 'a'', which would be silly. Similarly, three- + character or four-character constants are treated as strings when + they are operands to `DW', and so forth. + + 3.4.5 Unicode Strings + + The special operators `__utf16__' and `__utf32__' allows definition + of Unicode strings. They take a string in UTF-8 format and converts + it to (littleendian) UTF-16 or UTF-32, respectively. + + For example: + + %define u(x) __utf16__(x) + %define w(x) __utf32__(x) + + dw u('C:\WINDOWS'), 0 ; Pathname in UTF-16 + dd w(`A + B = \u206a`), 0 ; String in UTF-32 + + `__utf16__' and `__utf32__' can be applied either to strings passed + to the `DB' family instructions, or to character constants in an + expression context. + + 3.4.6 Floating-Point Constants + + Floating-point constants are acceptable only as arguments to `DB', + `DW', `DD', `DQ', `DT', and `DO', or as arguments to the special + operators `__float8__', `__float16__', `__float32__', `__float64__', + `__float80m__', `__float80e__', `__float128l__', and + `__float128h__'. + + Floating-point constants are expressed in the traditional form: + digits, then a period, then optionally more digits, then optionally + an `E' followed by an exponent. The period is mandatory, so that + NASM can distinguish between `dd 1', which declares an integer + constant, and `dd 1.0' which declares a floating-point constant. + NASM also support C99-style hexadecimal floating-point: `0x', + hexadecimal digits, period, optionally more hexadeximal digits, then + optionally a `P' followed by a _binary_ (not hexadecimal) exponent + in decimal notation. + + Underscores to break up groups of digits are permitted in floating- + point constants as well. + + Some examples: + + db -0.2 ; "Quarter precision" + dw -0.5 ; IEEE 754r/SSE5 half precision + dd 1.2 ; an easy one + dd 1.222_222_222 ; underscores are permitted + dd 0x1p+2 ; 1.0x2^2 = 4.0 + dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0 + dq 1.e10 ; 10 000 000 000.0 + dq 1.e+10 ; synonymous with 1.e10 + dq 1.e-10 ; 0.000 000 000 1 + dt 3.141592653589793238462 ; pi + do 1.e+4000 ; IEEE 754r quad precision + + The 8-bit "quarter-precision" floating-point format is + sign:exponent:mantissa = 1:4:3 with an exponent bias of 7. This + appears to be the most frequently used 8-bit floating-point format, + although it is not covered by any formal standard. This is sometimes + called a "minifloat." + + The special operators are used to produce floating-point numbers in + other contexts. They produce the binary representation of a specific + floating-point number as an integer, and can use anywhere integer + constants are used in an expression. `__float80m__' and + `__float80e__' produce the 64-bit mantissa and 16-bit exponent of an + 80-bit floating-point number, and `__float128l__' and + `__float128h__' produce the lower and upper 64-bit halves of a 128- + bit floating-point number, respectively. + + For example: + + mov rax,__float64__(3.141592653589793238462) + + ... would assign the binary representation of pi as a 64-bit + floating point number into `RAX'. This is exactly equivalent to: + + mov rax,0x400921fb54442d18 + + NASM cannot do compile-time arithmetic on floating-point constants. + This is because NASM is designed to be portable - although it always + generates code to run on x86 processors, the assembler itself can + run on any system with an ANSI C compiler. Therefore, the assembler + cannot guarantee the presence of a floating-point unit capable of + handling the Intel number formats, and so for NASM to be able to do + floating arithmetic it would have to include its own complete set of + floating-point routines, which would significantly increase the size + of the assembler for very little benefit. + + The special tokens `__Infinity__', `__QNaN__' (or `__NaN__') and + `__SNaN__' can be used to generate infinities, quiet NaNs, and + signalling NaNs, respectively. These are normally used as macros: + + %define Inf __Infinity__ + %define NaN __QNaN__ + + dq +1.5, -Inf, NaN ; Double-precision constants + + 3.4.7 Packed BCD Constants + + x87-style packed BCD constants can be used in the same contexts as + 80-bit floating-point numbers. They are suffixed with `p' or + prefixed with `0p', and can include up to 18 decimal digits. + + As with other numeric constants, underscores can be used to separate + digits. + + For example: + + dt 12_345_678_901_245_678p + dt -12_345_678_901_245_678p + dt +0p33 + dt 33p + + 3.5 Expressions + + Expressions in NASM are similar in syntax to those in C. Expressions + are evaluated as 64-bit integers which are then adjusted to the + appropriate size. + + NASM supports two special tokens in expressions, allowing + calculations to involve the current assembly position: the `$' and + `$$' tokens. `$' evaluates to the assembly position at the beginning + of the line containing the expression; so you can code an infinite + loop using `JMP $'. `$$' evaluates to the beginning of the current + section; so you can tell how far into the section you are by using + `($-$$)'. + + The arithmetic operators provided by NASM are listed here, in + increasing order of precedence. + + 3.5.1 `|': Bitwise OR Operator + + The `|' operator gives a bitwise OR, exactly as performed by the + `OR' machine instruction. Bitwise OR is the lowest-priority + arithmetic operator supported by NASM. + + 3.5.2 `^': Bitwise XOR Operator + + `^' provides the bitwise XOR operation. + + 3.5.3 `&': Bitwise AND Operator + + `&' provides the bitwise AND operation. + + 3.5.4 `<<' and `>>': Bit Shift Operators + + `<<' gives a bit-shift to the left, just as it does in C. So `5<<3' + evaluates to 5 times 8, or 40. `>>' gives a bit-shift to the right; + in NASM, such a shift is _always_ unsigned, so that the bits shifted + in from the left-hand end are filled with zero rather than a sign- + extension of the previous highest bit. + + 3.5.5 `+' and `-': Addition and Subtraction Operators + + The `+' and `-' operators do perfectly ordinary addition and + subtraction. + + 3.5.6 `*', `/', `//', `%' and `%%': Multiplication and Division + + `*' is the multiplication operator. `/' and `//' are both division + operators: `/' is unsigned division and `//' is signed division. + Similarly, `%' and `%%' provide unsigned and signed modulo operators + respectively. + + NASM, like ANSI C, provides no guarantees about the sensible + operation of the signed modulo operator. + + Since the `%' character is used extensively by the macro + preprocessor, you should ensure that both the signed and unsigned + modulo operators are followed by white space wherever they appear. + + 3.5.7 Unary Operators: `+', `-', `~', `!' and `SEG' + + The highest-priority operators in NASM's expression grammar are + those which only apply to one argument. `-' negates its operand, `+' + does nothing (it's provided for symmetry with `-'), `~' computes the + one's complement of its operand, `!' is the logical negation + operator, and `SEG' provides the segment address of its operand + (explained in more detail in section 3.6). + + 3.6 `SEG' and `WRT' + + When writing large 16-bit programs, which must be split into + multiple segments, it is often necessary to be able to refer to the + segment part of the address of a symbol. NASM supports the `SEG' + operator to perform this function. + + The `SEG' operator returns the _preferred_ segment base of a symbol, + defined as the segment base relative to which the offset of the + symbol makes sense. So the code + + mov ax,seg symbol + mov es,ax + mov bx,symbol + + will load `ES:BX' with a valid pointer to the symbol `symbol'. + + Things can be more complex than this: since 16-bit segments and + groups may overlap, you might occasionally want to refer to some + symbol using a different segment base from the preferred one. NASM + lets you do this, by the use of the `WRT' (With Reference To) + keyword. So you can do things like + + mov ax,weird_seg ; weird_seg is a segment base + mov es,ax + mov bx,symbol wrt weird_seg + + to load `ES:BX' with a different, but functionally equivalent, + pointer to the symbol `symbol'. + + NASM supports far (inter-segment) calls and jumps by means of the + syntax `call segment:offset', where `segment' and `offset' both + represent immediate values. So to call a far procedure, you could + code either of + + call (seg procedure):procedure + call weird_seg:(procedure wrt weird_seg) + + (The parentheses are included for clarity, to show the intended + parsing of the above instructions. They are not necessary in + practice.) + + NASM supports the syntax `call far procedure' as a synonym for the + first of the above usages. `JMP' works identically to `CALL' in + these examples. + + To declare a far pointer to a data item in a data segment, you must + code + + dw symbol, seg symbol + + NASM supports no convenient synonym for this, though you can always + invent one using the macro processor. + + 3.7 `STRICT': Inhibiting Optimization + + When assembling with the optimizer set to level 2 or higher (see + section 2.1.22), NASM will use size specifiers (`BYTE', `WORD', + `DWORD', `QWORD', `TWORD', `OWORD' or `YWORD'), but will give them + the smallest possible size. The keyword `STRICT' can be used to + inhibit optimization and force a particular operand to be emitted in + the specified size. For example, with the optimizer on, and in + `BITS 16' mode, + + push dword 33 + + is encoded in three bytes `66 6A 21', whereas + + push strict dword 33 + + is encoded in six bytes, with a full dword immediate operand + `66 68 21 00 00 00'. + + With the optimizer off, the same code (six bytes) is generated + whether the `STRICT' keyword was used or not. + + 3.8 Critical Expressions + + Although NASM has an optional multi-pass optimizer, there are some + expressions which must be resolvable on the first pass. These are + called _Critical Expressions_. + + The first pass is used to determine the size of all the assembled + code and data, so that the second pass, when generating all the + code, knows all the symbol addresses the code refers to. So one + thing NASM can't handle is code whose size depends on the value of a + symbol declared after the code in question. For example, + + times (label-$) db 0 + label: db 'Where am I?' + + The argument to `TIMES' in this case could equally legally evaluate + to anything at all; NASM will reject this example because it cannot + tell the size of the `TIMES' line when it first sees it. It will + just as firmly reject the slightly paradoxical code + + times (label-$+1) db 0 + label: db 'NOW where am I?' + + in which _any_ value for the `TIMES' argument is by definition + wrong! + + NASM rejects these examples by means of a concept called a _critical + expression_, which is defined to be an expression whose value is + required to be computable in the first pass, and which must + therefore depend only on symbols defined before it. The argument to + the `TIMES' prefix is a critical expression. + + 3.9 Local Labels + + NASM gives special treatment to symbols beginning with a period. A + label beginning with a single period is treated as a _local_ label, + which means that it is associated with the previous non-local label. + So, for example: + + label1 ; some code + + .loop + ; some more code + + jne .loop + ret + + label2 ; some code + + .loop + ; some more code + + jne .loop + ret + + In the above code fragment, each `JNE' instruction jumps to the line + immediately before it, because the two definitions of `.loop' are + kept separate by virtue of each being associated with the previous + non-local label. + + This form of local label handling is borrowed from the old Amiga + assembler DevPac; however, NASM goes one step further, in allowing + access to local labels from other parts of the code. This is + achieved by means of _defining_ a local label in terms of the + previous non-local label: the first definition of `.loop' above is + really defining a symbol called `label1.loop', and the second + defines a symbol called `label2.loop'. So, if you really needed to, + you could write + + label3 ; some more code + ; and some more + + jmp label1.loop + + Sometimes it is useful - in a macro, for instance - to be able to + define a label which can be referenced from anywhere but which + doesn't interfere with the normal local-label mechanism. Such a + label can't be non-local because it would interfere with subsequent + definitions of, and references to, local labels; and it can't be + local because the macro that defined it wouldn't know the label's + full name. NASM therefore introduces a third type of label, which is + probably only useful in macro definitions: if a label begins with + the special prefix `..@', then it does nothing to the local label + mechanism. So you could code + + label1: ; a non-local label + .local: ; this is really label1.local + ..@foo: ; this is a special symbol + label2: ; another non-local label + .local: ; this is really label2.local + + jmp ..@foo ; this will jump three lines up + + NASM has the capacity to define other special symbols beginning with + a double period: for example, `..start' is used to specify the entry + point in the `obj' output format (see section 7.4.6). + +Chapter 4: The NASM Preprocessor +-------------------------------- + + NASM contains a powerful macro processor, which supports conditional + assembly, multi-level file inclusion, two forms of macro (single- + line and multi-line), and a `context stack' mechanism for extra + macro power. Preprocessor directives all begin with a `%' sign. + + The preprocessor collapses all lines which end with a backslash (\) + character into a single line. Thus: + + %define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \ + THIS_VALUE + + will work like a single-line macro without the backslash-newline + sequence. + + 4.1 Single-Line Macros + + 4.1.1 The Normal Way: `%define' + + Single-line macros are defined using the `%define' preprocessor + directive. The definitions work in a similar way to C; so you can do + things like + + %define ctrl 0x1F & + %define param(a,b) ((a)+(a)*(b)) + + mov byte [param(2,ebx)], ctrl 'D' + + which will expand to + + mov byte [(2)+(2)*(ebx)], 0x1F & 'D' + + When the expansion of a single-line macro contains tokens which + invoke another macro, the expansion is performed at invocation time, + not at definition time. Thus the code + + %define a(x) 1+b(x) + %define b(x) 2*x + + mov ax,a(8) + + will evaluate in the expected way to `mov ax,1+2*8', even though the + macro `b' wasn't defined at the time of definition of `a'. + + Macros defined with `%define' are case sensitive: after + `%define foo bar', only `foo' will expand to `bar': `Foo' or `FOO' + will not. By using `%idefine' instead of `%define' (the `i' stands + for `insensitive') you can define all the case variants of a macro + at once, so that `%idefine foo bar' would cause `foo', `Foo', `FOO', + `fOO' and so on all to expand to `bar'. + + There is a mechanism which detects when a macro call has occurred as + a result of a previous expansion of the same macro, to guard against + circular references and infinite loops. If this happens, the + preprocessor will only expand the first occurrence of the macro. + Hence, if you code + + %define a(x) 1+a(x) + + mov ax,a(3) + + the macro `a(3)' will expand once, becoming `1+a(3)', and will then + expand no further. This behaviour can be useful: see section 9.1 for + an example of its use. + + You can overload single-line macros: if you write + + %define foo(x) 1+x + %define foo(x,y) 1+x*y + + the preprocessor will be able to handle both types of macro call, by + counting the parameters you pass; so `foo(3)' will become `1+3' + whereas `foo(ebx,2)' will become `1+ebx*2'. However, if you define + + %define foo bar + + then no other definition of `foo' will be accepted: a macro with no + parameters prohibits the definition of the same name as a macro + _with_ parameters, and vice versa. + + This doesn't prevent single-line macros being _redefined_: you can + perfectly well define a macro with + + %define foo bar + + and then re-define it later in the same source file with + + %define foo baz + + Then everywhere the macro `foo' is invoked, it will be expanded + according to the most recent definition. This is particularly useful + when defining single-line macros with `%assign' (see section 4.1.7). + + You can pre-define single-line macros using the `-d' option on the + NASM command line: see section 2.1.18. + + 4.1.2 Resolving `%define': `%xdefine' + + To have a reference to an embedded single-line macro resolved at the + time that the embedding macro is _defined_, as opposed to when the + embedding macro is _expanded_, you need a different mechanism to the + one offered by `%define'. The solution is to use `%xdefine', or it's + case-insensitive counterpart `%ixdefine'. + + Suppose you have the following code: + + %define isTrue 1 + %define isFalse isTrue + %define isTrue 0 + + val1: db isFalse + + %define isTrue 1 + + val2: db isFalse + + In this case, `val1' is equal to 0, and `val2' is equal to 1. This + is because, when a single-line macro is defined using `%define', it + is expanded only when it is called. As `isFalse' expands to + `isTrue', the expansion will be the current value of `isTrue'. The + first time it is called that is 0, and the second time it is 1. + + If you wanted `isFalse' to expand to the value assigned to the + embedded macro `isTrue' at the time that `isFalse' was defined, you + need to change the above code to use `%xdefine'. + + %xdefine isTrue 1 + %xdefine isFalse isTrue + %xdefine isTrue 0 + + val1: db isFalse + + %xdefine isTrue 1 + + val2: db isFalse + + Now, each time that `isFalse' is called, it expands to 1, as that is + what the embedded macro `isTrue' expanded to at the time that + `isFalse' was defined. + + 4.1.3 Macro Indirection: `%[...]' + + The `%[...]' construct can be used to expand macros in contexts + where macro expansion would otherwise not occur, including in the + names other macros. For example, if you have a set of macros named + `Foo16', `Foo32' and `Foo64', you could write: + + mov ax,Foo%[__BITS__] ; The Foo value + + to use the builtin macro `__BITS__' (see section 4.11.5) to + automatically select between them. Similarly, the two statements: + + %xdefine Bar Quux ; Expands due to %xdefine + %define Bar %[Quux] ; Expands due to %[...] + + have, in fact, exactly the same effect. + + `%[...]' concatenates to adjacent tokens in the same way that multi- + line macro parameters do, see section 4.3.8 for details. + + 4.1.4 Concatenating Single Line Macro Tokens: `%+' + + Individual tokens in single line macros can be concatenated, to + produce longer tokens for later processing. This can be useful if + there are several similar macros that perform similar functions. + + Please note that a space is required after `%+', in order to + disambiguate it from the syntax `%+1' used in multiline macros. + + As an example, consider the following: + + %define BDASTART 400h ; Start of BIOS data area + + struc tBIOSDA ; its structure + .COM1addr RESW 1 + .COM2addr RESW 1 + ; ..and so on + endstruc + + Now, if we need to access the elements of tBIOSDA in different + places, we can end up with: + + mov ax,BDASTART + tBIOSDA.COM1addr + mov bx,BDASTART + tBIOSDA.COM2addr + + This will become pretty ugly (and tedious) if used in many places, + and can be reduced in size significantly by using the following + macro: + + ; Macro to access BIOS variables by their names (from tBDA): + + %define BDA(x) BDASTART + tBIOSDA. %+ x + + Now the above code can be written as: + + mov ax,BDA(COM1addr) + mov bx,BDA(COM2addr) + + Using this feature, we can simplify references to a lot of macros + (and, in turn, reduce typing errors). + + 4.1.5 The Macro Name Itself: `%?' and `%??' + + The special symbols `%?' and `%??' can be used to reference the + macro name itself inside a macro expansion, this is supported for + both single-and multi-line macros. `%?' refers to the macro name as + _invoked_, whereas `%??' refers to the macro name as _declared_. The + two are always the same for case-sensitive macros, but for case- + insensitive macros, they can differ. + + For example: + + %idefine Foo mov %?,%?? + + foo + FOO + + will expand to: + + mov foo,Foo + mov FOO,Foo + + The sequence: + + %idefine keyword $%? + + can be used to make a keyword "disappear", for example in case a new + instruction has been used as a label in older code. For example: + + %idefine pause $%? ; Hide the PAUSE instruction + + 4.1.6 Undefining Single-Line Macros: `%undef' + + Single-line macros can be removed with the `%undef' directive. For + example, the following sequence: + + %define foo bar + %undef foo + + mov eax, foo + + will expand to the instruction `mov eax, foo', since after `%undef' + the macro `foo' is no longer defined. + + Macros that would otherwise be pre-defined can be undefined on the + command-line using the `-u' option on the NASM command line: see + section 2.1.19. + + 4.1.7 Preprocessor Variables: `%assign' + + An alternative way to define single-line macros is by means of the + `%assign' command (and its case-insensitive counterpart `%iassign', + which differs from `%assign' in exactly the same way that `%idefine' + differs from `%define'). + + `%assign' is used to define single-line macros which take no + parameters and have a numeric value. This value can be specified in + the form of an expression, and it will be evaluated once, when the + `%assign' directive is processed. + + Like `%define', macros defined using `%assign' can be re-defined + later, so you can do things like + + %assign i i+1 + + to increment the numeric value of a macro. + + `%assign' is useful for controlling the termination of `%rep' + preprocessor loops: see section 4.5 for an example of this. Another + use for `%assign' is given in section 8.4 and section 9.1. + + The expression passed to `%assign' is a critical expression (see + section 3.8), and must also evaluate to a pure number (rather than a + relocatable reference such as a code or data address, or anything + involving a register). + + 4.1.8 Defining Strings: `%defstr' + + `%defstr', and its case-insensitive counterpart `%idefstr', define + or redefine a single-line macro without parameters but converts the + entire right-hand side, after macro expansion, to a quoted string + before definition. + + For example: + + %defstr test TEST + + is equivalent to + + %define test 'TEST' + + This can be used, for example, with the `%!' construct (see section + 4.10.2): + + %defstr PATH %!PATH ; The operating system PATH variable + + 4.1.9 Defining Tokens: `%deftok' + + `%deftok', and its case-insensitive counterpart `%ideftok', define + or redefine a single-line macro without parameters but converts the + second parameter, after string conversion, to a sequence of tokens. + + For example: + + %deftok test 'TEST' + + is equivalent to + + %define test TEST + + 4.2 String Manipulation in Macros + + It's often useful to be able to handle strings in macros. NASM + supports a few simple string handling macro operators from which + more complex operations can be constructed. + + All the string operators define or redefine a value (either a string + or a numeric value) to a single-line macro. When producing a string + value, it may change the style of quoting of the input string or + strings, and possibly use `\'-escapes inside ``'-quoted strings. + + 4.2.1 Concatenating Strings: `%strcat' + + The `%strcat' operator concatenates quoted strings and assign them + to a single-line macro. + + For example: + + %strcat alpha "Alpha: ", '12" screen' + + ... would assign the value `'Alpha: 12" screen'' to `alpha'. + Similarly: + + %strcat beta '"foo"\', "'bar'" + + ... would assign the value ``"foo"\\'bar'`' to `beta'. + + The use of commas to separate strings is permitted but optional. + + 4.2.2 String Length: `%strlen' + + The `%strlen' operator assigns the length of a string to a macro. + For example: + + %strlen charcnt 'my string' + + In this example, `charcnt' would receive the value 9, just as if an + `%assign' had been used. In this example, `'my string'' was a + literal string but it could also have been a single-line macro that + expands to a string, as in the following example: + + %define sometext 'my string' + %strlen charcnt sometext + + As in the first case, this would result in `charcnt' being assigned + the value of 9. + + 4.2.3 Extracting Substrings: `%substr' + + Individual letters or substrings in strings can be extracted using + the `%substr' operator. An example of its use is probably more + useful than the description: + + %substr mychar 'xyzw' 1 ; equivalent to %define mychar 'x' + %substr mychar 'xyzw' 2 ; equivalent to %define mychar 'y' + %substr mychar 'xyzw' 3 ; equivalent to %define mychar 'z' + %substr mychar 'xyzw' 2,2 ; equivalent to %define mychar 'yz' + %substr mychar 'xyzw' 2,-1 ; equivalent to %define mychar 'yzw' + %substr mychar 'xyzw' 2,-2 ; equivalent to %define mychar 'yz' + + As with `%strlen' (see section 4.2.2), the first parameter is the + single-line macro to be created and the second is the string. The + third parameter specifies the first character to be selected, and + the optional fourth parameter preceeded by comma) is the length. + Note that the first index is 1, not 0 and the last index is equal to + the value that `%strlen' would assign given the same string. Index + values out of range result in an empty string. A negative length + means "until N-1 characters before the end of string", i.e. `-1' + means until end of string, `-2' until one character before, etc. + + 4.3 Multi-Line Macros: `%macro' + + Multi-line macros are much more like the type of macro seen in MASM + and TASM: a multi-line macro definition in NASM looks something like + this. + + %macro prologue 1 + + push ebp + mov ebp,esp + sub esp,%1 + + %endmacro + + This defines a C-like function prologue as a macro: so you would + invoke the macro with a call such as + + myfunc: prologue 12 + + which would expand to the three lines of code + + myfunc: push ebp + mov ebp,esp + sub esp,12 + + The number `1' after the macro name in the `%macro' line defines the + number of parameters the macro `prologue' expects to receive. The + use of `%1' inside the macro definition refers to the first + parameter to the macro call. With a macro taking more than one + parameter, subsequent parameters would be referred to as `%2', `%3' + and so on. + + Multi-line macros, like single-line macros, are case-sensitive, + unless you define them using the alternative directive `%imacro'. + + If you need to pass a comma as _part_ of a parameter to a multi-line + macro, you can do that by enclosing the entire parameter in braces. + So you could code things like + + %macro silly 2 + + %2: db %1 + + %endmacro + + silly 'a', letter_a ; letter_a: db 'a' + silly 'ab', string_ab ; string_ab: db 'ab' + silly {13,10}, crlf ; crlf: db 13,10 + + 4.3.1 Recursive Multi-Line Macros: `%rmacro' + + A multi-line macro cannot be referenced within itself, in order to + prevent accidental infinite recursion. + + Recursive multi-line macros allow for self-referencing, with the + caveat that the user is aware of the existence, use and purpose of + recursive multi-line macros. There is also a generous, but sane, + upper limit to the number of recursions, in order to prevent run- + away memory consumption in case of accidental infinite recursion. + + As with non-recursive multi-line macros, recursive multi-line macros + are case-sensitive, unless you define them using the alternative + directive `%irmacro'. + + 4.3.2 Overloading Multi-Line Macros + + As with single-line macros, multi-line macros can be overloaded by + defining the same macro name several times with different numbers of + parameters. This time, no exception is made for macros with no + parameters at all. So you could define + + %macro prologue 0 + + push ebp + mov ebp,esp + + %endmacro + + to define an alternative form of the function prologue which + allocates no local stack space. + + Sometimes, however, you might want to `overload' a machine + instruction; for example, you might want to define + + %macro push 2 + + push %1 + push %2 + + %endmacro + + so that you could code + + push ebx ; this line is not a macro call + push eax,ecx ; but this one is + + Ordinarily, NASM will give a warning for the first of the above two + lines, since `push' is now defined to be a macro, and is being + invoked with a number of parameters for which no definition has been + given. The correct code will still be generated, but the assembler + will give a warning. This warning can be disabled by the use of the + `-w-macro-params' command-line option (see section 2.1.24). + + 4.3.3 Macro-Local Labels + + NASM allows you to define labels within a multi-line macro + definition in such a way as to make them local to the macro call: so + calling the same macro multiple times will use a different label + each time. You do this by prefixing `%%' to the label name. So you + can invent an instruction which executes a `RET' if the `Z' flag is + set by doing this: + + %macro retz 0 + + jnz %%skip + ret + %%skip: + + %endmacro + + You can call this macro as many times as you want, and every time + you call it NASM will make up a different `real' name to substitute + for the label `%%skip'. The names NASM invents are of the form + `..@2345.skip', where the number 2345 changes with every macro call. + The `..@' prefix prevents macro-local labels from interfering with + the local label mechanism, as described in section 3.9. You should + avoid defining your own labels in this form (the `..@' prefix, then + a number, then another period) in case they interfere with macro- + local labels. + + 4.3.4 Greedy Macro Parameters + + Occasionally it is useful to define a macro which lumps its entire + command line into one parameter definition, possibly after + extracting one or two smaller parameters from the front. An example + might be a macro to write a text string to a file in MS-DOS, where + you might want to be able to write + + writefile [filehandle],"hello, world",13,10 + + NASM allows you to define the last parameter of a macro to be + _greedy_, meaning that if you invoke the macro with more parameters + than it expects, all the spare parameters get lumped into the last + defined one along with the separating commas. So if you code: + + %macro writefile 2+ + + jmp %%endstr + %%str: db %2 + %%endstr: + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + then the example call to `writefile' above will work as expected: + the text before the first comma, `[filehandle]', is used as the + first macro parameter and expanded when `%1' is referred to, and all + the subsequent text is lumped into `%2' and placed after the `db'. + + The greedy nature of the macro is indicated to NASM by the use of + the `+' sign after the parameter count on the `%macro' line. + + If you define a greedy macro, you are effectively telling NASM how + it should expand the macro given _any_ number of parameters from the + actual number specified up to infinity; in this case, for example, + NASM now knows what to do when it sees a call to `writefile' with 2, + 3, 4 or more parameters. NASM will take this into account when + overloading macros, and will not allow you to define another form of + `writefile' taking 4 parameters (for example). + + Of course, the above macro could have been implemented as a non- + greedy macro, in which case the call to it would have had to look + like + + writefile [filehandle], {"hello, world",13,10} + + NASM provides both mechanisms for putting commas in macro + parameters, and you choose which one you prefer for each macro + definition. + + See section 6.3.1 for a better way to write the above macro. + + 4.3.5 Default Macro Parameters + + NASM also allows you to define a multi-line macro with a _range_ of + allowable parameter counts. If you do this, you can specify defaults + for omitted parameters. So, for example: + + %macro die 0-1 "Painful program death has occurred." + + writefile 2,%1 + mov ax,0x4c01 + int 0x21 + + %endmacro + + This macro (which makes use of the `writefile' macro defined in + section 4.3.4) can be called with an explicit error message, which + it will display on the error output stream before exiting, or it can + be called with no parameters, in which case it will use the default + error message supplied in the macro definition. + + In general, you supply a minimum and maximum number of parameters + for a macro of this type; the minimum number of parameters are then + required in the macro call, and then you provide defaults for the + optional ones. So if a macro definition began with the line + + %macro foobar 1-3 eax,[ebx+2] + + then it could be called with between one and three parameters, and + `%1' would always be taken from the macro call. `%2', if not + specified by the macro call, would default to `eax', and `%3' if not + specified would default to `[ebx+2]'. + + You can provide extra information to a macro by providing too many + default parameters: + + %macro quux 1 something + + This will trigger a warning by default; see section 2.1.24 for more + information. When `quux' is invoked, it receives not one but two + parameters. `something' can be referred to as `%2'. The difference + between passing `something' this way and writing `something' in the + macro body is that with this way `something' is evaluated when the + macro is defined, not when it is expanded. + + You may omit parameter defaults from the macro definition, in which + case the parameter default is taken to be blank. This can be useful + for macros which can take a variable number of parameters, since the + `%0' token (see section 4.3.6) allows you to determine how many + parameters were really passed to the macro call. + + This defaulting mechanism can be combined with the greedy-parameter + mechanism; so the `die' macro above could be made more powerful, and + more useful, by changing the first line of the definition to + + %macro die 0-1+ "Painful program death has occurred.",13,10 + + The maximum parameter count can be infinite, denoted by `*'. In this + case, of course, it is impossible to provide a _full_ set of default + parameters. Examples of this usage are shown in section 4.3.7. + + 4.3.6 `%0': Macro Parameter Counter + + The parameter reference `%0' will return a numeric constant giving + the number of parameters received, that is, if `%0' is n then `%'n + is the last parameter. `%0' is mostly useful for macros that can + take a variable number of parameters. It can be used as an argument + to `%rep' (see section 4.5) in order to iterate through all the + parameters of a macro. Examples are given in section 4.3.7. + + 4.3.7 `%rotate': Rotating Macro Parameters + + Unix shell programmers will be familiar with the `shift' shell + command, which allows the arguments passed to a shell script + (referenced as `$1', `$2' and so on) to be moved left by one place, + so that the argument previously referenced as `$2' becomes available + as `$1', and the argument previously referenced as `$1' is no longer + available at all. + + NASM provides a similar mechanism, in the form of `%rotate'. As its + name suggests, it differs from the Unix `shift' in that no + parameters are lost: parameters rotated off the left end of the + argument list reappear on the right, and vice versa. + + `%rotate' is invoked with a single numeric argument (which may be an + expression). The macro parameters are rotated to the left by that + many places. If the argument to `%rotate' is negative, the macro + parameters are rotated to the right. + + So a pair of macros to save and restore a set of registers might + work as follows: + + %macro multipush 1-* + + %rep %0 + push %1 + %rotate 1 + %endrep + + %endmacro + + This macro invokes the `PUSH' instruction on each of its arguments + in turn, from left to right. It begins by pushing its first + argument, `%1', then invokes `%rotate' to move all the arguments one + place to the left, so that the original second argument is now + available as `%1'. Repeating this procedure as many times as there + were arguments (achieved by supplying `%0' as the argument to + `%rep') causes each argument in turn to be pushed. + + Note also the use of `*' as the maximum parameter count, indicating + that there is no upper limit on the number of parameters you may + supply to the `multipush' macro. + + It would be convenient, when using this macro, to have a `POP' + equivalent, which _didn't_ require the arguments to be given in + reverse order. Ideally, you would write the `multipush' macro call, + then cut-and-paste the line to where the pop needed to be done, and + change the name of the called macro to `multipop', and the macro + would take care of popping the registers in the opposite order from + the one in which they were pushed. + + This can be done by the following definition: + + %macro multipop 1-* + + %rep %0 + %rotate -1 + pop %1 + %endrep + + %endmacro + + This macro begins by rotating its arguments one place to the + _right_, so that the original _last_ argument appears as `%1'. This + is then popped, and the arguments are rotated right again, so the + second-to-last argument becomes `%1'. Thus the arguments are + iterated through in reverse order. + + 4.3.8 Concatenating Macro Parameters + + NASM can concatenate macro parameters and macro indirection + constructs on to other text surrounding them. This allows you to + declare a family of symbols, for example, in a macro definition. If, + for example, you wanted to generate a table of key codes along with + offsets into the table, you could code something like + + %macro keytab_entry 2 + + keypos%1 equ $-keytab + db %2 + + %endmacro + + keytab: + keytab_entry F1,128+1 + keytab_entry F2,128+2 + keytab_entry Return,13 + + which would expand to + + keytab: + keyposF1 equ $-keytab + db 128+1 + keyposF2 equ $-keytab + db 128+2 + keyposReturn equ $-keytab + db 13 + + You can just as easily concatenate text on to the other end of a + macro parameter, by writing `%1foo'. + + If you need to append a _digit_ to a macro parameter, for example + defining labels `foo1' and `foo2' when passed the parameter `foo', + you can't code `%11' because that would be taken as the eleventh + macro parameter. Instead, you must code `%{1}1', which will separate + the first `1' (giving the number of the macro parameter) from the + second (literal text to be concatenated to the parameter). + + This concatenation can also be applied to other preprocessor in-line + objects, such as macro-local labels (section 4.3.3) and context- + local labels (section 4.7.2). In all cases, ambiguities in syntax + can be resolved by enclosing everything after the `%' sign and + before the literal text in braces: so `%{%foo}bar' concatenates the + text `bar' to the end of the real name of the macro-local label + `%%foo'. (This is unnecessary, since the form NASM uses for the real + names of macro-local labels means that the two usages `%{%foo}bar' + and `%%foobar' would both expand to the same thing anyway; + nevertheless, the capability is there.) + + The single-line macro indirection construct, `%[...]' (section + 4.1.3), behaves the same way as macro parameters for the purpose of + concatenation. + + See also the `%+' operator, section 4.1.4. + + 4.3.9 Condition Codes as Macro Parameters + + NASM can give special treatment to a macro parameter which contains + a condition code. For a start, you can refer to the macro parameter + `%1' by means of the alternative syntax `%+1', which informs NASM + that this macro parameter is supposed to contain a condition code, + and will cause the preprocessor to report an error message if the + macro is called with a parameter which is _not_ a valid condition + code. + + Far more usefully, though, you can refer to the macro parameter by + means of `%-1', which NASM will expand as the _inverse_ condition + code. So the `retz' macro defined in section 4.3.3 can be replaced + by a general conditional-return macro like this: + + %macro retc 1 + + j%-1 %%skip + ret + %%skip: + + %endmacro + + This macro can now be invoked using calls like `retc ne', which will + cause the conditional-jump instruction in the macro expansion to + come out as `JE', or `retc po' which will make the jump a `JPE'. + + The `%+1' macro-parameter reference is quite happy to interpret the + arguments `CXZ' and `ECXZ' as valid condition codes; however, `%-1' + will report an error if passed either of these, because no inverse + condition code exists. + +4.3.10 Disabling Listing Expansion + + When NASM is generating a listing file from your program, it will + generally expand multi-line macros by means of writing the macro + call and then listing each line of the expansion. This allows you to + see which instructions in the macro expansion are generating what + code; however, for some macros this clutters the listing up + unnecessarily. + + NASM therefore provides the `.nolist' qualifier, which you can + include in a macro definition to inhibit the expansion of the macro + in the listing file. The `.nolist' qualifier comes directly after + the number of parameters, like this: + + %macro foo 1.nolist + + Or like this: + + %macro bar 1-5+.nolist a,b,c,d,e,f,g,h + +4.3.11 Undefining Multi-Line Macros: `%unmacro' + + Multi-line macros can be removed with the `%unmacro' directive. + Unlike the `%undef' directive, however, `%unmacro' takes an argument + specification, and will only remove exact matches with that argument + specification. + + For example: + + %macro foo 1-3 + ; Do something + %endmacro + %unmacro foo 1-3 + + removes the previously defined macro `foo', but + + %macro bar 1-3 + ; Do something + %endmacro + %unmacro bar 1 + + does _not_ remove the macro `bar', since the argument specification + does not match exactly. + +4.3.12 Exiting Multi-Line Macros: `%exitmacro' + + Multi-line macro expansions can be arbitrarily terminated with the + `%exitmacro' directive. + + For example: + + %macro foo 1-3 + ; Do something + %if<condition> + %exitmacro + %endif + ; Do something + %endmacro + + 4.4 Conditional Assembly + + Similarly to the C preprocessor, NASM allows sections of a source + file to be assembled only if certain conditions are met. The general + syntax of this feature looks like this: + + %if<condition> + ; some code which only appears if <condition> is met + %elif<condition2> + ; only appears if <condition> is not met but <condition2> is + %else + ; this appears if neither <condition> nor <condition2> was met + %endif + + The inverse forms `%ifn' and `%elifn' are also supported. + + The `%else' clause is optional, as is the `%elif' clause. You can + have more than one `%elif' clause as well. + + There are a number of variants of the `%if' directive. Each has its + corresponding `%elif', `%ifn', and `%elifn' directives; for example, + the equivalents to the `%ifdef' directive are `%elifdef', `%ifndef', + and `%elifndef'. + + 4.4.1 `%ifdef': Testing Single-Line Macro Existence + + Beginning a conditional-assembly block with the line `%ifdef MACRO' + will assemble the subsequent code if, and only if, a single-line + macro called `MACRO' is defined. If not, then the `%elif' and + `%else' blocks (if any) will be processed instead. + + For example, when debugging a program, you might want to write code + such as + + ; perform some function + %ifdef DEBUG + writefile 2,"Function performed successfully",13,10 + %endif + ; go and do something else + + Then you could use the command-line option `-dDEBUG' to create a + version of the program which produced debugging messages, and remove + the option to generate the final release version of the program. + + You can test for a macro _not_ being defined by using `%ifndef' + instead of `%ifdef'. You can also test for macro definitions in + `%elif' blocks by using `%elifdef' and `%elifndef'. + + 4.4.2 `%ifmacro': Testing Multi-Line Macro Existence + + The `%ifmacro' directive operates in the same way as the `%ifdef' + directive, except that it checks for the existence of a multi-line + macro. + + For example, you may be working with a large project and not have + control over the macros in a library. You may want to create a macro + with one name if it doesn't already exist, and another name if one + with that name does exist. + + The `%ifmacro' is considered true if defining a macro with the given + name and number of arguments would cause a definitions conflict. For + example: + + %ifmacro MyMacro 1-3 + + %error "MyMacro 1-3" causes a conflict with an existing macro. + + %else + + %macro MyMacro 1-3 + + ; insert code to define the macro + + %endmacro + + %endif + + This will create the macro "MyMacro 1-3" if no macro already exists + which would conflict with it, and emits a warning if there would be + a definition conflict. + + You can test for the macro not existing by using the `%ifnmacro' + instead of `%ifmacro'. Additional tests can be performed in `%elif' + blocks by using `%elifmacro' and `%elifnmacro'. + + 4.4.3 `%ifctx': Testing the Context Stack + + The conditional-assembly construct `%ifctx' will cause the + subsequent code to be assembled if and only if the top context on + the preprocessor's context stack has the same name as one of the + arguments. As with `%ifdef', the inverse and `%elif' forms + `%ifnctx', `%elifctx' and `%elifnctx' are also supported. + + For more details of the context stack, see section 4.7. For a sample + use of `%ifctx', see section 4.7.5. + + 4.4.4 `%if': Testing Arbitrary Numeric Expressions + + The conditional-assembly construct `%if expr' will cause the + subsequent code to be assembled if and only if the value of the + numeric expression `expr' is non-zero. An example of the use of this + feature is in deciding when to break out of a `%rep' preprocessor + loop: see section 4.5 for a detailed example. + + The expression given to `%if', and its counterpart `%elif', is a + critical expression (see section 3.8). + + `%if' extends the normal NASM expression syntax, by providing a set + of relational operators which are not normally available in + expressions. The operators `=', `<', `>', `<=', `>=' and `<>' test + equality, less-than, greater-than, less-or-equal, greater-or-equal + and not-equal respectively. The C-like forms `==' and `!=' are + supported as alternative forms of `=' and `<>'. In addition, low- + priority logical operators `&&', `^^' and `||' are provided, + supplying logical AND, logical XOR and logical OR. These work like + the C logical operators (although C has no logical XOR), in that + they always return either 0 or 1, and treat any non-zero input as 1 + (so that `^^', for example, returns 1 if exactly one of its inputs + is zero, and 0 otherwise). The relational operators also return 1 + for true and 0 for false. + + Like other `%if' constructs, `%if' has a counterpart `%elif', and + negative forms `%ifn' and `%elifn'. + + 4.4.5 `%ifidn' and `%ifidni': Testing Exact Text Identity + + The construct `%ifidn text1,text2' will cause the subsequent code to + be assembled if and only if `text1' and `text2', after expanding + single-line macros, are identical pieces of text. Differences in + white space are not counted. + + `%ifidni' is similar to `%ifidn', but is case-insensitive. + + For example, the following macro pushes a register or number on the + stack, and allows you to treat `IP' as a real register: + + %macro pushparam 1 + + %ifidni %1,ip + call %%label + %%label: + %else + push %1 + %endif + + %endmacro + + Like other `%if' constructs, `%ifidn' has a counterpart `%elifidn', + and negative forms `%ifnidn' and `%elifnidn'. Similarly, `%ifidni' + has counterparts `%elifidni', `%ifnidni' and `%elifnidni'. + + 4.4.6 `%ifid', `%ifnum', `%ifstr': Testing Token Types + + Some macros will want to perform different tasks depending on + whether they are passed a number, a string, or an identifier. For + example, a string output macro might want to be able to cope with + being passed either a string constant or a pointer to an existing + string. + + The conditional assembly construct `%ifid', taking one parameter + (which may be blank), assembles the subsequent code if and only if + the first token in the parameter exists and is an identifier. + `%ifnum' works similarly, but tests for the token being a numeric + constant; `%ifstr' tests for it being a string. + + For example, the `writefile' macro defined in section 4.3.4 can be + extended to take advantage of `%ifstr' in the following fashion: + + %macro writefile 2-3+ + + %ifstr %2 + jmp %%endstr + %if %0 = 3 + %%str: db %2,%3 + %else + %%str: db %2 + %endif + %%endstr: mov dx,%%str + mov cx,%%endstr-%%str + %else + mov dx,%2 + mov cx,%3 + %endif + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + Then the `writefile' macro can cope with being called in either of + the following two ways: + + writefile [file], strpointer, length + writefile [file], "hello", 13, 10 + + In the first, `strpointer' is used as the address of an already- + declared string, and `length' is used as its length; in the second, + a string is given to the macro, which therefore declares it itself + and works out the address and length for itself. + + Note the use of `%if' inside the `%ifstr': this is to detect whether + the macro was passed two arguments (so the string would be a single + string constant, and `db %2' would be adequate) or more (in which + case, all but the first two would be lumped together into `%3', and + `db %2,%3' would be required). + + The usual `%elif'..., `%ifn'..., and `%elifn'... versions exist for + each of `%ifid', `%ifnum' and `%ifstr'. + + 4.4.7 `%iftoken': Test for a Single Token + + Some macros will want to do different things depending on if it is + passed a single token (e.g. paste it to something else using `%+') + versus a multi-token sequence. + + The conditional assembly construct `%iftoken' assembles the + subsequent code if and only if the expanded parameters consist of + exactly one token, possibly surrounded by whitespace. + + For example: + + %iftoken 1 + + will assemble the subsequent code, but + + %iftoken -1 + + will not, since `-1' contains two tokens: the unary minus operator + `-', and the number `1'. + + The usual `%eliftoken', `%ifntoken', and `%elifntoken' variants are + also provided. + + 4.4.8 `%ifempty': Test for Empty Expansion + + The conditional assembly construct `%ifempty' assembles the + subsequent code if and only if the expanded parameters do not + contain any tokens at all, whitespace excepted. + + The usual `%elifempty', `%ifnempty', and `%elifnempty' variants are + also provided. + + 4.5 Preprocessor Loops: `%rep' + + NASM's `TIMES' prefix, though useful, cannot be used to invoke a + multi-line macro multiple times, because it is processed by NASM + after macros have already been expanded. Therefore NASM provides + another form of loop, this time at the preprocessor level: `%rep'. + + The directives `%rep' and `%endrep' (`%rep' takes a numeric + argument, which can be an expression; `%endrep' takes no arguments) + can be used to enclose a chunk of code, which is then replicated as + many times as specified by the preprocessor: + + %assign i 0 + %rep 64 + inc word [table+2*i] + %assign i i+1 + %endrep + + This will generate a sequence of 64 `INC' instructions, incrementing + every word of memory from `[table]' to `[table+126]'. + + For more complex termination conditions, or to break out of a repeat + loop part way along, you can use the `%exitrep' directive to + terminate the loop, like this: + + fibonacci: + %assign i 0 + %assign j 1 + %rep 100 + %if j > 65535 + %exitrep + %endif + dw j + %assign k j+i + %assign i j + %assign j k + %endrep + + fib_number equ ($-fibonacci)/2 + + This produces a list of all the Fibonacci numbers that will fit in + 16 bits. Note that a maximum repeat count must still be given to + `%rep'. This is to prevent the possibility of NASM getting into an + infinite loop in the preprocessor, which (on multitasking or multi- + user systems) would typically cause all the system memory to be + gradually used up and other applications to start crashing. + + 4.6 Source Files and Dependencies + + These commands allow you to split your sources into multiple files. + + 4.6.1 `%include': Including Other Files + + Using, once again, a very similar syntax to the C preprocessor, + NASM's preprocessor lets you include other source files into your + code. This is done by the use of the `%include' directive: + + %include "macros.mac" + + will include the contents of the file `macros.mac' into the source + file containing the `%include' directive. + + Include files are searched for in the current directory (the + directory you're in when you run NASM, as opposed to the location of + the NASM executable or the location of the source file), plus any + directories specified on the NASM command line using the `-i' + option. + + The standard C idiom for preventing a file being included more than + once is just as applicable in NASM: if the file `macros.mac' has the + form + + %ifndef MACROS_MAC + %define MACROS_MAC + ; now define some macros + %endif + + then including the file more than once will not cause errors, + because the second time the file is included nothing will happen + because the macro `MACROS_MAC' will already be defined. + + You can force a file to be included even if there is no `%include' + directive that explicitly includes it, by using the `-p' option on + the NASM command line (see section 2.1.17). + + 4.6.2 `%pathsearch': Search the Include Path + + The `%pathsearch' directive takes a single-line macro name and a + filename, and declare or redefines the specified single-line macro + to be the include-path-resolved version of the filename, if the file + exists (otherwise, it is passed unchanged.) + + For example, + + %pathsearch MyFoo "foo.bin" + + ... with `-Ibins/' in the include path may end up defining the macro + `MyFoo' to be `"bins/foo.bin"'. + + 4.6.3 `%depend': Add Dependent Files + + The `%depend' directive takes a filename and adds it to the list of + files to be emitted as dependency generation when the `-M' options + and its relatives (see section 2.1.4) are used. It produces no + output. + + This is generally used in conjunction with `%pathsearch'. For + example, a simplified version of the standard macro wrapper for the + `INCBIN' directive looks like: + + %imacro incbin 1-2+ 0 + %pathsearch dep %1 + %depend dep + incbin dep,%2 + %endmacro + + This first resolves the location of the file into the macro `dep', + then adds it to the dependency lists, and finally issues the + assembler-level `INCBIN' directive. + + 4.6.4 `%use': Include Standard Macro Package + + The `%use' directive is similar to `%include', but rather than + including the contents of a file, it includes a named standard macro + package. The standard macro packages are part of NASM, and are + described in chapter 5. + + Unlike the `%include' directive, package names for the `%use' + directive do not require quotes, but quotes are permitted. In NASM + 2.04 and 2.05 the unquoted form would be macro-expanded; this is no + longer true. Thus, the following lines are equivalent: + + %use altreg + %use 'altreg' + + Standard macro packages are protected from multiple inclusion. When + a standard macro package is used, a testable single-line macro of + the form `__USE_'_package_`__' is also defined, see section 4.11.8. + + 4.7 The Context Stack + + Having labels that are local to a macro definition is sometimes not + quite powerful enough: sometimes you want to be able to share labels + between several macro calls. An example might be a `REPEAT' ... + `UNTIL' loop, in which the expansion of the `REPEAT' macro would + need to be able to refer to a label which the `UNTIL' macro had + defined. However, for such a macro you would also want to be able to + nest these loops. + + NASM provides this level of power by means of a _context stack_. The + preprocessor maintains a stack of _contexts_, each of which is + characterized by a name. You add a new context to the stack using + the `%push' directive, and remove one using `%pop'. You can define + labels that are local to a particular context on the stack. + + 4.7.1 `%push' and `%pop': Creating and Removing Contexts + + The `%push' directive is used to create a new context and place it + on the top of the context stack. `%push' takes an optional argument, + which is the name of the context. For example: + + %push foobar + + This pushes a new context called `foobar' on the stack. You can have + several contexts on the stack with the same name: they can still be + distinguished. If no name is given, the context is unnamed (this is + normally used when both the `%push' and the `%pop' are inside a + single macro definition.) + + The directive `%pop', taking one optional argument, removes the top + context from the context stack and destroys it, along with any + labels associated with it. If an argument is given, it must match + the name of the current context, otherwise it will issue an error. + + 4.7.2 Context-Local Labels + + Just as the usage `%%foo' defines a label which is local to the + particular macro call in which it is used, the usage `%$foo' is used + to define a label which is local to the context on the top of the + context stack. So the `REPEAT' and `UNTIL' example given above could + be implemented by means of: + + %macro repeat 0 + + %push repeat + %$begin: + + %endmacro + + %macro until 1 + + j%-1 %$begin + %pop + + %endmacro + + and invoked by means of, for example, + + mov cx,string + repeat + add cx,3 + scasb + until e + + which would scan every fourth byte of a string in search of the byte + in `AL'. + + If you need to define, or access, labels local to the context + _below_ the top one on the stack, you can use `%$$foo', or `%$$$foo' + for the context below that, and so on. + + 4.7.3 Context-Local Single-Line Macros + + NASM also allows you to define single-line macros which are local to + a particular context, in just the same way: + + %define %$localmac 3 + + will define the single-line macro `%$localmac' to be local to the + top context on the stack. Of course, after a subsequent `%push', it + can then still be accessed by the name `%$$localmac'. + + 4.7.4 `%repl': Renaming a Context + + If you need to change the name of the top context on the stack (in + order, for example, to have it respond differently to `%ifctx'), you + can execute a `%pop' followed by a `%push'; but this will have the + side effect of destroying all context-local labels and macros + associated with the context that was just popped. + + NASM provides the directive `%repl', which _replaces_ a context with + a different name, without touching the associated macros and labels. + So you could replace the destructive code + + %pop + %push newname + + with the non-destructive version `%repl newname'. + + 4.7.5 Example Use of the Context Stack: Block IFs + + This example makes use of almost all the context-stack features, + including the conditional-assembly construct `%ifctx', to implement + a block IF statement as a set of macros. + + %macro if 1 + + %push if + j%-1 %$ifnot + + %endmacro + + %macro else 0 + + %ifctx if + %repl else + jmp %$ifend + %$ifnot: + %else + %error "expected `if' before `else'" + %endif + + %endmacro + + %macro endif 0 + + %ifctx if + %$ifnot: + %pop + %elifctx else + %$ifend: + %pop + %else + %error "expected `if' or `else' before `endif'" + %endif + + %endmacro + + This code is more robust than the `REPEAT' and `UNTIL' macros given + in section 4.7.2, because it uses conditional assembly to check that + the macros are issued in the right order (for example, not calling + `endif' before `if') and issues a `%error' if they're not. + + In addition, the `endif' macro has to be able to cope with the two + distinct cases of either directly following an `if', or following an + `else'. It achieves this, again, by using conditional assembly to do + different things depending on whether the context on top of the + stack is `if' or `else'. + + The `else' macro has to preserve the context on the stack, in order + to have the `%$ifnot' referred to by the `if' macro be the same as + the one defined by the `endif' macro, but has to change the + context's name so that `endif' will know there was an intervening + `else'. It does this by the use of `%repl'. + + A sample usage of these macros might look like: + + cmp ax,bx + + if ae + cmp bx,cx + + if ae + mov ax,cx + else + mov ax,bx + endif + + else + cmp ax,cx + + if ae + mov ax,cx + endif + + endif + + The block-`IF' macros handle nesting quite happily, by means of + pushing another context, describing the inner `if', on top of the + one describing the outer `if'; thus `else' and `endif' always refer + to the last unmatched `if' or `else'. + + 4.8 Stack Relative Preprocessor Directives + + The following preprocessor directives provide a way to use labels to + refer to local variables allocated on the stack. + + (*) `%arg' (see section 4.8.1) + + (*) `%stacksize' (see section 4.8.2) + + (*) `%local' (see section 4.8.3) + + 4.8.1 `%arg' Directive + + The `%arg' directive is used to simplify the handling of parameters + passed on the stack. Stack based parameter passing is used by many + high level languages, including C, C++ and Pascal. + + While NASM has macros which attempt to duplicate this functionality + (see section 8.4.5), the syntax is not particularly convenient to + use. and is not TASM compatible. Here is an example which shows the + use of `%arg' without any external macros: + + some_function: + + %push mycontext ; save the current context + %stacksize large ; tell NASM to use bp + %arg i:word, j_ptr:word + + mov ax,[i] + mov bx,[j_ptr] + add ax,[bx] + ret + + %pop ; restore original context + + This is similar to the procedure defined in section 8.4.5 and adds + the value in i to the value pointed to by j_ptr and returns the sum + in the ax register. See section 4.7.1 for an explanation of `push' + and `pop' and the use of context stacks. + + 4.8.2 `%stacksize' Directive + + The `%stacksize' directive is used in conjunction with the `%arg' + (see section 4.8.1) and the `%local' (see section 4.8.3) directives. + It tells NASM the default size to use for subsequent `%arg' and + `%local' directives. The `%stacksize' directive takes one required + argument which is one of `flat', `flat64', `large' or `small'. + + %stacksize flat + + This form causes NASM to use stack-based parameter addressing + relative to `ebp' and it assumes that a near form of call was used + to get to this label (i.e. that `eip' is on the stack). + + %stacksize flat64 + + This form causes NASM to use stack-based parameter addressing + relative to `rbp' and it assumes that a near form of call was used + to get to this label (i.e. that `rip' is on the stack). + + %stacksize large + + This form uses `bp' to do stack-based parameter addressing and + assumes that a far form of call was used to get to this address + (i.e. that `ip' and `cs' are on the stack). + + %stacksize small + + This form also uses `bp' to address stack parameters, but it is + different from `large' because it also assumes that the old value of + bp is pushed onto the stack (i.e. it expects an `ENTER' + instruction). In other words, it expects that `bp', `ip' and `cs' + are on the top of the stack, underneath any local space which may + have been allocated by `ENTER'. This form is probably most useful + when used in combination with the `%local' directive (see section + 4.8.3). + + 4.8.3 `%local' Directive + + The `%local' directive is used to simplify the use of local + temporary stack variables allocated in a stack frame. Automatic + local variables in C are an example of this kind of variable. The + `%local' directive is most useful when used with the `%stacksize' + (see section 4.8.2 and is also compatible with the `%arg' directive + (see section 4.8.1). It allows simplified reference to variables on + the stack which have been allocated typically by using the `ENTER' + instruction. An example of its use is the following: + + silly_swap: + + %push mycontext ; save the current context + %stacksize small ; tell NASM to use bp + %assign %$localsize 0 ; see text for explanation + %local old_ax:word, old_dx:word + + enter %$localsize,0 ; see text for explanation + mov [old_ax],ax ; swap ax & bx + mov [old_dx],dx ; and swap dx & cx + mov ax,bx + mov dx,cx + mov bx,[old_ax] + mov cx,[old_dx] + leave ; restore old bp + ret ; + + %pop ; restore original context + + The `%$localsize' variable is used internally by the `%local' + directive and _must_ be defined within the current context before + the `%local' directive may be used. Failure to do so will result in + one expression syntax error for each `%local' variable declared. It + then may be used in the construction of an appropriately sized ENTER + instruction as shown in the example. + + 4.9 Reporting User-Defined Errors: `%error', `%warning', `%fatal' + + The preprocessor directive `%error' will cause NASM to report an + error if it occurs in assembled code. So if other users are going to + try to assemble your source files, you can ensure that they define + the right macros by means of code like this: + + %ifdef F1 + ; do some setup + %elifdef F2 + ; do some different setup + %else + %error "Neither F1 nor F2 was defined." + %endif + + Then any user who fails to understand the way your code is supposed + to be assembled will be quickly warned of their mistake, rather than + having to wait until the program crashes on being run and then not + knowing what went wrong. + + Similarly, `%warning' issues a warning, but allows assembly to + continue: + + %ifdef F1 + ; do some setup + %elifdef F2 + ; do some different setup + %else + %warning "Neither F1 nor F2 was defined, assuming F1." + %define F1 + %endif + + `%error' and `%warning' are issued only on the final assembly pass. + This makes them safe to use in conjunction with tests that depend on + symbol values. + + `%fatal' terminates assembly immediately, regardless of pass. This + is useful when there is no point in continuing the assembly further, + and doing so is likely just going to cause a spew of confusing error + messages. + + It is optional for the message string after `%error', `%warning' or + `%fatal' to be quoted. If it is _not_, then single-line macros are + expanded in it, which can be used to display more information to the + user. For example: + + %if foo > 64 + %assign foo_over foo-64 + %error foo is foo_over bytes too large + %endif + + 4.10 Other Preprocessor Directives + + NASM also has preprocessor directives which allow access to + information from external sources. Currently they include: + + (*) `%line' enables NASM to correctly handle the output of another + preprocessor (see section 4.10.1). + + (*) `%!' enables NASM to read in the value of an environment + variable, which can then be used in your program (see section + 4.10.2). + +4.10.1 `%line' Directive + + The `%line' directive is used to notify NASM that the input line + corresponds to a specific line number in another file. Typically + this other file would be an original source file, with the current + NASM input being the output of a pre-processor. The `%line' + directive allows NASM to output messages which indicate the line + number of the original source file, instead of the file that is + being read by NASM. + + This preprocessor directive is not generally of use to programmers, + by may be of interest to preprocessor authors. The usage of the + `%line' preprocessor directive is as follows: + + %line nnn[+mmm] [filename] + + In this directive, `nnn' identifies the line of the original source + file which this line corresponds to. `mmm' is an optional parameter + which specifies a line increment value; each line of the input file + read in is considered to correspond to `mmm' lines of the original + source file. Finally, `filename' is an optional parameter which + specifies the file name of the original source file. + + After reading a `%line' preprocessor directive, NASM will report all + file name and line numbers relative to the values specified therein. + +4.10.2 `%!'`<env>': Read an environment variable. + + The `%!<env>' directive makes it possible to read the value of an + environment variable at assembly time. This could, for example, be + used to store the contents of an environment variable into a string, + which could be used at some other point in your code. + + For example, suppose that you have an environment variable `FOO', + and you want the contents of `FOO' to be embedded in your program. + You could do that as follows: + + %defstr FOO %!FOO + + See section 4.1.8 for notes on the `%defstr' directive. + + 4.11 Standard Macros + + NASM defines a set of standard macros, which are already defined + when it starts to process any source file. If you really need a + program to be assembled with no pre-defined macros, you can use the + `%clear' directive to empty the preprocessor of everything but + context-local preprocessor variables and single-line macros. + + Most user-level assembler directives (see chapter 6) are implemented + as macros which invoke primitive directives; these are described in + chapter 6. The rest of the standard macro set is described here. + +4.11.1 NASM Version Macros + + The single-line macros `__NASM_MAJOR__', `__NASM_MINOR__', + `__NASM_SUBMINOR__' and `___NASM_PATCHLEVEL__' expand to the major, + minor, subminor and patch level parts of the version number of NASM + being used. So, under NASM 0.98.32p1 for example, `__NASM_MAJOR__' + would be defined to be 0, `__NASM_MINOR__' would be defined as 98, + `__NASM_SUBMINOR__' would be defined to 32, and + `___NASM_PATCHLEVEL__' would be defined as 1. + + Additionally, the macro `__NASM_SNAPSHOT__' is defined for + automatically generated snapshot releases _only_. + +4.11.2 `__NASM_VERSION_ID__': NASM Version ID + + The single-line macro `__NASM_VERSION_ID__' expands to a dword + integer representing the full version number of the version of nasm + being used. The value is the equivalent to `__NASM_MAJOR__', + `__NASM_MINOR__', `__NASM_SUBMINOR__' and `___NASM_PATCHLEVEL__' + concatenated to produce a single doubleword. Hence, for 0.98.32p1, + the returned number would be equivalent to: + + dd 0x00622001 + + or + + db 1,32,98,0 + + Note that the above lines are generate exactly the same code, the + second line is used just to give an indication of the order that the + separate values will be present in memory. + +4.11.3 `__NASM_VER__': NASM Version string + + The single-line macro `__NASM_VER__' expands to a string which + defines the version number of nasm being used. So, under NASM + 0.98.32 for example, + + db __NASM_VER__ + + would expand to + + db "0.98.32" + +4.11.4 `__FILE__' and `__LINE__': File Name and Line Number + + Like the C preprocessor, NASM allows the user to find out the file + name and line number containing the current instruction. The macro + `__FILE__' expands to a string constant giving the name of the + current input file (which may change through the course of assembly + if `%include' directives are used), and `__LINE__' expands to a + numeric constant giving the current line number in the input file. + + These macros could be used, for example, to communicate debugging + information to a macro, since invoking `__LINE__' inside a macro + definition (either single-line or multi-line) will return the line + number of the macro _call_, rather than _definition_. So to + determine where in a piece of code a crash is occurring, for + example, one could write a routine `stillhere', which is passed a + line number in `EAX' and outputs something like `line 155: still + here'. You could then write a macro + + %macro notdeadyet 0 + + push eax + mov eax,__LINE__ + call stillhere + pop eax + + %endmacro + + and then pepper your code with calls to `notdeadyet' until you find + the crash point. + +4.11.5 `__BITS__': Current BITS Mode + + The `__BITS__' standard macro is updated every time that the BITS + mode is set using the `BITS XX' or `[BITS XX]' directive, where XX + is a valid mode number of 16, 32 or 64. `__BITS__' receives the + specified mode number and makes it globally available. This can be + very useful for those who utilize mode-dependent macros. + +4.11.6 `__OUTPUT_FORMAT__': Current Output Format + + The `__OUTPUT_FORMAT__' standard macro holds the current Output + Format, as given by the `-f' option or NASM's default. Type + `nasm -hf' for a list. + + %ifidn __OUTPUT_FORMAT__, win32 + %define NEWLINE 13, 10 + %elifidn __OUTPUT_FORMAT__, elf32 + %define NEWLINE 10 + %endif + +4.11.7 Assembly Date and Time Macros + + NASM provides a variety of macros that represent the timestamp of + the assembly session. + + (*) The `__DATE__' and `__TIME__' macros give the assembly date and + time as strings, in ISO 8601 format (`"YYYY-MM-DD"' and + `"HH:MM:SS"', respectively.) + + (*) The `__DATE_NUM__' and `__TIME_NUM__' macros give the assembly + date and time in numeric form; in the format `YYYYMMDD' and + `HHMMSS' respectively. + + (*) The `__UTC_DATE__' and `__UTC_TIME__' macros give the assembly + date and time in universal time (UTC) as strings, in ISO 8601 + format (`"YYYY-MM-DD"' and `"HH:MM:SS"', respectively.) If the + host platform doesn't provide UTC time, these macros are + undefined. + + (*) The `__UTC_DATE_NUM__' and `__UTC_TIME_NUM__' macros give the + assembly date and time universal time (UTC) in numeric form; in + the format `YYYYMMDD' and `HHMMSS' respectively. If the host + platform doesn't provide UTC time, these macros are undefined. + + (*) The `__POSIX_TIME__' macro is defined as a number containing the + number of seconds since the POSIX epoch, 1 January 1970 00:00:00 + UTC; excluding any leap seconds. This is computed using UTC time + if available on the host platform, otherwise it is computed + using the local time as if it was UTC. + + All instances of time and date macros in the same assembly session + produce consistent output. For example, in an assembly session + started at 42 seconds after midnight on January 1, 2010 in Moscow + (timezone UTC+3) these macros would have the following values, + assuming, of course, a properly configured environment with a + correct clock: + + __DATE__ "2010-01-01" + __TIME__ "00:00:42" + __DATE_NUM__ 20100101 + __TIME_NUM__ 000042 + __UTC_DATE__ "2009-12-31" + __UTC_TIME__ "21:00:42" + __UTC_DATE_NUM__ 20091231 + __UTC_TIME_NUM__ 210042 + __POSIX_TIME__ 1262293242 + +4.11.8 `__USE_'_package_`__': Package Include Test + + When a standard macro package (see chapter 5) is included with the + `%use' directive (see section 4.6.4), a single-line macro of the + form `__USE_'_package_`__' is automatically defined. This allows + testing if a particular package is invoked or not. + + For example, if the `altreg' package is included (see section 5.1), + then the macro `__USE_ALTREG__' is defined. + +4.11.9 `__PASS__': Assembly Pass + + The macro `__PASS__' is defined to be `1' on preparatory passes, and + `2' on the final pass. In preprocess-only mode, it is set to `3', + and when running only to generate dependencies (due to the `-M' or + `-MG' option, see section 2.1.4) it is set to `0'. + + _Avoid using this macro if at all possible. It is tremendously easy + to generate very strange errors by misusing it, and the semantics + may change in future versions of NASM._ + +4.11.10 `STRUC' and `ENDSTRUC': Declaring Structure Data Types + + The core of NASM contains no intrinsic means of defining data + structures; instead, the preprocessor is sufficiently powerful that + data structures can be implemented as a set of macros. The macros + `STRUC' and `ENDSTRUC' are used to define a structure data type. + + `STRUC' takes one or two parameters. The first parameter is the name + of the data type. The second, optional parameter is the base offset + of the structure. The name of the data type is defined as a symbol + with the value of the base offset, and the name of the data type + with the suffix `_size' appended to it is defined as an `EQU' giving + the size of the structure. Once `STRUC' has been issued, you are + defining the structure, and should define fields using the `RESB' + family of pseudo-instructions, and then invoke `ENDSTRUC' to finish + the definition. + + For example, to define a structure called `mytype' containing a + longword, a word, a byte and a string of bytes, you might code + + struc mytype + + mt_long: resd 1 + mt_word: resw 1 + mt_byte: resb 1 + mt_str: resb 32 + + endstruc + + The above code defines six symbols: `mt_long' as 0 (the offset from + the beginning of a `mytype' structure to the longword field), + `mt_word' as 4, `mt_byte' as 6, `mt_str' as 7, `mytype_size' as 39, + and `mytype' itself as zero. + + The reason why the structure type name is defined at zero by default + is a side effect of allowing structures to work with the local label + mechanism: if your structure members tend to have the same names in + more than one structure, you can define the above structure like + this: + + struc mytype + + .long: resd 1 + .word: resw 1 + .byte: resb 1 + .str: resb 32 + + endstruc + + This defines the offsets to the structure fields as `mytype.long', + `mytype.word', `mytype.byte' and `mytype.str'. + + NASM, since it has no _intrinsic_ structure support, does not + support any form of period notation to refer to the elements of a + structure once you have one (except the above local-label notation), + so code such as `mov ax,[mystruc.mt_word]' is not valid. `mt_word' + is a constant just like any other constant, so the correct syntax is + `mov ax,[mystruc+mt_word]' or `mov ax,[mystruc+mytype.word]'. + + Sometimes you only have the address of the structure displaced by an + offset. For example, consider this standard stack frame setup: + + push ebp + mov ebp, esp + sub esp, 40 + + In this case, you could access an element by subtracting the offset: + + mov [ebp - 40 + mytype.word], ax + + However, if you do not want to repeat this offset, you can use -40 + as a base offset: + + struc mytype, -40 + + And access an element this way: + + mov [ebp + mytype.word], ax + +4.11.11 `ISTRUC', `AT' and `IEND': Declaring Instances of Structures + + Having defined a structure type, the next thing you typically want + to do is to declare instances of that structure in your data + segment. NASM provides an easy way to do this in the `ISTRUC' + mechanism. To declare a structure of type `mytype' in a program, you + code something like this: + + mystruc: + istruc mytype + + at mt_long, dd 123456 + at mt_word, dw 1024 + at mt_byte, db 'x' + at mt_str, db 'hello, world', 13, 10, 0 + + iend + + The function of the `AT' macro is to make use of the `TIMES' prefix + to advance the assembly position to the correct point for the + specified structure field, and then to declare the specified data. + Therefore the structure fields must be declared in the same order as + they were specified in the structure definition. + + If the data to go in a structure field requires more than one source + line to specify, the remaining source lines can easily come after + the `AT' line. For example: + + at mt_str, db 123,134,145,156,167,178,189 + db 190,100,0 + + Depending on personal taste, you can also omit the code part of the + `AT' line completely, and start the structure field on the next + line: + + at mt_str + db 'hello, world' + db 13,10,0 + +4.11.12 `ALIGN' and `ALIGNB': Data Alignment + + The `ALIGN' and `ALIGNB' macros provides a convenient way to align + code or data on a word, longword, paragraph or other boundary. (Some + assemblers call this directive `EVEN'.) The syntax of the `ALIGN' + and `ALIGNB' macros is + + align 4 ; align on 4-byte boundary + align 16 ; align on 16-byte boundary + align 8,db 0 ; pad with 0s rather than NOPs + align 4,resb 1 ; align to 4 in the BSS + alignb 4 ; equivalent to previous line + + Both macros require their first argument to be a power of two; they + both compute the number of additional bytes required to bring the + length of the current section up to a multiple of that power of two, + and then apply the `TIMES' prefix to their second argument to + perform the alignment. + + If the second argument is not specified, the default for `ALIGN' is + `NOP', and the default for `ALIGNB' is `RESB 1'. So if the second + argument is specified, the two macros are equivalent. Normally, you + can just use `ALIGN' in code and data sections and `ALIGNB' in BSS + sections, and never need the second argument except for special + purposes. + + `ALIGN' and `ALIGNB', being simple macros, perform no error + checking: they cannot warn you if their first argument fails to be a + power of two, or if their second argument generates more than one + byte of code. In each of these cases they will silently do the wrong + thing. + + `ALIGNB' (or `ALIGN' with a second argument of `RESB 1') can be used + within structure definitions: + + struc mytype2 + + mt_byte: + resb 1 + alignb 2 + mt_word: + resw 1 + alignb 4 + mt_long: + resd 1 + mt_str: + resb 32 + + endstruc + + This will ensure that the structure members are sensibly aligned + relative to the base of the structure. + + A final caveat: `ALIGN' and `ALIGNB' work relative to the beginning + of the _section_, not the beginning of the address space in the + final executable. Aligning to a 16-byte boundary when the section + you're in is only guaranteed to be aligned to a 4-byte boundary, for + example, is a waste of effort. Again, NASM does not check that the + section's alignment characteristics are sensible for the use of + `ALIGN' or `ALIGNB'. + + See also the `smartalign' standard macro package, section 5.2. + +Chapter 5: Standard Macro Packages +---------------------------------- + + The `%use' directive (see section 4.6.4) includes one of the + standard macro packages included with the NASM distribution and + compiled into the NASM binary. It operates like the `%include' + directive (see section 4.6.1), but the included contents is provided + by NASM itself. + + The names of standard macro packages are case insensitive, and can + be quoted or not. + + 5.1 `altreg': Alternate Register Names + + The `altreg' standard macro package provides alternate register + names. It provides numeric register names for all registers (not + just `R8'-`R15'), the Intel-defined aliases `R8L'-`R15L' for the low + bytes of register (as opposed to the NASM/AMD standard names `R8B'- + `R15B'), and the names `R0H'-`R3H' (by analogy with `R0L'-`R3L') for + `AH', `CH', `DH', and `BH'. + + Example use: + + %use altreg + + proc: + mov r0l,r3h ; mov al,bh + ret + + See also section 11.1. + + 5.2 `smartalign': Smart `ALIGN' Macro + + The `smartalign' standard macro package provides for an `ALIGN' + macro which is more powerful than the default (and backwards- + compatible) one (see section 4.11.12). When the `smartalign' package + is enabled, when `ALIGN' is used without a second argument, NASM + will generate a sequence of instructions more efficient than a + series of `NOP'. Furthermore, if the padding exceeds a specific + threshold, then NASM will generate a jump over the entire padding + sequence. + + The specific instructions generated can be controlled with the new + `ALIGNMODE' macro. This macro takes two parameters: one mode, and an + optional jump threshold override. The modes are as follows: + + (*) `generic': Works on all x86 CPUs and should have reasonable + performance. The default jump threshold is 8. This is the + default. + + (*) `nop': Pad out with `NOP' instructions. The only difference + compared to the standard `ALIGN' macro is that NASM can still + jump over a large padding area. The default jump threshold is + 16. + + (*) `k7': Optimize for the AMD K7 (Athlon/Althon XP). These + instructions should still work on all x86 CPUs. The default jump + threshold is 16. + + (*) `k8': Optimize for the AMD K8 (Opteron/Althon 64). These + instructions should still work on all x86 CPUs. The default jump + threshold is 16. + + (*) `p6': Optimize for Intel CPUs. This uses the long `NOP' + instructions first introduced in Pentium Pro. This is + incompatible with all CPUs of family 5 or lower, as well as some + VIA CPUs and several virtualization solutions. The default jump + threshold is 16. + + The macro `__ALIGNMODE__' is defined to contain the current + alignment mode. A number of other macros beginning with `__ALIGN_' + are used internally by this macro package. + +Chapter 6: Assembler Directives +------------------------------- + + NASM, though it attempts to avoid the bureaucracy of assemblers like + MASM and TASM, is nevertheless forced to support a _few_ directives. + These are described in this chapter. + + NASM's directives come in two types: _user-level_ directives and + _primitive_ directives. Typically, each directive has a user-level + form and a primitive form. In almost all cases, we recommend that + users use the user-level forms of the directives, which are + implemented as macros which call the primitive forms. + + Primitive directives are enclosed in square brackets; user-level + directives are not. + + In addition to the universal directives described in this chapter, + each object file format can optionally supply extra directives in + order to control particular features of that file format. These + _format-specific_ directives are documented along with the formats + that implement them, in chapter 7. + + 6.1 `BITS': Specifying Target Processor Mode + + The `BITS' directive specifies whether NASM should generate code + designed to run on a processor operating in 16-bit mode, 32-bit mode + or 64-bit mode. The syntax is `BITS XX', where XX is 16, 32 or 64. + + In most cases, you should not need to use `BITS' explicitly. The + `aout', `coff', `elf', `macho', `win32' and `win64' object formats, + which are designed for use in 32-bit or 64-bit operating systems, + all cause NASM to select 32-bit or 64-bit mode, respectively, by + default. The `obj' object format allows you to specify each segment + you define as either `USE16' or `USE32', and NASM will set its + operating mode accordingly, so the use of the `BITS' directive is + once again unnecessary. + + The most likely reason for using the `BITS' directive is to write + 32-bit or 64-bit code in a flat binary file; this is because the + `bin' output format defaults to 16-bit mode in anticipation of it + being used most frequently to write DOS `.COM' programs, DOS `.SYS' + device drivers and boot loader software. + + You do _not_ need to specify `BITS 32' merely in order to use 32-bit + instructions in a 16-bit DOS program; if you do, the assembler will + generate incorrect code because it will be writing code targeted at + a 32-bit platform, to be run on a 16-bit one. + + When NASM is in `BITS 16' mode, instructions which use 32-bit data + are prefixed with an 0x66 byte, and those referring to 32-bit + addresses have an 0x67 prefix. In `BITS 32' mode, the reverse is + true: 32-bit instructions require no prefixes, whereas instructions + using 16-bit data need an 0x66 and those working on 16-bit addresses + need an 0x67. + + When NASM is in `BITS 64' mode, most instructions operate the same + as they do for `BITS 32' mode. However, there are 8 more general and + SSE registers, and 16-bit addressing is no longer supported. + + The default address size is 64 bits; 32-bit addressing can be + selected with the 0x67 prefix. The default operand size is still 32 + bits, however, and the 0x66 prefix selects 16-bit operand size. The + `REX' prefix is used both to select 64-bit operand size, and to + access the new registers. NASM automatically inserts REX prefixes + when necessary. + + When the `REX' prefix is used, the processor does not know how to + address the AH, BH, CH or DH (high 8-bit legacy) registers. Instead, + it is possible to access the the low 8-bits of the SP, BP SI and DI + registers as SPL, BPL, SIL and DIL, respectively; but only when the + REX prefix is used. + + The `BITS' directive has an exactly equivalent primitive form, + `[BITS 16]', `[BITS 32]' and `[BITS 64]'. The user-level form is a + macro which has no function other than to call the primitive form. + + Note that the space is neccessary, e.g. `BITS32' will _not_ work! + + 6.1.1 `USE16' & `USE32': Aliases for BITS + + The ``USE16'' and ``USE32'' directives can be used in place of + ``BITS 16'' and ``BITS 32'', for compatibility with other + assemblers. + + 6.2 `DEFAULT': Change the assembler defaults + + The `DEFAULT' directive changes the assembler defaults. Normally, + NASM defaults to a mode where the programmer is expected to + explicitly specify most features directly. However, this is + occationally obnoxious, as the explicit form is pretty much the only + one one wishes to use. + + Currently, the only `DEFAULT' that is settable is whether or not + registerless instructions in 64-bit mode are `RIP'-relative or not. + By default, they are absolute unless overridden with the `REL' + specifier (see section 3.3). However, if `DEFAULT REL' is specified, + `REL' is default, unless overridden with the `ABS' specifier, + _except when used with an FS or GS segment override_. + + The special handling of `FS' and `GS' overrides are due to the fact + that these registers are generally used as thread pointers or other + special functions in 64-bit mode, and generating `RIP'-relative + addresses would be extremely confusing. + + `DEFAULT REL' is disabled with `DEFAULT ABS'. + + 6.3 `SECTION' or `SEGMENT': Changing and Defining Sections + + The `SECTION' directive (`SEGMENT' is an exactly equivalent synonym) + changes which section of the output file the code you write will be + assembled into. In some object file formats, the number and names of + sections are fixed; in others, the user may make up as many as they + wish. Hence `SECTION' may sometimes give an error message, or may + define a new section, if you try to switch to a section that does + not (yet) exist. + + The Unix object formats, and the `bin' object format (but see + section 7.1.3, all support the standardized section names `.text', + `.data' and `.bss' for the code, data and uninitialized-data + sections. The `obj' format, by contrast, does not recognize these + section names as being special, and indeed will strip off the + leading period of any section name that has one. + + 6.3.1 The `__SECT__' Macro + + The `SECTION' directive is unusual in that its user-level form + functions differently from its primitive form. The primitive form, + `[SECTION xyz]', simply switches the current target section to the + one given. The user-level form, `SECTION xyz', however, first + defines the single-line macro `__SECT__' to be the primitive + `[SECTION]' directive which it is about to issue, and then issues + it. So the user-level directive + + SECTION .text + + expands to the two lines + + %define __SECT__ [SECTION .text] + [SECTION .text] + + Users may find it useful to make use of this in their own macros. + For example, the `writefile' macro defined in section 4.3.4 can be + usefully rewritten in the following more sophisticated form: + + %macro writefile 2+ + + [section .data] + + %%str: db %2 + %%endstr: + + __SECT__ + + mov dx,%%str + mov cx,%%endstr-%%str + mov bx,%1 + mov ah,0x40 + int 0x21 + + %endmacro + + This form of the macro, once passed a string to output, first + switches temporarily to the data section of the file, using the + primitive form of the `SECTION' directive so as not to modify + `__SECT__'. It then declares its string in the data section, and + then invokes `__SECT__' to switch back to _whichever_ section the + user was previously working in. It thus avoids the need, in the + previous version of the macro, to include a `JMP' instruction to + jump over the data, and also does not fail if, in a complicated + `OBJ' format module, the user could potentially be assembling the + code in any of several separate code sections. + + 6.4 `ABSOLUTE': Defining Absolute Labels + + The `ABSOLUTE' directive can be thought of as an alternative form of + `SECTION': it causes the subsequent code to be directed at no + physical section, but at the hypothetical section starting at the + given absolute address. The only instructions you can use in this + mode are the `RESB' family. + + `ABSOLUTE' is used as follows: + + absolute 0x1A + + kbuf_chr resw 1 + kbuf_free resw 1 + kbuf resw 16 + + This example describes a section of the PC BIOS data area, at + segment address 0x40: the above code defines `kbuf_chr' to be 0x1A, + `kbuf_free' to be 0x1C, and `kbuf' to be 0x1E. + + The user-level form of `ABSOLUTE', like that of `SECTION', redefines + the `__SECT__' macro when it is invoked. + + `STRUC' and `ENDSTRUC' are defined as macros which use `ABSOLUTE' + (and also `__SECT__'). + + `ABSOLUTE' doesn't have to take an absolute constant as an argument: + it can take an expression (actually, a critical expression: see + section 3.8) and it can be a value in a segment. For example, a TSR + can re-use its setup code as run-time BSS like this: + + org 100h ; it's a .COM program + + jmp setup ; setup code comes last + + ; the resident part of the TSR goes here + setup: + ; now write the code that installs the TSR here + + absolute setup + + runtimevar1 resw 1 + runtimevar2 resd 20 + + tsr_end: + + This defines some variables `on top of' the setup code, so that + after the setup has finished running, the space it took up can be + re-used as data storage for the running TSR. The symbol `tsr_end' + can be used to calculate the total size of the part of the TSR that + needs to be made resident. + + 6.5 `EXTERN': Importing Symbols from Other Modules + + `EXTERN' is similar to the MASM directive `EXTRN' and the C keyword + `extern': it is used to declare a symbol which is not defined + anywhere in the module being assembled, but is assumed to be defined + in some other module and needs to be referred to by this one. Not + every object-file format can support external variables: the `bin' + format cannot. + + The `EXTERN' directive takes as many arguments as you like. Each + argument is the name of a symbol: + + extern _printf + extern _sscanf,_fscanf + + Some object-file formats provide extra features to the `EXTERN' + directive. In all cases, the extra features are used by suffixing a + colon to the symbol name followed by object-format specific text. + For example, the `obj' format allows you to declare that the default + segment base of an external should be the group `dgroup' by means of + the directive + + extern _variable:wrt dgroup + + The primitive form of `EXTERN' differs from the user-level form only + in that it can take only one argument at a time: the support for + multiple arguments is implemented at the preprocessor level. + + You can declare the same variable as `EXTERN' more than once: NASM + will quietly ignore the second and later redeclarations. You can't + declare a variable as `EXTERN' as well as something else, though. + + 6.6 `GLOBAL': Exporting Symbols to Other Modules + + `GLOBAL' is the other end of `EXTERN': if one module declares a + symbol as `EXTERN' and refers to it, then in order to prevent linker + errors, some other module must actually _define_ the symbol and + declare it as `GLOBAL'. Some assemblers use the name `PUBLIC' for + this purpose. + + The `GLOBAL' directive applying to a symbol must appear _before_ the + definition of the symbol. + + `GLOBAL' uses the same syntax as `EXTERN', except that it must refer + to symbols which _are_ defined in the same module as the `GLOBAL' + directive. For example: + + global _main + _main: + ; some code + + `GLOBAL', like `EXTERN', allows object formats to define private + extensions by means of a colon. The `elf' object format, for + example, lets you specify whether global data items are functions or + data: + + global hashlookup:function, hashtable:data + + Like `EXTERN', the primitive form of `GLOBAL' differs from the user- + level form only in that it can take only one argument at a time. + + 6.7 `COMMON': Defining Common Data Areas + + The `COMMON' directive is used to declare _common variables_. A + common variable is much like a global variable declared in the + uninitialized data section, so that + + common intvar 4 + + is similar in function to + + global intvar + section .bss + + intvar resd 1 + + The difference is that if more than one module defines the same + common variable, then at link time those variables will be _merged_, + and references to `intvar' in all modules will point at the same + piece of memory. + + Like `GLOBAL' and `EXTERN', `COMMON' supports object-format specific + extensions. For example, the `obj' format allows common variables to + be NEAR or FAR, and the `elf' format allows you to specify the + alignment requirements of a common variable: + + common commvar 4:near ; works in OBJ + common intarray 100:4 ; works in ELF: 4 byte aligned + + Once again, like `EXTERN' and `GLOBAL', the primitive form of + `COMMON' differs from the user-level form only in that it can take + only one argument at a time. + + 6.8 `CPU': Defining CPU Dependencies + + The `CPU' directive restricts assembly to those instructions which + are available on the specified CPU. + + Options are: + + (*) `CPU 8086' Assemble only 8086 instruction set + + (*) `CPU 186' Assemble instructions up to the 80186 instruction set + + (*) `CPU 286' Assemble instructions up to the 286 instruction set + + (*) `CPU 386' Assemble instructions up to the 386 instruction set + + (*) `CPU 486' 486 instruction set + + (*) `CPU 586' Pentium instruction set + + (*) `CPU PENTIUM' Same as 586 + + (*) `CPU 686' P6 instruction set + + (*) `CPU PPRO' Same as 686 + + (*) `CPU P2' Same as 686 + + (*) `CPU P3' Pentium III (Katmai) instruction sets + + (*) `CPU KATMAI' Same as P3 + + (*) `CPU P4' Pentium 4 (Willamette) instruction set + + (*) `CPU WILLAMETTE' Same as P4 + + (*) `CPU PRESCOTT' Prescott instruction set + + (*) `CPU X64' x86-64 (x64/AMD64/Intel 64) instruction set + + (*) `CPU IA64' IA64 CPU (in x86 mode) instruction set + + All options are case insensitive. All instructions will be selected + only if they apply to the selected CPU or lower. By default, all + instructions are available. + + 6.9 `FLOAT': Handling of floating-point constants + + By default, floating-point constants are rounded to nearest, and + IEEE denormals are supported. The following options can be set to + alter this behaviour: + + (*) `FLOAT DAZ' Flush denormals to zero + + (*) `FLOAT NODAZ' Do not flush denormals to zero (default) + + (*) `FLOAT NEAR' Round to nearest (default) + + (*) `FLOAT UP' Round up (toward +Infinity) + + (*) `FLOAT DOWN' Round down (toward -Infinity) + + (*) `FLOAT ZERO' Round toward zero + + (*) `FLOAT DEFAULT' Restore default settings + + The standard macros `__FLOAT_DAZ__', `__FLOAT_ROUND__', and + `__FLOAT__' contain the current state, as long as the programmer has + avoided the use of the brackeded primitive form, (`[FLOAT]'). + + `__FLOAT__' contains the full set of floating-point settings; this + value can be saved away and invoked later to restore the setting. + +Chapter 7: Output Formats +------------------------- + + NASM is a portable assembler, designed to be able to compile on any + ANSI C-supporting platform and produce output to run on a variety of + Intel x86 operating systems. For this reason, it has a large number + of available output formats, selected using the `-f' option on the + NASM command line. Each of these formats, along with its extensions + to the base NASM syntax, is detailed in this chapter. + + As stated in section 2.1.1, NASM chooses a default name for your + output file based on the input file name and the chosen output + format. This will be generated by removing the extension (`.asm', + `.s', or whatever you like to use) from the input file name, and + substituting an extension defined by the output format. The + extensions are given with each format below. + + 7.1 `bin': Flat-Form Binary Output + + The `bin' format does not produce object files: it generates nothing + in the output file except the code you wrote. Such `pure binary' + files are used by MS-DOS: `.COM' executables and `.SYS' device + drivers are pure binary files. Pure binary output is also useful for + operating system and boot loader development. + + The `bin' format supports multiple section names. For details of how + NASM handles sections in the `bin' format, see section 7.1.3. + + Using the `bin' format puts NASM by default into 16-bit mode (see + section 6.1). In order to use `bin' to write 32-bit or 64-bit code, + such as an OS kernel, you need to explicitly issue the `BITS 32' or + `BITS 64' directive. + + `bin' has no default output file name extension: instead, it leaves + your file name as it is once the original extension has been + removed. Thus, the default is for NASM to assemble `binprog.asm' + into a binary file called `binprog'. + + 7.1.1 `ORG': Binary File Program Origin + + The `bin' format provides an additional directive to the list given + in chapter 6: `ORG'. The function of the `ORG' directive is to + specify the origin address which NASM will assume the program begins + at when it is loaded into memory. + + For example, the following code will generate the longword + `0x00000104': + + org 0x100 + dd label + label: + + Unlike the `ORG' directive provided by MASM-compatible assemblers, + which allows you to jump around in the object file and overwrite + code you have already generated, NASM's `ORG' does exactly what the + directive says: _origin_. Its sole function is to specify one offset + which is added to all internal address references within the + section; it does not permit any of the trickery that MASM's version + does. See section 12.1.3 for further comments. + + 7.1.2 `bin' Extensions to the `SECTION' Directive + + The `bin' output format extends the `SECTION' (or `SEGMENT') + directive to allow you to specify the alignment requirements of + segments. This is done by appending the `ALIGN' qualifier to the end + of the section-definition line. For example, + + section .data align=16 + + switches to the section `.data' and also specifies that it must be + aligned on a 16-byte boundary. + + The parameter to `ALIGN' specifies how many low bits of the section + start address must be forced to zero. The alignment value given may + be any power of two. + + 7.1.3 Multisection Support for the `bin' Format + + The `bin' format allows the use of multiple sections, of arbitrary + names, besides the "known" `.text', `.data', and `.bss' names. + + (*) Sections may be designated `progbits' or `nobits'. Default is + `progbits' (except `.bss', which defaults to `nobits', of + course). + + (*) Sections can be aligned at a specified boundary following the + previous section with `align=', or at an arbitrary byte-granular + position with `start='. + + (*) Sections can be given a virtual start address, which will be + used for the calculation of all memory references within that + section with `vstart='. + + (*) Sections can be ordered using `follows='`<section>' or + `vfollows='`<section>' as an alternative to specifying an + explicit start address. + + (*) Arguments to `org', `start', `vstart', and `align=' are critical + expressions. See section 3.8. E.g. `align=(1 << ALIGN_SHIFT)' - + `ALIGN_SHIFT' must be defined before it is used here. + + (*) Any code which comes before an explicit `SECTION' directive is + directed by default into the `.text' section. + + (*) If an `ORG' statement is not given, `ORG 0' is used by default. + + (*) The `.bss' section will be placed after the last `progbits' + section, unless `start=', `vstart=', `follows=', or `vfollows=' + has been specified. + + (*) All sections are aligned on dword boundaries, unless a different + alignment has been specified. + + (*) Sections may not overlap. + + (*) NASM creates the `section.<secname>.start' for each section, + which may be used in your code. + + 7.1.4 Map Files + + Map files can be generated in `-f bin' format by means of the + `[map]' option. Map types of `all' (default), `brief', `sections', + `segments', or `symbols' may be specified. Output may be directed to + `stdout' (default), `stderr', or a specified file. E.g. + `[map symbols myfile.map]'. No "user form" exists, the square + brackets must be used. + + 7.2 `ith': Intel Hex Output + + The `ith' file format produces Intel hex-format files. Just as the + `bin' format, this is a flat memory image format with no support for + relocation or linking. It is usually used with ROM programmers and + similar utilities. + + All extensions supported by the `bin' file format is also supported + by the `ith' file format. + + `ith' provides a default output file-name extension of `.ith'. + + 7.3 `srec': Motorola S-Records Output + + The `srec' file format produces Motorola S-records files. Just as + the `bin' format, this is a flat memory image format with no support + for relocation or linking. It is usually used with ROM programmers + and similar utilities. + + All extensions supported by the `bin' file format is also supported + by the `srec' file format. + + `srec' provides a default output file-name extension of `.srec'. + + 7.4 `obj': Microsoft OMF Object Files + + The `obj' file format (NASM calls it `obj' rather than `omf' for + historical reasons) is the one produced by MASM and TASM, which is + typically fed to 16-bit DOS linkers to produce `.EXE' files. It is + also the format used by OS/2. + + `obj' provides a default output file-name extension of `.obj'. + + `obj' is not exclusively a 16-bit format, though: NASM has full + support for the 32-bit extensions to the format. In particular, 32- + bit `obj' format files are used by Borland's Win32 compilers, + instead of using Microsoft's newer `win32' object file format. + + The `obj' format does not define any special segment names: you can + call your segments anything you like. Typical names for segments in + `obj' format files are `CODE', `DATA' and `BSS'. + + If your source file contains code before specifying an explicit + `SEGMENT' directive, then NASM will invent its own segment called + `__NASMDEFSEG' for you. + + When you define a segment in an `obj' file, NASM defines the segment + name as a symbol as well, so that you can access the segment address + of the segment. So, for example: + + segment data + + dvar: dw 1234 + + segment code + + function: + mov ax,data ; get segment address of data + mov ds,ax ; and move it into DS + inc word [dvar] ; now this reference will work + ret + + The `obj' format also enables the use of the `SEG' and `WRT' + operators, so that you can write code which does things like + + extern foo + + mov ax,seg foo ; get preferred segment of foo + mov ds,ax + mov ax,data ; a different segment + mov es,ax + mov ax,[ds:foo] ; this accesses `foo' + mov [es:foo wrt data],bx ; so does this + + 7.4.1 `obj' Extensions to the `SEGMENT' Directive + + The `obj' output format extends the `SEGMENT' (or `SECTION') + directive to allow you to specify various properties of the segment + you are defining. This is done by appending extra qualifiers to the + end of the segment-definition line. For example, + + segment code private align=16 + + defines the segment `code', but also declares it to be a private + segment, and requires that the portion of it described in this code + module must be aligned on a 16-byte boundary. + + The available qualifiers are: + + (*) `PRIVATE', `PUBLIC', `COMMON' and `STACK' specify the + combination characteristics of the segment. `PRIVATE' segments + do not get combined with any others by the linker; `PUBLIC' and + `STACK' segments get concatenated together at link time; and + `COMMON' segments all get overlaid on top of each other rather + than stuck end-to-end. + + (*) `ALIGN' is used, as shown above, to specify how many low bits of + the segment start address must be forced to zero. The alignment + value given may be any power of two from 1 to 4096; in reality, + the only values supported are 1, 2, 4, 16, 256 and 4096, so if 8 + is specified it will be rounded up to 16, and 32, 64 and 128 + will all be rounded up to 256, and so on. Note that alignment to + 4096-byte boundaries is a PharLap extension to the format and + may not be supported by all linkers. + + (*) `CLASS' can be used to specify the segment class; this feature + indicates to the linker that segments of the same class should + be placed near each other in the output file. The class name can + be any word, e.g. `CLASS=CODE'. + + (*) `OVERLAY', like `CLASS', is specified with an arbitrary word as + an argument, and provides overlay information to an overlay- + capable linker. + + (*) Segments can be declared as `USE16' or `USE32', which has the + effect of recording the choice in the object file and also + ensuring that NASM's default assembly mode when assembling in + that segment is 16-bit or 32-bit respectively. + + (*) When writing OS/2 object files, you should declare 32-bit + segments as `FLAT', which causes the default segment base for + anything in the segment to be the special group `FLAT', and also + defines the group if it is not already defined. + + (*) The `obj' file format also allows segments to be declared as + having a pre-defined absolute segment address, although no + linkers are currently known to make sensible use of this + feature; nevertheless, NASM allows you to declare a segment such + as `SEGMENT SCREEN ABSOLUTE=0xB800' if you need to. The + `ABSOLUTE' and `ALIGN' keywords are mutually exclusive. + + NASM's default segment attributes are `PUBLIC', `ALIGN=1', no class, + no overlay, and `USE16'. + + 7.4.2 `GROUP': Defining Groups of Segments + + The `obj' format also allows segments to be grouped, so that a + single segment register can be used to refer to all the segments in + a group. NASM therefore supplies the `GROUP' directive, whereby you + can code + + segment data + + ; some data + + segment bss + + ; some uninitialized data + + group dgroup data bss + + which will define a group called `dgroup' to contain the segments + `data' and `bss'. Like `SEGMENT', `GROUP' causes the group name to + be defined as a symbol, so that you can refer to a variable `var' in + the `data' segment as `var wrt data' or as `var wrt dgroup', + depending on which segment value is currently in your segment + register. + + If you just refer to `var', however, and `var' is declared in a + segment which is part of a group, then NASM will default to giving + you the offset of `var' from the beginning of the _group_, not the + _segment_. Therefore `SEG var', also, will return the group base + rather than the segment base. + + NASM will allow a segment to be part of more than one group, but + will generate a warning if you do this. Variables declared in a + segment which is part of more than one group will default to being + relative to the first group that was defined to contain the segment. + + A group does not have to contain any segments; you can still make + `WRT' references to a group which does not contain the variable you + are referring to. OS/2, for example, defines the special group + `FLAT' with no segments in it. + + 7.4.3 `UPPERCASE': Disabling Case Sensitivity in Output + + Although NASM itself is case sensitive, some OMF linkers are not; + therefore it can be useful for NASM to output single-case object + files. The `UPPERCASE' format-specific directive causes all segment, + group and symbol names that are written to the object file to be + forced to upper case just before being written. Within a source + file, NASM is still case-sensitive; but the object file can be + written entirely in upper case if desired. + + `UPPERCASE' is used alone on a line; it requires no parameters. + + 7.4.4 `IMPORT': Importing DLL Symbols + + The `IMPORT' format-specific directive defines a symbol to be + imported from a DLL, for use if you are writing a DLL's import + library in NASM. You still need to declare the symbol as `EXTERN' as + well as using the `IMPORT' directive. + + The `IMPORT' directive takes two required parameters, separated by + white space, which are (respectively) the name of the symbol you + wish to import and the name of the library you wish to import it + from. For example: + + import WSAStartup wsock32.dll + + A third optional parameter gives the name by which the symbol is + known in the library you are importing it from, in case this is not + the same as the name you wish the symbol to be known by to your code + once you have imported it. For example: + + import asyncsel wsock32.dll WSAAsyncSelect + + 7.4.5 `EXPORT': Exporting DLL Symbols + + The `EXPORT' format-specific directive defines a global symbol to be + exported as a DLL symbol, for use if you are writing a DLL in NASM. + You still need to declare the symbol as `GLOBAL' as well as using + the `EXPORT' directive. + + `EXPORT' takes one required parameter, which is the name of the + symbol you wish to export, as it was defined in your source file. An + optional second parameter (separated by white space from the first) + gives the _external_ name of the symbol: the name by which you wish + the symbol to be known to programs using the DLL. If this name is + the same as the internal name, you may leave the second parameter + off. + + Further parameters can be given to define attributes of the exported + symbol. These parameters, like the second, are separated by white + space. If further parameters are given, the external name must also + be specified, even if it is the same as the internal name. The + available attributes are: + + (*) `resident' indicates that the exported name is to be kept + resident by the system loader. This is an optimisation for + frequently used symbols imported by name. + + (*) `nodata' indicates that the exported symbol is a function which + does not make use of any initialized data. + + (*) `parm=NNN', where `NNN' is an integer, sets the number of + parameter words for the case in which the symbol is a call gate + between 32-bit and 16-bit segments. + + (*) An attribute which is just a number indicates that the symbol + should be exported with an identifying number (ordinal), and + gives the desired number. + + For example: + + export myfunc + export myfunc TheRealMoreFormalLookingFunctionName + export myfunc myfunc 1234 ; export by ordinal + export myfunc myfunc resident parm=23 nodata + + 7.4.6 `..start': Defining the Program Entry Point + + `OMF' linkers require exactly one of the object files being linked + to define the program entry point, where execution will begin when + the program is run. If the object file that defines the entry point + is assembled using NASM, you specify the entry point by declaring + the special symbol `..start' at the point where you wish execution + to begin. + + 7.4.7 `obj' Extensions to the `EXTERN' Directive + + If you declare an external symbol with the directive + + extern foo + + then references such as `mov ax,foo' will give you the offset of + `foo' from its preferred segment base (as specified in whichever + module `foo' is actually defined in). So to access the contents of + `foo' you will usually need to do something like + + mov ax,seg foo ; get preferred segment base + mov es,ax ; move it into ES + mov ax,[es:foo] ; and use offset `foo' from it + + This is a little unwieldy, particularly if you know that an external + is going to be accessible from a given segment or group, say + `dgroup'. So if `DS' already contained `dgroup', you could simply + code + + mov ax,[foo wrt dgroup] + + However, having to type this every time you want to access `foo' can + be a pain; so NASM allows you to declare `foo' in the alternative + form + + extern foo:wrt dgroup + + This form causes NASM to pretend that the preferred segment base of + `foo' is in fact `dgroup'; so the expression `seg foo' will now + return `dgroup', and the expression `foo' is equivalent to + `foo wrt dgroup'. + + This default-`WRT' mechanism can be used to make externals appear to + be relative to any group or segment in your program. It can also be + applied to common variables: see section 7.4.8. + + 7.4.8 `obj' Extensions to the `COMMON' Directive + + The `obj' format allows common variables to be either near or far; + NASM allows you to specify which your variables should be by the use + of the syntax + + common nearvar 2:near ; `nearvar' is a near common + common farvar 10:far ; and `farvar' is far + + Far common variables may be greater in size than 64Kb, and so the + OMF specification says that they are declared as a number of + _elements_ of a given size. So a 10-byte far common variable could + be declared as ten one-byte elements, five two-byte elements, two + five-byte elements or one ten-byte element. + + Some `OMF' linkers require the element size, as well as the variable + size, to match when resolving common variables declared in more than + one module. Therefore NASM must allow you to specify the element + size on your far common variables. This is done by the following + syntax: + + common c_5by2 10:far 5 ; two five-byte elements + common c_2by5 10:far 2 ; five two-byte elements + + If no element size is specified, the default is 1. Also, the `FAR' + keyword is not required when an element size is specified, since + only far commons may have element sizes at all. So the above + declarations could equivalently be + + common c_5by2 10:5 ; two five-byte elements + common c_2by5 10:2 ; five two-byte elements + + In addition to these extensions, the `COMMON' directive in `obj' + also supports default-`WRT' specification like `EXTERN' does + (explained in section 7.4.7). So you can also declare things like + + common foo 10:wrt dgroup + common bar 16:far 2:wrt data + common baz 24:wrt data:6 + + 7.5 `win32': Microsoft Win32 Object Files + + The `win32' output format generates Microsoft Win32 object files, + suitable for passing to Microsoft linkers such as Visual C++. Note + that Borland Win32 compilers do not use this format, but use `obj' + instead (see section 7.4). + + `win32' provides a default output file-name extension of `.obj'. + + Note that although Microsoft say that Win32 object files follow the + `COFF' (Common Object File Format) standard, the object files + produced by Microsoft Win32 compilers are not compatible with COFF + linkers such as DJGPP's, and vice versa. This is due to a difference + of opinion over the precise semantics of PC-relative relocations. To + produce COFF files suitable for DJGPP, use NASM's `coff' output + format; conversely, the `coff' format does not produce object files + that Win32 linkers can generate correct output from. + + 7.5.1 `win32' Extensions to the `SECTION' Directive + + Like the `obj' format, `win32' allows you to specify additional + information on the `SECTION' directive line, to control the type and + properties of sections you declare. Section types and properties are + generated automatically by NASM for the standard section names + `.text', `.data' and `.bss', but may still be overridden by these + qualifiers. + + The available qualifiers are: + + (*) `code', or equivalently `text', defines the section to be a code + section. This marks the section as readable and executable, but + not writable, and also indicates to the linker that the type of + the section is code. + + (*) `data' and `bss' define the section to be a data section, + analogously to `code'. Data sections are marked as readable and + writable, but not executable. `data' declares an initialized + data section, whereas `bss' declares an uninitialized data + section. + + (*) `rdata' declares an initialized data section that is readable + but not writable. Microsoft compilers use this section to place + constants in it. + + (*) `info' defines the section to be an informational section, which + is not included in the executable file by the linker, but may + (for example) pass information _to_ the linker. For example, + declaring an `info'-type section called `.drectve' causes the + linker to interpret the contents of the section as command-line + options. + + (*) `align=', used with a trailing number as in `obj', gives the + alignment requirements of the section. The maximum you may + specify is 64: the Win32 object file format contains no means to + request a greater section alignment than this. If alignment is + not explicitly specified, the defaults are 16-byte alignment for + code sections, 8-byte alignment for rdata sections and 4-byte + alignment for data (and BSS) sections. Informational sections + get a default alignment of 1 byte (no alignment), though the + value does not matter. + + The defaults assumed by NASM if you do not specify the above + qualifiers are: + + section .text code align=16 + section .data data align=4 + section .rdata rdata align=8 + section .bss bss align=4 + + Any other section name is treated by default like `.text'. + + 7.5.2 `win32': Safe Structured Exception Handling + + Among other improvements in Windows XP SP2 and Windows Server 2003 + Microsoft has introduced concept of "safe structured exception + handling." General idea is to collect handlers' entry points in + designated read-only table and have alleged entry point verified + against this table prior exception control is passed to the handler. + In order for an executable module to be equipped with such "safe + exception handler table," all object modules on linker command line + has to comply with certain criteria. If one single module among them + does not, then the table in question is omitted and above mentioned + run-time checks will not be performed for application in question. + Table omission is by default silent and therefore can be easily + overlooked. One can instruct linker to refuse to produce binary + without such table by passing `/safeseh' command line option. + + Without regard to this run-time check merits it's natural to expect + NASM to be capable of generating modules suitable for `/safeseh' + linking. From developer's viewpoint the problem is two-fold: + + (*) how to adapt modules not deploying exception handlers of their + own; + + (*) how to adapt/develop modules utilizing custom exception + handling; + + Former can be easily achieved with any NASM version by adding + following line to source code: + + $@feat.00 equ 1 + + As of version 2.03 NASM adds this absolute symbol automatically. If + it's not already present to be precise. I.e. if for whatever reason + developer would choose to assign another value in source file, it + would still be perfectly possible. + + Registering custom exception handler on the other hand requires + certain "magic." As of version 2.03 additional directive is + implemented, `safeseh', which instructs the assembler to produce + appropriately formatted input data for above mentioned "safe + exception handler table." Its typical use would be: + + section .text + extern _MessageBoxA@16 + %if __NASM_VERSION_ID__ >= 0x02030000 + safeseh handler ; register handler as "safe handler" + %endif + handler: + push DWORD 1 ; MB_OKCANCEL + push DWORD caption + push DWORD text + push DWORD 0 + call _MessageBoxA@16 + sub eax,1 ; incidentally suits as return value + ; for exception handler + ret + global _main + _main: + push DWORD handler + push DWORD [fs:0] + mov DWORD [fs:0],esp ; engage exception handler + xor eax,eax + mov eax,DWORD[eax] ; cause exception + pop DWORD [fs:0] ; disengage exception handler + add esp,4 + ret + text: db 'OK to rethrow, CANCEL to generate core dump',0 + caption:db 'SEGV',0 + + section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' + + As you might imagine, it's perfectly possible to produce .exe binary + with "safe exception handler table" and yet engage unregistered + exception handler. Indeed, handler is engaged by simply manipulating + `[fs:0]' location at run-time, something linker has no power over, + run-time that is. It should be explicitly mentioned that such + failure to register handler's entry point with `safeseh' directive + has undesired side effect at run-time. If exception is raised and + unregistered handler is to be executed, the application is abruptly + terminated without any notification whatsoever. One can argue that + system could at least have logged some kind "non-safe exception + handler in x.exe at address n" message in event log, but no, + literally no notification is provided and user is left with no clue + on what caused application failure. + + Finally, all mentions of linker in this paragraph refer to Microsoft + linker version 7.x and later. Presence of `@feat.00' symbol and + input data for "safe exception handler table" causes no backward + incompatibilities and "safeseh" modules generated by NASM 2.03 and + later can still be linked by earlier versions or non-Microsoft + linkers. + + 7.6 `win64': Microsoft Win64 Object Files + + The `win64' output format generates Microsoft Win64 object files, + which is nearly 100% identical to the `win32' object format (section + 7.5) with the exception that it is meant to target 64-bit code and + the x86-64 platform altogether. This object file is used exactly the + same as the `win32' object format (section 7.5), in NASM, with + regard to this exception. + + 7.6.1 `win64': Writing Position-Independent Code + + While `REL' takes good care of RIP-relative addressing, there is one + aspect that is easy to overlook for a Win64 programmer: indirect + references. Consider a switch dispatch table: + + jmp QWORD[dsptch+rax*8] + ... + dsptch: dq case0 + dq case1 + ... + + Even novice Win64 assembler programmer will soon realize that the + code is not 64-bit savvy. Most notably linker will refuse to link it + with + "`'ADDR32' relocation to '.text' invalid without /LARGEADDRESSAWARE:NO'". + So [s]he will have to split jmp instruction as following: + + lea rbx,[rel dsptch] + jmp QWORD[rbx+rax*8] + + What happens behind the scene is that effective address in `lea' is + encoded relative to instruction pointer, or in perfectly position- + independent manner. But this is only part of the problem! Trouble is + that in .dll context `caseN' relocations will make their way to the + final module and might have to be adjusted at .dll load time. To be + specific when it can't be loaded at preferred address. And when this + occurs, pages with such relocations will be rendered private to + current process, which kind of undermines the idea of sharing .dll. + But no worry, it's trivial to fix: + + lea rbx,[rel dsptch] + add rbx,QWORD[rbx+rax*8] + jmp rbx + ... + dsptch: dq case0-dsptch + dq case1-dsptch + ... + + NASM version 2.03 and later provides another alternative, + `wrt ..imagebase' operator, which returns offset from base address + of the current image, be it .exe or .dll module, therefore the name. + For those acquainted with PE-COFF format base address denotes start + of `IMAGE_DOS_HEADER' structure. Here is how to implement switch + with these image-relative references: + + lea rbx,[rel dsptch] + mov eax,DWORD[rbx+rax*4] + sub rbx,dsptch wrt ..imagebase + add rbx,rax + jmp rbx + ... + dsptch: dd case0 wrt ..imagebase + dd case1 wrt ..imagebase + + One can argue that the operator is redundant. Indeed, snippet before + last works just fine with any NASM version and is not even Windows + specific... The real reason for implementing `wrt ..imagebase' will + become apparent in next paragraph. + + It should be noted that `wrt ..imagebase' is defined as 32-bit + operand only: + + dd label wrt ..imagebase ; ok + dq label wrt ..imagebase ; bad + mov eax,label wrt ..imagebase ; ok + mov rax,label wrt ..imagebase ; bad + + 7.6.2 `win64': Structured Exception Handling + + Structured exception handing in Win64 is completely different matter + from Win32. Upon exception program counter value is noted, and + linker-generated table comprising start and end addresses of all the + functions [in given executable module] is traversed and compared to + the saved program counter. Thus so called `UNWIND_INFO' structure is + identified. If it's not found, then offending subroutine is assumed + to be "leaf" and just mentioned lookup procedure is attempted for + its caller. In Win64 leaf function is such function that does not + call any other function _nor_ modifies any Win64 non-volatile + registers, including stack pointer. The latter ensures that it's + possible to identify leaf function's caller by simply pulling the + value from the top of the stack. + + While majority of subroutines written in assembler are not calling + any other function, requirement for non-volatile registers' + immutability leaves developer with not more than 7 registers and no + stack frame, which is not necessarily what [s]he counted with. + Customarily one would meet the requirement by saving non-volatile + registers on stack and restoring them upon return, so what can go + wrong? If [and only if] an exception is raised at run-time and no + `UNWIND_INFO' structure is associated with such "leaf" function, the + stack unwind procedure will expect to find caller's return address + on the top of stack immediately followed by its frame. Given that + developer pushed caller's non-volatile registers on stack, would the + value on top point at some code segment or even addressable space? + Well, developer can attempt copying caller's return address to the + top of stack and this would actually work in some very specific + circumstances. But unless developer can guarantee that these + circumstances are always met, it's more appropriate to assume worst + case scenario, i.e. stack unwind procedure going berserk. Relevant + question is what happens then? Application is abruptly terminated + without any notification whatsoever. Just like in Win32 case, one + can argue that system could at least have logged "unwind procedure + went berserk in x.exe at address n" in event log, but no, no trace + of failure is left. + + Now, when we understand significance of the `UNWIND_INFO' structure, + let's discuss what's in it and/or how it's processed. First of all + it is checked for presence of reference to custom language-specific + exception handler. If there is one, then it's invoked. Depending on + the return value, execution flow is resumed (exception is said to be + "handled"), _or_ rest of `UNWIND_INFO' structure is processed as + following. Beside optional reference to custom handler, it carries + information about current callee's stack frame and where non- + volatile registers are saved. Information is detailed enough to be + able to reconstruct contents of caller's non-volatile registers upon + call to current callee. And so caller's context is reconstructed, + and then unwind procedure is repeated, i.e. another `UNWIND_INFO' + structure is associated, this time, with caller's instruction + pointer, which is then checked for presence of reference to + language-specific handler, etc. The procedure is recursively + repeated till exception is handled. As last resort system "handles" + it by generating memory core dump and terminating the application. + + As for the moment of this writing NASM unfortunately does not + facilitate generation of above mentioned detailed information about + stack frame layout. But as of version 2.03 it implements building + blocks for generating structures involved in stack unwinding. As + simplest example, here is how to deploy custom exception handler for + leaf function: + + default rel + section .text + extern MessageBoxA + handler: + sub rsp,40 + mov rcx,0 + lea rdx,[text] + lea r8,[caption] + mov r9,1 ; MB_OKCANCEL + call MessageBoxA + sub eax,1 ; incidentally suits as return value + ; for exception handler + add rsp,40 + ret + global main + main: + xor rax,rax + mov rax,QWORD[rax] ; cause exception + ret + main_end: + text: db 'OK to rethrow, CANCEL to generate core dump',0 + caption:db 'SEGV',0 + + section .pdata rdata align=4 + dd main wrt ..imagebase + dd main_end wrt ..imagebase + dd xmain wrt ..imagebase + section .xdata rdata align=8 + xmain: db 9,0,0,0 + dd handler wrt ..imagebase + section .drectve info + db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' + + What you see in `.pdata' section is element of the "table comprising + start and end addresses of function" along with reference to + associated `UNWIND_INFO' structure. And what you see in `.xdata' + section is `UNWIND_INFO' structure describing function with no + frame, but with designated exception handler. References are + _required_ to be image-relative (which is the real reason for + implementing `wrt ..imagebase' operator). It should be noted that + `rdata align=n', as well as `wrt ..imagebase', are optional in these + two segments' contexts, i.e. can be omitted. Latter means that _all_ + 32-bit references, not only above listed required ones, placed into + these two segments turn out image-relative. Why is it important to + understand? Developer is allowed to append handler-specific data to + `UNWIND_INFO' structure, and if [s]he adds a 32-bit reference, then + [s]he will have to remember to adjust its value to obtain the real + pointer. + + As already mentioned, in Win64 terms leaf function is one that does + not call any other function _nor_ modifies any non-volatile + register, including stack pointer. But it's not uncommon that + assembler programmer plans to utilize every single register and + sometimes even have variable stack frame. Is there anything one can + do with bare building blocks? I.e. besides manually composing fully- + fledged `UNWIND_INFO' structure, which would surely be considered + error-prone? Yes, there is. Recall that exception handler is called + first, before stack layout is analyzed. As it turned out, it's + perfectly possible to manipulate current callee's context in custom + handler in manner that permits further stack unwinding. General idea + is that handler would not actually "handle" the exception, but + instead restore callee's context, as it was at its entry point and + thus mimic leaf function. In other words, handler would simply + undertake part of unwinding procedure. Consider following example: + + function: + mov rax,rsp ; copy rsp to volatile register + push r15 ; save non-volatile registers + push rbx + push rbp + mov r11,rsp ; prepare variable stack frame + sub r11,rcx + and r11,-64 + mov QWORD[r11],rax ; check for exceptions + mov rsp,r11 ; allocate stack frame + mov QWORD[rsp],rax ; save original rsp value + magic_point: + ... + mov r11,QWORD[rsp] ; pull original rsp value + mov rbp,QWORD[r11-24] + mov rbx,QWORD[r11-16] + mov r15,QWORD[r11-8] + mov rsp,r11 ; destroy frame + ret + + The keyword is that up to `magic_point' original `rsp' value remains + in chosen volatile register and no non-volatile register, except for + `rsp', is modified. While past `magic_point' `rsp' remains constant + till the very end of the `function'. In this case custom language- + specific exception handler would look like this: + + EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, + CONTEXT *context,DISPATCHER_CONTEXT *disp) + { ULONG64 *rsp; + if (context->Rip<(ULONG64)magic_point) + rsp = (ULONG64 *)context->Rax; + else + { rsp = ((ULONG64 **)context->Rsp)[0]; + context->Rbp = rsp[-3]; + context->Rbx = rsp[-2]; + context->R15 = rsp[-1]; + } + context->Rsp = (ULONG64)rsp; + + memcpy (disp->ContextRecord,context,sizeof(CONTEXT)); + RtlVirtualUnwind(UNW_FLAG_NHANDLER,disp->ImageBase, + dips->ControlPc,disp->FunctionEntry,disp->ContextRecord, + &disp->HandlerData,&disp->EstablisherFrame,NULL); + return ExceptionContinueSearch; + } + + As custom handler mimics leaf function, corresponding `UNWIND_INFO' + structure does not have to contain any information about stack frame + and its layout. + + 7.7 `coff': Common Object File Format + + The `coff' output type produces `COFF' object files suitable for + linking with the DJGPP linker. + + `coff' provides a default output file-name extension of `.o'. + + The `coff' format supports the same extensions to the `SECTION' + directive as `win32' does, except that the `align' qualifier and the + `info' section type are not supported. + + 7.8 `macho32' and `macho64': Mach Object File Format + + The `macho32' and `macho64' output formts produces `Mach-O' object + files suitable for linking with the MacOS X linker. `macho' is a + synonym for `macho32'. + + `macho' provides a default output file-name extension of `.o'. + + 7.9 `elf32' and `elf64': Executable and Linkable Format Object Files + + The `elf32' and `elf64' output formats generate `ELF32 and ELF64' + (Executable and Linkable Format) object files, as used by Linux as + well as Unix System V, including Solaris x86, UnixWare and SCO Unix. + `elf' provides a default output file-name extension of `.o'. `elf' + is a synonym for `elf32'. + + 7.9.1 ELF specific directive `osabi' + + The ELF header specifies the application binary interface for the + target operating system (OSABI). This field can be set by using the + `osabi' directive with the numeric value (0-255) of the target + system. If this directive is not used, the default value will be + "UNIX System V ABI" (0) which will work on most systems which + support ELF. + + 7.9.2 `elf' Extensions to the `SECTION' Directive + + Like the `obj' format, `elf' allows you to specify additional + information on the `SECTION' directive line, to control the type and + properties of sections you declare. Section types and properties are + generated automatically by NASM for the standard section names, but + may still be overridden by these qualifiers. + + The available qualifiers are: + + (*) `alloc' defines the section to be one which is loaded into + memory when the program is run. `noalloc' defines it to be one + which is not, such as an informational or comment section. + + (*) `exec' defines the section to be one which should have execute + permission when the program is run. `noexec' defines it as one + which should not. + + (*) `write' defines the section to be one which should be writable + when the program is run. `nowrite' defines it as one which + should not. + + (*) `progbits' defines the section to be one with explicit contents + stored in the object file: an ordinary code or data section, for + example, `nobits' defines the section to be one with no explicit + contents given, such as a BSS section. + + (*) `align=', used with a trailing number as in `obj', gives the + alignment requirements of the section. + + (*) `tls' defines the section to be one which contains thread local + variables. + + The defaults assumed by NASM if you do not specify the above + qualifiers are: + + + section .text progbits alloc exec nowrite align=16 + section .rodata progbits alloc noexec nowrite align=4 + section .lrodata progbits alloc noexec nowrite align=4 + section .data progbits alloc noexec write align=4 + section .ldata progbits alloc noexec write align=4 + section .bss nobits alloc noexec write align=4 + section .lbss nobits alloc noexec write align=4 + section .tdata progbits alloc noexec write align=4 tls + section .tbss nobits alloc noexec write align=4 tls + section .comment progbits noalloc noexec nowrite align=1 + section other progbits alloc noexec nowrite align=1 + + (Any section name other than those in the above table is treated by + default like `other' in the above table. Please note that section + names are case sensitive.) + + 7.9.3 Position-Independent Code: `elf' Special Symbols and `WRT' + + The `ELF' specification contains enough features to allow position- + independent code (PIC) to be written, which makes ELF shared + libraries very flexible. However, it also means NASM has to be able + to generate a variety of ELF specific relocation types in ELF object + files, if it is to be an assembler which can write PIC. + + Since `ELF' does not support segment-base references, the `WRT' + operator is not used for its normal purpose; therefore NASM's `elf' + output format makes use of `WRT' for a different purpose, namely the + PIC-specific relocation types. + + `elf' defines five special symbols which you can use as the right- + hand side of the `WRT' operator to obtain PIC relocation types. They + are `..gotpc', `..gotoff', `..got', `..plt' and `..sym'. Their + functions are summarized here: + + (*) Referring to the symbol marking the global offset table base + using `wrt ..gotpc' will end up giving the distance from the + beginning of the current section to the global offset table. + (`_GLOBAL_OFFSET_TABLE_' is the standard symbol name used to + refer to the GOT.) So you would then need to add `$$' to the + result to get the real address of the GOT. + + (*) Referring to a location in one of your own sections using + `wrt ..gotoff' will give the distance from the beginning of the + GOT to the specified location, so that adding on the address of + the GOT would give the real address of the location you wanted. + + (*) Referring to an external or global symbol using `wrt ..got' + causes the linker to build an entry _in_ the GOT containing the + address of the symbol, and the reference gives the distance from + the beginning of the GOT to the entry; so you can add on the + address of the GOT, load from the resulting address, and end up + with the address of the symbol. + + (*) Referring to a procedure name using `wrt ..plt' causes the + linker to build a procedure linkage table entry for the symbol, + and the reference gives the address of the PLT entry. You can + only use this in contexts which would generate a PC-relative + relocation normally (i.e. as the destination for `CALL' or + `JMP'), since ELF contains no relocation type to refer to PLT + entries absolutely. + + (*) Referring to a symbol name using `wrt ..sym' causes NASM to + write an ordinary relocation, but instead of making the + relocation relative to the start of the section and then adding + on the offset to the symbol, it will write a relocation record + aimed directly at the symbol in question. The distinction is a + necessary one due to a peculiarity of the dynamic linker. + + A fuller explanation of how to use these relocation types to write + shared libraries entirely in NASM is given in section 9.2. + + 7.9.4 Thread Local Storage: `elf' Special Symbols and `WRT' + + (*) In ELF32 mode, referring to an external or global symbol using + `wrt ..tlsie' causes the linker to build an entry _in_ the GOT + containing the offset of the symbol within the TLS block, so you + can access the value of the symbol with code such as: + + mov eax,[tid wrt ..tlsie] + mov [gs:eax],ebx + + (*) In ELF64 mode, referring to an external or global symbol using + `wrt ..gottpoff' causes the linker to build an entry _in_ the + GOT containing the offset of the symbol within the TLS block, so + you can access the value of the symbol with code such as: + + mov rax,[rel tid wrt ..gottpoff] + mov rcx,[fs:rax] + + 7.9.5 `elf' Extensions to the `GLOBAL' Directive + + `ELF' object files can contain more information about a global + symbol than just its address: they can contain the size of the + symbol and its type as well. These are not merely debugger + conveniences, but are actually necessary when the program being + written is a shared library. NASM therefore supports some extensions + to the `GLOBAL' directive, allowing you to specify these features. + + You can specify whether a global variable is a function or a data + object by suffixing the name with a colon and the word `function' or + `data'. (`object' is a synonym for `data'.) For example: + + global hashlookup:function, hashtable:data + + exports the global symbol `hashlookup' as a function and `hashtable' + as a data object. + + Optionally, you can control the ELF visibility of the symbol. Just + add one of the visibility keywords: `default', `internal', `hidden', + or `protected'. The default is `default' of course. For example, to + make `hashlookup' hidden: + + global hashlookup:function hidden + + You can also specify the size of the data associated with the + symbol, as a numeric expression (which may involve labels, and even + forward references) after the type specifier. Like this: + + global hashtable:data (hashtable.end - hashtable) + + hashtable: + db this,that,theother ; some data here + .end: + + This makes NASM automatically calculate the length of the table and + place that information into the `ELF' symbol table. + + Declaring the type and size of global symbols is necessary when + writing shared library code. For more information, see section + 9.2.4. + + 7.9.6 `elf' Extensions to the `COMMON' Directive + + `ELF' also allows you to specify alignment requirements on common + variables. This is done by putting a number (which must be a power + of two) after the name and size of the common variable, separated + (as usual) by a colon. For example, an array of doublewords would + benefit from 4-byte alignment: + + common dwordarray 128:4 + + This declares the total size of the array to be 128 bytes, and + requires that it be aligned on a 4-byte boundary. + + 7.9.7 16-bit code and ELF + + The `ELF32' specification doesn't provide relocations for 8- and 16- + bit values, but the GNU `ld' linker adds these as an extension. NASM + can generate GNU-compatible relocations, to allow 16-bit code to be + linked as ELF using GNU `ld'. If NASM is used with the + `-w+gnu-elf-extensions' option, a warning is issued when one of + these relocations is generated. + + 7.9.8 Debug formats and ELF + + `ELF32' and `ELF64' provide debug information in `STABS' and `DWARF' + formats. Line number information is generated for all executable + sections, but please note that only the ".text" section is + executable by default. + + 7.10 `aout': Linux `a.out' Object Files + + The `aout' format generates `a.out' object files, in the form used + by early Linux systems (current Linux systems use ELF, see section + 7.9.) These differ from other `a.out' object files in that the magic + number in the first four bytes of the file is different; also, some + implementations of `a.out', for example NetBSD's, support position- + independent code, which Linux's implementation does not. + + `a.out' provides a default output file-name extension of `.o'. + + `a.out' is a very simple object format. It supports no special + directives, no special symbols, no use of `SEG' or `WRT', and no + extensions to any standard directives. It supports only the three + standard section names `.text', `.data' and `.bss'. + + 7.11 `aoutb': NetBSD/FreeBSD/OpenBSD `a.out' Object Files + + The `aoutb' format generates `a.out' object files, in the form used + by the various free `BSD Unix' clones, `NetBSD', `FreeBSD' and + `OpenBSD'. For simple object files, this object format is exactly + the same as `aout' except for the magic number in the first four + bytes of the file. However, the `aoutb' format supports + position-independent code in the same way as the `elf' format, so + you can use it to write `BSD' shared libraries. + + `aoutb' provides a default output file-name extension of `.o'. + + `aoutb' supports no special directives, no special symbols, and only + the three standard section names `.text', `.data' and `.bss'. + However, it also supports the same use of `WRT' as `elf' does, to + provide position-independent code relocation types. See section + 7.9.3 for full documentation of this feature. + + `aoutb' also supports the same extensions to the `GLOBAL' directive + as `elf' does: see section 7.9.5 for documentation of this. + + 7.12 `as86': Minix/Linux `as86' Object Files + + The Minix/Linux 16-bit assembler `as86' has its own non-standard + object file format. Although its companion linker `ld86' produces + something close to ordinary `a.out' binaries as output, the object + file format used to communicate between `as86' and `ld86' is not + itself `a.out'. + + NASM supports this format, just in case it is useful, as `as86'. + `as86' provides a default output file-name extension of `.o'. + + `as86' is a very simple object format (from the NASM user's point of + view). It supports no special directives, no use of `SEG' or `WRT', + and no extensions to any standard directives. It supports only the + three standard section names `.text', `.data' and `.bss'. The only + special symbol supported is `..start'. + + 7.13 `rdf': Relocatable Dynamic Object File Format + + The `rdf' output format produces `RDOFF' object files. `RDOFF' + (Relocatable Dynamic Object File Format) is a home-grown object-file + format, designed alongside NASM itself and reflecting in its file + format the internal structure of the assembler. + + `RDOFF' is not used by any well-known operating systems. Those + writing their own systems, however, may well wish to use `RDOFF' as + their object format, on the grounds that it is designed primarily + for simplicity and contains very little file-header bureaucracy. + + The Unix NASM archive, and the DOS archive which includes sources, + both contain an `rdoff' subdirectory holding a set of RDOFF + utilities: an RDF linker, an `RDF' static-library manager, an RDF + file dump utility, and a program which will load and execute an RDF + executable under Linux. + + `rdf' supports only the standard section names `.text', `.data' and + `.bss'. + +7.13.1 Requiring a Library: The `LIBRARY' Directive + + `RDOFF' contains a mechanism for an object file to demand a given + library to be linked to the module, either at load time or run time. + This is done by the `LIBRARY' directive, which takes one argument + which is the name of the module: + + library mylib.rdl + +7.13.2 Specifying a Module Name: The `MODULE' Directive + + Special `RDOFF' header record is used to store the name of the + module. It can be used, for example, by run-time loader to perform + dynamic linking. `MODULE' directive takes one argument which is the + name of current module: + + module mymodname + + Note that when you statically link modules and tell linker to strip + the symbols from output file, all module names will be stripped too. + To avoid it, you should start module names with `$', like: + + module $kernel.core + +7.13.3 `rdf' Extensions to the `GLOBAL' Directive + + `RDOFF' global symbols can contain additional information needed by + the static linker. You can mark a global symbol as exported, thus + telling the linker do not strip it from target executable or library + file. Like in `ELF', you can also specify whether an exported symbol + is a procedure (function) or data object. + + Suffixing the name with a colon and the word `export' you make the + symbol exported: + + global sys_open:export + + To specify that exported symbol is a procedure (function), you add + the word `proc' or `function' after declaration: + + global sys_open:export proc + + Similarly, to specify exported data object, add the word `data' or + `object' to the directive: + + global kernel_ticks:export data + +7.13.4 `rdf' Extensions to the `EXTERN' Directive + + By default the `EXTERN' directive in `RDOFF' declares a "pure + external" symbol (i.e. the static linker will complain if such a + symbol is not resolved). To declare an "imported" symbol, which must + be resolved later during a dynamic linking phase, `RDOFF' offers an + additional `import' modifier. As in `GLOBAL', you can also specify + whether an imported symbol is a procedure (function) or data object. + For example: + + library $libc + extern _open:import + extern _printf:import proc + extern _errno:import data + + Here the directive `LIBRARY' is also included, which gives the + dynamic linker a hint as to where to find requested symbols. + + 7.14 `dbg': Debugging Format + + The `dbg' output format is not built into NASM in the default + configuration. If you are building your own NASM executable from the + sources, you can define `OF_DBG' in `output/outform.h' or on the + compiler command line, and obtain the `dbg' output format. + + The `dbg' format does not output an object file as such; instead, it + outputs a text file which contains a complete list of all the + transactions between the main body of NASM and the output-format + back end module. It is primarily intended to aid people who want to + write their own output drivers, so that they can get a clearer idea + of the various requests the main program makes of the output driver, + and in what order they happen. + + For simple files, one can easily use the `dbg' format like this: + + nasm -f dbg filename.asm + + which will generate a diagnostic file called `filename.dbg'. + However, this will not work well on files which were designed for a + different object format, because each object format defines its own + macros (usually user-level forms of directives), and those macros + will not be defined in the `dbg' format. Therefore it can be useful + to run NASM twice, in order to do the preprocessing with the native + object format selected: + + nasm -e -f rdf -o rdfprog.i rdfprog.asm + nasm -a -f dbg rdfprog.i + + This preprocesses `rdfprog.asm' into `rdfprog.i', keeping the `rdf' + object format selected in order to make sure RDF special directives + are converted into primitive form correctly. Then the preprocessed + source is fed through the `dbg' format to generate the final + diagnostic output. + + This workaround will still typically not work for programs intended + for `obj' format, because the `obj' `SEGMENT' and `GROUP' directives + have side effects of defining the segment and group names as + symbols; `dbg' will not do this, so the program will not assemble. + You will have to work around that by defining the symbols yourself + (using `EXTERN', for example) if you really need to get a `dbg' + trace of an `obj'-specific source file. + + `dbg' accepts any section name and any directives at all, and logs + them all to its output file. + +Chapter 8: Writing 16-bit Code (DOS, Windows 3/3.1) +--------------------------------------------------- + + This chapter attempts to cover some of the common issues encountered + when writing 16-bit code to run under `MS-DOS' or `Windows 3.x'. It + covers how to link programs to produce `.EXE' or `.COM' files, how + to write `.SYS' device drivers, and how to interface assembly + language code with 16-bit C compilers and with Borland Pascal. + + 8.1 Producing `.EXE' Files + + Any large program written under DOS needs to be built as a `.EXE' + file: only `.EXE' files have the necessary internal structure + required to span more than one 64K segment. Windows programs, also, + have to be built as `.EXE' files, since Windows does not support the + `.COM' format. + + In general, you generate `.EXE' files by using the `obj' output + format to produce one or more `.OBJ' files, and then linking them + together using a linker. However, NASM also supports the direct + generation of simple DOS `.EXE' files using the `bin' output format + (by using `DB' and `DW' to construct the `.EXE' file header), and a + macro package is supplied to do this. Thanks to Yann Guidon for + contributing the code for this. + + NASM may also support `.EXE' natively as another output format in + future releases. + + 8.1.1 Using the `obj' Format To Generate `.EXE' Files + + This section describes the usual method of generating `.EXE' files + by linking `.OBJ' files together. + + Most 16-bit programming language packages come with a suitable + linker; if you have none of these, there is a free linker called + VAL, available in `LZH' archive format from `x2ftp.oulu.fi'. An LZH + archiver can be found at `ftp.simtel.net'. There is another `free' + linker (though this one doesn't come with sources) called FREELINK, + available from `www.pcorner.com'. A third, `djlink', written by DJ + Delorie, is available at `www.delorie.com'. A fourth linker, + `ALINK', written by Anthony A.J. Williams, is available at + `alink.sourceforge.net'. + + When linking several `.OBJ' files into a `.EXE' file, you should + ensure that exactly one of them has a start point defined (using the + `..start' special symbol defined by the `obj' format: see section + 7.4.6). If no module defines a start point, the linker will not know + what value to give the entry-point field in the output file header; + if more than one defines a start point, the linker will not know + _which_ value to use. + + An example of a NASM source file which can be assembled to a `.OBJ' + file and linked on its own to a `.EXE' is given here. It + demonstrates the basic principles of defining a stack, initialising + the segment registers, and declaring a start point. This file is + also provided in the `test' subdirectory of the NASM archives, under + the name `objexe.asm'. + + segment code + + ..start: + mov ax,data + mov ds,ax + mov ax,stack + mov ss,ax + mov sp,stacktop + + This initial piece of code sets up `DS' to point to the data + segment, and initializes `SS' and `SP' to point to the top of the + provided stack. Notice that interrupts are implicitly disabled for + one instruction after a move into `SS', precisely for this + situation, so that there's no chance of an interrupt occurring + between the loads of `SS' and `SP' and not having a stack to execute + on. + + Note also that the special symbol `..start' is defined at the + beginning of this code, which means that will be the entry point + into the resulting executable file. + + mov dx,hello + mov ah,9 + int 0x21 + + The above is the main program: load `DS:DX' with a pointer to the + greeting message (`hello' is implicitly relative to the segment + `data', which was loaded into `DS' in the setup code, so the full + pointer is valid), and call the DOS print-string function. + + mov ax,0x4c00 + int 0x21 + + This terminates the program using another DOS system call. + + segment data + + hello: db 'hello, world', 13, 10, '$' + + The data segment contains the string we want to display. + + segment stack stack + resb 64 + stacktop: + + The above code declares a stack segment containing 64 bytes of + uninitialized stack space, and points `stacktop' at the top of it. + The directive `segment stack stack' defines a segment _called_ + `stack', and also of _type_ `STACK'. The latter is not necessary to + the correct running of the program, but linkers are likely to issue + warnings or errors if your program has no segment of type `STACK'. + + The above file, when assembled into a `.OBJ' file, will link on its + own to a valid `.EXE' file, which when run will print `hello, world' + and then exit. + + 8.1.2 Using the `bin' Format To Generate `.EXE' Files + + The `.EXE' file format is simple enough that it's possible to build + a `.EXE' file by writing a pure-binary program and sticking a 32- + byte header on the front. This header is simple enough that it can + be generated using `DB' and `DW' commands by NASM itself, so that + you can use the `bin' output format to directly generate `.EXE' + files. + + Included in the NASM archives, in the `misc' subdirectory, is a file + `exebin.mac' of macros. It defines three macros: `EXE_begin', + `EXE_stack' and `EXE_end'. + + To produce a `.EXE' file using this method, you should start by + using `%include' to load the `exebin.mac' macro package into your + source file. You should then issue the `EXE_begin' macro call (which + takes no arguments) to generate the file header data. Then write + code as normal for the `bin' format - you can use all three standard + sections `.text', `.data' and `.bss'. At the end of the file you + should call the `EXE_end' macro (again, no arguments), which defines + some symbols to mark section sizes, and these symbols are referred + to in the header code generated by `EXE_begin'. + + In this model, the code you end up writing starts at `0x100', just + like a `.COM' file - in fact, if you strip off the 32-byte header + from the resulting `.EXE' file, you will have a valid `.COM' + program. All the segment bases are the same, so you are limited to a + 64K program, again just like a `.COM' file. Note that an `ORG' + directive is issued by the `EXE_begin' macro, so you should not + explicitly issue one of your own. + + You can't directly refer to your segment base value, unfortunately, + since this would require a relocation in the header, and things + would get a lot more complicated. So you should get your segment + base by copying it out of `CS' instead. + + On entry to your `.EXE' file, `SS:SP' are already set up to point to + the top of a 2Kb stack. You can adjust the default stack size of 2Kb + by calling the `EXE_stack' macro. For example, to change the stack + size of your program to 64 bytes, you would call `EXE_stack 64'. + + A sample program which generates a `.EXE' file in this way is given + in the `test' subdirectory of the NASM archive, as `binexe.asm'. + + 8.2 Producing `.COM' Files + + While large DOS programs must be written as `.EXE' files, small ones + are often better written as `.COM' files. `.COM' files are pure + binary, and therefore most easily produced using the `bin' output + format. + + 8.2.1 Using the `bin' Format To Generate `.COM' Files + + `.COM' files expect to be loaded at offset `100h' into their segment + (though the segment may change). Execution then begins at `100h', + i.e. right at the start of the program. So to write a `.COM' + program, you would create a source file looking like + + org 100h + + section .text + + start: + ; put your code here + + section .data + + ; put data items here + + section .bss + + ; put uninitialized data here + + The `bin' format puts the `.text' section first in the file, so you + can declare data or BSS items before beginning to write code if you + want to and the code will still end up at the front of the file + where it belongs. + + The BSS (uninitialized data) section does not take up space in the + `.COM' file itself: instead, addresses of BSS items are resolved to + point at space beyond the end of the file, on the grounds that this + will be free memory when the program is run. Therefore you should + not rely on your BSS being initialized to all zeros when you run. + + To assemble the above program, you should use a command line like + + nasm myprog.asm -fbin -o myprog.com + + The `bin' format would produce a file called `myprog' if no explicit + output file name were specified, so you have to override it and give + the desired file name. + + 8.2.2 Using the `obj' Format To Generate `.COM' Files + + If you are writing a `.COM' program as more than one module, you may + wish to assemble several `.OBJ' files and link them together into a + `.COM' program. You can do this, provided you have a linker capable + of outputting `.COM' files directly (TLINK does this), or + alternatively a converter program such as `EXE2BIN' to transform the + `.EXE' file output from the linker into a `.COM' file. + + If you do this, you need to take care of several things: + + (*) The first object file containing code should start its code + segment with a line like `RESB 100h'. This is to ensure that the + code begins at offset `100h' relative to the beginning of the + code segment, so that the linker or converter program does not + have to adjust address references within the file when + generating the `.COM' file. Other assemblers use an `ORG' + directive for this purpose, but `ORG' in NASM is a format- + specific directive to the `bin' output format, and does not mean + the same thing as it does in MASM-compatible assemblers. + + (*) You don't need to define a stack segment. + + (*) All your segments should be in the same group, so that every + time your code or data references a symbol offset, all offsets + are relative to the same segment base. This is because, when a + `.COM' file is loaded, all the segment registers contain the + same value. + + 8.3 Producing `.SYS' Files + + MS-DOS device drivers - `.SYS' files - are pure binary files, + similar to `.COM' files, except that they start at origin zero + rather than `100h'. Therefore, if you are writing a device driver + using the `bin' format, you do not need the `ORG' directive, since + the default origin for `bin' is zero. Similarly, if you are using + `obj', you do not need the `RESB 100h' at the start of your code + segment. + + `.SYS' files start with a header structure, containing pointers to + the various routines inside the driver which do the work. This + structure should be defined at the start of the code segment, even + though it is not actually code. + + For more information on the format of `.SYS' files, and the data + which has to go in the header structure, a list of books is given in + the Frequently Asked Questions list for the newsgroup + `comp.os.msdos.programmer'. + + 8.4 Interfacing to 16-bit C Programs + + This section covers the basics of writing assembly routines that + call, or are called from, C programs. To do this, you would + typically write an assembly module as a `.OBJ' file, and link it + with your C modules to produce a mixed-language program. + + 8.4.1 External Symbol Names + + C compilers have the convention that the names of all global symbols + (functions or data) they define are formed by prefixing an + underscore to the name as it appears in the C program. So, for + example, the function a C programmer thinks of as `printf' appears + to an assembly language programmer as `_printf'. This means that in + your assembly programs, you can define symbols without a leading + underscore, and not have to worry about name clashes with C symbols. + + If you find the underscores inconvenient, you can define macros to + replace the `GLOBAL' and `EXTERN' directives as follows: + + %macro cglobal 1 + + global _%1 + %define %1 _%1 + + %endmacro + + %macro cextern 1 + + extern _%1 + %define %1 _%1 + + %endmacro + + (These forms of the macros only take one argument at a time; a + `%rep' construct could solve this.) + + If you then declare an external like this: + + cextern printf + + then the macro will expand it as + + extern _printf + %define printf _printf + + Thereafter, you can reference `printf' as if it was a symbol, and + the preprocessor will put the leading underscore on where necessary. + + The `cglobal' macro works similarly. You must use `cglobal' before + defining the symbol in question, but you would have had to do that + anyway if you used `GLOBAL'. + + Also see section 2.1.27. + + 8.4.2 Memory Models + + NASM contains no mechanism to support the various C memory models + directly; you have to keep track yourself of which one you are + writing for. This means you have to keep track of the following + things: + + (*) In models using a single code segment (tiny, small and compact), + functions are near. This means that function pointers, when + stored in data segments or pushed on the stack as function + arguments, are 16 bits long and contain only an offset field + (the `CS' register never changes its value, and always gives the + segment part of the full function address), and that functions + are called using ordinary near `CALL' instructions and return + using `RETN' (which, in NASM, is synonymous with `RET' anyway). + This means both that you should write your own routines to + return with `RETN', and that you should call external C routines + with near `CALL' instructions. + + (*) In models using more than one code segment (medium, large and + huge), functions are far. This means that function pointers are + 32 bits long (consisting of a 16-bit offset followed by a 16-bit + segment), and that functions are called using `CALL FAR' (or + `CALL seg:offset') and return using `RETF'. Again, you should + therefore write your own routines to return with `RETF' and use + `CALL FAR' to call external routines. + + (*) In models using a single data segment (tiny, small and medium), + data pointers are 16 bits long, containing only an offset field + (the `DS' register doesn't change its value, and always gives + the segment part of the full data item address). + + (*) In models using more than one data segment (compact, large and + huge), data pointers are 32 bits long, consisting of a 16-bit + offset followed by a 16-bit segment. You should still be careful + not to modify `DS' in your routines without restoring it + afterwards, but `ES' is free for you to use to access the + contents of 32-bit data pointers you are passed. + + (*) The huge memory model allows single data items to exceed 64K in + size. In all other memory models, you can access the whole of a + data item just by doing arithmetic on the offset field of the + pointer you are given, whether a segment field is present or + not; in huge model, you have to be more careful of your pointer + arithmetic. + + (*) In most memory models, there is a _default_ data segment, whose + segment address is kept in `DS' throughout the program. This + data segment is typically the same segment as the stack, kept in + `SS', so that functions' local variables (which are stored on + the stack) and global data items can both be accessed easily + without changing `DS'. Particularly large data items are + typically stored in other segments. However, some memory models + (though not the standard ones, usually) allow the assumption + that `SS' and `DS' hold the same value to be removed. Be careful + about functions' local variables in this latter case. + + In models with a single code segment, the segment is called `_TEXT', + so your code segment must also go by this name in order to be linked + into the same place as the main code segment. In models with a + single data segment, or with a default data segment, it is called + `_DATA'. + + 8.4.3 Function Definitions and Function Calls + + The C calling convention in 16-bit programs is as follows. In the + following description, the words _caller_ and _callee_ are used to + denote the function doing the calling and the function which gets + called. + + (*) The caller pushes the function's parameters on the stack, one + after another, in reverse order (right to left, so that the + first argument specified to the function is pushed last). + + (*) The caller then executes a `CALL' instruction to pass control to + the callee. This `CALL' is either near or far depending on the + memory model. + + (*) The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access + their parameters) starts by saving the value of `SP' in `BP' so + as to be able to use `BP' as a base pointer to find its + parameters on the stack. However, the caller was probably doing + this too, so part of the calling convention states that `BP' + must be preserved by any C function. Hence the callee, if it is + going to set up `BP' as a _frame pointer_, must push the + previous value first. + + (*) The callee may then access its parameters relative to `BP'. The + word at `[BP]' holds the previous value of `BP' as it was + pushed; the next word, at `[BP+2]', holds the offset part of the + return address, pushed implicitly by `CALL'. In a small-model + (near) function, the parameters start after that, at `[BP+4]'; + in a large-model (far) function, the segment part of the return + address lives at `[BP+4]', and the parameters begin at `[BP+6]'. + The leftmost parameter of the function, since it was pushed + last, is accessible at this offset from `BP'; the others follow, + at successively greater offsets. Thus, in a function such as + `printf' which takes a variable number of parameters, the + pushing of the parameters in reverse order means that the + function knows where to find its first parameter, which tells it + the number and type of the remaining ones. + + (*) The callee may also wish to decrease `SP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `BP'. + + (*) The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `DX:AX' depending on the size + of the value. Floating-point results are sometimes (depending on + the compiler) returned in `ST0'. + + (*) Once the callee has finished processing, it restores `SP' from + `BP' if it had allocated local stack space, then pops the + previous value of `BP', and returns via `RETN' or `RETF' + depending on memory model. + + (*) When the caller regains control from the callee, the function + parameters are still on the stack, so it typically adds an + immediate constant to `SP' to remove them (instead of executing + a number of slow `POP' instructions). Thus, if a function is + accidentally called with the wrong number of parameters due to a + prototype mismatch, the stack will still be returned to a + sensible state since the caller, which _knows_ how many + parameters it pushed, does the removing. + + It is instructive to compare this calling convention with that for + Pascal programs (described in section 8.5.1). Pascal has a simpler + convention, since no functions have variable numbers of parameters. + Therefore the callee knows how many parameters it should have been + passed, and is able to deallocate them from the stack itself by + passing an immediate argument to the `RET' or `RETF' instruction, so + the caller does not have to do it. Also, the parameters are pushed + in left-to-right order, not right-to-left, which means that a + compiler can give better guarantees about sequence points without + performance suffering. + + Thus, you would define a function in C style in the following way. + The following example is for small model: + + global _myfunc + + _myfunc: + push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+4] ; first parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + ret + + For a large-model function, you would replace `RET' by `RETF', and + look for the first parameter at `[BP+6]' instead of `[BP+4]'. Of + course, if one of the parameters is a pointer, then the offsets of + _subsequent_ parameters will change depending on the memory model as + well: far pointers take up four bytes on the stack when passed as a + parameter, whereas near pointers take up two. + + At the other end of the process, to call a C function from your + assembly code, you would do something like this: + + extern _printf + + ; and then, further down... + + push word [myint] ; one of my integer variables + push word mystring ; pointer into my data segment + call _printf + add sp,byte 4 ; `byte' saves space + + ; then those data items... + + segment _DATA + + myint dw 1234 + mystring db 'This number -> %d <- should be 1234',10,0 + + This piece of code is the small-model assembly equivalent of the C + code + + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); + + In large model, the function-call code might look more like this. In + this example, it is assumed that `DS' already holds the segment base + of the segment `_DATA'. If not, you would have to initialize it + first. + + push word [myint] + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + call far _printf + add sp,byte 6 + + The integer value still takes up one word on the stack, since large + model does not affect the size of the `int' data type. The first + argument (pushed last) to `printf', however, is a data pointer, and + therefore has to contain a segment and offset part. The segment + should be stored second in memory, and therefore must be pushed + first. (Of course, `PUSH DS' would have been a shorter instruction + than `PUSH WORD SEG mystring', if `DS' was set up as the above + example assumed.) Then the actual call becomes a far call, since + functions expect far calls in large model; and `SP' has to be + increased by 6 rather than 4 afterwards to make up for the extra + word of parameters. + + 8.4.4 Accessing Data Items + + To get at the contents of C variables, or to declare variables which + C can access, you need only declare the names as `GLOBAL' or + `EXTERN'. (Again, the names require leading underscores, as stated + in section 8.4.1.) Thus, a C variable declared as `int i' can be + accessed from assembler as + + extern _i + + mov ax,[_i] + + And to declare your own integer variable which C programs can access + as `extern int j', you do this (making sure you are assembling in + the `_DATA' segment, if necessary): + + global _j + + _j dw 0 + + To access a C array, you need to know the size of the components of + the array. For example, `int' variables are two bytes long, so if a + C program declares an array as `int a[10]', you can access `a[3]' by + coding `mov ax,[_a+6]'. (The byte offset 6 is obtained by + multiplying the desired array index, 3, by the size of the array + element, 2.) The sizes of the C base types in 16-bit compilers are: + 1 for `char', 2 for `short' and `int', 4 for `long' and `float', and + 8 for `double'. + + To access a C data structure, you need to know the offset from the + base of the structure to the field you are interested in. You can + either do this by converting the C structure definition into a NASM + structure definition (using `STRUC'), or by calculating the one + offset and using just that. + + To do either of these, you should read your C compiler's manual to + find out how it organizes data structures. NASM gives no special + alignment to structure members in its own `STRUC' macro, so you have + to specify alignment yourself if the C compiler generates it. + Typically, you might find that a structure like + + struct { + char c; + int i; + } foo; + + might be four bytes long rather than three, since the `int' field + would be aligned to a two-byte boundary. However, this sort of + feature tends to be a configurable option in the C compiler, either + using command-line options or `#pragma' lines, so you have to find + out how your own compiler does it. + + 8.4.5 `c16.mac': Helper Macros for the 16-bit C Interface + + Included in the NASM archives, in the `misc' directory, is a file + `c16.mac' of macros. It defines three macros: `proc', `arg' and + `endproc'. These are intended to be used for C-style procedure + definitions, and they automate a lot of the work involved in keeping + track of the calling convention. + + (An alternative, TASM compatible form of `arg' is also now built + into NASM's preprocessor. See section 4.8 for details.) + + An example of an assembly function using the macro set is given + here: + + proc _nearproc + + %$i arg + %$j arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + add ax,[bx] + + endproc + + This defines `_nearproc' to be a procedure taking two arguments, the + first (`i') an integer and the second (`j') a pointer to an integer. + It returns `i + *j'. + + Note that the `arg' macro has an `EQU' as the first line of its + expansion, and since the label before the macro call gets prepended + to the first line of the expanded macro, the `EQU' works, defining + `%$i' to be an offset from `BP'. A context-local variable is used, + local to the context pushed by the `proc' macro and popped by the + `endproc' macro, so that the same argument name can be used in later + procedures. Of course, you don't _have_ to do that. + + The macro set produces code for near functions (tiny, small and + compact-model code) by default. You can have it generate far + functions (medium, large and huge-model code) by means of coding + `%define FARCODE'. This changes the kind of return instruction + generated by `endproc', and also changes the starting point for the + argument offsets. The macro set contains no intrinsic dependency on + whether data pointers are far or not. + + `arg' can take an optional parameter, giving the size of the + argument. If no size is given, 2 is assumed, since it is likely that + many function parameters will be of type `int'. + + The large-model equivalent of the above function would look like + this: + + %define FARCODE + + proc _farproc + + %$i arg + %$j arg 4 + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + + endproc + + This makes use of the argument to the `arg' macro to define a + parameter of size 4, because `j' is now a far pointer. When we load + from `j', we must load a segment and an offset. + + 8.5 Interfacing to Borland Pascal Programs + + Interfacing to Borland Pascal programs is similar in concept to + interfacing to 16-bit C programs. The differences are: + + (*) The leading underscore required for interfacing to C programs is + not required for Pascal. + + (*) The memory model is always large: functions are far, data + pointers are far, and no data item can be more than 64K long. + (Actually, some functions are near, but only those functions + that are local to a Pascal unit and never called from outside + it. All assembly functions that Pascal calls, and all Pascal + functions that assembly routines are able to call, are far.) + However, all static data declared in a Pascal program goes into + the default data segment, which is the one whose segment address + will be in `DS' when control is passed to your assembly code. + The only things that do not live in the default data segment are + local variables (they live in the stack segment) and dynamically + allocated variables. All data _pointers_, however, are far. + + (*) The function calling convention is different - described below. + + (*) Some data types, such as strings, are stored differently. + + (*) There are restrictions on the segment names you are allowed to + use - Borland Pascal will ignore code or data declared in a + segment it doesn't like the name of. The restrictions are + described below. + + 8.5.1 The Pascal Calling Convention + + The 16-bit Pascal calling convention is as follows. In the following + description, the words _caller_ and _callee_ are used to denote the + function doing the calling and the function which gets called. + + (*) The caller pushes the function's parameters on the stack, one + after another, in normal order (left to right, so that the first + argument specified to the function is pushed first). + + (*) The caller then executes a far `CALL' instruction to pass + control to the callee. + + (*) The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access + their parameters) starts by saving the value of `SP' in `BP' so + as to be able to use `BP' as a base pointer to find its + parameters on the stack. However, the caller was probably doing + this too, so part of the calling convention states that `BP' + must be preserved by any function. Hence the callee, if it is + going to set up `BP' as a frame pointer, must push the previous + value first. + + (*) The callee may then access its parameters relative to `BP'. The + word at `[BP]' holds the previous value of `BP' as it was + pushed. The next word, at `[BP+2]', holds the offset part of the + return address, and the next one at `[BP+4]' the segment part. + The parameters begin at `[BP+6]'. The rightmost parameter of the + function, since it was pushed last, is accessible at this offset + from `BP'; the others follow, at successively greater offsets. + + (*) The callee may also wish to decrease `SP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `BP'. + + (*) The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `DX:AX' depending on the size + of the value. Floating-point results are returned in `ST0'. + Results of type `Real' (Borland's own custom floating-point data + type, not handled directly by the FPU) are returned in + `DX:BX:AX'. To return a result of type `String', the caller + pushes a pointer to a temporary string before pushing the + parameters, and the callee places the returned string value at + that location. The pointer is not a parameter, and should not be + removed from the stack by the `RETF' instruction. + + (*) Once the callee has finished processing, it restores `SP' from + `BP' if it had allocated local stack space, then pops the + previous value of `BP', and returns via `RETF'. It uses the form + of `RETF' with an immediate parameter, giving the number of + bytes taken up by the parameters on the stack. This causes the + parameters to be removed from the stack as a side effect of the + return instruction. + + (*) When the caller regains control from the callee, the function + parameters have already been removed from the stack, so it needs + to do nothing further. + + Thus, you would define a function in Pascal style, taking two + `Integer'-type parameters, in the following way: + + global myfunc + + myfunc: push bp + mov bp,sp + sub sp,0x40 ; 64 bytes of local stack space + mov bx,[bp+8] ; first parameter to function + mov bx,[bp+6] ; second parameter to function + + ; some more code + + mov sp,bp ; undo "sub sp,0x40" above + pop bp + retf 4 ; total size of params is 4 + + At the other end of the process, to call a Pascal function from your + assembly code, you would do something like this: + + extern SomeFunc + + ; and then, further down... + + push word seg mystring ; Now push the segment, and... + push word mystring ; ... offset of "mystring" + push word [myint] ; one of my variables + call far SomeFunc + + This is equivalent to the Pascal code + + procedure SomeFunc(String: PChar; Int: Integer); + SomeFunc(@mystring, myint); + + 8.5.2 Borland Pascal Segment Name Restrictions + + Since Borland Pascal's internal unit file format is completely + different from `OBJ', it only makes a very sketchy job of actually + reading and understanding the various information contained in a + real `OBJ' file when it links that in. Therefore an object file + intended to be linked to a Pascal program must obey a number of + restrictions: + + (*) Procedures and functions must be in a segment whose name is + either `CODE', `CSEG', or something ending in `_TEXT'. + + (*) initialized data must be in a segment whose name is either + `CONST' or something ending in `_DATA'. + + (*) Uninitialized data must be in a segment whose name is either + `DATA', `DSEG', or something ending in `_BSS'. + + (*) Any other segments in the object file are completely ignored. + `GROUP' directives and segment attributes are also ignored. + + 8.5.3 Using `c16.mac' With Pascal Programs + + The `c16.mac' macro package, described in section 8.4.5, can also be + used to simplify writing functions to be called from Pascal + programs, if you code `%define PASCAL'. This definition ensures that + functions are far (it implies `FARCODE'), and also causes procedure + return instructions to be generated with an operand. + + Defining `PASCAL' does not change the code which calculates the + argument offsets; you must declare your function's arguments in + reverse order. For example: + + %define PASCAL + + proc _pascalproc + + %$j arg 4 + %$i arg + mov ax,[bp + %$i] + mov bx,[bp + %$j] + mov es,[bp + %$j + 2] + add ax,[bx] + + endproc + + This defines the same routine, conceptually, as the example in + section 8.4.5: it defines a function taking two arguments, an + integer and a pointer to an integer, which returns the sum of the + integer and the contents of the pointer. The only difference between + this code and the large-model C version is that `PASCAL' is defined + instead of `FARCODE', and that the arguments are declared in reverse + order. + +Chapter 9: Writing 32-bit Code (Unix, Win32, DJGPP) +--------------------------------------------------- + + This chapter attempts to cover some of the common issues involved + when writing 32-bit code, to run under Win32 or Unix, or to be + linked with C code generated by a Unix-style C compiler such as + DJGPP. It covers how to write assembly code to interface with 32-bit + C routines, and how to write position-independent code for shared + libraries. + + Almost all 32-bit code, and in particular all code running under + `Win32', `DJGPP' or any of the PC Unix variants, runs in _flat_ + memory model. This means that the segment registers and paging have + already been set up to give you the same 32-bit 4Gb address space no + matter what segment you work relative to, and that you should ignore + all segment registers completely. When writing flat-model + application code, you never need to use a segment override or modify + any segment register, and the code-section addresses you pass to + `CALL' and `JMP' live in the same address space as the data-section + addresses you access your variables by and the stack-section + addresses you access local variables and procedure parameters by. + Every address is 32 bits long and contains only an offset part. + + 9.1 Interfacing to 32-bit C Programs + + A lot of the discussion in section 8.4, about interfacing to 16-bit + C programs, still applies when working in 32 bits. The absence of + memory models or segmentation worries simplifies things a lot. + + 9.1.1 External Symbol Names + + Most 32-bit C compilers share the convention used by 16-bit + compilers, that the names of all global symbols (functions or data) + they define are formed by prefixing an underscore to the name as it + appears in the C program. However, not all of them do: the `ELF' + specification states that C symbols do _not_ have a leading + underscore on their assembly-language names. + + The older Linux `a.out' C compiler, all `Win32' compilers, `DJGPP', + and `NetBSD' and `FreeBSD', all use the leading underscore; for + these compilers, the macros `cextern' and `cglobal', as given in + section 8.4.1, will still work. For `ELF', though, the leading + underscore should not be used. + + See also section 2.1.27. + + 9.1.2 Function Definitions and Function Calls + + The C calling convention in 32-bit programs is as follows. In the + following description, the words _caller_ and _callee_ are used to + denote the function doing the calling and the function which gets + called. + + (*) The caller pushes the function's parameters on the stack, one + after another, in reverse order (right to left, so that the + first argument specified to the function is pushed last). + + (*) The caller then executes a near `CALL' instruction to pass + control to the callee. + + (*) The callee receives control, and typically (although this is not + actually necessary, in functions which do not need to access + their parameters) starts by saving the value of `ESP' in `EBP' + so as to be able to use `EBP' as a base pointer to find its + parameters on the stack. However, the caller was probably doing + this too, so part of the calling convention states that `EBP' + must be preserved by any C function. Hence the callee, if it is + going to set up `EBP' as a frame pointer, must push the previous + value first. + + (*) The callee may then access its parameters relative to `EBP'. The + doubleword at `[EBP]' holds the previous value of `EBP' as it + was pushed; the next doubleword, at `[EBP+4]', holds the return + address, pushed implicitly by `CALL'. The parameters start after + that, at `[EBP+8]'. The leftmost parameter of the function, + since it was pushed last, is accessible at this offset from + `EBP'; the others follow, at successively greater offsets. Thus, + in a function such as `printf' which takes a variable number of + parameters, the pushing of the parameters in reverse order means + that the function knows where to find its first parameter, which + tells it the number and type of the remaining ones. + + (*) The callee may also wish to decrease `ESP' further, so as to + allocate space on the stack for local variables, which will then + be accessible at negative offsets from `EBP'. + + (*) The callee, if it wishes to return a value to the caller, should + leave the value in `AL', `AX' or `EAX' depending on the size of + the value. Floating-point results are typically returned in + `ST0'. + + (*) Once the callee has finished processing, it restores `ESP' from + `EBP' if it had allocated local stack space, then pops the + previous value of `EBP', and returns via `RET' (equivalently, + `RETN'). + + (*) When the caller regains control from the callee, the function + parameters are still on the stack, so it typically adds an + immediate constant to `ESP' to remove them (instead of executing + a number of slow `POP' instructions). Thus, if a function is + accidentally called with the wrong number of parameters due to a + prototype mismatch, the stack will still be returned to a + sensible state since the caller, which _knows_ how many + parameters it pushed, does the removing. + + There is an alternative calling convention used by Win32 programs + for Windows API calls, and also for functions called _by_ the + Windows API such as window procedures: they follow what Microsoft + calls the `__stdcall' convention. This is slightly closer to the + Pascal convention, in that the callee clears the stack by passing a + parameter to the `RET' instruction. However, the parameters are + still pushed in right-to-left order. + + Thus, you would define a function in C style in the following way: + + global _myfunc + + _myfunc: + push ebp + mov ebp,esp + sub esp,0x40 ; 64 bytes of local stack space + mov ebx,[ebp+8] ; first parameter to function + + ; some more code + + leave ; mov esp,ebp / pop ebp + ret + + At the other end of the process, to call a C function from your + assembly code, you would do something like this: + + extern _printf + + ; and then, further down... + + push dword [myint] ; one of my integer variables + push dword mystring ; pointer into my data segment + call _printf + add esp,byte 8 ; `byte' saves space + + ; then those data items... + + segment _DATA + + myint dd 1234 + mystring db 'This number -> %d <- should be 1234',10,0 + + This piece of code is the assembly equivalent of the C code + + int myint = 1234; + printf("This number -> %d <- should be 1234\n", myint); + + 9.1.3 Accessing Data Items + + To get at the contents of C variables, or to declare variables which + C can access, you need only declare the names as `GLOBAL' or + `EXTERN'. (Again, the names require leading underscores, as stated + in section 9.1.1.) Thus, a C variable declared as `int i' can be + accessed from assembler as + + extern _i + mov eax,[_i] + + And to declare your own integer variable which C programs can access + as `extern int j', you do this (making sure you are assembling in + the `_DATA' segment, if necessary): + + global _j + _j dd 0 + + To access a C array, you need to know the size of the components of + the array. For example, `int' variables are four bytes long, so if a + C program declares an array as `int a[10]', you can access `a[3]' by + coding `mov ax,[_a+12]'. (The byte offset 12 is obtained by + multiplying the desired array index, 3, by the size of the array + element, 4.) The sizes of the C base types in 32-bit compilers are: + 1 for `char', 2 for `short', 4 for `int', `long' and `float', and 8 + for `double'. Pointers, being 32-bit addresses, are also 4 bytes + long. + + To access a C data structure, you need to know the offset from the + base of the structure to the field you are interested in. You can + either do this by converting the C structure definition into a NASM + structure definition (using `STRUC'), or by calculating the one + offset and using just that. + + To do either of these, you should read your C compiler's manual to + find out how it organizes data structures. NASM gives no special + alignment to structure members in its own `STRUC' macro, so you have + to specify alignment yourself if the C compiler generates it. + Typically, you might find that a structure like + + struct { + char c; + int i; + } foo; + + might be eight bytes long rather than five, since the `int' field + would be aligned to a four-byte boundary. However, this sort of + feature is sometimes a configurable option in the C compiler, either + using command-line options or `#pragma' lines, so you have to find + out how your own compiler does it. + + 9.1.4 `c32.mac': Helper Macros for the 32-bit C Interface + + Included in the NASM archives, in the `misc' directory, is a file + `c32.mac' of macros. It defines three macros: `proc', `arg' and + `endproc'. These are intended to be used for C-style procedure + definitions, and they automate a lot of the work involved in keeping + track of the calling convention. + + An example of an assembly function using the macro set is given + here: + + proc _proc32 + + %$i arg + %$j arg + mov eax,[ebp + %$i] + mov ebx,[ebp + %$j] + add eax,[ebx] + + endproc + + This defines `_proc32' to be a procedure taking two arguments, the + first (`i') an integer and the second (`j') a pointer to an integer. + It returns `i + *j'. + + Note that the `arg' macro has an `EQU' as the first line of its + expansion, and since the label before the macro call gets prepended + to the first line of the expanded macro, the `EQU' works, defining + `%$i' to be an offset from `BP'. A context-local variable is used, + local to the context pushed by the `proc' macro and popped by the + `endproc' macro, so that the same argument name can be used in later + procedures. Of course, you don't _have_ to do that. + + `arg' can take an optional parameter, giving the size of the + argument. If no size is given, 4 is assumed, since it is likely that + many function parameters will be of type `int' or pointers. + + 9.2 Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries + + `ELF' replaced the older `a.out' object file format under Linux + because it contains support for position-independent code (PIC), + which makes writing shared libraries much easier. NASM supports the + `ELF' position-independent code features, so you can write Linux + `ELF' shared libraries in NASM. + + NetBSD, and its close cousins FreeBSD and OpenBSD, take a different + approach by hacking PIC support into the `a.out' format. NASM + supports this as the `aoutb' output format, so you can write BSD + shared libraries in NASM too. + + The operating system loads a PIC shared library by memory-mapping + the library file at an arbitrarily chosen point in the address space + of the running process. The contents of the library's code section + must therefore not depend on where it is loaded in memory. + + Therefore, you cannot get at your variables by writing code like + this: + + mov eax,[myvar] ; WRONG + + Instead, the linker provides an area of memory called the _global + offset table_, or GOT; the GOT is situated at a constant distance + from your library's code, so if you can find out where your library + is loaded (which is typically done using a `CALL' and `POP' + combination), you can obtain the address of the GOT, and you can + then load the addresses of your variables out of linker-generated + entries in the GOT. + + The _data_ section of a PIC shared library does not have these + restrictions: since the data section is writable, it has to be + copied into memory anyway rather than just paged in from the library + file, so as long as it's being copied it can be relocated too. So + you can put ordinary types of relocation in the data section without + too much worry (but see section 9.2.4 for a caveat). + + 9.2.1 Obtaining the Address of the GOT + + Each code module in your shared library should define the GOT as an + external symbol: + + extern _GLOBAL_OFFSET_TABLE_ ; in ELF + extern __GLOBAL_OFFSET_TABLE_ ; in BSD a.out + + At the beginning of any function in your shared library which plans + to access your data or BSS sections, you must first calculate the + address of the GOT. This is typically done by writing the function + in this form: + + func: push ebp + mov ebp,esp + push ebx + call .get_GOT + .get_GOT: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc + + ; the function body comes here + + mov ebx,[ebp-4] + mov esp,ebp + pop ebp + ret + + (For BSD, again, the symbol `_GLOBAL_OFFSET_TABLE' requires a second + leading underscore.) + + The first two lines of this function are simply the standard C + prologue to set up a stack frame, and the last three lines are + standard C function epilogue. The third line, and the fourth to last + line, save and restore the `EBX' register, because PIC shared + libraries use this register to store the address of the GOT. + + The interesting bit is the `CALL' instruction and the following two + lines. The `CALL' and `POP' combination obtains the address of the + label `.get_GOT', without having to know in advance where the + program was loaded (since the `CALL' instruction is encoded relative + to the current position). The `ADD' instruction makes use of one of + the special PIC relocation types: GOTPC relocation. With the + `WRT ..gotpc' qualifier specified, the symbol referenced (here + `_GLOBAL_OFFSET_TABLE_', the special symbol assigned to the GOT) is + given as an offset from the beginning of the section. (Actually, + `ELF' encodes it as the offset from the operand field of the `ADD' + instruction, but NASM simplifies this deliberately, so you do things + the same way for both `ELF' and `BSD'.) So the instruction then + _adds_ the beginning of the section, to get the real address of the + GOT, and subtracts the value of `.get_GOT' which it knows is in + `EBX'. Therefore, by the time that instruction has finished, `EBX' + contains the address of the GOT. + + If you didn't follow that, don't worry: it's never necessary to + obtain the address of the GOT by any other means, so you can put + those three instructions into a macro and safely ignore them: + + %macro get_GOT 0 + + call %%getgot + %%getgot: + pop ebx + add ebx,_GLOBAL_OFFSET_TABLE_+$$-%%getgot wrt ..gotpc + + %endmacro + + 9.2.2 Finding Your Local Data Items + + Having got the GOT, you can then use it to obtain the addresses of + your data items. Most variables will reside in the sections you have + declared; they can be accessed using the `..gotoff' special `WRT' + type. The way this works is like this: + + lea eax,[ebx+myvar wrt ..gotoff] + + The expression `myvar wrt ..gotoff' is calculated, when the shared + library is linked, to be the offset to the local variable `myvar' + from the beginning of the GOT. Therefore, adding it to `EBX' as + above will place the real address of `myvar' in `EAX'. + + If you declare variables as `GLOBAL' without specifying a size for + them, they are shared between code modules in the library, but do + not get exported from the library to the program that loaded it. + They will still be in your ordinary data and BSS sections, so you + can access them in the same way as local variables, using the above + `..gotoff' mechanism. + + Note that due to a peculiarity of the way BSD `a.out' format handles + this relocation type, there must be at least one non-local symbol in + the same section as the address you're trying to access. + + 9.2.3 Finding External and Common Data Items + + If your library needs to get at an external variable (external to + the _library_, not just to one of the modules within it), you must + use the `..got' type to get at it. The `..got' type, instead of + giving you the offset from the GOT base to the variable, gives you + the offset from the GOT base to a GOT _entry_ containing the address + of the variable. The linker will set up this GOT entry when it + builds the library, and the dynamic linker will place the correct + address in it at load time. So to obtain the address of an external + variable `extvar' in `EAX', you would code + + mov eax,[ebx+extvar wrt ..got] + + This loads the address of `extvar' out of an entry in the GOT. The + linker, when it builds the shared library, collects together every + relocation of type `..got', and builds the GOT so as to ensure it + has every necessary entry present. + + Common variables must also be accessed in this way. + + 9.2.4 Exporting Symbols to the Library User + + If you want to export symbols to the user of the library, you have + to declare whether they are functions or data, and if they are data, + you have to give the size of the data item. This is because the + dynamic linker has to build procedure linkage table entries for any + exported functions, and also moves exported data items away from the + library's data section in which they were declared. + + So to export a function to users of the library, you must use + + global func:function ; declare it as a function + + func: push ebp + + ; etc. + + And to export a data item such as an array, you would have to code + + global array:data array.end-array ; give the size too + + array: resd 128 + .end: + + Be careful: If you export a variable to the library user, by + declaring it as `GLOBAL' and supplying a size, the variable will end + up living in the data section of the main program, rather than in + your library's data section, where you declared it. So you will have + to access your own global variable with the `..got' mechanism rather + than `..gotoff', as if it were external (which, effectively, it has + become). + + Equally, if you need to store the address of an exported global in + one of your data sections, you can't do it by means of the standard + sort of code: + + dataptr: dd global_data_item ; WRONG + + NASM will interpret this code as an ordinary relocation, in which + `global_data_item' is merely an offset from the beginning of the + `.data' section (or whatever); so this reference will end up + pointing at your data section instead of at the exported global + which resides elsewhere. + + Instead of the above code, then, you must write + + dataptr: dd global_data_item wrt ..sym + + which makes use of the special `WRT' type `..sym' to instruct NASM + to search the symbol table for a particular symbol at that address, + rather than just relocating by section base. + + Either method will work for functions: referring to one of your + functions by means of + + funcptr: dd my_function + + will give the user the address of the code you wrote, whereas + + funcptr: dd my_function wrt .sym + + will give the address of the procedure linkage table for the + function, which is where the calling program will _believe_ the + function lives. Either address is a valid way to call the function. + + 9.2.5 Calling Procedures Outside the Library + + Calling procedures outside your shared library has to be done by + means of a _procedure linkage table_, or PLT. The PLT is placed at a + known offset from where the library is loaded, so the library code + can make calls to the PLT in a position-independent way. Within the + PLT there is code to jump to offsets contained in the GOT, so + function calls to other shared libraries or to routines in the main + program can be transparently passed off to their real destinations. + + To call an external routine, you must use another special PIC + relocation type, `WRT ..plt'. This is much easier than the GOT-based + ones: you simply replace calls such as `CALL printf' with the PLT- + relative version `CALL printf WRT ..plt'. + + 9.2.6 Generating the Library File + + Having written some code modules and assembled them to `.o' files, + you then generate your shared library with a command such as + + ld -shared -o library.so module1.o module2.o # for ELF + ld -Bshareable -o library.so module1.o module2.o # for BSD + + For ELF, if your shared library is going to reside in system + directories such as `/usr/lib' or `/lib', it is usually worth using + the `-soname' flag to the linker, to store the final library file + name, with a version number, into the library: + + ld -shared -soname library.so.1 -o library.so.1.2 *.o + + You would then copy `library.so.1.2' into the library directory, and + create `library.so.1' as a symbolic link to it. + +Chapter 10: Mixing 16 and 32 Bit Code +------------------------------------- + + This chapter tries to cover some of the issues, largely related to + unusual forms of addressing and jump instructions, encountered when + writing operating system code such as protected-mode initialisation + routines, which require code that operates in mixed segment sizes, + such as code in a 16-bit segment trying to modify data in a 32-bit + one, or jumps between different-size segments. + + 10.1 Mixed-Size Jumps + + The most common form of mixed-size instruction is the one used when + writing a 32-bit OS: having done your setup in 16-bit mode, such as + loading the kernel, you then have to boot it by switching into + protected mode and jumping to the 32-bit kernel start address. In a + fully 32-bit OS, this tends to be the _only_ mixed-size instruction + you need, since everything before it can be done in pure 16-bit + code, and everything after it can be pure 32-bit. + + This jump must specify a 48-bit far address, since the target + segment is a 32-bit one. However, it must be assembled in a 16-bit + segment, so just coding, for example, + + jmp 0x1234:0x56789ABC ; wrong! + + will not work, since the offset part of the address will be + truncated to `0x9ABC' and the jump will be an ordinary 16-bit far + one. + + The Linux kernel setup code gets round the inability of `as86' to + generate the required instruction by coding it manually, using `DB' + instructions. NASM can go one better than that, by actually + generating the right instruction itself. Here's how to do it right: + + jmp dword 0x1234:0x56789ABC ; right + + The `DWORD' prefix (strictly speaking, it should come _after_ the + colon, since it is declaring the _offset_ field to be a doubleword; + but NASM will accept either form, since both are unambiguous) forces + the offset part to be treated as far, in the assumption that you are + deliberately writing a jump from a 16-bit segment to a 32-bit one. + + You can do the reverse operation, jumping from a 32-bit segment to a + 16-bit one, by means of the `WORD' prefix: + + jmp word 0x8765:0x4321 ; 32 to 16 bit + + If the `WORD' prefix is specified in 16-bit mode, or the `DWORD' + prefix in 32-bit mode, they will be ignored, since each is + explicitly forcing NASM into a mode it was in anyway. + + 10.2 Addressing Between Different-Size Segments + + If your OS is mixed 16 and 32-bit, or if you are writing a DOS + extender, you are likely to have to deal with some 16-bit segments + and some 32-bit ones. At some point, you will probably end up + writing code in a 16-bit segment which has to access data in a 32- + bit segment, or vice versa. + + If the data you are trying to access in a 32-bit segment lies within + the first 64K of the segment, you may be able to get away with using + an ordinary 16-bit addressing operation for the purpose; but sooner + or later, you will want to do 32-bit addressing from 16-bit mode. + + The easiest way to do this is to make sure you use a register for + the address, since any effective address containing a 32-bit + register is forced to be a 32-bit address. So you can do + + mov eax,offset_into_32_bit_segment_specified_by_fs + mov dword [fs:eax],0x11223344 + + This is fine, but slightly cumbersome (since it wastes an + instruction and a register) if you already know the precise offset + you are aiming at. The x86 architecture does allow 32-bit effective + addresses to specify nothing but a 4-byte offset, so why shouldn't + NASM be able to generate the best instruction for the purpose? + + It can. As in section 10.1, you need only prefix the address with + the `DWORD' keyword, and it will be forced to be a 32-bit address: + + mov dword [fs:dword my_offset],0x11223344 + + Also as in section 10.1, NASM is not fussy about whether the `DWORD' + prefix comes before or after the segment override, so arguably a + nicer-looking way to code the above instruction is + + mov dword [dword fs:my_offset],0x11223344 + + Don't confuse the `DWORD' prefix _outside_ the square brackets, + which controls the size of the data stored at the address, with the + one `inside' the square brackets which controls the length of the + address itself. The two can quite easily be different: + + mov word [dword 0x12345678],0x9ABC + + This moves 16 bits of data to an address specified by a 32-bit + offset. + + You can also specify `WORD' or `DWORD' prefixes along with the `FAR' + prefix to indirect far jumps or calls. For example: + + call dword far [fs:word 0x4321] + + This instruction contains an address specified by a 16-bit offset; + it loads a 48-bit far pointer from that (16-bit segment and 32-bit + offset), and calls that address. + + 10.3 Other Mixed-Size Instructions + + The other way you might want to access data might be using the + string instructions (`LODSx', `STOSx' and so on) or the `XLATB' + instruction. These instructions, since they take no parameters, + might seem to have no easy way to make them perform 32-bit + addressing when assembled in a 16-bit segment. + + This is the purpose of NASM's `a16', `a32' and `a64' prefixes. If + you are coding `LODSB' in a 16-bit segment but it is supposed to be + accessing a string in a 32-bit segment, you should load the desired + address into `ESI' and then code + + a32 lodsb + + The prefix forces the addressing size to 32 bits, meaning that + `LODSB' loads from `[DS:ESI]' instead of `[DS:SI]'. To access a + string in a 16-bit segment when coding in a 32-bit one, the + corresponding `a16' prefix can be used. + + The `a16', `a32' and `a64' prefixes can be applied to any + instruction in NASM's instruction table, but most of them can + generate all the useful forms without them. The prefixes are + necessary only for instructions with implicit addressing: `CMPSx', + `SCASx', `LODSx', `STOSx', `MOVSx', `INSx', `OUTSx', and `XLATB'. + Also, the various push and pop instructions (`PUSHA' and `POPF' as + well as the more usual `PUSH' and `POP') can accept `a16', `a32' or + `a64' prefixes to force a particular one of `SP', `ESP' or `RSP' to + be used as a stack pointer, in case the stack segment in use is a + different size from the code segment. + + `PUSH' and `POP', when applied to segment registers in 32-bit mode, + also have the slightly odd behaviour that they push and pop 4 bytes + at a time, of which the top two are ignored and the bottom two give + the value of the segment register being manipulated. To force the + 16-bit behaviour of segment-register push and pop instructions, you + can use the operand-size prefix `o16': + + o16 push ss + o16 push ds + + This code saves a doubleword of stack space by fitting two segment + registers into the space which would normally be consumed by pushing + one. + + (You can also use the `o32' prefix to force the 32-bit behaviour + when in 16-bit mode, but this seems less useful.) + +Chapter 11: Writing 64-bit Code (Unix, Win64) +--------------------------------------------- + + This chapter attempts to cover some of the common issues involved + when writing 64-bit code, to run under Win64 or Unix. It covers how + to write assembly code to interface with 64-bit C routines, and how + to write position-independent code for shared libraries. + + All 64-bit code uses a flat memory model, since segmentation is not + available in 64-bit mode. The one exception is the `FS' and `GS' + registers, which still add their bases. + + Position independence in 64-bit mode is significantly simpler, since + the processor supports `RIP'-relative addressing directly; see the + `REL' keyword (section 3.3). On most 64-bit platforms, it is + probably desirable to make that the default, using the directive + `DEFAULT REL' (section 6.2). + + 64-bit programming is relatively similar to 32-bit programming, but + of course pointers are 64 bits long; additionally, all existing + platforms pass arguments in registers rather than on the stack. + Furthermore, 64-bit platforms use SSE2 by default for floating + point. Please see the ABI documentation for your platform. + + 64-bit platforms differ in the sizes of the fundamental datatypes, + not just from 32-bit platforms but from each other. If a specific + size data type is desired, it is probably best to use the types + defined in the Standard C header `<inttypes.h>'. + + In 64-bit mode, the default instruction size is still 32 bits. When + loading a value into a 32-bit register (but not an 8- or 16-bit + register), the upper 32 bits of the corresponding 64-bit register + are set to zero. + + 11.1 Register Names in 64-bit Mode + + NASM uses the following names for general-purpose registers in 64- + bit mode, for 8-, 16-, 32- and 64-bit references, respecitively: + + AL/AH, CL/CH, DL/DH, BL/BH, SPL, BPL, SIL, DIL, R8B-R15B + AX, CX, DX, BX, SP, BP, SI, DI, R8W-R15W + EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D-R15D + RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8-R15 + + This is consistent with the AMD documentation and most other + assemblers. The Intel documentation, however, uses the names + `R8L-R15L' for 8-bit references to the higher registers. It is + possible to use those names by definiting them as macros; similarly, + if one wants to use numeric names for the low 8 registers, define + them as macros. The standard macro package `altreg' (see section + 5.1) can be used for this purpose. + + 11.2 Immediates and Displacements in 64-bit Mode + + In 64-bit mode, immediates and displacements are generally only 32 + bits wide. NASM will therefore truncate most displacements and + immediates to 32 bits. + + The only instruction which takes a full 64-bit immediate is: + + MOV reg64,imm64 + + NASM will produce this instruction whenever the programmer uses + `MOV' with an immediate into a 64-bit register. If this is not + desirable, simply specify the equivalent 32-bit register, which will + be automatically zero-extended by the processor, or specify the + immediate as `DWORD': + + mov rax,foo ; 64-bit immediate + mov rax,qword foo ; (identical) + mov eax,foo ; 32-bit immediate, zero-extended + mov rax,dword foo ; 32-bit immediate, sign-extended + + The length of these instructions are 10, 5 and 7 bytes, + respectively. + + The only instructions which take a full 64-bit _displacement_ is + loading or storing, using `MOV', `AL', `AX', `EAX' or `RAX' (but no + other registers) to an absolute 64-bit address. Since this is a + relatively rarely used instruction (64-bit code generally uses + relative addressing), the programmer has to explicitly declare the + displacement size as `QWORD': + + default abs + + mov eax,[foo] ; 32-bit absolute disp, sign-extended + mov eax,[a32 foo] ; 32-bit absolute disp, zero-extended + mov eax,[qword foo] ; 64-bit absolute disp + + default rel + + mov eax,[foo] ; 32-bit relative disp + mov eax,[a32 foo] ; d:o, address truncated to 32 bits(!) + mov eax,[qword foo] ; error + mov eax,[abs qword foo] ; 64-bit absolute disp + + A sign-extended absolute displacement can access from -2 GB to +2 + GB; a zero-extended absolute displacement can access from 0 to 4 GB. + + 11.3 Interfacing to 64-bit C Programs (Unix) + + On Unix, the 64-bit ABI is defined by the document: + + `http://www.x86-64.org/documentation/abi.pdf' + + Although written for AT&T-syntax assembly, the concepts apply + equally well for NASM-style assembly. What follows is a simplified + summary. + + The first six integer arguments (from the left) are passed in `RDI', + `RSI', `RDX', `RCX', `R8', and `R9', in that order. Additional + integer arguments are passed on the stack. These registers, plus + `RAX', `R10' and `R11' are destroyed by function calls, and thus are + available for use by the function without saving. + + Integer return values are passed in `RAX' and `RDX', in that order. + + Floating point is done using SSE registers, except for + `long double'. Floating-point arguments are passed in `XMM0' to + `XMM7'; return is `XMM0' and `XMM1'. `long double' are passed on the + stack, and returned in `ST0' and `ST1'. + + All SSE and x87 registers are destroyed by function calls. + + On 64-bit Unix, `long' is 64 bits. + + Integer and SSE register arguments are counted separately, so for + the case of + + void foo(long a, double b, int c) + + `a' is passed in `RDI', `b' in `XMM0', and `c' in `ESI'. + + 11.4 Interfacing to 64-bit C Programs (Win64) + + The Win64 ABI is described at: + + `http://msdn2.microsoft.com/en-gb/library/ms794533.aspx' + + What follows is a simplified summary. + + The first four integer arguments are passed in `RCX', `RDX', `R8' + and `R9', in that order. Additional integer arguments are passed on + the stack. These registers, plus `RAX', `R10' and `R11' are + destroyed by function calls, and thus are available for use by the + function without saving. + + Integer return values are passed in `RAX' only. + + Floating point is done using SSE registers, except for + `long double'. Floating-point arguments are passed in `XMM0' to + `XMM3'; return is `XMM0' only. + + On Win64, `long' is 32 bits; `long long' or `_int64' is 64 bits. + + Integer and SSE register arguments are counted together, so for the + case of + + void foo(long long a, double b, int c) + + `a' is passed in `RCX', `b' in `XMM1', and `c' in `R8D'. + +Chapter 12: Troubleshooting +--------------------------- + + This chapter describes some of the common problems that users have + been known to encounter with NASM, and answers them. It also gives + instructions for reporting bugs in NASM if you find a difficulty + that isn't listed here. + + 12.1 Common Problems + +12.1.1 NASM Generates Inefficient Code + + We sometimes get `bug' reports about NASM generating inefficient, or + even `wrong', code on instructions such as `ADD ESP,8'. This is a + deliberate design feature, connected to predictability of output: + NASM, on seeing `ADD ESP,8', will generate the form of the + instruction which leaves room for a 32-bit offset. You need to code + `ADD ESP,BYTE 8' if you want the space-efficient form of the + instruction. This isn't a bug, it's user error: if you prefer to + have NASM produce the more efficient code automatically enable + optimization with the `-O' option (see section 2.1.22). + +12.1.2 My Jumps are Out of Range + + Similarly, people complain that when they issue conditional jumps + (which are `SHORT' by default) that try to jump too far, NASM + reports `short jump out of range' instead of making the jumps + longer. + + This, again, is partly a predictability issue, but in fact has a + more practical reason as well. NASM has no means of being told what + type of processor the code it is generating will be run on; so it + cannot decide for itself that it should generate `Jcc NEAR' type + instructions, because it doesn't know that it's working for a 386 or + above. Alternatively, it could replace the out-of-range short `JNE' + instruction with a very short `JE' instruction that jumps over a + `JMP NEAR'; this is a sensible solution for processors below a 386, + but hardly efficient on processors which have good branch prediction + _and_ could have used `JNE NEAR' instead. So, once again, it's up to + the user, not the assembler, to decide what instructions should be + generated. See section 2.1.22. + +12.1.3 `ORG' Doesn't Work + + People writing boot sector programs in the `bin' format often + complain that `ORG' doesn't work the way they'd like: in order to + place the `0xAA55' signature word at the end of a 512-byte boot + sector, people who are used to MASM tend to code + + ORG 0 + + ; some boot sector code + + ORG 510 + DW 0xAA55 + + This is not the intended use of the `ORG' directive in NASM, and + will not work. The correct way to solve this problem in NASM is to + use the `TIMES' directive, like this: + + ORG 0 + + ; some boot sector code + + TIMES 510-($-$$) DB 0 + DW 0xAA55 + + The `TIMES' directive will insert exactly enough zero bytes into the + output to move the assembly point up to 510. This method also has + the advantage that if you accidentally fill your boot sector too + full, NASM will catch the problem at assembly time and report it, so + you won't end up with a boot sector that you have to disassemble to + find out what's wrong with it. + +12.1.4 `TIMES' Doesn't Work + + The other common problem with the above code is people who write the + `TIMES' line as + + TIMES 510-$ DB 0 + + by reasoning that `$' should be a pure number, just like 510, so the + difference between them is also a pure number and can happily be fed + to `TIMES'. + + NASM is a _modular_ assembler: the various component parts are + designed to be easily separable for re-use, so they don't exchange + information unnecessarily. In consequence, the `bin' output format, + even though it has been told by the `ORG' directive that the `.text' + section should start at 0, does not pass that information back to + the expression evaluator. So from the evaluator's point of view, `$' + isn't a pure number: it's an offset from a section base. Therefore + the difference between `$' and 510 is also not a pure number, but + involves a section base. Values involving section bases cannot be + passed as arguments to `TIMES'. + + The solution, as in the previous section, is to code the `TIMES' + line in the form + + TIMES 510-($-$$) DB 0 + + in which `$' and `$$' are offsets from the same section base, and so + their difference is a pure number. This will solve the problem and + generate sensible code. + + 12.2 Bugs + + We have never yet released a version of NASM with any _known_ bugs. + That doesn't usually stop there being plenty we didn't know about, + though. Any that you find should be reported firstly via the + `bugtracker' at `https://sourceforge.net/projects/nasm/' (click on + "Bugs"), or if that fails then through one of the contacts in + section 1.2. + + Please read section 2.2 first, and don't report the bug if it's + listed in there as a deliberate feature. (If you think the feature + is badly thought out, feel free to send us reasons why you think it + should be changed, but don't just send us mail saying `This is a + bug' if the documentation says we did it on purpose.) Then read + section 12.1, and don't bother reporting the bug if it's listed + there. + + If you do report a bug, _please_ give us all of the following + information: + + (*) What operating system you're running NASM under. DOS, Linux, + NetBSD, Win16, Win32, VMS (I'd be impressed), whatever. + + (*) If you're running NASM under DOS or Win32, tell us whether + you've compiled your own executable from the DOS source archive, + or whether you were using the standard distribution binaries out + of the archive. If you were using a locally built executable, + try to reproduce the problem using one of the standard binaries, + as this will make it easier for us to reproduce your problem + prior to fixing it. + + (*) Which version of NASM you're using, and exactly how you invoked + it. Give us the precise command line, and the contents of the + `NASMENV' environment variable if any. + + (*) Which versions of any supplementary programs you're using, and + how you invoked them. If the problem only becomes visible at + link time, tell us what linker you're using, what version of it + you've got, and the exact linker command line. If the problem + involves linking against object files generated by a compiler, + tell us what compiler, what version, and what command line or + options you used. (If you're compiling in an IDE, please try to + reproduce the problem with the command-line version of the + compiler.) + + (*) If at all possible, send us a NASM source file which exhibits + the problem. If this causes copyright problems (e.g. you can + only reproduce the bug in restricted-distribution code) then + bear in mind the following two points: firstly, we guarantee + that any source code sent to us for the purposes of debugging + NASM will be used _only_ for the purposes of debugging NASM, and + that we will delete all our copies of it as soon as we have + found and fixed the bug or bugs in question; and secondly, we + would prefer _not_ to be mailed large chunks of code anyway. The + smaller the file, the better. A three-line sample file that does + nothing useful _except_ demonstrate the problem is much easier + to work with than a fully fledged ten-thousand-line program. (Of + course, some errors _do_ only crop up in large files, so this + may not be possible.) + + (*) A description of what the problem actually _is_. `It doesn't + work' is _not_ a helpful description! Please describe exactly + what is happening that shouldn't be, or what isn't happening + that should. Examples might be: `NASM generates an error message + saying Line 3 for an error that's actually on Line 5'; `NASM + generates an error message that I believe it shouldn't be + generating at all'; `NASM fails to generate an error message + that I believe it _should_ be generating'; `the object file + produced from this source code crashes my linker'; `the ninth + byte of the output file is 66 and I think it should be 77 + instead'. + + (*) If you believe the output file from NASM to be faulty, send it + to us. That allows us to determine whether our own copy of NASM + generates the same file, or whether the problem is related to + portability issues between our development platforms and yours. + We can handle binary files mailed to us as MIME attachments, + uuencoded, and even BinHex. Alternatively, we may be able to + provide an FTP site you can upload the suspect files to; but + mailing them is easier for us. + + (*) Any other information or data files that might be helpful. If, + for example, the problem involves NASM failing to generate an + object file while TASM can generate an equivalent file without + trouble, then send us _both_ object files, so we can see what + TASM is doing differently from us. + +Appendix A: Ndisasm +------------------- + + The Netwide Disassembler, NDISASM + + A.1 Introduction + + The Netwide Disassembler is a small companion program to the Netwide + Assembler, NASM. It seemed a shame to have an x86 assembler, + complete with a full instruction table, and not make as much use of + it as possible, so here's a disassembler which shares the + instruction table (and some other bits of code) with NASM. + + The Netwide Disassembler does nothing except to produce + disassemblies of _binary_ source files. NDISASM does not have any + understanding of object file formats, like `objdump', and it will + not understand `DOS .EXE' files like `debug' will. It just + disassembles. + + A.2 Getting Started: Installation + + See section 1.3 for installation instructions. NDISASM, like NASM, + has a `man page' which you may want to put somewhere useful, if you + are on a Unix system. + + A.3 Running NDISASM + + To disassemble a file, you will typically use a command of the form + + ndisasm -b {16|32|64} filename + + NDISASM can disassemble 16-, 32- or 64-bit code equally easily, + provided of course that you remember to specify which it is to work + with. If no `-b' switch is present, NDISASM works in 16-bit mode by + default. The `-u' switch (for USE32) also invokes 32-bit mode. + + Two more command line options are `-r' which reports the version + number of NDISASM you are running, and `-h' which gives a short + summary of command line options. + + A.3.1 COM Files: Specifying an Origin + + To disassemble a `DOS .COM' file correctly, a disassembler must + assume that the first instruction in the file is loaded at address + `0x100', rather than at zero. NDISASM, which assumes by default that + any file you give it is loaded at zero, will therefore need to be + informed of this. + + The `-o' option allows you to declare a different origin for the + file you are disassembling. Its argument may be expressed in any of + the NASM numeric formats: decimal by default, if it begins with + ``$'' or ``0x'' or ends in ``H'' it's `hex', if it ends in ``Q'' + it's `octal', and if it ends in ``B'' it's `binary'. + + Hence, to disassemble a `.COM' file: + + ndisasm -o100h filename.com + + will do the trick. + + A.3.2 Code Following Data: Synchronisation + + Suppose you are disassembling a file which contains some data which + isn't machine code, and _then_ contains some machine code. NDISASM + will faithfully plough through the data section, producing machine + instructions wherever it can (although most of them will look + bizarre, and some may have unusual prefixes, e.g. + ``FS OR AX,0x240A''), and generating `DB' instructions ever so often + if it's totally stumped. Then it will reach the code section. + + Supposing NDISASM has just finished generating a strange machine + instruction from part of the data section, and its file position is + now one byte _before_ the beginning of the code section. It's + entirely possible that another spurious instruction will get + generated, starting with the final byte of the data section, and + then the correct first instruction in the code section will not be + seen because the starting point skipped over it. This isn't really + ideal. + + To avoid this, you can specify a ``synchronisation'' point, or + indeed as many synchronisation points as you like (although NDISASM + can only handle 2147483647 sync points internally). The definition + of a sync point is this: NDISASM guarantees to hit sync points + exactly during disassembly. If it is thinking about generating an + instruction which would cause it to jump over a sync point, it will + discard that instruction and output a ``db'' instead. So it _will_ + start disassembly exactly from the sync point, and so you _will_ see + all the instructions in your code section. + + Sync points are specified using the `-s' option: they are measured + in terms of the program origin, not the file position. So if you + want to synchronize after 32 bytes of a `.COM' file, you would have + to do + + ndisasm -o100h -s120h file.com + + rather than + + ndisasm -o100h -s20h file.com + + As stated above, you can specify multiple sync markers if you need + to, just by repeating the `-s' option. + + A.3.3 Mixed Code and Data: Automatic (Intelligent) Synchronisation + + Suppose you are disassembling the boot sector of a `DOS' floppy + (maybe it has a virus, and you need to understand the virus so that + you know what kinds of damage it might have done you). Typically, + this will contain a `JMP' instruction, then some data, then the rest + of the code. So there is a very good chance of NDISASM being + _misaligned_ when the data ends and the code begins. Hence a sync + point is needed. + + On the other hand, why should you have to specify the sync point + manually? What you'd do in order to find where the sync point would + be, surely, would be to read the `JMP' instruction, and then to use + its target address as a sync point. So can NDISASM do that for you? + + The answer, of course, is yes: using either of the synonymous + switches `-a' (for automatic sync) or `-i' (for intelligent sync) + will enable `auto-sync' mode. Auto-sync mode automatically generates + a sync point for any forward-referring PC-relative jump or call + instruction that NDISASM encounters. (Since NDISASM is one-pass, if + it encounters a PC-relative jump whose target has already been + processed, there isn't much it can do about it...) + + Only PC-relative jumps are processed, since an absolute jump is + either through a register (in which case NDISASM doesn't know what + the register contains) or involves a segment address (in which case + the target code isn't in the same segment that NDISASM is working + in, and so the sync point can't be placed anywhere useful). + + For some kinds of file, this mechanism will automatically put sync + points in all the right places, and save you from having to place + any sync points manually. However, it should be stressed that auto- + sync mode is _not_ guaranteed to catch all the sync points, and you + may still have to place some manually. + + Auto-sync mode doesn't prevent you from declaring manual sync + points: it just adds automatically generated ones to the ones you + provide. It's perfectly feasible to specify `-i' _and_ some `-s' + options. + + Another caveat with auto-sync mode is that if, by some unpleasant + fluke, something in your data section should disassemble to a PC- + relative call or jump instruction, NDISASM may obediently place a + sync point in a totally random place, for example in the middle of + one of the instructions in your code section. So you may end up with + a wrong disassembly even if you use auto-sync. Again, there isn't + much I can do about this. If you have problems, you'll have to use + manual sync points, or use the `-k' option (documented below) to + suppress disassembly of the data area. + + A.3.4 Other Options + + The `-e' option skips a header on the file, by ignoring the first N + bytes. This means that the header is _not_ counted towards the + disassembly offset: if you give `-e10 -o10', disassembly will start + at byte 10 in the file, and this will be given offset 10, not 20. + + The `-k' option is provided with two comma-separated numeric + arguments, the first of which is an assembly offset and the second + is a number of bytes to skip. This _will_ count the skipped bytes + towards the assembly offset: its use is to suppress disassembly of a + data section which wouldn't contain anything you wanted to see + anyway. + + A.4 Bugs and Improvements + + There are no known bugs. However, any you find, with patches if + possible, should be sent to `nasm-bugs@lists.sourceforge.net', or to + the developer's site at `https://sourceforge.net/projects/nasm/' and + we'll try to fix them. Feel free to send contributions and new + features as well. + +Appendix B: Instruction List +---------------------------- + + B.1 Introduction + + The following sections show the instructions which NASM currently + supports. For each instruction, there is a separate entry for each + supported addressing mode. The third column shows the processor type + in which the instruction was introduced and, when appropriate, one + or more usage flags. + + B.1.1 Special instructions... + + DB + DW + DD + DQ + DT + DO + DY + RESB imm 8086 + RESW + RESD + RESQ + REST + RESO + RESY + + B.1.2 Conventional instructions + + AAA 8086,NOLONG + AAD 8086,NOLONG + AAD imm 8086,NOLONG + AAM 8086,NOLONG + AAM imm 8086,NOLONG + AAS 8086,NOLONG + ADC mem,reg8 8086 + ADC reg8,reg8 8086 + ADC mem,reg16 8086 + ADC reg16,reg16 8086 + ADC mem,reg32 386 + ADC reg32,reg32 386 + ADC mem,reg64 X64 + ADC reg64,reg64 X64 + ADC reg8,mem 8086 + ADC reg8,reg8 8086 + ADC reg16,mem 8086 + ADC reg16,reg16 8086 + ADC reg32,mem 386 + ADC reg32,reg32 386 + ADC reg64,mem X64 + ADC reg64,reg64 X64 + ADC rm16,imm8 8086 + ADC rm32,imm8 386 + ADC rm64,imm8 X64 + ADC reg_al,imm 8086 + ADC reg_ax,sbyte16 8086 + ADC reg_ax,imm 8086 + ADC reg_eax,sbyte32 386 + ADC reg_eax,imm 386 + ADC reg_rax,sbyte64 X64 + ADC reg_rax,imm X64 + ADC rm8,imm 8086 + ADC rm16,imm 8086 + ADC rm32,imm 386 + ADC rm64,imm X64 + ADC mem,imm8 8086 + ADC mem,imm16 8086 + ADC mem,imm32 386 + ADD mem,reg8 8086 + ADD reg8,reg8 8086 + ADD mem,reg16 8086 + ADD reg16,reg16 8086 + ADD mem,reg32 386 + ADD reg32,reg32 386 + ADD mem,reg64 X64 + ADD reg64,reg64 X64 + ADD reg8,mem 8086 + ADD reg8,reg8 8086 + ADD reg16,mem 8086 + ADD reg16,reg16 8086 + ADD reg32,mem 386 + ADD reg32,reg32 386 + ADD reg64,mem X64 + ADD reg64,reg64 X64 + ADD rm16,imm8 8086 + ADD rm32,imm8 386 + ADD rm64,imm8 X64 + ADD reg_al,imm 8086 + ADD reg_ax,sbyte16 8086 + ADD reg_ax,imm 8086 + ADD reg_eax,sbyte32 386 + ADD reg_eax,imm 386 + ADD reg_rax,sbyte64 X64 + ADD reg_rax,imm X64 + ADD rm8,imm 8086 + ADD rm16,imm 8086 + ADD rm32,imm 386 + ADD rm64,imm X64 + ADD mem,imm8 8086 + ADD mem,imm16 8086 + ADD mem,imm32 386 + AND mem,reg8 8086 + AND reg8,reg8 8086 + AND mem,reg16 8086 + AND reg16,reg16 8086 + AND mem,reg32 386 + AND reg32,reg32 386 + AND mem,reg64 X64 + AND reg64,reg64 X64 + AND reg8,mem 8086 + AND reg8,reg8 8086 + AND reg16,mem 8086 + AND reg16,reg16 8086 + AND reg32,mem 386 + AND reg32,reg32 386 + AND reg64,mem X64 + AND reg64,reg64 X64 + AND rm16,imm8 8086 + AND rm32,imm8 386 + AND rm64,imm8 X64 + AND reg_al,imm 8086 + AND reg_ax,sbyte16 8086 + AND reg_ax,imm 8086 + AND reg_eax,sbyte32 386 + AND reg_eax,imm 386 + AND reg_rax,sbyte64 X64 + AND reg_rax,imm X64 + AND rm8,imm 8086 + AND rm16,imm 8086 + AND rm32,imm 386 + AND rm64,imm X64 + AND mem,imm8 8086 + AND mem,imm16 8086 + AND mem,imm32 386 + ARPL mem,reg16 286,PROT,NOLONG + ARPL reg16,reg16 286,PROT,NOLONG + BB0_RESET PENT,CYRIX,ND + BB1_RESET PENT,CYRIX,ND + BOUND reg16,mem 186,NOLONG + BOUND reg32,mem 386,NOLONG + BSF reg16,mem 386 + BSF reg16,reg16 386 + BSF reg32,mem 386 + BSF reg32,reg32 386 + BSF reg64,mem X64 + BSF reg64,reg64 X64 + BSR reg16,mem 386 + BSR reg16,reg16 386 + BSR reg32,mem 386 + BSR reg32,reg32 386 + BSR reg64,mem X64 + BSR reg64,reg64 X64 + BSWAP reg32 486 + BSWAP reg64 X64 + BT mem,reg16 386 + BT reg16,reg16 386 + BT mem,reg32 386 + BT reg32,reg32 386 + BT mem,reg64 X64 + BT reg64,reg64 X64 + BT rm16,imm 386 + BT rm32,imm 386 + BT rm64,imm X64 + BTC mem,reg16 386 + BTC reg16,reg16 386 + BTC mem,reg32 386 + BTC reg32,reg32 386 + BTC mem,reg64 X64 + BTC reg64,reg64 X64 + BTC rm16,imm 386 + BTC rm32,imm 386 + BTC rm64,imm X64 + BTR mem,reg16 386 + BTR reg16,reg16 386 + BTR mem,reg32 386 + BTR reg32,reg32 386 + BTR mem,reg64 X64 + BTR reg64,reg64 X64 + BTR rm16,imm 386 + BTR rm32,imm 386 + BTR rm64,imm X64 + BTS mem,reg16 386 + BTS reg16,reg16 386 + BTS mem,reg32 386 + BTS reg32,reg32 386 + BTS mem,reg64 X64 + BTS reg64,reg64 X64 + BTS rm16,imm 386 + BTS rm32,imm 386 + BTS rm64,imm X64 + CALL imm 8086 + CALL imm|near 8086 + CALL imm|far 8086,ND,NOLONG + CALL imm16 8086 + CALL imm16|near 8086 + CALL imm16|far 8086,ND,NOLONG + CALL imm32 386 + CALL imm32|near 386 + CALL imm32|far 386,ND,NOLONG + CALL imm:imm 8086,NOLONG + CALL imm16:imm 8086,NOLONG + CALL imm:imm16 8086,NOLONG + CALL imm32:imm 386,NOLONG + CALL imm:imm32 386,NOLONG + CALL mem|far 8086,NOLONG + CALL mem|far X64 + CALL mem16|far 8086 + CALL mem32|far 386 + CALL mem64|far X64 + CALL mem|near 8086 + CALL mem16|near 8086 + CALL mem32|near 386,NOLONG + CALL mem64|near X64 + CALL reg16 8086 + CALL reg32 386,NOLONG + CALL reg64 X64 + CALL mem 8086 + CALL mem16 8086 + CALL mem32 386,NOLONG + CALL mem64 X64 + CBW 8086 + CDQ 386 + CDQE X64 + CLC 8086 + CLD 8086 + CLGI X64,AMD + CLI 8086 + CLTS 286,PRIV + CMC 8086 + CMP mem,reg8 8086 + CMP reg8,reg8 8086 + CMP mem,reg16 8086 + CMP reg16,reg16 8086 + CMP mem,reg32 386 + CMP reg32,reg32 386 + CMP mem,reg64 X64 + CMP reg64,reg64 X64 + CMP reg8,mem 8086 + CMP reg8,reg8 8086 + CMP reg16,mem 8086 + CMP reg16,reg16 8086 + CMP reg32,mem 386 + CMP reg32,reg32 386 + CMP reg64,mem X64 + CMP reg64,reg64 X64 + CMP rm16,imm8 8086 + CMP rm32,imm8 386 + CMP rm64,imm8 X64 + CMP reg_al,imm 8086 + CMP reg_ax,sbyte16 8086 + CMP reg_ax,imm 8086 + CMP reg_eax,sbyte32 386 + CMP reg_eax,imm 386 + CMP reg_rax,sbyte64 X64 + CMP reg_rax,imm X64 + CMP rm8,imm 8086 + CMP rm16,imm 8086 + CMP rm32,imm 386 + CMP rm64,imm X64 + CMP mem,imm8 8086 + CMP mem,imm16 8086 + CMP mem,imm32 386 + CMPSB 8086 + CMPSD 386 + CMPSQ X64 + CMPSW 8086 + CMPXCHG mem,reg8 PENT + CMPXCHG reg8,reg8 PENT + CMPXCHG mem,reg16 PENT + CMPXCHG reg16,reg16 PENT + CMPXCHG mem,reg32 PENT + CMPXCHG reg32,reg32 PENT + CMPXCHG mem,reg64 X64 + CMPXCHG reg64,reg64 X64 + CMPXCHG486 mem,reg8 486,UNDOC,ND + CMPXCHG486 reg8,reg8 486,UNDOC,ND + CMPXCHG486 mem,reg16 486,UNDOC,ND + CMPXCHG486 reg16,reg16 486,UNDOC,ND + CMPXCHG486 mem,reg32 486,UNDOC,ND + CMPXCHG486 reg32,reg32 486,UNDOC,ND + CMPXCHG8B mem PENT + CMPXCHG16B mem X64 + CPUID PENT + CPU_READ PENT,CYRIX + CPU_WRITE PENT,CYRIX + CQO X64 + CWD 8086 + CWDE 386 + DAA 8086,NOLONG + DAS 8086,NOLONG + DEC reg16 8086,NOLONG + DEC reg32 386,NOLONG + DEC rm8 8086 + DEC rm16 8086 + DEC rm32 386 + DEC rm64 X64 + DIV rm8 8086 + DIV rm16 8086 + DIV rm32 386 + DIV rm64 X64 + DMINT P6,CYRIX + EMMS PENT,MMX + ENTER imm,imm 186 + EQU imm 8086 + EQU imm:imm 8086 + F2XM1 8086,FPU + FABS 8086,FPU + FADD mem32 8086,FPU + FADD mem64 8086,FPU + FADD fpureg|to 8086,FPU + FADD fpureg 8086,FPU + FADD fpureg,fpu0 8086,FPU + FADD fpu0,fpureg 8086,FPU + FADD 8086,FPU,ND + FADDP fpureg 8086,FPU + FADDP fpureg,fpu0 8086,FPU + FADDP 8086,FPU,ND + FBLD mem80 8086,FPU + FBLD mem 8086,FPU + FBSTP mem80 8086,FPU + FBSTP mem 8086,FPU + FCHS 8086,FPU + FCLEX 8086,FPU + FCMOVB fpureg P6,FPU + FCMOVB fpu0,fpureg P6,FPU + FCMOVB P6,FPU,ND + FCMOVBE fpureg P6,FPU + FCMOVBE fpu0,fpureg P6,FPU + FCMOVBE P6,FPU,ND + FCMOVE fpureg P6,FPU + FCMOVE fpu0,fpureg P6,FPU + FCMOVE P6,FPU,ND + FCMOVNB fpureg P6,FPU + FCMOVNB fpu0,fpureg P6,FPU + FCMOVNB P6,FPU,ND + FCMOVNBE fpureg P6,FPU + FCMOVNBE fpu0,fpureg P6,FPU + FCMOVNBE P6,FPU,ND + FCMOVNE fpureg P6,FPU + FCMOVNE fpu0,fpureg P6,FPU + FCMOVNE P6,FPU,ND + FCMOVNU fpureg P6,FPU + FCMOVNU fpu0,fpureg P6,FPU + FCMOVNU P6,FPU,ND + FCMOVU fpureg P6,FPU + FCMOVU fpu0,fpureg P6,FPU + FCMOVU P6,FPU,ND + FCOM mem32 8086,FPU + FCOM mem64 8086,FPU + FCOM fpureg 8086,FPU + FCOM fpu0,fpureg 8086,FPU + FCOM 8086,FPU,ND + FCOMI fpureg P6,FPU + FCOMI fpu0,fpureg P6,FPU + FCOMI P6,FPU,ND + FCOMIP fpureg P6,FPU + FCOMIP fpu0,fpureg P6,FPU + FCOMIP P6,FPU,ND + FCOMP mem32 8086,FPU + FCOMP mem64 8086,FPU + FCOMP fpureg 8086,FPU + FCOMP fpu0,fpureg 8086,FPU + FCOMP 8086,FPU,ND + FCOMPP 8086,FPU + FCOS 386,FPU + FDECSTP 8086,FPU + FDISI 8086,FPU + FDIV mem32 8086,FPU + FDIV mem64 8086,FPU + FDIV fpureg|to 8086,FPU + FDIV fpureg 8086,FPU + FDIV fpureg,fpu0 8086,FPU + FDIV fpu0,fpureg 8086,FPU + FDIV 8086,FPU,ND + FDIVP fpureg 8086,FPU + FDIVP fpureg,fpu0 8086,FPU + FDIVP 8086,FPU,ND + FDIVR mem32 8086,FPU + FDIVR mem64 8086,FPU + FDIVR fpureg|to 8086,FPU + FDIVR fpureg,fpu0 8086,FPU + FDIVR fpureg 8086,FPU + FDIVR fpu0,fpureg 8086,FPU + FDIVR 8086,FPU,ND + FDIVRP fpureg 8086,FPU + FDIVRP fpureg,fpu0 8086,FPU + FDIVRP 8086,FPU,ND + FEMMS PENT,3DNOW + FENI 8086,FPU + FFREE fpureg 8086,FPU + FFREE 8086,FPU + FFREEP fpureg 286,FPU,UNDOC + FFREEP 286,FPU,UNDOC + FIADD mem32 8086,FPU + FIADD mem16 8086,FPU + FICOM mem32 8086,FPU + FICOM mem16 8086,FPU + FICOMP mem32 8086,FPU + FICOMP mem16 8086,FPU + FIDIV mem32 8086,FPU + FIDIV mem16 8086,FPU + FIDIVR mem32 8086,FPU + FIDIVR mem16 8086,FPU + FILD mem32 8086,FPU + FILD mem16 8086,FPU + FILD mem64 8086,FPU + FIMUL mem32 8086,FPU + FIMUL mem16 8086,FPU + FINCSTP 8086,FPU + FINIT 8086,FPU + FIST mem32 8086,FPU + FIST mem16 8086,FPU + FISTP mem32 8086,FPU + FISTP mem16 8086,FPU + FISTP mem64 8086,FPU + FISTTP mem16 PRESCOTT,FPU + FISTTP mem32 PRESCOTT,FPU + FISTTP mem64 PRESCOTT,FPU + FISUB mem32 8086,FPU + FISUB mem16 8086,FPU + FISUBR mem32 8086,FPU + FISUBR mem16 8086,FPU + FLD mem32 8086,FPU + FLD mem64 8086,FPU + FLD mem80 8086,FPU + FLD fpureg 8086,FPU + FLD 8086,FPU,ND + FLD1 8086,FPU + FLDCW mem 8086,FPU,SW + FLDENV mem 8086,FPU + FLDL2E 8086,FPU + FLDL2T 8086,FPU + FLDLG2 8086,FPU + FLDLN2 8086,FPU + FLDPI 8086,FPU + FLDZ 8086,FPU + FMUL mem32 8086,FPU + FMUL mem64 8086,FPU + FMUL fpureg|to 8086,FPU + FMUL fpureg,fpu0 8086,FPU + FMUL fpureg 8086,FPU + FMUL fpu0,fpureg 8086,FPU + FMUL 8086,FPU,ND + FMULP fpureg 8086,FPU + FMULP fpureg,fpu0 8086,FPU + FMULP 8086,FPU,ND + FNCLEX 8086,FPU + FNDISI 8086,FPU + FNENI 8086,FPU + FNINIT 8086,FPU + FNOP 8086,FPU + FNSAVE mem 8086,FPU + FNSTCW mem 8086,FPU,SW + FNSTENV mem 8086,FPU + FNSTSW mem 8086,FPU,SW + FNSTSW reg_ax 286,FPU + FPATAN 8086,FPU + FPREM 8086,FPU + FPREM1 386,FPU + FPTAN 8086,FPU + FRNDINT 8086,FPU + FRSTOR mem 8086,FPU + FSAVE mem 8086,FPU + FSCALE 8086,FPU + FSETPM 286,FPU + FSIN 386,FPU + FSINCOS 386,FPU + FSQRT 8086,FPU + FST mem32 8086,FPU + FST mem64 8086,FPU + FST fpureg 8086,FPU + FST 8086,FPU,ND + FSTCW mem 8086,FPU,SW + FSTENV mem 8086,FPU + FSTP mem32 8086,FPU + FSTP mem64 8086,FPU + FSTP mem80 8086,FPU + FSTP fpureg 8086,FPU + FSTP 8086,FPU,ND + FSTSW mem 8086,FPU,SW + FSTSW reg_ax 286,FPU + FSUB mem32 8086,FPU + FSUB mem64 8086,FPU + FSUB fpureg|to 8086,FPU + FSUB fpureg,fpu0 8086,FPU + FSUB fpureg 8086,FPU + FSUB fpu0,fpureg 8086,FPU + FSUB 8086,FPU,ND + FSUBP fpureg 8086,FPU + FSUBP fpureg,fpu0 8086,FPU + FSUBP 8086,FPU,ND + FSUBR mem32 8086,FPU + FSUBR mem64 8086,FPU + FSUBR fpureg|to 8086,FPU + FSUBR fpureg,fpu0 8086,FPU + FSUBR fpureg 8086,FPU + FSUBR fpu0,fpureg 8086,FPU + FSUBR 8086,FPU,ND + FSUBRP fpureg 8086,FPU + FSUBRP fpureg,fpu0 8086,FPU + FSUBRP 8086,FPU,ND + FTST 8086,FPU + FUCOM fpureg 386,FPU + FUCOM fpu0,fpureg 386,FPU + FUCOM 386,FPU,ND + FUCOMI fpureg P6,FPU + FUCOMI fpu0,fpureg P6,FPU + FUCOMI P6,FPU,ND + FUCOMIP fpureg P6,FPU + FUCOMIP fpu0,fpureg P6,FPU + FUCOMIP P6,FPU,ND + FUCOMP fpureg 386,FPU + FUCOMP fpu0,fpureg 386,FPU + FUCOMP 386,FPU,ND + FUCOMPP 386,FPU + FXAM 8086,FPU + FXCH fpureg 8086,FPU + FXCH fpureg,fpu0 8086,FPU + FXCH fpu0,fpureg 8086,FPU + FXCH 8086,FPU,ND + FXTRACT 8086,FPU + FYL2X 8086,FPU + FYL2XP1 8086,FPU + HLT 8086,PRIV + IBTS mem,reg16 386,SW,UNDOC,ND + IBTS reg16,reg16 386,UNDOC,ND + IBTS mem,reg32 386,SD,UNDOC,ND + IBTS reg32,reg32 386,UNDOC,ND + ICEBP 386,ND + IDIV rm8 8086 + IDIV rm16 8086 + IDIV rm32 386 + IDIV rm64 X64 + IMUL rm8 8086 + IMUL rm16 8086 + IMUL rm32 386 + IMUL rm64 X64 + IMUL reg16,mem 386 + IMUL reg16,reg16 386 + IMUL reg32,mem 386 + IMUL reg32,reg32 386 + IMUL reg64,mem X64 + IMUL reg64,reg64 X64 + IMUL reg16,mem,imm8 186 + IMUL reg16,mem,sbyte16 186,ND + IMUL reg16,mem,imm16 186 + IMUL reg16,mem,imm 186,ND + IMUL reg16,reg16,imm8 186 + IMUL reg16,reg16,sbyte16 186,ND + IMUL reg16,reg16,imm16 186 + IMUL reg16,reg16,imm 186,ND + IMUL reg32,mem,imm8 386 + IMUL reg32,mem,sbyte32 386,ND + IMUL reg32,mem,imm32 386 + IMUL reg32,mem,imm 386,ND + IMUL reg32,reg32,imm8 386 + IMUL reg32,reg32,sbyte32 386,ND + IMUL reg32,reg32,imm32 386 + IMUL reg32,reg32,imm 386,ND + IMUL reg64,mem,imm8 X64 + IMUL reg64,mem,sbyte64 X64,ND + IMUL reg64,mem,imm32 X64 + IMUL reg64,mem,imm X64,ND + IMUL reg64,reg64,imm8 X64 + IMUL reg64,reg64,sbyte64 X64,ND + IMUL reg64,reg64,imm32 X64 + IMUL reg64,reg64,imm X64,ND + IMUL reg16,imm8 186 + IMUL reg16,sbyte16 186,ND + IMUL reg16,imm16 186 + IMUL reg16,imm 186,ND + IMUL reg32,imm8 386 + IMUL reg32,sbyte32 386,ND + IMUL reg32,imm32 386 + IMUL reg32,imm 386,ND + IMUL reg64,imm8 X64 + IMUL reg64,sbyte64 X64,ND + IMUL reg64,imm32 X64 + IMUL reg64,imm X64,ND + IN reg_al,imm 8086 + IN reg_ax,imm 8086 + IN reg_eax,imm 386 + IN reg_al,reg_dx 8086 + IN reg_ax,reg_dx 8086 + IN reg_eax,reg_dx 386 + INC reg16 8086,NOLONG + INC reg32 386,NOLONG + INC rm8 8086 + INC rm16 8086 + INC rm32 386 + INC rm64 X64 + INCBIN + INSB 186 + INSD 386 + INSW 186 + INT imm 8086 + INT01 386,ND + INT1 386 + INT03 8086,ND + INT3 8086 + INTO 8086,NOLONG + INVD 486,PRIV + INVLPG mem 486,PRIV + INVLPGA reg_ax,reg_ecx X86_64,AMD,NOLONG + INVLPGA reg_eax,reg_ecx X86_64,AMD + INVLPGA reg_rax,reg_ecx X64,AMD + INVLPGA X86_64,AMD + IRET 8086 + IRETD 386 + IRETQ X64 + IRETW 8086 + JCXZ imm 8086,NOLONG + JECXZ imm 386 + JRCXZ imm X64 + JMP imm|short 8086 + JMP imm 8086,ND + JMP imm 8086 + JMP imm|near 8086,ND + JMP imm|far 8086,ND,NOLONG + JMP imm16 8086 + JMP imm16|near 8086,ND + JMP imm16|far 8086,ND,NOLONG + JMP imm32 386 + JMP imm32|near 386,ND + JMP imm32|far 386,ND,NOLONG + JMP imm:imm 8086,NOLONG + JMP imm16:imm 8086,NOLONG + JMP imm:imm16 8086,NOLONG + JMP imm32:imm 386,NOLONG + JMP imm:imm32 386,NOLONG + JMP mem|far 8086,NOLONG + JMP mem|far X64 + JMP mem16|far 8086 + JMP mem32|far 386 + JMP mem64|far X64 + JMP mem|near 8086 + JMP mem16|near 8086 + JMP mem32|near 386,NOLONG + JMP mem64|near X64 + JMP reg16 8086 + JMP reg32 386,NOLONG + JMP reg64 X64 + JMP mem 8086 + JMP mem16 8086 + JMP mem32 386,NOLONG + JMP mem64 X64 + JMPE imm IA64 + JMPE imm16 IA64 + JMPE imm32 IA64 + JMPE rm16 IA64 + JMPE rm32 IA64 + LAHF 8086 + LAR reg16,mem 286,PROT,SW + LAR reg16,reg16 286,PROT + LAR reg16,reg32 386,PROT + LAR reg16,reg64 X64,PROT,ND + LAR reg32,mem 386,PROT,SW + LAR reg32,reg16 386,PROT + LAR reg32,reg32 386,PROT + LAR reg32,reg64 X64,PROT,ND + LAR reg64,mem X64,PROT,SW + LAR reg64,reg16 X64,PROT + LAR reg64,reg32 X64,PROT + LAR reg64,reg64 X64,PROT + LDS reg16,mem 8086,NOLONG + LDS reg32,mem 386,NOLONG + LEA reg16,mem 8086 + LEA reg32,mem 386 + LEA reg64,mem X64 + LEAVE 186 + LES reg16,mem 8086,NOLONG + LES reg32,mem 386,NOLONG + LFENCE X64,AMD + LFS reg16,mem 386 + LFS reg32,mem 386 + LGDT mem 286,PRIV + LGS reg16,mem 386 + LGS reg32,mem 386 + LIDT mem 286,PRIV + LLDT mem 286,PROT,PRIV + LLDT mem16 286,PROT,PRIV + LLDT reg16 286,PROT,PRIV + LMSW mem 286,PRIV + LMSW mem16 286,PRIV + LMSW reg16 286,PRIV + LOADALL 386,UNDOC + LOADALL286 286,UNDOC + LODSB 8086 + LODSD 386 + LODSQ X64 + LODSW 8086 + LOOP imm 8086 + LOOP imm,reg_cx 8086,NOLONG + LOOP imm,reg_ecx 386 + LOOP imm,reg_rcx X64 + LOOPE imm 8086 + LOOPE imm,reg_cx 8086,NOLONG + LOOPE imm,reg_ecx 386 + LOOPE imm,reg_rcx X64 + LOOPNE imm 8086 + LOOPNE imm,reg_cx 8086,NOLONG + LOOPNE imm,reg_ecx 386 + LOOPNE imm,reg_rcx X64 + LOOPNZ imm 8086 + LOOPNZ imm,reg_cx 8086,NOLONG + LOOPNZ imm,reg_ecx 386 + LOOPNZ imm,reg_rcx X64 + LOOPZ imm 8086 + LOOPZ imm,reg_cx 8086,NOLONG + LOOPZ imm,reg_ecx 386 + LOOPZ imm,reg_rcx X64 + LSL reg16,mem 286,PROT,SW + LSL reg16,reg16 286,PROT + LSL reg16,reg32 386,PROT + LSL reg16,reg64 X64,PROT,ND + LSL reg32,mem 386,PROT,SW + LSL reg32,reg16 386,PROT + LSL reg32,reg32 386,PROT + LSL reg32,reg64 X64,PROT,ND + LSL reg64,mem X64,PROT,SW + LSL reg64,reg16 X64,PROT + LSL reg64,reg32 X64,PROT + LSL reg64,reg64 X64,PROT + LSS reg16,mem 386 + LSS reg32,mem 386 + LTR mem 286,PROT,PRIV + LTR mem16 286,PROT,PRIV + LTR reg16 286,PROT,PRIV + MFENCE X64,AMD + MONITOR PRESCOTT + MONITOR reg_eax,reg_ecx,reg_edx PRESCOTT,ND + MONITOR reg_rax,reg_ecx,reg_edx X64,ND + MOV mem,reg_sreg 8086 + MOV reg16,reg_sreg 8086 + MOV reg32,reg_sreg 386 + MOV reg_sreg,mem 8086 + MOV reg_sreg,reg16 8086 + MOV reg_sreg,reg32 386 + MOV reg_al,mem_offs 8086 + MOV reg_ax,mem_offs 8086 + MOV reg_eax,mem_offs 386 + MOV reg_rax,mem_offs X64 + MOV mem_offs,reg_al 8086 + MOV mem_offs,reg_ax 8086 + MOV mem_offs,reg_eax 386 + MOV mem_offs,reg_rax X64 + MOV reg32,reg_creg 386,PRIV,NOLONG + MOV reg64,reg_creg X64,PRIV + MOV reg_creg,reg32 386,PRIV,NOLONG + MOV reg_creg,reg64 X64,PRIV + MOV reg32,reg_dreg 386,PRIV,NOLONG + MOV reg64,reg_dreg X64,PRIV + MOV reg_dreg,reg32 386,PRIV,NOLONG + MOV reg_dreg,reg64 X64,PRIV + MOV reg32,reg_treg 386,NOLONG,ND + MOV reg_treg,reg32 386,NOLONG,ND + MOV mem,reg8 8086 + MOV reg8,reg8 8086 + MOV mem,reg16 8086 + MOV reg16,reg16 8086 + MOV mem,reg32 386 + MOV reg32,reg32 386 + MOV mem,reg64 X64 + MOV reg64,reg64 X64 + MOV reg8,mem 8086 + MOV reg8,reg8 8086 + MOV reg16,mem 8086 + MOV reg16,reg16 8086 + MOV reg32,mem 386 + MOV reg32,reg32 386 + MOV reg64,mem X64 + MOV reg64,reg64 X64 + MOV reg8,imm 8086 + MOV reg16,imm 8086 + MOV reg32,imm 386 + MOV reg64,imm X64 + MOV reg64,imm32 X64 + MOV rm8,imm 8086 + MOV rm16,imm 8086 + MOV rm32,imm 386 + MOV rm64,imm X64 + MOV mem,imm8 8086 + MOV mem,imm16 8086 + MOV mem,imm32 386 + MOVD mmxreg,mem PENT,MMX,SD + MOVD mmxreg,reg32 PENT,MMX + MOVD mem,mmxreg PENT,MMX,SD + MOVD reg32,mmxreg PENT,MMX + MOVD xmmreg,mem X64,SD + MOVD xmmreg,reg32 X64 + MOVD mem,xmmreg X64,SD + MOVD reg32,xmmreg X64,SSE + MOVQ mmxreg,mmxrm PENT,MMX + MOVQ mmxrm,mmxreg PENT,MMX + MOVQ mmxreg,rm64 X64,MMX + MOVQ rm64,mmxreg X64,MMX + MOVSB 8086 + MOVSD 386 + MOVSQ X64 + MOVSW 8086 + MOVSX reg16,mem 386 + MOVSX reg16,reg8 386 + MOVSX reg32,rm8 386 + MOVSX reg32,rm16 386 + MOVSX reg64,rm8 X64 + MOVSX reg64,rm16 X64 + MOVSXD reg64,rm32 X64 + MOVSX reg64,rm32 X64,ND + MOVZX reg16,mem 386 + MOVZX reg16,reg8 386 + MOVZX reg32,rm8 386 + MOVZX reg32,rm16 386 + MOVZX reg64,rm8 X64 + MOVZX reg64,rm16 X64 + MUL rm8 8086 + MUL rm16 8086 + MUL rm32 386 + MUL rm64 X64 + MWAIT PRESCOTT + MWAIT reg_eax,reg_ecx PRESCOTT,ND + NEG rm8 8086 + NEG rm16 8086 + NEG rm32 386 + NEG rm64 X64 + NOP 8086 + NOP rm16 P6 + NOP rm32 P6 + NOP rm64 X64 + NOT rm8 8086 + NOT rm16 8086 + NOT rm32 386 + NOT rm64 X64 + OR mem,reg8 8086 + OR reg8,reg8 8086 + OR mem,reg16 8086 + OR reg16,reg16 8086 + OR mem,reg32 386 + OR reg32,reg32 386 + OR mem,reg64 X64 + OR reg64,reg64 X64 + OR reg8,mem 8086 + OR reg8,reg8 8086 + OR reg16,mem 8086 + OR reg16,reg16 8086 + OR reg32,mem 386 + OR reg32,reg32 386 + OR reg64,mem X64 + OR reg64,reg64 X64 + OR rm16,imm8 8086 + OR rm32,imm8 386 + OR rm64,imm8 X64 + OR reg_al,imm 8086 + OR reg_ax,sbyte16 8086 + OR reg_ax,imm 8086 + OR reg_eax,sbyte32 386 + OR reg_eax,imm 386 + OR reg_rax,sbyte64 X64 + OR reg_rax,imm X64 + OR rm8,imm 8086 + OR rm16,imm 8086 + OR rm32,imm 386 + OR rm64,imm X64 + OR mem,imm8 8086 + OR mem,imm16 8086 + OR mem,imm32 386 + OUT imm,reg_al 8086 + OUT imm,reg_ax 8086 + OUT imm,reg_eax 386 + OUT reg_dx,reg_al 8086 + OUT reg_dx,reg_ax 8086 + OUT reg_dx,reg_eax 386 + OUTSB 186 + OUTSD 386 + OUTSW 186 + PACKSSDW mmxreg,mmxrm PENT,MMX + PACKSSWB mmxreg,mmxrm PENT,MMX + PACKUSWB mmxreg,mmxrm PENT,MMX + PADDB mmxreg,mmxrm PENT,MMX + PADDD mmxreg,mmxrm PENT,MMX + PADDSB mmxreg,mmxrm PENT,MMX + PADDSIW mmxreg,mmxrm PENT,MMX,CYRIX + PADDSW mmxreg,mmxrm PENT,MMX + PADDUSB mmxreg,mmxrm PENT,MMX + PADDUSW mmxreg,mmxrm PENT,MMX + PADDW mmxreg,mmxrm PENT,MMX + PAND mmxreg,mmxrm PENT,MMX + PANDN mmxreg,mmxrm PENT,MMX + PAUSE 8086 + PAVEB mmxreg,mmxrm PENT,MMX,CYRIX + PAVGUSB mmxreg,mmxrm PENT,3DNOW + PCMPEQB mmxreg,mmxrm PENT,MMX + PCMPEQD mmxreg,mmxrm PENT,MMX + PCMPEQW mmxreg,mmxrm PENT,MMX + PCMPGTB mmxreg,mmxrm PENT,MMX + PCMPGTD mmxreg,mmxrm PENT,MMX + PCMPGTW mmxreg,mmxrm PENT,MMX + PDISTIB mmxreg,mem PENT,MMX,CYRIX + PF2ID mmxreg,mmxrm PENT,3DNOW + PFACC mmxreg,mmxrm PENT,3DNOW + PFADD mmxreg,mmxrm PENT,3DNOW + PFCMPEQ mmxreg,mmxrm PENT,3DNOW + PFCMPGE mmxreg,mmxrm PENT,3DNOW + PFCMPGT mmxreg,mmxrm PENT,3DNOW + PFMAX mmxreg,mmxrm PENT,3DNOW + PFMIN mmxreg,mmxrm PENT,3DNOW + PFMUL mmxreg,mmxrm PENT,3DNOW + PFRCP mmxreg,mmxrm PENT,3DNOW + PFRCPIT1 mmxreg,mmxrm PENT,3DNOW + PFRCPIT2 mmxreg,mmxrm PENT,3DNOW + PFRSQIT1 mmxreg,mmxrm PENT,3DNOW + PFRSQRT mmxreg,mmxrm PENT,3DNOW + PFSUB mmxreg,mmxrm PENT,3DNOW + PFSUBR mmxreg,mmxrm PENT,3DNOW + PI2FD mmxreg,mmxrm PENT,3DNOW + PMACHRIW mmxreg,mem PENT,MMX,CYRIX + PMADDWD mmxreg,mmxrm PENT,MMX + PMAGW mmxreg,mmxrm PENT,MMX,CYRIX + PMULHRIW mmxreg,mmxrm PENT,MMX,CYRIX + PMULHRWA mmxreg,mmxrm PENT,3DNOW + PMULHRWC mmxreg,mmxrm PENT,MMX,CYRIX + PMULHW mmxreg,mmxrm PENT,MMX + PMULLW mmxreg,mmxrm PENT,MMX + PMVGEZB mmxreg,mem PENT,MMX,CYRIX + PMVLZB mmxreg,mem PENT,MMX,CYRIX + PMVNZB mmxreg,mem PENT,MMX,CYRIX + PMVZB mmxreg,mem PENT,MMX,CYRIX + POP reg16 8086 + POP reg32 386,NOLONG + POP reg64 X64 + POP rm16 8086 + POP rm32 386,NOLONG + POP rm64 X64 + POP reg_cs 8086,UNDOC,ND + POP reg_dess 8086,NOLONG + POP reg_fsgs 386 + POPA 186,NOLONG + POPAD 386,NOLONG + POPAW 186,NOLONG + POPF 8086 + POPFD 386,NOLONG + POPFQ X64 + POPFW 8086 + POR mmxreg,mmxrm PENT,MMX + PREFETCH mem PENT,3DNOW + PREFETCHW mem PENT,3DNOW + PSLLD mmxreg,mmxrm PENT,MMX + PSLLD mmxreg,imm PENT,MMX + PSLLQ mmxreg,mmxrm PENT,MMX + PSLLQ mmxreg,imm PENT,MMX + PSLLW mmxreg,mmxrm PENT,MMX + PSLLW mmxreg,imm PENT,MMX + PSRAD mmxreg,mmxrm PENT,MMX + PSRAD mmxreg,imm PENT,MMX + PSRAW mmxreg,mmxrm PENT,MMX + PSRAW mmxreg,imm PENT,MMX + PSRLD mmxreg,mmxrm PENT,MMX + PSRLD mmxreg,imm PENT,MMX + PSRLQ mmxreg,mmxrm PENT,MMX + PSRLQ mmxreg,imm PENT,MMX + PSRLW mmxreg,mmxrm PENT,MMX + PSRLW mmxreg,imm PENT,MMX + PSUBB mmxreg,mmxrm PENT,MMX + PSUBD mmxreg,mmxrm PENT,MMX + PSUBSB mmxreg,mmxrm PENT,MMX + PSUBSIW mmxreg,mmxrm PENT,MMX,CYRIX + PSUBSW mmxreg,mmxrm PENT,MMX + PSUBUSB mmxreg,mmxrm PENT,MMX + PSUBUSW mmxreg,mmxrm PENT,MMX + PSUBW mmxreg,mmxrm PENT,MMX + PUNPCKHBW mmxreg,mmxrm PENT,MMX + PUNPCKHDQ mmxreg,mmxrm PENT,MMX + PUNPCKHWD mmxreg,mmxrm PENT,MMX + PUNPCKLBW mmxreg,mmxrm PENT,MMX + PUNPCKLDQ mmxreg,mmxrm PENT,MMX + PUNPCKLWD mmxreg,mmxrm PENT,MMX + PUSH reg16 8086 + PUSH reg32 386,NOLONG + PUSH reg64 X64 + PUSH rm16 8086 + PUSH rm32 386,NOLONG + PUSH rm64 X64 + PUSH reg_cs 8086,NOLONG + PUSH reg_dess 8086,NOLONG + PUSH reg_fsgs 386 + PUSH imm8 186 + PUSH imm16 186,AR0,SZ + PUSH imm32 386,NOLONG,AR0,SZ + PUSH imm32 386,NOLONG,SD + PUSH imm64 X64,AR0,SZ + PUSHA 186,NOLONG + PUSHAD 386,NOLONG + PUSHAW 186,NOLONG + PUSHF 8086 + PUSHFD 386,NOLONG + PUSHFQ X64 + PUSHFW 8086 + PXOR mmxreg,mmxrm PENT,MMX + RCL rm8,unity 8086 + RCL rm8,reg_cl 8086 + RCL rm8,imm 186 + RCL rm16,unity 8086 + RCL rm16,reg_cl 8086 + RCL rm16,imm 186 + RCL rm32,unity 386 + RCL rm32,reg_cl 386 + RCL rm32,imm 386 + RCL rm64,unity X64 + RCL rm64,reg_cl X64 + RCL rm64,imm X64 + RCR rm8,unity 8086 + RCR rm8,reg_cl 8086 + RCR rm8,imm 186 + RCR rm16,unity 8086 + RCR rm16,reg_cl 8086 + RCR rm16,imm 186 + RCR rm32,unity 386 + RCR rm32,reg_cl 386 + RCR rm32,imm 386 + RCR rm64,unity X64 + RCR rm64,reg_cl X64 + RCR rm64,imm X64 + RDSHR rm32 P6,CYRIXM + RDMSR PENT,PRIV + RDPMC P6 + RDTSC PENT + RDTSCP X86_64 + RET 8086 + RET imm 8086,SW + RETF 8086 + RETF imm 8086,SW + RETN 8086 + RETN imm 8086,SW + ROL rm8,unity 8086 + ROL rm8,reg_cl 8086 + ROL rm8,imm 186 + ROL rm16,unity 8086 + ROL rm16,reg_cl 8086 + ROL rm16,imm 186 + ROL rm32,unity 386 + ROL rm32,reg_cl 386 + ROL rm32,imm 386 + ROL rm64,unity X64 + ROL rm64,reg_cl X64 + ROL rm64,imm X64 + ROR rm8,unity 8086 + ROR rm8,reg_cl 8086 + ROR rm8,imm 186 + ROR rm16,unity 8086 + ROR rm16,reg_cl 8086 + ROR rm16,imm 186 + ROR rm32,unity 386 + ROR rm32,reg_cl 386 + ROR rm32,imm 386 + ROR rm64,unity X64 + ROR rm64,reg_cl X64 + ROR rm64,imm X64 + RDM P6,CYRIX,ND + RSDC reg_sreg,mem80 486,CYRIXM + RSLDT mem80 486,CYRIXM + RSM PENTM + RSTS mem80 486,CYRIXM + SAHF 8086 + SAL rm8,unity 8086,ND + SAL rm8,reg_cl 8086,ND + SAL rm8,imm 186,ND + SAL rm16,unity 8086,ND + SAL rm16,reg_cl 8086,ND + SAL rm16,imm 186,ND + SAL rm32,unity 386,ND + SAL rm32,reg_cl 386,ND + SAL rm32,imm 386,ND + SAL rm64,unity X64,ND + SAL rm64,reg_cl X64,ND + SAL rm64,imm X64,ND + SALC 8086,UNDOC + SAR rm8,unity 8086 + SAR rm8,reg_cl 8086 + SAR rm8,imm 186 + SAR rm16,unity 8086 + SAR rm16,reg_cl 8086 + SAR rm16,imm 186 + SAR rm32,unity 386 + SAR rm32,reg_cl 386 + SAR rm32,imm 386 + SAR rm64,unity X64 + SAR rm64,reg_cl X64 + SAR rm64,imm X64 + SBB mem,reg8 8086 + SBB reg8,reg8 8086 + SBB mem,reg16 8086 + SBB reg16,reg16 8086 + SBB mem,reg32 386 + SBB reg32,reg32 386 + SBB mem,reg64 X64 + SBB reg64,reg64 X64 + SBB reg8,mem 8086 + SBB reg8,reg8 8086 + SBB reg16,mem 8086 + SBB reg16,reg16 8086 + SBB reg32,mem 386 + SBB reg32,reg32 386 + SBB reg64,mem X64 + SBB reg64,reg64 X64 + SBB rm16,imm8 8086 + SBB rm32,imm8 386 + SBB rm64,imm8 X64 + SBB reg_al,imm 8086 + SBB reg_ax,sbyte16 8086 + SBB reg_ax,imm 8086 + SBB reg_eax,sbyte32 386 + SBB reg_eax,imm 386 + SBB reg_rax,sbyte64 X64 + SBB reg_rax,imm X64 + SBB rm8,imm 8086 + SBB rm16,imm 8086 + SBB rm32,imm 386 + SBB rm64,imm X64 + SBB mem,imm8 8086 + SBB mem,imm16 8086 + SBB mem,imm32 386 + SCASB 8086 + SCASD 386 + SCASQ X64 + SCASW 8086 + SFENCE X64,AMD + SGDT mem 286 + SHL rm8,unity 8086 + SHL rm8,reg_cl 8086 + SHL rm8,imm 186 + SHL rm16,unity 8086 + SHL rm16,reg_cl 8086 + SHL rm16,imm 186 + SHL rm32,unity 386 + SHL rm32,reg_cl 386 + SHL rm32,imm 386 + SHL rm64,unity X64 + SHL rm64,reg_cl X64 + SHL rm64,imm X64 + SHLD mem,reg16,imm 3862 + SHLD reg16,reg16,imm 3862 + SHLD mem,reg32,imm 3862 + SHLD reg32,reg32,imm 3862 + SHLD mem,reg64,imm X642 + SHLD reg64,reg64,imm X642 + SHLD mem,reg16,reg_cl 386 + SHLD reg16,reg16,reg_cl 386 + SHLD mem,reg32,reg_cl 386 + SHLD reg32,reg32,reg_cl 386 + SHLD mem,reg64,reg_cl X64 + SHLD reg64,reg64,reg_cl X64 + SHR rm8,unity 8086 + SHR rm8,reg_cl 8086 + SHR rm8,imm 186 + SHR rm16,unity 8086 + SHR rm16,reg_cl 8086 + SHR rm16,imm 186 + SHR rm32,unity 386 + SHR rm32,reg_cl 386 + SHR rm32,imm 386 + SHR rm64,unity X64 + SHR rm64,reg_cl X64 + SHR rm64,imm X64 + SHRD mem,reg16,imm 3862 + SHRD reg16,reg16,imm 3862 + SHRD mem,reg32,imm 3862 + SHRD reg32,reg32,imm 3862 + SHRD mem,reg64,imm X642 + SHRD reg64,reg64,imm X642 + SHRD mem,reg16,reg_cl 386 + SHRD reg16,reg16,reg_cl 386 + SHRD mem,reg32,reg_cl 386 + SHRD reg32,reg32,reg_cl 386 + SHRD mem,reg64,reg_cl X64 + SHRD reg64,reg64,reg_cl X64 + SIDT mem 286 + SLDT mem 286 + SLDT mem16 286 + SLDT reg16 286 + SLDT reg32 386 + SLDT reg64 X64,ND + SLDT reg64 X64 + SKINIT X64 + SMI 386,UNDOC + SMINT P6,CYRIX,ND + SMINTOLD 486,CYRIX,ND + SMSW mem 286 + SMSW mem16 286 + SMSW reg16 286 + SMSW reg32 386 + STC 8086 + STD 8086 + STGI X64 + STI 8086 + STOSB 8086 + STOSD 386 + STOSQ X64 + STOSW 8086 + STR mem 286,PROT + STR mem16 286,PROT + STR reg16 286,PROT + STR reg32 386,PROT + STR reg64 X64 + SUB mem,reg8 8086 + SUB reg8,reg8 8086 + SUB mem,reg16 8086 + SUB reg16,reg16 8086 + SUB mem,reg32 386 + SUB reg32,reg32 386 + SUB mem,reg64 X64 + SUB reg64,reg64 X64 + SUB reg8,mem 8086 + SUB reg8,reg8 8086 + SUB reg16,mem 8086 + SUB reg16,reg16 8086 + SUB reg32,mem 386 + SUB reg32,reg32 386 + SUB reg64,mem X64 + SUB reg64,reg64 X64 + SUB rm16,imm8 8086 + SUB rm32,imm8 386 + SUB rm64,imm8 X64 + SUB reg_al,imm 8086 + SUB reg_ax,sbyte16 8086 + SUB reg_ax,imm 8086 + SUB reg_eax,sbyte32 386 + SUB reg_eax,imm 386 + SUB reg_rax,sbyte64 X64 + SUB reg_rax,imm X64 + SUB rm8,imm 8086 + SUB rm16,imm 8086 + SUB rm32,imm 386 + SUB rm64,imm X64 + SUB mem,imm8 8086 + SUB mem,imm16 8086 + SUB mem,imm32 386 + SVDC mem80,reg_sreg 486,CYRIXM + SVLDT mem80 486,CYRIXM,ND + SVTS mem80 486,CYRIXM + SWAPGS X64 + SYSCALL P6,AMD + SYSENTER P6 + SYSEXIT P6,PRIV + SYSRET P6,PRIV,AMD + TEST mem,reg8 8086 + TEST reg8,reg8 8086 + TEST mem,reg16 8086 + TEST reg16,reg16 8086 + TEST mem,reg32 386 + TEST reg32,reg32 386 + TEST mem,reg64 X64 + TEST reg64,reg64 X64 + TEST reg8,mem 8086 + TEST reg16,mem 8086 + TEST reg32,mem 386 + TEST reg64,mem X64 + TEST reg_al,imm 8086 + TEST reg_ax,imm 8086 + TEST reg_eax,imm 386 + TEST reg_rax,imm X64 + TEST rm8,imm 8086 + TEST rm16,imm 8086 + TEST rm32,imm 386 + TEST rm64,imm X64 + TEST mem,imm8 8086 + TEST mem,imm16 8086 + TEST mem,imm32 386 + UD0 186,UNDOC + UD1 186,UNDOC + UD2B 186,UNDOC,ND + UD2 186 + UD2A 186,ND + UMOV mem,reg8 386,UNDOC,ND + UMOV reg8,reg8 386,UNDOC,ND + UMOV mem,reg16 386,UNDOC,ND + UMOV reg16,reg16 386,UNDOC,ND + UMOV mem,reg32 386,UNDOC,ND + UMOV reg32,reg32 386,UNDOC,ND + UMOV reg8,mem 386,UNDOC,ND + UMOV reg8,reg8 386,UNDOC,ND + UMOV reg16,mem 386,UNDOC,ND + UMOV reg16,reg16 386,UNDOC,ND + UMOV reg32,mem 386,UNDOC,ND + UMOV reg32,reg32 386,UNDOC,ND + VERR mem 286,PROT + VERR mem16 286,PROT + VERR reg16 286,PROT + VERW mem 286,PROT + VERW mem16 286,PROT + VERW reg16 286,PROT + FWAIT 8086 + WBINVD 486,PRIV + WRSHR rm32 P6,CYRIXM + WRMSR PENT,PRIV + XADD mem,reg8 486 + XADD reg8,reg8 486 + XADD mem,reg16 486 + XADD reg16,reg16 486 + XADD mem,reg32 486 + XADD reg32,reg32 486 + XADD mem,reg64 X64 + XADD reg64,reg64 X64 + XBTS reg16,mem 386,SW,UNDOC,ND + XBTS reg16,reg16 386,UNDOC,ND + XBTS reg32,mem 386,SD,UNDOC,ND + XBTS reg32,reg32 386,UNDOC,ND + XCHG reg_ax,reg16 8086 + XCHG reg_eax,reg32na 386 + XCHG reg_rax,reg64 X64 + XCHG reg16,reg_ax 8086 + XCHG reg32na,reg_eax 386 + XCHG reg64,reg_rax X64 + XCHG reg_eax,reg_eax 386,NOLONG + XCHG reg8,mem 8086 + XCHG reg8,reg8 8086 + XCHG reg16,mem 8086 + XCHG reg16,reg16 8086 + XCHG reg32,mem 386 + XCHG reg32,reg32 386 + XCHG reg64,mem X64 + XCHG reg64,reg64 X64 + XCHG mem,reg8 8086 + XCHG reg8,reg8 8086 + XCHG mem,reg16 8086 + XCHG reg16,reg16 8086 + XCHG mem,reg32 386 + XCHG reg32,reg32 386 + XCHG mem,reg64 X64 + XCHG reg64,reg64 X64 + XLATB 8086 + XLAT 8086 + XOR mem,reg8 8086 + XOR reg8,reg8 8086 + XOR mem,reg16 8086 + XOR reg16,reg16 8086 + XOR mem,reg32 386 + XOR reg32,reg32 386 + XOR mem,reg64 X64 + XOR reg64,reg64 X64 + XOR reg8,mem 8086 + XOR reg8,reg8 8086 + XOR reg16,mem 8086 + XOR reg16,reg16 8086 + XOR reg32,mem 386 + XOR reg32,reg32 386 + XOR reg64,mem X64 + XOR reg64,reg64 X64 + XOR rm16,imm8 8086 + XOR rm32,imm8 386 + XOR rm64,imm8 X64 + XOR reg_al,imm 8086 + XOR reg_ax,sbyte16 8086 + XOR reg_ax,imm 8086 + XOR reg_eax,sbyte32 386 + XOR reg_eax,imm 386 + XOR reg_rax,sbyte64 X64 + XOR reg_rax,imm X64 + XOR rm8,imm 8086 + XOR rm16,imm 8086 + XOR rm32,imm 386 + XOR rm64,imm X64 + XOR mem,imm8 8086 + XOR mem,imm16 8086 + XOR mem,imm32 386 + CMOVcc reg16,mem P6 + CMOVcc reg16,reg16 P6 + CMOVcc reg32,mem P6 + CMOVcc reg32,reg32 P6 + CMOVcc reg64,mem X64 + CMOVcc reg64,reg64 X64 + Jcc imm|near 386 + Jcc imm16|near 386 + Jcc imm32|near 386 + Jcc imm|short 8086,ND + Jcc imm 8086,ND + Jcc imm 386,ND + Jcc imm 8086,ND + Jcc imm 8086 + SETcc mem 386 + SETcc reg8 386 + + B.1.3 Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2) + + ADDPS xmmreg,xmmrm KATMAI,SSE + ADDSS xmmreg,xmmrm KATMAI,SSE,SD + ANDNPS xmmreg,xmmrm KATMAI,SSE + ANDPS xmmreg,xmmrm KATMAI,SSE + CMPEQPS xmmreg,xmmrm KATMAI,SSE + CMPEQSS xmmreg,xmmrm KATMAI,SSE + CMPLEPS xmmreg,xmmrm KATMAI,SSE + CMPLESS xmmreg,xmmrm KATMAI,SSE + CMPLTPS xmmreg,xmmrm KATMAI,SSE + CMPLTSS xmmreg,xmmrm KATMAI,SSE + CMPNEQPS xmmreg,xmmrm KATMAI,SSE + CMPNEQSS xmmreg,xmmrm KATMAI,SSE + CMPNLEPS xmmreg,xmmrm KATMAI,SSE + CMPNLESS xmmreg,xmmrm KATMAI,SSE + CMPNLTPS xmmreg,xmmrm KATMAI,SSE + CMPNLTSS xmmreg,xmmrm KATMAI,SSE + CMPORDPS xmmreg,xmmrm KATMAI,SSE + CMPORDSS xmmreg,xmmrm KATMAI,SSE + CMPUNORDPS xmmreg,xmmrm KATMAI,SSE + CMPUNORDSS xmmreg,xmmrm KATMAI,SSE + CMPPS xmmreg,mem,imm KATMAI,SSE + CMPPS xmmreg,xmmreg,imm KATMAI,SSE + CMPSS xmmreg,mem,imm KATMAI,SSE + CMPSS xmmreg,xmmreg,imm KATMAI,SSE + COMISS xmmreg,xmmrm KATMAI,SSE + CVTPI2PS xmmreg,mmxrm KATMAI,SSE,MMX + CVTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX + CVTSI2SS xmmreg,mem KATMAI,SSE,SD,AR1,ND + CVTSI2SS xmmreg,rm32 KATMAI,SSE,SD,AR1 + CVTSI2SS xmmreg,rm64 X64,SSE,AR1 + CVTSS2SI reg32,xmmreg KATMAI,SSE,SD,AR1 + CVTSS2SI reg32,mem KATMAI,SSE,SD,AR1 + CVTSS2SI reg64,xmmreg X64,SSE,SD,AR1 + CVTSS2SI reg64,mem X64,SSE,SD,AR1 + CVTTPS2PI mmxreg,xmmrm KATMAI,SSE,MMX + CVTTSS2SI reg32,xmmrm KATMAI,SSE,SD,AR1 + CVTTSS2SI reg64,xmmrm X64,SSE,SD,AR1 + DIVPS xmmreg,xmmrm KATMAI,SSE + DIVSS xmmreg,xmmrm KATMAI,SSE + LDMXCSR mem KATMAI,SSE,SD + MAXPS xmmreg,xmmrm KATMAI,SSE + MAXSS xmmreg,xmmrm KATMAI,SSE + MINPS xmmreg,xmmrm KATMAI,SSE + MINSS xmmreg,xmmrm KATMAI,SSE + MOVAPS xmmreg,mem KATMAI,SSE + MOVAPS mem,xmmreg KATMAI,SSE + MOVAPS xmmreg,xmmreg KATMAI,SSE + MOVAPS xmmreg,xmmreg KATMAI,SSE + MOVHPS xmmreg,mem KATMAI,SSE + MOVHPS mem,xmmreg KATMAI,SSE + MOVLHPS xmmreg,xmmreg KATMAI,SSE + MOVLPS xmmreg,mem KATMAI,SSE + MOVLPS mem,xmmreg KATMAI,SSE + MOVHLPS xmmreg,xmmreg KATMAI,SSE + MOVMSKPS reg32,xmmreg KATMAI,SSE + MOVMSKPS reg64,xmmreg X64,SSE + MOVNTPS mem,xmmreg KATMAI,SSE + MOVSS xmmreg,mem KATMAI,SSE + MOVSS mem,xmmreg KATMAI,SSE + MOVSS xmmreg,xmmreg KATMAI,SSE + MOVSS xmmreg,xmmreg KATMAI,SSE + MOVUPS xmmreg,mem KATMAI,SSE + MOVUPS mem,xmmreg KATMAI,SSE + MOVUPS xmmreg,xmmreg KATMAI,SSE + MOVUPS xmmreg,xmmreg KATMAI,SSE + MULPS xmmreg,xmmrm KATMAI,SSE + MULSS xmmreg,xmmrm KATMAI,SSE + ORPS xmmreg,xmmrm KATMAI,SSE + RCPPS xmmreg,xmmrm KATMAI,SSE + RCPSS xmmreg,xmmrm KATMAI,SSE + RSQRTPS xmmreg,xmmrm KATMAI,SSE + RSQRTSS xmmreg,xmmrm KATMAI,SSE + SHUFPS xmmreg,mem,imm KATMAI,SSE + SHUFPS xmmreg,xmmreg,imm KATMAI,SSE + SQRTPS xmmreg,xmmrm KATMAI,SSE + SQRTSS xmmreg,xmmrm KATMAI,SSE + STMXCSR mem KATMAI,SSE,SD + SUBPS xmmreg,xmmrm KATMAI,SSE + SUBSS xmmreg,xmmrm KATMAI,SSE + UCOMISS xmmreg,xmmrm KATMAI,SSE + UNPCKHPS xmmreg,xmmrm KATMAI,SSE + UNPCKLPS xmmreg,xmmrm KATMAI,SSE + XORPS xmmreg,xmmrm KATMAI,SSE + + B.1.4 Introduced in Deschutes but necessary for SSE support + + FXRSTOR mem P6,SSE,FPU + FXSAVE mem P6,SSE,FPU + + B.1.5 XSAVE group (AVX and extended state) + + XGETBV NEHALEM + XSETBV NEHALEM,PRIV + XSAVE mem NEHALEM + XRSTOR mem NEHALEM + + B.1.6 Generic memory operations + + PREFETCHNTA mem KATMAI + PREFETCHT0 mem KATMAI + PREFETCHT1 mem KATMAI + PREFETCHT2 mem KATMAI + SFENCE KATMAI + + B.1.7 New MMX instructions introduced in Katmai + + MASKMOVQ mmxreg,mmxreg KATMAI,MMX + MOVNTQ mem,mmxreg KATMAI,MMX + PAVGB mmxreg,mmxrm KATMAI,MMX + PAVGW mmxreg,mmxrm KATMAI,MMX + PEXTRW reg32,mmxreg,imm KATMAI,MMX + PINSRW mmxreg,mem,imm KATMAI,MMX + PINSRW mmxreg,rm16,imm KATMAI,MMX + PINSRW mmxreg,reg32,imm KATMAI,MMX + PMAXSW mmxreg,mmxrm KATMAI,MMX + PMAXUB mmxreg,mmxrm KATMAI,MMX + PMINSW mmxreg,mmxrm KATMAI,MMX + PMINUB mmxreg,mmxrm KATMAI,MMX + PMOVMSKB reg32,mmxreg KATMAI,MMX + PMULHUW mmxreg,mmxrm KATMAI,MMX + PSADBW mmxreg,mmxrm KATMAI,MMX + PSHUFW mmxreg,mmxrm,imm KATMAI,MMX2 + + B.1.8 AMD Enhanced 3DNow! (Athlon) instructions + + PF2IW mmxreg,mmxrm PENT,3DNOW + PFNACC mmxreg,mmxrm PENT,3DNOW + PFPNACC mmxreg,mmxrm PENT,3DNOW + PI2FW mmxreg,mmxrm PENT,3DNOW + PSWAPD mmxreg,mmxrm PENT,3DNOW + + B.1.9 Willamette SSE2 Cacheability Instructions + + MASKMOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + CLFLUSH mem WILLAMETTE,SSE2 + MOVNTDQ mem,xmmreg WILLAMETTE,SSE2,SO + MOVNTI mem,reg32 WILLAMETTE,SD + MOVNTI mem,reg64 X64 + MOVNTPD mem,xmmreg WILLAMETTE,SSE2,SO + LFENCE WILLAMETTE,SSE2 + MFENCE WILLAMETTE,SSE2 + +B.1.10 Willamette MMX instructions (SSE2 SIMD Integer Instructions) + + MOVD mem,xmmreg WILLAMETTE,SSE2,SD + MOVD xmmreg,mem WILLAMETTE,SSE2,SD + MOVD xmmreg,rm32 WILLAMETTE,SSE2 + MOVD rm32,xmmreg WILLAMETTE,SSE2 + MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQA mem,xmmreg WILLAMETTE,SSE2,SO + MOVDQA xmmreg,mem WILLAMETTE,SSE2,SO + MOVDQA xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQU mem,xmmreg WILLAMETTE,SSE2,SO + MOVDQU xmmreg,mem WILLAMETTE,SSE2,SO + MOVDQU xmmreg,xmmreg WILLAMETTE,SSE2 + MOVDQ2Q mmxreg,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,xmmreg WILLAMETTE,SSE2 + MOVQ mem,xmmreg WILLAMETTE,SSE2 + MOVQ xmmreg,mem WILLAMETTE,SSE2 + MOVQ xmmreg,rm64 X64,SSE2 + MOVQ rm64,xmmreg X64,SSE2 + MOVQ2DQ xmmreg,mmxreg WILLAMETTE,SSE2 + PACKSSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PACKSSDW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PACKUSWB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDQ mmxreg,mmxrm WILLAMETTE,MMX + PADDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PADDUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAND xmmreg,xmmrm WILLAMETTE,SSE2,SO + PANDN xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAVGB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PAVGW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPEQD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PCMPGTD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PEXTRW reg32,xmmreg,imm WILLAMETTE,SSE2 + PINSRW xmmreg,reg16,imm WILLAMETTE,SSE2 + PINSRW xmmreg,reg32,imm WILLAMETTE,SSE2,ND + PINSRW xmmreg,mem,imm WILLAMETTE,SSE2 + PINSRW xmmreg,mem16,imm WILLAMETTE,SSE2 + PMADDWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMAXSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMAXUB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMINSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMINUB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMOVMSKB reg32,xmmreg WILLAMETTE,SSE2 + PMULHUW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULHW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PMULUDQ mmxreg,mmxrm WILLAMETTE,SSE2,SO + PMULUDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + POR xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSADBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSHUFD xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFD xmmreg,mem,imm WILLAMETTE,SSE22 + PSHUFHW xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFHW xmmreg,mem,imm WILLAMETTE,SSE22 + PSHUFLW xmmreg,xmmreg,imm WILLAMETTE,SSE2 + PSHUFLW xmmreg,mem,imm WILLAMETTE,SSE22 + PSLLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSLLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSLLQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRAW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRAW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRAD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRAD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLDQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLW xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLD xmmreg,imm WILLAMETTE,SSE2,AR1 + PSRLQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSRLQ xmmreg,imm WILLAMETTE,SSE2,AR1 + PSUBB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBQ mmxreg,mmxrm WILLAMETTE,SSE2,SO + PSUBQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBUSB xmmreg,xmmrm WILLAMETTE,SSE2,SO + PSUBUSW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKHQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLBW xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLWD xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PUNPCKLQDQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + PXOR xmmreg,xmmrm WILLAMETTE,SSE2,SO + +B.1.11 Willamette Streaming SIMD instructions (SSE2) + + ADDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + ADDSD xmmreg,xmmrm WILLAMETTE,SSE2 + ANDNPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + ANDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPEQSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPLESD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPLTSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNEQPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNEQSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNLEPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNLESD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPNLTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPNLTSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPORDSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPUNORDPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + CMPUNORDSD xmmreg,xmmrm WILLAMETTE,SSE2 + CMPPD xmmreg,xmmrm,imm WILLAMETTE,SSE22 + CMPSD xmmreg,xmmrm,imm WILLAMETTE,SSE2 + COMISD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTDQ2PD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTDQ2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO + CVTPD2PS xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPI2PD xmmreg,mmxrm WILLAMETTE,SSE2 + CVTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTPS2PD xmmreg,xmmrm WILLAMETTE,SSE2 + CVTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 + CVTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 + CVTSD2SI reg64,xmmreg X64,SSE2,AR1 + CVTSD2SI reg64,mem X64,SSE2,AR1 + CVTSD2SS xmmreg,xmmrm WILLAMETTE,SSE2 + CVTSI2SD xmmreg,mem WILLAMETTE,SSE2,SD,AR1,ND + CVTSI2SD xmmreg,rm32 WILLAMETTE,SSE2,SD,AR1 + CVTSI2SD xmmreg,rm64 X64,SSE2,AR1 + CVTSS2SD xmmreg,xmmrm WILLAMETTE,SSE2,SD + CVTTPD2PI mmxreg,xmmrm WILLAMETTE,SSE2,SO + CVTTPD2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTTPS2DQ xmmreg,xmmrm WILLAMETTE,SSE2,SO + CVTTSD2SI reg32,xmmreg WILLAMETTE,SSE2,AR1 + CVTTSD2SI reg32,mem WILLAMETTE,SSE2,AR1 + CVTTSD2SI reg64,xmmreg X64,SSE2,AR1 + CVTTSD2SI reg64,mem X64,SSE2,AR1 + DIVPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + DIVSD xmmreg,xmmrm WILLAMETTE,SSE2 + MAXPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MAXSD xmmreg,xmmrm WILLAMETTE,SSE2 + MINPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MINSD xmmreg,xmmrm WILLAMETTE,SSE2 + MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVAPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVAPD mem,xmmreg WILLAMETTE,SSE2,SO + MOVAPD xmmreg,mem WILLAMETTE,SSE2,SO + MOVHPD mem,xmmreg WILLAMETTE,SSE2 + MOVHPD xmmreg,mem WILLAMETTE,SSE2 + MOVLPD mem,xmmreg WILLAMETTE,SSE2 + MOVLPD xmmreg,mem WILLAMETTE,SSE2 + MOVMSKPD reg32,xmmreg WILLAMETTE,SSE2 + MOVMSKPD reg64,xmmreg X64,SSE2 + MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVSD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVSD mem,xmmreg WILLAMETTE,SSE2 + MOVSD xmmreg,mem WILLAMETTE,SSE2 + MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVUPD xmmreg,xmmreg WILLAMETTE,SSE2 + MOVUPD mem,xmmreg WILLAMETTE,SSE2,SO + MOVUPD xmmreg,mem WILLAMETTE,SSE2,SO + MULPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + MULSD xmmreg,xmmrm WILLAMETTE,SSE2 + ORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SHUFPD xmmreg,xmmreg,imm WILLAMETTE,SSE2 + SHUFPD xmmreg,mem,imm WILLAMETTE,SSE2 + SQRTPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SQRTSD xmmreg,xmmrm WILLAMETTE,SSE2 + SUBPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + SUBSD xmmreg,xmmrm WILLAMETTE,SSE2 + UCOMISD xmmreg,xmmrm WILLAMETTE,SSE2 + UNPCKHPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + UNPCKLPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + XORPD xmmreg,xmmrm WILLAMETTE,SSE2,SO + +B.1.12 Prescott New Instructions (SSE3) + + ADDSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO + ADDSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO + HADDPD xmmreg,xmmrm PRESCOTT,SSE3,SO + HADDPS xmmreg,xmmrm PRESCOTT,SSE3,SO + HSUBPD xmmreg,xmmrm PRESCOTT,SSE3,SO + HSUBPS xmmreg,xmmrm PRESCOTT,SSE3,SO + LDDQU xmmreg,mem PRESCOTT,SSE3,SO + MOVDDUP xmmreg,xmmrm PRESCOTT,SSE3 + MOVSHDUP xmmreg,xmmrm PRESCOTT,SSE3 + MOVSLDUP xmmreg,xmmrm PRESCOTT,SSE3 + +B.1.13 VMX Instructions + + VMCALL VMX + VMCLEAR mem VMX + VMLAUNCH VMX + VMLOAD X64,VMX + VMMCALL X64,VMX + VMPTRLD mem VMX + VMPTRST mem VMX + VMREAD rm32,reg32 VMX,NOLONG,SD + VMREAD rm64,reg64 X64,VMX + VMRESUME VMX + VMRUN X64,VMX + VMSAVE X64,VMX + VMWRITE reg32,rm32 VMX,NOLONG,SD + VMWRITE reg64,rm64 X64,VMX + VMXOFF VMX + VMXON mem VMX + +B.1.14 Extended Page Tables VMX instructions + + INVEPT reg32,mem VMX,SO,NOLONG + INVEPT reg64,mem VMX,SO,LONG + INVVPID reg32,mem VMX,SO,NOLONG + INVVPID reg64,mem VMX,SO,LONG + +B.1.15 Tejas New Instructions (SSSE3) + + PABSB mmxreg,mmxrm SSSE3,MMX + PABSB xmmreg,xmmrm SSSE3 + PABSW mmxreg,mmxrm SSSE3,MMX + PABSW xmmreg,xmmrm SSSE3 + PABSD mmxreg,mmxrm SSSE3,MMX + PABSD xmmreg,xmmrm SSSE3 + PALIGNR mmxreg,mmxrm,imm SSSE3,MMX + PALIGNR xmmreg,xmmrm,imm SSSE3 + PHADDW mmxreg,mmxrm SSSE3,MMX + PHADDW xmmreg,xmmrm SSSE3 + PHADDD mmxreg,mmxrm SSSE3,MMX + PHADDD xmmreg,xmmrm SSSE3 + PHADDSW mmxreg,mmxrm SSSE3,MMX + PHADDSW xmmreg,xmmrm SSSE3 + PHSUBW mmxreg,mmxrm SSSE3,MMX + PHSUBW xmmreg,xmmrm SSSE3 + PHSUBD mmxreg,mmxrm SSSE3,MMX + PHSUBD xmmreg,xmmrm SSSE3 + PHSUBSW mmxreg,mmxrm SSSE3,MMX + PHSUBSW xmmreg,xmmrm SSSE3 + PMADDUBSW mmxreg,mmxrm SSSE3,MMX + PMADDUBSW xmmreg,xmmrm SSSE3 + PMULHRSW mmxreg,mmxrm SSSE3,MMX + PMULHRSW xmmreg,xmmrm SSSE3 + PSHUFB mmxreg,mmxrm SSSE3,MMX + PSHUFB xmmreg,xmmrm SSSE3 + PSIGNB mmxreg,mmxrm SSSE3,MMX + PSIGNB xmmreg,xmmrm SSSE3 + PSIGNW mmxreg,mmxrm SSSE3,MMX + PSIGNW xmmreg,xmmrm SSSE3 + PSIGND mmxreg,mmxrm SSSE3,MMX + PSIGND xmmreg,xmmrm SSSE3 + +B.1.16 AMD SSE4A + + EXTRQ xmmreg,imm,imm SSE4A,AMD + EXTRQ xmmreg,xmmreg SSE4A,AMD + INSERTQ xmmreg,xmmreg,imm,imm SSE4A,AMD + INSERTQ xmmreg,xmmreg SSE4A,AMD + MOVNTSD mem,xmmreg SSE4A,AMD + MOVNTSS mem,xmmreg SSE4A,AMD,SD + +B.1.17 New instructions in Barcelona + + LZCNT reg16,rm16 P6,AMD + LZCNT reg32,rm32 P6,AMD + LZCNT reg64,rm64 X64,AMD + +B.1.18 Penryn New Instructions (SSE4.1) + + BLENDPD xmmreg,xmmrm,imm SSE41 + BLENDPS xmmreg,xmmrm,imm SSE41 + BLENDVPD xmmreg,xmmrm,xmm0 SSE41 + BLENDVPS xmmreg,xmmrm,xmm0 SSE41 + DPPD xmmreg,xmmrm,imm SSE41 + DPPS xmmreg,xmmrm,imm SSE41 + EXTRACTPS rm32,xmmreg,imm SSE41 + EXTRACTPS reg64,xmmreg,imm SSE41,X64 + INSERTPS xmmreg,xmmrm,imm SSE41,SD + MOVNTDQA xmmreg,mem SSE41 + MPSADBW xmmreg,xmmrm,imm SSE41 + PACKUSDW xmmreg,xmmrm SSE41 + PBLENDVB xmmreg,xmmrm,xmm0 SSE41 + PBLENDW xmmreg,xmmrm,imm SSE41 + PCMPEQQ xmmreg,xmmrm SSE41 + PEXTRB reg32,xmmreg,imm SSE41 + PEXTRB mem8,xmmreg,imm SSE41 + PEXTRB reg64,xmmreg,imm SSE41,X64 + PEXTRD rm32,xmmreg,imm SSE41 + PEXTRQ rm64,xmmreg,imm SSE41,X64 + PEXTRW reg32,xmmreg,imm SSE41 + PEXTRW mem16,xmmreg,imm SSE41 + PEXTRW reg64,xmmreg,imm SSE41,X64 + PHMINPOSUW xmmreg,xmmrm SSE41 + PINSRB xmmreg,mem,imm SSE41 + PINSRB xmmreg,rm8,imm SSE41 + PINSRB xmmreg,reg32,imm SSE41 + PINSRD xmmreg,mem,imm SSE41 + PINSRD xmmreg,rm32,imm SSE41 + PINSRQ xmmreg,mem,imm SSE41,X64 + PINSRQ xmmreg,rm64,imm SSE41,X64 + PMAXSB xmmreg,xmmrm SSE41 + PMAXSD xmmreg,xmmrm SSE41 + PMAXUD xmmreg,xmmrm SSE41 + PMAXUW xmmreg,xmmrm SSE41 + PMINSB xmmreg,xmmrm SSE41 + PMINSD xmmreg,xmmrm SSE41 + PMINUD xmmreg,xmmrm SSE41 + PMINUW xmmreg,xmmrm SSE41 + PMOVSXBW xmmreg,xmmrm SSE41 + PMOVSXBD xmmreg,xmmrm SSE41,SD + PMOVSXBQ xmmreg,xmmrm SSE41,SW + PMOVSXWD xmmreg,xmmrm SSE41 + PMOVSXWQ xmmreg,xmmrm SSE41,SD + PMOVSXDQ xmmreg,xmmrm SSE41 + PMOVZXBW xmmreg,xmmrm SSE41 + PMOVZXBD xmmreg,xmmrm SSE41,SD + PMOVZXBQ xmmreg,xmmrm SSE41,SW + PMOVZXWD xmmreg,xmmrm SSE41 + PMOVZXWQ xmmreg,xmmrm SSE41,SD + PMOVZXDQ xmmreg,xmmrm SSE41 + PMULDQ xmmreg,xmmrm SSE41 + PMULLD xmmreg,xmmrm SSE41 + PTEST xmmreg,xmmrm SSE41 + ROUNDPD xmmreg,xmmrm,imm SSE41 + ROUNDPS xmmreg,xmmrm,imm SSE41 + ROUNDSD xmmreg,xmmrm,imm SSE41 + ROUNDSS xmmreg,xmmrm,imm SSE41 + +B.1.19 Nehalem New Instructions (SSE4.2) + + CRC32 reg32,rm8 SSE42 + CRC32 reg32,rm16 SSE42 + CRC32 reg32,rm32 SSE42 + CRC32 reg64,rm8 SSE42,X64 + CRC32 reg64,rm64 SSE42,X64 + PCMPESTRI xmmreg,xmmrm,imm SSE42 + PCMPESTRM xmmreg,xmmrm,imm SSE42 + PCMPISTRI xmmreg,xmmrm,imm SSE42 + PCMPISTRM xmmreg,xmmrm,imm SSE42 + PCMPGTQ xmmreg,xmmrm SSE42 + POPCNT reg16,rm16 NEHALEM,SW + POPCNT reg32,rm32 NEHALEM,SD + POPCNT reg64,rm64 NEHALEM,X64 + +B.1.20 Intel SMX + + GETSEC KATMAI + +B.1.21 Geode (Cyrix) 3DNow! additions + + PFRCPV mmxreg,mmxrm PENT,3DNOW,CYRIX + PFRSQRTV mmxreg,mmxrm PENT,3DNOW,CYRIX + +B.1.22 Intel new instructions in ??? + + MOVBE reg16,mem16 NEHALEM + MOVBE reg32,mem32 NEHALEM + MOVBE reg64,mem64 NEHALEM + MOVBE mem16,reg16 NEHALEM + MOVBE mem32,reg32 NEHALEM + MOVBE mem64,reg64 NEHALEM + +B.1.23 Intel AES instructions + + AESENC xmmreg,xmmrm128 SSE,WESTMERE + AESENCLAST xmmreg,xmmrm128 SSE,WESTMERE + AESDEC xmmreg,xmmrm128 SSE,WESTMERE + AESDECLAST xmmreg,xmmrm128 SSE,WESTMERE + AESIMC xmmreg,xmmrm128 SSE,WESTMERE + AESKEYGENASSIST xmmreg,xmmrm128,imm8 SSE,WESTMERE + +B.1.24 Intel AVX AES instructions + + VAESENC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESENCLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESDEC xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESDECLAST xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VAESIMC xmmreg,xmmrm128 AVX,SANDYBRIDGE + VAESKEYGENASSIST xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + +B.1.25 Intel AVX instructions + + VADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VADDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VADDSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VADDSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VADDSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDNPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDNPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VANDNPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VANDNPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VBLENDVPD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VBLENDVPD xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE + VBLENDVPS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VBLENDVPS xmmreg,xmmrm128,xmm0 AVX,SANDYBRIDGE + VBLENDVPS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VBLENDVPD ymmreg,ymmrm256,ymm0 AVX,SANDYBRIDGE + VBROADCASTSS xmmreg,mem32 AVX,SANDYBRIDGE + VBROADCASTSS ymmreg,mem32 AVX,SANDYBRIDGE + VBROADCASTSD ymmreg,mem64 AVX,SANDYBRIDGE + VBROADCASTF128 ymmreg,mem128 AVX,SANDYBRIDGE + VCMPEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGTPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGTPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VCMPEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGTPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGTPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VCMPEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPORDSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPFALSESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPTRUESD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE + VCMPEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPUNORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPORDSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPFALSESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPTRUESS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPLE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPORD_SSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPEQ_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGE_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPGT_OQSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCMPSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE + VCVTDQ2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCVTDQ2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTDQ2PS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTDQ2PS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTPD2PS xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTPD2PS xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTPD2PS xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTPD2PS xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTPS2PD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VCVTPS2PD ymmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE + VCVTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG + VCVTSD2SS xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VCVTSI2SD xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD + VCVTSI2SD xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD + VCVTSI2SD xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG + VCVTSI2SS xmmreg,xmmreg*,rm32 AVX,SANDYBRIDGE,SD + VCVTSI2SS xmmreg,xmmreg*,mem32 AVX,SANDYBRIDGE,ND,SD + VCVTSI2SS xmmreg,xmmreg*,rm64 AVX,SANDYBRIDGE,LONG + VCVTSS2SD xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VCVTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE + VCVTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG + VCVTTPD2DQ xmmreg,xmmreg AVX,SANDYBRIDGE + VCVTTPD2DQ xmmreg,mem128 AVX,SANDYBRIDGE,SO + VCVTTPD2DQ xmmreg,ymmreg AVX,SANDYBRIDGE + VCVTTPD2DQ xmmreg,mem256 AVX,SANDYBRIDGE,SY + VCVTTPS2DQ xmmreg,xmmrm128 AVX,SANDYBRIDGE + VCVTTPS2DQ ymmreg,ymmrm256 AVX,SANDYBRIDGE + VCVTTSD2SI reg32,xmmrm64 AVX,SANDYBRIDGE + VCVTTSD2SI reg64,xmmrm64 AVX,SANDYBRIDGE,LONG + VCVTTSS2SI reg32,xmmrm32 AVX,SANDYBRIDGE + VCVTTSS2SI reg64,xmmrm32 AVX,SANDYBRIDGE,LONG + VDIVPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VDIVPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VDIVPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VDIVPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VDIVSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VDIVSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VDPPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VDPPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VDPPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VEXTRACTF128 xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VEXTRACTPS rm32,xmmreg,imm8 AVX,SANDYBRIDGE + VHADDPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHADDPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHADDPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHADDPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VHSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VHSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VINSERTF128 ymmreg,ymmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VLDDQU xmmreg,mem128 AVX,SANDYBRIDGE + VLDQQU ymmreg,mem256 AVX,SANDYBRIDGE + VLDDQU ymmreg,mem256 AVX,SANDYBRIDGE + VLDMXCSR mem32 AVX,SANDYBRIDGE + VMASKMOVDQU xmmreg,xmmreg AVX,SANDYBRIDGE + VMASKMOVPS xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE + VMASKMOVPS ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE + VMASKMOVPS mem128,xmmreg,xmmreg AVX,SANDYBRIDGE,SO + VMASKMOVPS mem256,xmmreg,xmmreg AVX,SANDYBRIDGE,SY + VMASKMOVPD xmmreg,xmmreg,mem128 AVX,SANDYBRIDGE + VMASKMOVPD ymmreg,ymmreg,mem256 AVX,SANDYBRIDGE + VMASKMOVPD mem128,xmmreg,xmmreg AVX,SANDYBRIDGE + VMASKMOVPD mem256,ymmreg,ymmreg AVX,SANDYBRIDGE + VMAXPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMAXPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMAXPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMAXPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMAXSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMAXSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VMINPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMINPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMINPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMINPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMINSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMINSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VMOVAPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVAPD xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVAPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVAPD ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVAPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVAPS xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVAPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVAPS ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VMOVQ xmmrm64,xmmreg AVX,SANDYBRIDGE + VMOVQ xmmreg,rm64 AVX,SANDYBRIDGE,LONG + VMOVQ rm64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVD xmmreg,rm32 AVX,SANDYBRIDGE + VMOVD rm32,xmmreg AVX,SANDYBRIDGE + VMOVDDUP xmmreg,xmmrm64 AVX,SANDYBRIDGE + VMOVDDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVDQA xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVDQA xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVQQA ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVQQA ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQA ymmreg,ymmrm AVX,SANDYBRIDGE + VMOVDQA ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQU xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVDQU xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVQQU ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVQQU ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVDQU ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVDQU ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVHLPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVHPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVHPD mem64,xmmreg AVX,SANDYBRIDGE + VMOVHPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVHPS mem64,xmmreg AVX,SANDYBRIDGE + VMOVLHPS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVLPD xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVLPD mem64,xmmreg AVX,SANDYBRIDGE + VMOVLPS xmmreg,xmmreg*,mem64 AVX,SANDYBRIDGE + VMOVLPS mem64,xmmreg AVX,SANDYBRIDGE + VMOVMSKPD reg64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPD reg32,xmmreg AVX,SANDYBRIDGE + VMOVMSKPD reg64,ymmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPD reg32,ymmreg AVX,SANDYBRIDGE + VMOVMSKPS reg64,xmmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPS reg32,xmmreg AVX,SANDYBRIDGE + VMOVMSKPS reg64,ymmreg AVX,SANDYBRIDGE,LONG + VMOVMSKPS reg32,ymmreg AVX,SANDYBRIDGE + VMOVNTDQ mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTQQ mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTDQ mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTDQA xmmreg,mem128 AVX,SANDYBRIDGE + VMOVNTPD mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTPD mem256,ymmreg AVX,SANDYBRIDGE + VMOVNTPS mem128,xmmreg AVX,SANDYBRIDGE + VMOVNTPS mem128,ymmreg AVX,SANDYBRIDGE + VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSD xmmreg,mem64 AVX,SANDYBRIDGE + VMOVSD xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSD mem64,xmmreg AVX,SANDYBRIDGE + VMOVSHDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVSHDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVSLDUP xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVSLDUP ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSS xmmreg,mem64 AVX,SANDYBRIDGE + VMOVSS xmmreg,xmmreg*,xmmreg AVX,SANDYBRIDGE + VMOVSS mem64,xmmreg AVX,SANDYBRIDGE + VMOVUPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVUPD xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVUPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVUPD ymmrm256,ymmreg AVX,SANDYBRIDGE + VMOVUPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VMOVUPS xmmrm128,xmmreg AVX,SANDYBRIDGE + VMOVUPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VMOVUPS ymmrm256,ymmreg AVX,SANDYBRIDGE + VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VMULPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMULPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMULPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VMULPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VMULSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VMULSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VPABSB xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPABSW xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPABSD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPACKSSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKSSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKUSWB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPACKUSDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPADDUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VPAND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPANDN xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPAVGB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPAVGW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPESTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPESTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPISTRI xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPISTRM xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPCMPEQB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPEQQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCMPGTQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPERMILPD xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILPD ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMILPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILTD2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILTD2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILTD2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILTD2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMO2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMO2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMO2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMO2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMZ2PD xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMZ2PD xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMZ2PD ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMZ2PD ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMIL2PD xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PD xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMIL2PD ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PD ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILPS xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILPS ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMILPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERMILTD2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILTD2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILTD2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILTD2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMO2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMO2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMO2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMO2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMILMZ2PS xmmreg,xmmreg,xmmrm128,xmmreg AVX,SANDYBRIDGE + VPERMILMZ2PS xmmreg,xmmreg,xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPERMILMZ2PS ymmreg,ymmreg,ymmrm256,ymmreg AVX,SANDYBRIDGE + VPERMILMZ2PS ymmreg,ymmreg,ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPERMIL2PS xmmreg,xmmreg,xmmrm128,xmmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PS xmmreg,xmmreg,xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPERMIL2PS ymmreg,ymmreg,ymmrm256,ymmreg,imm8 AVX,SANDYBRIDGE + VPERMIL2PS ymmreg,ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPERM2F128 ymmreg,ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VPEXTRB reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRB reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRB mem8,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRW reg32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRW mem16,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRD reg64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPEXTRD rm32,xmmreg,imm8 AVX,SANDYBRIDGE + VPEXTRQ rm64,xmmreg,imm8 AVX,SANDYBRIDGE,LONG + VPHADDW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHADDD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHADDSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHMINPOSUW xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPHSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPHSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,mem8,imm8 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,rm8,imm8 AVX,SANDYBRIDGE + VPINSRB xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,mem16,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,rm16,imm8 AVX,SANDYBRIDGE + VPINSRW xmmreg,xmmreg*,reg32,imm8 AVX,SANDYBRIDGE + VPINSRD xmmreg,xmmreg*,mem32,imm8 AVX,SANDYBRIDGE + VPINSRD xmmreg,xmmreg*,rm32,imm8 AVX,SANDYBRIDGE + VPINSRQ xmmreg,xmmreg*,mem64,imm8 AVX,SANDYBRIDGE,LONG + VPINSRQ xmmreg,xmmreg*,rm64,imm8 AVX,SANDYBRIDGE,LONG + VPMADDWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMADDUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMAXUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINSD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMINUD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMOVMSKB reg64,xmmreg AVX,SANDYBRIDGE,LONG + VPMOVMSKB reg32,xmmreg AVX,SANDYBRIDGE + VPMOVSXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVSXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVSXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE + VPMOVSXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVSXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVSXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXBW xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXBD xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVZXBQ xmmreg,xmmrm16 AVX,SANDYBRIDGE + VPMOVZXWD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMOVZXWQ xmmreg,xmmrm32 AVX,SANDYBRIDGE + VPMOVZXDQ xmmreg,xmmrm64 AVX,SANDYBRIDGE + VPMULHUW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULHRSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULHW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULUDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPMULDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSADBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSHUFB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSHUFD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSHUFHW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSHUFLW xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VPSIGNB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSIGNW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSIGND xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLDQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSLLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSLLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRAW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRAW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRAD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRAD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLW xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLD xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPSRLQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSRLQ xmmreg,xmmreg*,imm8 AVX,SANDYBRIDGE + VPTEST xmmreg,xmmrm128 AVX,SANDYBRIDGE + VPTEST ymmreg,ymmrm256 AVX,SANDYBRIDGE + VPSUBB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBUSB xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPSUBUSW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPXOR xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VRCPPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VRCPPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VRCPSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VRSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VRSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VRSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VROUNDPD xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VROUNDPD ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VROUNDPS xmmreg,xmmrm128,imm8 AVX,SANDYBRIDGE + VROUNDPS ymmreg,ymmrm256,imm8 AVX,SANDYBRIDGE + VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 AVX,SANDYBRIDGE + VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 AVX,SANDYBRIDGE + VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 AVX,SANDYBRIDGE + VSQRTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VSQRTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VSQRTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VSQRTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VSQRTSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VSQRTSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VSTMXCSR mem32 AVX,SANDYBRIDGE + VSUBPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VSUBPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VSUBPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VSUBPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VSUBSD xmmreg,xmmreg*,xmmrm64 AVX,SANDYBRIDGE + VSUBSS xmmreg,xmmreg*,xmmrm32 AVX,SANDYBRIDGE + VTESTPS xmmreg,xmmrm128 AVX,SANDYBRIDGE + VTESTPS ymmreg,ymmrm256 AVX,SANDYBRIDGE + VTESTPD xmmreg,xmmrm128 AVX,SANDYBRIDGE + VTESTPD ymmreg,ymmrm256 AVX,SANDYBRIDGE + VUCOMISD xmmreg,xmmrm64 AVX,SANDYBRIDGE + VUCOMISS xmmreg,xmmrm32 AVX,SANDYBRIDGE + VUNPCKHPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKHPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKHPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKHPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKLPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKLPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VUNPCKLPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VUNPCKLPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VXORPD xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VXORPD ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VXORPS xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VXORPS ymmreg,ymmreg*,ymmrm256 AVX,SANDYBRIDGE + VZEROALL AVX,SANDYBRIDGE + VZEROUPPER AVX,SANDYBRIDGE + +B.1.26 Intel Carry-Less Multiplication instructions (CLMUL) + + PCLMULLQLQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULHQLQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULLQHQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULHQHQDQ xmmreg,xmmrm128 SSE,WESTMERE + PCLMULQDQ xmmreg,xmmrm128,imm8 SSE,WESTMERE + +B.1.27 Intel AVX Carry-Less Multiplication instructions (CLMUL) + + VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 AVX,SANDYBRIDGE + VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 AVX,SANDYBRIDGE + +B.1.28 Intel Fused Multiply-Add instructions (FMA) + + VFMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMADD321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMADD321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB132PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB132PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB132PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB132PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB312PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB312PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB312PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB312PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB213PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB213PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB213PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB213PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB123PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB123PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB123PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB123PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB231PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB231PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB231PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB231PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB321PS xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB321PS ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFNMSUB321PD xmmreg,xmmreg,xmmrm128 FMA,FUTURE + VFNMSUB321PD ymmreg,ymmreg,ymmrm256 FMA,FUTURE + VFMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMADD321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMADD321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB132SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB132SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB312SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB312SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB213SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB213SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB123SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB123SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB231SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB231SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + VFNMSUB321SS xmmreg,xmmreg,xmmrm32 FMA,FUTURE + VFNMSUB321SD xmmreg,xmmreg,xmmrm64 FMA,FUTURE + +B.1.29 VIA (Centaur) security instructions + + XSTORE PENT,CYRIX + XCRYPTECB PENT,CYRIX + XCRYPTCBC PENT,CYRIX + XCRYPTCTR PENT,CYRIX + XCRYPTCFB PENT,CYRIX + XCRYPTOFB PENT,CYRIX + MONTMUL PENT,CYRIX + XSHA1 PENT,CYRIX + XSHA256 PENT,CYRIX + +B.1.30 AMD Lightweight Profiling (LWP) instructions + + LLWPCB reg16 AMD + LLWPCB reg32 AMD,386 + LLWPCB reg64 AMD,X64 + SLWPCB reg16 AMD + SLWPCB reg32 AMD,386 + SLWPCB reg64 AMD,X64 + LWPVAL reg16,rm32,imm16 AMD,386 + LWPVAL reg32,rm32,imm32 AMD,386 + LWPVAL reg64,rm32,imm32 AMD,X64 + LWPINS reg16,rm32,imm16 AMD,386 + LWPINS reg32,rm32,imm32 AMD,386 + LWPINS reg64,rm32,imm32 AMD,X64 + +B.1.31 AMD XOP, FMA4 and CVT16 instructions (SSE5) + + VCVTPH2PS xmmreg,xmmrm64*,imm8 AMD,SSE5 + VCVTPH2PS ymmreg,xmmrm128,imm8 AMD,SSE5 + VCVTPH2PS ymmreg,ymmrm128*,imm8 AMD,SSE5 + VCVTPS2PH xmmrm64,xmmreg*,imm8 AMD,SSE5 + VCVTPS2PH xmmrm128,ymmreg,imm8 AMD,SSE5 + VCVTPS2PH ymmrm128,ymmreg*,imm8 AMD,SSE5 + VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg AMD,SSE5 + VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 AMD,SSE5 + VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg AMD,SSE5 + VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 AMD,SSE5 + VFRCZPD xmmreg,xmmrm128* AMD,SSE5 + VFRCZPD ymmreg,ymmrm256* AMD,SSE5 + VFRCZPS xmmreg,xmmrm128* AMD,SSE5 + VFRCZPS ymmreg,ymmrm256* AMD,SSE5 + VFRCZSD xmmreg,xmmrm64* AMD,SSE5 + VFRCZSS xmmreg,xmmrm32* AMD,SSE5 + VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg AMD,SSE5 + VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 AMD,SSE5 + VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 AMD,SSE5 + VPHADDBD xmmreg,xmmrm128* AMD,SSE5 + VPHADDBQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDBW xmmreg,xmmrm128* AMD,SSE5 + VPHADDDQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBD xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUBW xmmreg,xmmrm128* AMD,SSE5 + VPHADDUDQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDUWD xmmreg,xmmrm128* AMD,SSE5 + VPHADDUWQ xmmreg,xmmrm128* AMD,SSE5 + VPHADDWD xmmreg,xmmrm128* AMD,SSE5 + VPHADDWQ xmmreg,xmmrm128* AMD,SSE5 + VPHSUBBW xmmreg,xmmrm128* AMD,SSE5 + VPHSUBDQ xmmreg,xmmrm128* AMD,SSE5 + VPHSUBWD xmmreg,xmmrm128* AMD,SSE5 + VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 AMD,SSE5 + VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg AMD,SSE5 + VPROTB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTB xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTD xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTQ xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPROTW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPROTW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPROTW xmmreg,xmmrm128*,imm8 AMD,SSE5 + VPSHAB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHAW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHAW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLB xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLB xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLD xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLD xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLQ xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLQ xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + VPSHLW xmmreg,xmmrm128*,xmmreg AMD,SSE5 + VPSHLW xmmreg,xmmreg*,xmmrm128 AMD,SSE5 + +B.1.32 Systematic names for the hinting nop instructions + + HINT_NOP0 rm16 P6,UNDOC + HINT_NOP0 rm32 P6,UNDOC + HINT_NOP0 rm64 X64,UNDOC + HINT_NOP1 rm16 P6,UNDOC + HINT_NOP1 rm32 P6,UNDOC + HINT_NOP1 rm64 X64,UNDOC + HINT_NOP2 rm16 P6,UNDOC + HINT_NOP2 rm32 P6,UNDOC + HINT_NOP2 rm64 X64,UNDOC + HINT_NOP3 rm16 P6,UNDOC + HINT_NOP3 rm32 P6,UNDOC + HINT_NOP3 rm64 X64,UNDOC + HINT_NOP4 rm16 P6,UNDOC + HINT_NOP4 rm32 P6,UNDOC + HINT_NOP4 rm64 X64,UNDOC + HINT_NOP5 rm16 P6,UNDOC + HINT_NOP5 rm32 P6,UNDOC + HINT_NOP5 rm64 X64,UNDOC + HINT_NOP6 rm16 P6,UNDOC + HINT_NOP6 rm32 P6,UNDOC + HINT_NOP6 rm64 X64,UNDOC + HINT_NOP7 rm16 P6,UNDOC + HINT_NOP7 rm32 P6,UNDOC + HINT_NOP7 rm64 X64,UNDOC + HINT_NOP8 rm16 P6,UNDOC + HINT_NOP8 rm32 P6,UNDOC + HINT_NOP8 rm64 X64,UNDOC + HINT_NOP9 rm16 P6,UNDOC + HINT_NOP9 rm32 P6,UNDOC + HINT_NOP9 rm64 X64,UNDOC + HINT_NOP10 rm16 P6,UNDOC + HINT_NOP10 rm32 P6,UNDOC + HINT_NOP10 rm64 X64,UNDOC + HINT_NOP11 rm16 P6,UNDOC + HINT_NOP11 rm32 P6,UNDOC + HINT_NOP11 rm64 X64,UNDOC + HINT_NOP12 rm16 P6,UNDOC + HINT_NOP12 rm32 P6,UNDOC + HINT_NOP12 rm64 X64,UNDOC + HINT_NOP13 rm16 P6,UNDOC + HINT_NOP13 rm32 P6,UNDOC + HINT_NOP13 rm64 X64,UNDOC + HINT_NOP14 rm16 P6,UNDOC + HINT_NOP14 rm32 P6,UNDOC + HINT_NOP14 rm64 X64,UNDOC + HINT_NOP15 rm16 P6,UNDOC + HINT_NOP15 rm32 P6,UNDOC + HINT_NOP15 rm64 X64,UNDOC + HINT_NOP16 rm16 P6,UNDOC + HINT_NOP16 rm32 P6,UNDOC + HINT_NOP16 rm64 X64,UNDOC + HINT_NOP17 rm16 P6,UNDOC + HINT_NOP17 rm32 P6,UNDOC + HINT_NOP17 rm64 X64,UNDOC + HINT_NOP18 rm16 P6,UNDOC + HINT_NOP18 rm32 P6,UNDOC + HINT_NOP18 rm64 X64,UNDOC + HINT_NOP19 rm16 P6,UNDOC + HINT_NOP19 rm32 P6,UNDOC + HINT_NOP19 rm64 X64,UNDOC + HINT_NOP20 rm16 P6,UNDOC + HINT_NOP20 rm32 P6,UNDOC + HINT_NOP20 rm64 X64,UNDOC + HINT_NOP21 rm16 P6,UNDOC + HINT_NOP21 rm32 P6,UNDOC + HINT_NOP21 rm64 X64,UNDOC + HINT_NOP22 rm16 P6,UNDOC + HINT_NOP22 rm32 P6,UNDOC + HINT_NOP22 rm64 X64,UNDOC + HINT_NOP23 rm16 P6,UNDOC + HINT_NOP23 rm32 P6,UNDOC + HINT_NOP23 rm64 X64,UNDOC + HINT_NOP24 rm16 P6,UNDOC + HINT_NOP24 rm32 P6,UNDOC + HINT_NOP24 rm64 X64,UNDOC + HINT_NOP25 rm16 P6,UNDOC + HINT_NOP25 rm32 P6,UNDOC + HINT_NOP25 rm64 X64,UNDOC + HINT_NOP26 rm16 P6,UNDOC + HINT_NOP26 rm32 P6,UNDOC + HINT_NOP26 rm64 X64,UNDOC + HINT_NOP27 rm16 P6,UNDOC + HINT_NOP27 rm32 P6,UNDOC + HINT_NOP27 rm64 X64,UNDOC + HINT_NOP28 rm16 P6,UNDOC + HINT_NOP28 rm32 P6,UNDOC + HINT_NOP28 rm64 X64,UNDOC + HINT_NOP29 rm16 P6,UNDOC + HINT_NOP29 rm32 P6,UNDOC + HINT_NOP29 rm64 X64,UNDOC + HINT_NOP30 rm16 P6,UNDOC + HINT_NOP30 rm32 P6,UNDOC + HINT_NOP30 rm64 X64,UNDOC + HINT_NOP31 rm16 P6,UNDOC + HINT_NOP31 rm32 P6,UNDOC + HINT_NOP31 rm64 X64,UNDOC + HINT_NOP32 rm16 P6,UNDOC + HINT_NOP32 rm32 P6,UNDOC + HINT_NOP32 rm64 X64,UNDOC + HINT_NOP33 rm16 P6,UNDOC + HINT_NOP33 rm32 P6,UNDOC + HINT_NOP33 rm64 X64,UNDOC + HINT_NOP34 rm16 P6,UNDOC + HINT_NOP34 rm32 P6,UNDOC + HINT_NOP34 rm64 X64,UNDOC + HINT_NOP35 rm16 P6,UNDOC + HINT_NOP35 rm32 P6,UNDOC + HINT_NOP35 rm64 X64,UNDOC + HINT_NOP36 rm16 P6,UNDOC + HINT_NOP36 rm32 P6,UNDOC + HINT_NOP36 rm64 X64,UNDOC + HINT_NOP37 rm16 P6,UNDOC + HINT_NOP37 rm32 P6,UNDOC + HINT_NOP37 rm64 X64,UNDOC + HINT_NOP38 rm16 P6,UNDOC + HINT_NOP38 rm32 P6,UNDOC + HINT_NOP38 rm64 X64,UNDOC + HINT_NOP39 rm16 P6,UNDOC + HINT_NOP39 rm32 P6,UNDOC + HINT_NOP39 rm64 X64,UNDOC + HINT_NOP40 rm16 P6,UNDOC + HINT_NOP40 rm32 P6,UNDOC + HINT_NOP40 rm64 X64,UNDOC + HINT_NOP41 rm16 P6,UNDOC + HINT_NOP41 rm32 P6,UNDOC + HINT_NOP41 rm64 X64,UNDOC + HINT_NOP42 rm16 P6,UNDOC + HINT_NOP42 rm32 P6,UNDOC + HINT_NOP42 rm64 X64,UNDOC + HINT_NOP43 rm16 P6,UNDOC + HINT_NOP43 rm32 P6,UNDOC + HINT_NOP43 rm64 X64,UNDOC + HINT_NOP44 rm16 P6,UNDOC + HINT_NOP44 rm32 P6,UNDOC + HINT_NOP44 rm64 X64,UNDOC + HINT_NOP45 rm16 P6,UNDOC + HINT_NOP45 rm32 P6,UNDOC + HINT_NOP45 rm64 X64,UNDOC + HINT_NOP46 rm16 P6,UNDOC + HINT_NOP46 rm32 P6,UNDOC + HINT_NOP46 rm64 X64,UNDOC + HINT_NOP47 rm16 P6,UNDOC + HINT_NOP47 rm32 P6,UNDOC + HINT_NOP47 rm64 X64,UNDOC + HINT_NOP48 rm16 P6,UNDOC + HINT_NOP48 rm32 P6,UNDOC + HINT_NOP48 rm64 X64,UNDOC + HINT_NOP49 rm16 P6,UNDOC + HINT_NOP49 rm32 P6,UNDOC + HINT_NOP49 rm64 X64,UNDOC + HINT_NOP50 rm16 P6,UNDOC + HINT_NOP50 rm32 P6,UNDOC + HINT_NOP50 rm64 X64,UNDOC + HINT_NOP51 rm16 P6,UNDOC + HINT_NOP51 rm32 P6,UNDOC + HINT_NOP51 rm64 X64,UNDOC + HINT_NOP52 rm16 P6,UNDOC + HINT_NOP52 rm32 P6,UNDOC + HINT_NOP52 rm64 X64,UNDOC + HINT_NOP53 rm16 P6,UNDOC + HINT_NOP53 rm32 P6,UNDOC + HINT_NOP53 rm64 X64,UNDOC + HINT_NOP54 rm16 P6,UNDOC + HINT_NOP54 rm32 P6,UNDOC + HINT_NOP54 rm64 X64,UNDOC + HINT_NOP55 rm16 P6,UNDOC + HINT_NOP55 rm32 P6,UNDOC + HINT_NOP55 rm64 X64,UNDOC + HINT_NOP56 rm16 P6,UNDOC + HINT_NOP56 rm32 P6,UNDOC + HINT_NOP56 rm64 X64,UNDOC + HINT_NOP57 rm16 P6,UNDOC + HINT_NOP57 rm32 P6,UNDOC + HINT_NOP57 rm64 X64,UNDOC + HINT_NOP58 rm16 P6,UNDOC + HINT_NOP58 rm32 P6,UNDOC + HINT_NOP58 rm64 X64,UNDOC + HINT_NOP59 rm16 P6,UNDOC + HINT_NOP59 rm32 P6,UNDOC + HINT_NOP59 rm64 X64,UNDOC + HINT_NOP60 rm16 P6,UNDOC + HINT_NOP60 rm32 P6,UNDOC + HINT_NOP60 rm64 X64,UNDOC + HINT_NOP61 rm16 P6,UNDOC + HINT_NOP61 rm32 P6,UNDOC + HINT_NOP61 rm64 X64,UNDOC + HINT_NOP62 rm16 P6,UNDOC + HINT_NOP62 rm32 P6,UNDOC + HINT_NOP62 rm64 X64,UNDOC + HINT_NOP63 rm16 P6,UNDOC + HINT_NOP63 rm32 P6,UNDOC + HINT_NOP63 rm64 X64,UNDOC + +Appendix C: NASM Version History +-------------------------------- + + C.1 NASM 2 Series + + The NASM 2 series support x86-64, and is the production version of + NASM since 2007. + + C.1.1 Version 2.08 + + (*) A number of enhancements/fixes in macros area. + + (*) Support for arbitrarily terminating macro expansions + `%exitmacro'. See section 4.3.12. + + (*) Support for recursive macro expansion `%rmacro/irmacro'. See + section 4.3.1. + + (*) Support for converting strings to tokens. See section 4.1.9. + + (*) Fuzzy operand size logic introduced. + + (*) Fix COFF stack overrun on too long export identifiers. + + (*) Fix Macho-O alignment bug. + + (*) Fix crashes with -fwin32 on file with many exports. + + (*) Fix stack overrun for too long [DEBUG id]. + + (*) Fix incorrect sbyte usage in IMUL (hit only if optimization flag + passed). + + (*) Append ending token for `.stabs' records in the ELF output + format. + + (*) New NSIS script which uses ModernUI and MultiUser approach. + + (*) Visual Studio 2008 NASM integration (rules file). + + (*) Warn a user if a constant is too long (and as result will be + stripped). + + (*) The obsoleted pre-XOP AMD SSE5 instruction set which was never + actualized was removed. + + (*) Fix stack overrun on too long error file name passed from the + command line. + + (*) Bind symbols to the .text section by default (ie in case if + SECTION directive was omitted) in the ELF output format. + + (*) Fix sync points array index wrapping. + + (*) A few fixes for FMA4 and XOP instruction templates. + + (*) Add AMD Lightweight Profiling (LWP) instructions. + + C.1.2 Version 2.07 + + (*) NASM is now under the 2-clause BSD license. See section 1.1.2. + + (*) Fix the section type for the `.strtab' section in the `elf64' + output format. + + (*) Fix the handling of `COMMON' directives in the `obj' output + format. + + (*) New `ith' and `srec' output formats; these are variants of the + `bin' output format which output Intel hex and Motorola S- + records, respectively. See section 7.2 and section 7.3. + + (*) `rdf2ihx' replaced with an enhanced `rdf2bin', which can output + binary, COM, Intel hex or Motorola S-records. + + (*) The Windows installer now puts the NASM directory first in the + `PATH' of the "NASM Shell". + + (*) Revert the early expansion behavior of `%+' to pre-2.06 + behavior: `%+' is only expanded late. + + (*) Yet another Mach-O alignment fix. + + (*) Don't delete the list file on errors. Also, include error and + warning information in the list file. + + (*) Support for 64-bit Mach-O output, see section 7.8. + + (*) Fix assert failure on certain operations that involve strings + with high-bit bytes. + + C.1.3 Version 2.06 + + (*) This release is dedicated to the memory of Charles A. Crayne, + long time NASM developer as well as moderator of + `comp.lang.asm.x86' and author of the book _Serious Assembler_. + We miss you, Chuck. + + (*) Support for indirect macro expansion (`%[...]'). See section + 4.1.3. + + (*) `%pop' can now take an argument, see section 4.7.1. + + (*) The argument to `%use' is no longer macro-expanded. Use `%[...]' + if macro expansion is desired. + + (*) Support for thread-local storage in ELF32 and ELF64. See section + 7.9.4. + + (*) Fix crash on `%ifmacro' without an argument. + + (*) Correct the arguments to the `POPCNT' instruction. + + (*) Fix section alignment in the Mach-O format. + + (*) Update AVX support to version 5 of the Intel specification. + + (*) Fix the handling of accesses to context-local macros from higher + levels in the context stack. + + (*) Treat `WAIT' as a prefix rather than as an instruction, thereby + allowing constructs like `O16 FSAVE' to work correctly. + + (*) Support for structures with a non-zero base offset. See section + 4.11.10. + + (*) Correctly handle preprocessor token concatenation (see section + 4.3.8) involving floating-point numbers. + + (*) The `PINSR' series of instructions have been corrected and + rationalized. + + (*) Removed AMD SSE5, replaced with the new XOP/FMA4/CVT16 (rev + 3.03) spec. + + (*) The ELF backends no longer automatically generate a `.comment' + section. + + (*) Add additional "well-known" ELF sections with default + attributes. See section 7.9.2. + + C.1.4 Version 2.05.01 + + (*) Fix the `-w'/`-W' option parsing, which was broken in NASM 2.05. + + C.1.5 Version 2.05 + + (*) Fix redundant REX.W prefix on `JMP reg64'. + + (*) Make the behaviour of `-O0' match NASM 0.98 legacy behavior. See + section 2.1.22. + + (*) `-w-user' can be used to suppress the output of `%warning' + directives. See section 2.1.24. + + (*) Fix bug where `ALIGN' would issue a full alignment datum instead + of zero bytes. + + (*) Fix offsets in list files. + + (*) Fix `%include' inside multi-line macros or loops. + + (*) Fix error where NASM would generate a spurious warning on valid + optimizations of immediate values. + + (*) Fix arguments to a number of the `CVT' SSE instructions. + + (*) Fix RIP-relative offsets when the instruction carries an + immediate. + + (*) Massive overhaul of the ELF64 backend for spec compliance. + + (*) Fix the Geode `PFRCPV' and `PFRSQRTV' instruction. + + (*) Fix the SSE 4.2 `CRC32' instruction. + + C.1.6 Version 2.04 + + (*) Sanitize macro handing in the `%error' directive. + + (*) New `%warning' directive to issue user-controlled warnings. + + (*) `%error' directives are now deferred to the final assembly + phase. + + (*) New `%fatal' directive to immediately terminate assembly. + + (*) New `%strcat' directive to join quoted strings together. + + (*) New `%use' macro directive to support standard macro directives. + See section 4.6.4. + + (*) Excess default parameters to `%macro' now issues a warning by + default. See section 4.3. + + (*) Fix `%ifn' and `%elifn'. + + (*) Fix nested `%else' clauses. + + (*) Correct the handling of nested `%rep's. + + (*) New `%unmacro' directive to undeclare a multi-line macro. See + section 4.3.11. + + (*) Builtin macro `__PASS__' which expands to the current assembly + pass. See section 4.11.9. + + (*) `__utf16__' and `__utf32__' operators to generate UTF-16 and + UTF-32 strings. See section 3.4.5. + + (*) Fix bug in case-insensitive matching when compiled on platforms + that don't use the `configure' script. Of the official release + binaries, that only affected the OS/2 binary. + + (*) Support for x87 packed BCD constants. See section 3.4.7. + + (*) Correct the `LTR' and `SLDT' instructions in 64-bit mode. + + (*) Fix unnecessary REX.W prefix on indirect jumps in 64-bit mode. + + (*) Add AVX versions of the AES instructions (`VAES'...). + + (*) Fix the 256-bit FMA instructions. + + (*) Add 256-bit AVX stores per the latest AVX spec. + + (*) VIA XCRYPT instructions can now be written either with or + without `REP', apparently different versions of the VIA spec + wrote them differently. + + (*) Add missing 64-bit `MOVNTI' instruction. + + (*) Fix the operand size of `VMREAD' and `VMWRITE'. + + (*) Numerous bug fixes, especially to the AES, AVX and VTX + instructions. + + (*) The optimizer now always runs until it converges. It also runs + even when disabled, but doesn't optimize. This allows most + forward references to be resolved properly. + + (*) `%push' no longer needs a context identifier; omitting the + context identifier results in an anonymous context. + + C.1.7 Version 2.03.01 + + (*) Fix buffer overflow in the listing module. + + (*) Fix the handling of hexadecimal escape codes in `...` strings. + + (*) The Postscript/PDF documentation has been reformatted. + + (*) The `-F' option now implies `-g'. + + C.1.8 Version 2.03 + + (*) Add support for Intel AVX, CLMUL and FMA instructions, including + YMM registers. + + (*) `dy', `resy' and `yword' for 32-byte operands. + + (*) Fix some SSE5 instructions. + + (*) Intel `INVEPT', `INVVPID' and `MOVBE' instructions. + + (*) Fix checking for critical expressions when the optimizer is + enabled. + + (*) Support the DWARF debugging format for ELF targets. + + (*) Fix optimizations of signed bytes. + + (*) Fix operation on bigendian machines. + + (*) Fix buffer overflow in the preprocessor. + + (*) `SAFESEH' support for Win32, `IMAGEREL' for Win64 (SEH). + + (*) `%?' and `%??' to refer to the name of a macro itself. In + particular, `%idefine keyword $%?' can be used to make a keyword + "disappear". + + (*) New options for dependency generation: `-MD', `-MF', `-MP', + `-MT', `-MQ'. + + (*) New preprocessor directives `%pathsearch' and `%depend'; INCBIN + reimplemented as a macro. + + (*) `%include' now resolves macros in a sane manner. + + (*) `%substr' can now be used to get other than one-character + substrings. + + (*) New type of character/string constants, using backquotes + (``...`'), which support C-style escape sequences. + + (*) `%defstr' and `%idefstr' to stringize macro definitions before + creation. + + (*) Fix forward references used in `EQU' statements. + + C.1.9 Version 2.02 + + (*) Additional fixes for MMX operands with explicit `qword', as well + as (hopefully) SSE operands with `oword'. + + (*) Fix handling of truncated strings with `DO'. + + (*) Fix segfaults due to memory overwrites when floating-point + constants were used. + + (*) Fix segfaults due to missing include files. + + (*) Fix OpenWatcom Makefiles for DOS and OS/2. + + (*) Add autogenerated instruction list back into the documentation. + + (*) ELF: Fix segfault when generating stabs, and no symbols have + been defined. + + (*) ELF: Experimental support for DWARF debugging information. + + (*) New compile date and time standard macros. + + (*) `%ifnum' now returns true for negative numbers. + + (*) New `%iftoken' test for a single token. + + (*) New `%ifempty' test for empty expansion. + + (*) Add support for the `XSAVE' instruction group. + + (*) Makefile for Netware/gcc. + + (*) Fix issue with some warnings getting emitted way too many times. + + (*) Autogenerated instruction list added to the documentation. + +C.1.10 Version 2.01 + + (*) Fix the handling of MMX registers with explicit `qword' tags on + memory (broken in 2.00 due to 64-bit changes.) + + (*) Fix the PREFETCH instructions. + + (*) Fix the documentation. + + (*) Fix debugging info when using `-f elf' (backwards compatibility + alias for `-f elf32'). + + (*) Man pages for rdoff tools (from the Debian project.) + + (*) ELF: handle large numbers of sections. + + (*) Fix corrupt output when the optimizer runs out of passes. + +C.1.11 Version 2.00 + + (*) Added c99 data-type compliance. + + (*) Added general x86-64 support. + + (*) Added win64 (x86-64 COFF) output format. + + (*) Added `__BITS__' standard macro. + + (*) Renamed the `elf' output format to `elf32' for clarity. + + (*) Added `elf64' and `macho' (MacOS X) output formats. + + (*) Added Numeric constants in `dq' directive. + + (*) Added `oword', `do' and `reso' pseudo operands. + + (*) Allow underscores in numbers. + + (*) Added 8-, 16- and 128-bit floating-point formats. + + (*) Added binary, octal and hexadecimal floating-point. + + (*) Correct the generation of floating-point constants. + + (*) Added floating-point option control. + + (*) Added Infinity and NaN floating point support. + + (*) Added ELF Symbol Visibility support. + + (*) Added setting OSABI value in ELF header directive. + + (*) Added Generate Makefile Dependencies option. + + (*) Added Unlimited Optimization Passes option. + + (*) Added `%IFN' and `%ELIFN' support. + + (*) Added Logical Negation Operator. + + (*) Enhanced Stack Relative Preprocessor Directives. + + (*) Enhanced ELF Debug Formats. + + (*) Enhanced Send Errors to a File option. + + (*) Added SSSE3, SSE4.1, SSE4.2, SSE5 support. + + (*) Added a large number of additional instructions. + + (*) Significant performance improvements. + + (*) `-w+warning' and `-w-warning' can now be written as -Wwarning + and -Wno-warning, respectively. See section 2.1.24. + + (*) Add `-w+error' to treat warnings as errors. See section 2.1.24. + + (*) Add `-w+all' and `-w-all' to enable or disable all suppressible + warnings. See section 2.1.24. + + C.2 NASM 0.98 Series + + The 0.98 series was the production versions of NASM from 1999 to + 2007. + + C.2.1 Version 0.98.39 + + (*) fix buffer overflow + + (*) fix outas86's `.bss' handling + + (*) "make spotless" no longer deletes config.h.in. + + (*) `%(el)if(n)idn' insensitivity to string quotes difference + (#809300). + + (*) (nasm.c)`__OUTPUT_FORMAT__' changed to string value instead of + symbol. + + C.2.2 Version 0.98.38 + + (*) Add Makefile for 16-bit DOS binaries under OpenWatcom, and + modify `mkdep.pl' to be able to generate completely pathless + dependencies, as required by OpenWatcom wmake (it supports path + searches, but not explicit paths.) + + (*) Fix the `STR' instruction. + + (*) Fix the ELF output format, which was broken under certain + circumstances due to the addition of stabs support. + + (*) Quick-fix Borland format debug-info for `-f obj' + + (*) Fix for `%rep' with no arguments (#560568) + + (*) Fix concatenation of preprocessor function call (#794686) + + (*) Fix long label causes coredump (#677841) + + (*) Use autoheader as well as autoconf to keep configure from + generating ridiculously long command lines. + + (*) Make sure that all of the formats which support debugging output + actually will suppress debugging output when `-g' not specified. + + C.2.3 Version 0.98.37 + + (*) Paths given in `-I' switch searched for `incbin'-ed as well as + `%include'-ed files. + + (*) Added stabs debugging for the ELF output format, patch from + Martin Wawro. + + (*) Fix `output/outbin.c' to allow origin > 80000000h. + + (*) Make `-U' switch work. + + (*) Fix the use of relative offsets with explicit prefixes, e.g. + `a32 loop foo'. + + (*) Remove `backslash()'. + + (*) Fix the `SMSW' and `SLDT' instructions. + + (*) `-O2' and `-O3' are no longer aliases for `-O10' and `-O15'. If + you mean the latter, please say so! :) + + C.2.4 Version 0.98.36 + + (*) Update rdoff - librarian/archiver - common rec - docs! + + (*) Fix signed/unsigned problems. + + (*) Fix `JMP FAR label' and `CALL FAR label'. + + (*) Add new multisection support - map files - fix align bug + + (*) Fix sysexit, movhps/movlps reg,reg bugs in insns.dat + + (*) `Q' or `O' suffixes indicate octal + + (*) Support Prescott new instructions (PNI). + + (*) Cyrix `XSTORE' instruction. + + C.2.5 Version 0.98.35 + + (*) Fix build failure on 16-bit DOS (Makefile.bc3 workaround for + compiler bug.) + + (*) Fix dependencies and compiler warnings. + + (*) Add "const" in a number of places. + + (*) Add -X option to specify error reporting format (use -Xvc to + integrate with Microsoft Visual Studio.) + + (*) Minor changes for code legibility. + + (*) Drop use of tmpnam() in rdoff (security fix.) + + C.2.6 Version 0.98.34 + + (*) Correct additional address-size vs. operand-size confusions. + + (*) Generate dependencies for all Makefiles automatically. + + (*) Add support for unimplemented (but theoretically available) + registers such as tr0 and cr5. Segment registers 6 and 7 are + called segr6 and segr7 for the operations which they can be + represented. + + (*) Correct some disassembler bugs related to redundant address-size + prefixes. Some work still remains in this area. + + (*) Correctly generate an error for things like "SEG eax". + + (*) Add the JMPE instruction, enabled by "CPU IA64". + + (*) Correct compilation on newer gcc/glibc platforms. + + (*) Issue an error on things like "jmp far eax". + + C.2.7 Version 0.98.33 + + (*) New __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ standard macros + to round out the version-query macros. version.pl now + understands X.YYplWW or X.YY.ZZplWW as a version number, + equivalent to X.YY.ZZ.WW (or X.YY.0.WW, as appropriate). + + (*) New keyword "strict" to disable the optimization of specific + operands. + + (*) Fix the handing of size overrides with JMP instructions + (instructions such as "jmp dword foo".) + + (*) Fix the handling of "ABSOLUTE label", where "label" points into + a relocatable segment. + + (*) Fix OBJ output format with lots of externs. + + (*) More documentation updates. + + (*) Add -Ov option to get verbose information about optimizations. + + (*) Undo a braindead change which broke `%elif' directives. + + (*) Makefile updates. + + C.2.8 Version 0.98.32 + + (*) Fix NASM crashing when `%macro' directives were left + unterminated. + + (*) Lots of documentation updates. + + (*) Complete rewrite of the PostScript/PDF documentation generator. + + (*) The MS Visual C++ Makefile was updated and corrected. + + (*) Recognize .rodata as a standard section name in ELF. + + (*) Fix some obsolete Perl4-isms in Perl scripts. + + (*) Fix configure.in to work with autoconf 2.5x. + + (*) Fix a couple of "make cleaner" misses. + + (*) Make the normal "./configure && make" work with Cygwin. + + C.2.9 Version 0.98.31 + + (*) Correctly build in a separate object directory again. + + (*) Derive all references to the version number from the version + file. + + (*) New standard macros __NASM_SUBMINOR__ and __NASM_VER__ macros. + + (*) Lots of Makefile updates and bug fixes. + + (*) New `%ifmacro' directive to test for multiline macros. + + (*) Documentation updates. + + (*) Fixes for 16-bit OBJ format output. + + (*) Changed the NASM environment variable to NASMENV. + +C.2.10 Version 0.98.30 + + (*) Changed doc files a lot: completely removed old READMExx and + Wishlist files, incorporating all information in CHANGES and + TODO. + + (*) I waited a long time to rename zoutieee.c to (original) + outieee.c + + (*) moved all output modules to output/ subdirectory. + + (*) Added 'make strip' target to strip debug info from nasm & + ndisasm. + + (*) Added INSTALL file with installation instructions. + + (*) Added -v option description to nasm man. + + (*) Added dist makefile target to produce source distributions. + + (*) 16-bit support for ELF output format (GNU extension, but + useful.) + +C.2.11 Version 0.98.28 + + (*) Fastcooked this for Debian's Woody release: Frank applied the + INCBIN bug patch to 0.98.25alt and called it 0.98.28 to not + confuse poor little apt-get. + +C.2.12 Version 0.98.26 + + (*) Reorganised files even better from 0.98.25alt + +C.2.13 Version 0.98.25alt + + (*) Prettified the source tree. Moved files to more reasonable + places. + + (*) Added findleak.pl script to misc/ directory. + + (*) Attempted to fix doc. + +C.2.14 Version 0.98.25 + + (*) Line continuation character `\'. + + (*) Docs inadvertantly reverted - "dos packaging". + +C.2.15 Version 0.98.24p1 + + (*) FIXME: Someone, document this please. + +C.2.16 Version 0.98.24 + + (*) Documentation - Ndisasm doc added to Nasm.doc. + +C.2.17 Version 0.98.23 + + (*) Attempted to remove rdoff version1 + + (*) Lino Mastrodomenico's patches to preproc.c (%$$ bug?). + +C.2.18 Version 0.98.22 + + (*) Update rdoff2 - attempt to remove v1. + +C.2.19 Version 0.98.21 + + (*) Optimization fixes. + +C.2.20 Version 0.98.20 + + (*) Optimization fixes. + +C.2.21 Version 0.98.19 + + (*) H. J. Lu's patch back out. + +C.2.22 Version 0.98.18 + + (*) Added ".rdata" to "-f win32". + +C.2.23 Version 0.98.17 + + (*) H. J. Lu's "bogus elf" patch. (Red Hat problem?) + +C.2.24 Version 0.98.16 + + (*) Fix whitespace before "[section ..." bug. + +C.2.25 Version 0.98.15 + + (*) Rdoff changes (?). + + (*) Fix fixes to memory leaks. + +C.2.26 Version 0.98.14 + + (*) Fix memory leaks. + +C.2.27 Version 0.98.13 + + (*) There was no 0.98.13 + +C.2.28 Version 0.98.12 + + (*) Update optimization (new function of "-O1") + + (*) Changes to test/bintest.asm (?). + +C.2.29 Version 0.98.11 + + (*) Optimization changes. + + (*) Ndisasm fixed. + +C.2.30 Version 0.98.10 + + (*) There was no 0.98.10 + +C.2.31 Version 0.98.09 + + (*) Add multiple sections support to "-f bin". + + (*) Changed GLOBAL_TEMP_BASE in outelf.c from 6 to 15. + + (*) Add "-v" as an alias to the "-r" switch. + + (*) Remove "#ifdef" from Tasm compatibility options. + + (*) Remove redundant size-overrides on "mov ds, ex", etc. + + (*) Fixes to SSE2, other insns.dat (?). + + (*) Enable uppercase "I" and "P" switches. + + (*) Case insinsitive "seg" and "wrt". + + (*) Update install.sh (?). + + (*) Allocate tokens in blocks. + + (*) Improve "invalid effective address" messages. + +C.2.32 Version 0.98.08 + + (*) Add "`%strlen'" and "`%substr'" macro operators + + (*) Fixed broken c16.mac. + + (*) Unterminated string error reported. + + (*) Fixed bugs as per 0.98bf + +C.2.33 Version 0.98.09b with John Coffman patches released 28-Oct-2001 + + Changes from 0.98.07 release to 98.09b as of 28-Oct-2001 + + (*) More closely compatible with 0.98 when -O0 is implied or + specified. Not strictly identical, since backward branches in + range of short offsets are recognized, and signed byte values + with no explicit size specification will be assembled as a + single byte. + + (*) More forgiving with the PUSH instruction. 0.98 requires a size + to be specified always. 0.98.09b will imply the size from the + current BITS setting (16 or 32). + + (*) Changed definition of the optimization flag: + + -O0 strict two-pass assembly, JMP and Jcc are handled more like + 0.98, except that back- ward JMPs are short, if possible. + + -O1 strict two-pass assembly, but forward branches are assembled + with code guaranteed to reach; may produce larger code than -O0, but + will produce successful assembly more often if branch offset sizes + are not specified. + + -O2 multi-pass optimization, minimize branch offsets; also will + minimize signed immed- iate bytes, overriding size specification. + + -O3 like -O2, but more passes taken, if needed + +C.2.34 Version 0.98.07 released 01/28/01 + + (*) Added Stepane Denis' SSE2 instructions to a *working* version of + the code - some earlier versions were based on broken code - + sorry 'bout that. version "0.98.07" + + 01/28/01 + + (*) Cosmetic modifications to nasm.c, nasm.h, AUTHORS, MODIFIED + +C.2.35 Version 0.98.06f released 01/18/01 + + (*) - Add "metalbrain"s jecxz bug fix in insns.dat - alter + nasmdoc.src to match - version "0.98.06f" + +C.2.36 Version 0.98.06e released 01/09/01 + + (*) Removed the "outforms.h" file - it appears to be someone's old + backup of "outform.h". version "0.98.06e" + + 01/09/01 + + (*) fbk - finally added the fix for the "multiple %includes bug", + known since 7/27/99 - reported originally (?) and sent to us by + Austin Lunnen - he reports that John Fine had a fix within the + day. Here it is... + + (*) Nelson Rush resigns from the group. Big thanks to Nelson for his + leadership and enthusiasm in getting these changes incorporated + into Nasm! + + (*) fbk - [list +], [list -] directives - ineptly implemented, + should be re-written or removed, perhaps. + + (*) Brian Raiter / fbk - "elfso bug" fix - applied to aoutb format + as well - testing might be desirable... + + 08/07/00 + + (*) James Seter - -postfix, -prefix command line switches. + + (*) Yuri Zaporogets - rdoff utility changes. + +C.2.37 Version 0.98p1 + + (*) GAS-like palign (Panos Minos) + + (*) FIXME: Someone, fill this in with details + +C.2.38 Version 0.98bf (bug-fixed) + + (*) Fixed - elf and aoutb bug - shared libraries - multiple + "%include" bug in "-f obj" - jcxz, jecxz bug - unrecognized + option bug in ndisasm + +C.2.39 Version 0.98.03 with John Coffman's changes released 27-Jul-2000 + + (*) Added signed byte optimizations for the 0x81/0x83 class of + instructions: ADC, ADD, AND, CMP, OR, SBB, SUB, XOR: when used + as 'ADD reg16,imm' or 'ADD reg32,imm.' Also optimization of + signed byte form of 'PUSH imm' and 'IMUL reg,imm'/'IMUL + reg,reg,imm.' No size specification is needed. + + (*) Added multi-pass JMP and Jcc offset optimization. Offsets on + forward references will preferentially use the short form, + without the need to code a specific size (short or near) for the + branch. Added instructions for 'Jcc label' to use the form + 'Jnotcc $+3/JMP label', in cases where a short offset is out of + bounds. If compiling for a 386 or higher CPU, then the 386 form + of Jcc will be used instead. + + This feature is controlled by a new command-line switch: "O", (upper + case letter O). "-O0" reverts the assembler to no extra optimization + passes, "-O1" allows up to 5 extra passes, and "-O2"(default), + allows up to 10 extra optimization passes. + + (*) Added a new directive: 'cpu XXX', where XXX is any of: 8086, + 186, 286, 386, 486, 586, pentium, 686, PPro, P2, P3 or Katmai. + All are case insensitive. All instructions will be selected only + if they apply to the selected cpu or lower. Corrected a couple + of bugs in cpu-dependence in 'insns.dat'. + + (*) Added to 'standard.mac', the "use16" and "use32" forms of the + "bits 16/32" directive. This is nothing new, just conforms to a + lot of other assemblers. (minor) + + (*) Changed label allocation from 320/32 (10000 labels @ 200K+) to + 32/37 (1000 labels); makes running under DOS much easier. Since + additional label space is allocated dynamically, this should + have no effect on large programs with lots of labels. The 37 is + a prime, believed to be better for hashing. (minor) + +C.2.40 Version 0.98.03 + + "Integrated patchfile 0.98-0.98.01. I call this version 0.98.03 for + historical reasons: 0.98.02 was trashed." --John Coffman + <johninsd@san.rr.com>, 27-Jul-2000 + + (*) Kendall Bennett's SciTech MGL changes + + (*) Note that you must define "TASM_COMPAT" at compile-time to get + the Tasm Ideal Mode compatibility. + + (*) All changes can be compiled in and out using the TASM_COMPAT + macros, and when compiled without TASM_COMPAT defined we get the + exact same binary as the unmodified 0.98 sources. + + (*) standard.mac, macros.c: Added macros to ignore TASM directives + before first include + + (*) nasm.h: Added extern declaration for tasm_compatible_mode + + (*) nasm.c: Added global variable tasm_compatible_mode + + (*) Added command line switch for TASM compatible mode (-t) + + (*) Changed version command line to reflect when compiled with TASM + additions + + (*) Added response file processing to allow all arguments on a + single line (response file is @resp rather than -@resp for NASM + format). + + (*) labels.c: Changes islocal() macro to support TASM style @@local + labels. + + (*) Added islocalchar() macro to support TASM style @@local labels. + + (*) parser.c: Added support for TASM style memory references (ie: + mov [DWORD eax],10 rather than the NASM style mov DWORD + [eax],10). + + (*) preproc.c: Added new directives, `%arg', `%local', `%stacksize' + to directives table + + (*) Added support for TASM style directives without a leading % + symbol. + + (*) Integrated a block of changes from Andrew Zabolotny + <bit@eltech.ru>: + + (*) A new keyword `%xdefine' and its case-insensitive counterpart + `%ixdefine'. They work almost the same way as `%define' and + `%idefine' but expand the definition immediately, not on the + invocation. Something like a cross between `%define' and + `%assign'. The "x" suffix stands for "eXpand", so "xdefine" can + be deciphered as "expand-and-define". Thus you can do things + like this: + + %assign ofs 0 + + %macro arg 1 + %xdefine %1 dword [esp+ofs] + %assign ofs ofs+4 + %endmacro + + (*) Changed the place where the expansion of %$name macros are + expanded. Now they are converted into ..@ctxnum.name form when + detokenizing, so there are no quirks as before when using %$name + arguments to macros, in macros etc. For example: + + %macro abc 1 + %define %1 hello + %endm + + abc %$here + %$here + + Now last line will be expanded into "hello" as expected. This also + allows for lots of goodies, a good example are extended "proc" + macros included in this archive. + + (*) Added a check for "cstk" in smacro_defined() before calling + get_ctx() - this allows for things like: + + %ifdef %$abc + %endif + + to work without warnings even in no context. + + (*) Added a check for "cstk" in %if*ctx and %elif*ctx directives - + this allows to use `%ifctx' without excessive warnings. If there + is no active context, `%ifctx' goes through "false" branch. + + (*) Removed "user error: " prefix with `%error' directive: it just + clobbers the output and has absolutely no functionality. + Besides, this allows to write macros that does not differ from + built-in functions in any way. + + (*) Added expansion of string that is output by `%error' directive. + Now you can do things like: + + %define hello(x) Hello, x! + + %define %$name andy + %error "hello(%$name)" + + Same happened with `%include' directive. + + (*) Now all directives that expect an identifier will try to expand + and concatenate everything without whitespaces in between before + usage. For example, with "unfixed" nasm the commands + + %define %$abc hello + %define __%$abc goodbye + __%$abc + + would produce "incorrect" output: last line will expand to + + hello goodbyehello + + Not quite what you expected, eh? :-) The answer is that preprocessor + treats the `%define' construct as if it would be + + %define __ %$abc goodbye + + (note the white space between __ and %$abc). After my "fix" it will + "correctly" expand into + + goodbye + + as expected. Note that I use quotes around words "correct", + "incorrect" etc because this is rather a feature not a bug; however + current behaviour is more logical (and allows more advanced macro + usage :-). + + Same change was applied to: + `%push',`%macro',`%imacro',`%define',`%idefine',`%xdefine',`%ixdefine', + `%assign',`%iassign',`%undef' + + (*) A new directive [WARNING {+|-}warning-id] have been added. It + works only if the assembly phase is enabled (i.e. it doesn't + work with nasm -e). + + (*) A new warning type: macro-selfref. By default this warning is + disabled; when enabled NASM warns when a macro self-references + itself; for example the following source: + + [WARNING macro-selfref] + + %macro push 1-* + %rep %0 + push %1 + %rotate 1 + %endrep + %endmacro + + push eax,ebx,ecx + + will produce a warning, but if we remove the first line we won't see + it anymore (which is The Right Thing To Do {tm} IMHO since C + preprocessor eats such constructs without warnings at all). + + (*) Added a "error" routine to preprocessor which always will set + ERR_PASS1 bit in severity_code. This removes annoying repeated + errors on first and second passes from preprocessor. + + (*) Added the %+ operator in single-line macros for concatenating + two identifiers. Usage example: + + %define _myfunc _otherfunc + %define cextern(x) _ %+ x + cextern (myfunc) + + After first expansion, third line will become "_myfunc". After this + expansion is performed again so it becomes "_otherunc". + + (*) Now if preprocessor is in a non-emitting state, no warning or + error will be emitted. Example: + + %if 1 + mov eax,ebx + %else + put anything you want between these two brackets, + even macro-parameter references %1 or local + labels %$zz or macro-local labels %%zz - no + warning will be emitted. + %endif + + (*) Context-local variables on expansion as a last resort are looked + up in outer contexts. For example, the following piece: + + %push outer + %define %$a [esp] + + %push inner + %$a + %pop + %pop + + will expand correctly the fourth line to [esp]; if we'll define + another %$a inside the "inner" context, it will take precedence over + outer definition. However, this modification has been applied only + to expand_smacro and not to smacro_define: as a consequence + expansion looks in outer contexts, but `%ifdef' won't look in outer + contexts. + + This behaviour is needed because we don't want nested contexts to + act on already defined local macros. Example: + + %define %$arg1 [esp+4] + test eax,eax + if nz + mov eax,%$arg1 + endif + + In this example the "if" mmacro enters into the "if" context, so + %$arg1 is not valid anymore inside "if". Of course it could be + worked around by using explicitely %$$arg1 but this is ugly IMHO. + + (*) Fixed memory leak in `%undef'. The origline wasn't freed before + exiting on success. + + (*) Fixed trap in preprocessor when line expanded to empty set of + tokens. This happens, for example, in the following case: + + #define SOMETHING + SOMETHING + +C.2.41 Version 0.98 + + All changes since NASM 0.98p3 have been produced by H. Peter Anvin + <hpa@zytor.com>. + + (*) The documentation comment delimiter is + + (*) Allow EQU definitions to refer to external labels; reported by + Pedro Gimeno. + + (*) Re-enable support for RDOFF v1; reported by Pedro Gimeno. + + (*) Updated License file per OK from Simon and Julian. + +C.2.42 Version 0.98p9 + + (*) Update documentation (although the instruction set reference + will have to wait; I don't want to hold up the 0.98 release for + it.) + + (*) Verified that the NASM implementation of the PEXTRW and PMOVMSKB + instructions is correct. The encoding differs from what the + Intel manuals document, but the Pentium III behaviour matches + NASM, not the Intel manuals. + + (*) Fix handling of implicit sizes in PSHUFW and PINSRW, reported by + Stefan Hoffmeister. + + (*) Resurrect the -s option, which was removed when changing the + diagnostic output to stdout. + +C.2.43 Version 0.98p8 + + (*) Fix for "DB" when NASM is running on a bigendian machine. + + (*) Invoke insns.pl once for each output script, making Makefile.in + legal for "make -j". + + (*) Improve the Unix configure-based makefiles to make package + creation easier. + + (*) Included an RPM .spec file for building RPM (RedHat Package + Manager) packages on Linux or Unix systems. + + (*) Fix Makefile dependency problems. + + (*) Change src/rdsrc.pl to include sectioning information in info + output; required for install-info to work. + + (*) Updated the RDOFF distribution to version 2 from Jules; minor + massaging to make it compile in my environment. + + (*) Split doc files that can be built by anyone with a Perl + interpreter off into a separate archive. + + (*) "Dress rehearsal" release! + +C.2.44 Version 0.98p7 + + (*) Fixed opcodes with a third byte-sized immediate argument to not + complain if given "byte" on the immediate. + + (*) Allow `%undef' to remove single-line macros with arguments. This + matches the behaviour of #undef in the C preprocessor. + + (*) Allow -d, -u, -i and -p to be specified as -D, -U, -I and -P for + compatibility with most C compilers and preprocessors. This + allows Makefile options to be shared between cc and nasm, for + example. + + (*) Minor cleanups. + + (*) Went through the list of Katmai instructions and hopefully fixed + the (rather few) mistakes in it. + + (*) (Hopefully) fixed a number of disassembler bugs related to + ambiguous instructions (disambiguated by -p) and SSE + instructions with REP. + + (*) Fix for bug reported by Mark Junger: "call dword 0x12345678" + should work and may add an OSP (affected CALL, JMP, Jcc). + + (*) Fix for environments when "stderr" isn't a compile-time + constant. + +C.2.45 Version 0.98p6 + + (*) Took officially over coordination of the 0.98 release; so drop + the p3.x notation. Skipped p4 and p5 to avoid confusion with + John Fine's J4 and J5 releases. + + (*) Update the documentation; however, it still doesn't include + documentation for the various new instructions. I somehow wonder + if it makes sense to have an instruction set reference in the + assembler manual when Intel et al have PDF versions of their + manuals online. + + (*) Recognize "idt" or "centaur" for the -p option to ndisasm. + + (*) Changed error messages back to stderr where they belong, but add + an -E option to redirect them elsewhere (the DOS shell cannot + redirect stderr.) + + (*) -M option to generate Makefile dependencies (based on code from + Alex Verstak.) + + (*) `%undef' preprocessor directive, and -u option, that undefines a + single-line macro. + + (*) OS/2 Makefile (Mkfiles/Makefile.os2) for Borland under OS/2; + from Chuck Crayne. + + (*) Various minor bugfixes (reported by): - Dangling `%s' in + preproc.c (Martin Junker) + + (*) THERE ARE KNOWN BUGS IN SSE AND THE OTHER KATMAI INSTRUCTIONS. I + am on a trip and didn't bring the Katmai instruction reference, + so I can't work on them right now. + + (*) Updated the License file per agreement with Simon and Jules to + include a GPL distribution clause. + +C.2.46 Version 0.98p3.7 + + (*) (Hopefully) fixed the canned Makefiles to include the outrdf2 + and zoutieee modules. + + (*) Renamed changes.asm to changed.asm. + +C.2.47 Version 0.98p3.6 + + (*) Fixed a bunch of instructions that were added in 0.98p3.5 which + had memory operands, and the address-size prefix was missing + from the instruction pattern. + +C.2.48 Version 0.98p3.5 + + (*) Merged in changes from John S. Fine's 0.98-J5 release. John's + based 0.98-J5 on my 0.98p3.3 release; this merges the changes. + + (*) Expanded the instructions flag field to a long so we can fit + more flags; mark SSE (KNI) and AMD or Katmai-specific + instructions as such. + + (*) Fix the "PRIV" flag on a bunch of instructions, and create new + "PROT" flag for protected-mode-only instructions (orthogonal to + if the instruction is privileged!) and new "SMM" flag for SMM- + only instructions. + + (*) Added AMD-only SYSCALL and SYSRET instructions. + + (*) Make SSE actually work, and add new Katmai MMX instructions. + + (*) Added a -p (preferred vendor) option to ndisasm so that it can + distinguish e.g. Cyrix opcodes also used in SSE. For example: + + ndisasm -p cyrix aliased.bin + 00000000 670F514310 paddsiw mm0,[ebx+0x10] + 00000005 670F514320 paddsiw mm0,[ebx+0x20] + ndisasm -p intel aliased.bin + 00000000 670F514310 sqrtps xmm0,[ebx+0x10] + 00000005 670F514320 sqrtps xmm0,[ebx+0x20] + + (*) Added a bunch of Cyrix-specific instructions. + +C.2.49 Version 0.98p3.4 + + (*) Made at least an attempt to modify all the additional Makefiles + (in the Mkfiles directory). I can't test it, but this was the + best I could do. + + (*) DOS DJGPP+"Opus Make" Makefile from John S. Fine. + + (*) changes.asm changes from John S. Fine. + +C.2.50 Version 0.98p3.3 + + (*) Patch from Conan Brink to allow nesting of `%rep' directives. + + (*) If we're going to allow INT01 as an alias for INT1/ICEBP (one of + Jules 0.98p3 changes), then we should allow INT03 as an alias + for INT3 as well. + + (*) Updated changes.asm to include the latest changes. + + (*) Tried to clean up the <CR>s that had snuck in from a DOS/Windows + environment into my Unix environment, and try to make sure than + DOS/Windows users get them back. + + (*) We would silently generate broken tools if insns.dat wasn't + sorted properly. Change insns.pl so that the order doesn't + matter. + + (*) Fix bug in insns.pl (introduced by me) which would cause + conditional instructions to have an extra "cc" in disassembly, + e.g. "jnz" disassembled as "jccnz". + +C.2.51 Version 0.98p3.2 + + (*) Merged in John S. Fine's changes from his 0.98-J4 prerelease; + see http://www.csoft.net/cz/johnfine/ + + (*) Changed previous "spotless" Makefile target (appropriate for + distribution) to "distclean", and added "cleaner" target which + is same as "clean" except deletes files generated by Perl + scripts; "spotless" is union. + + (*) Removed BASIC programs from distribution. Get a Perl interpreter + instead (see below.) + + (*) Calling this "pre-release 3.2" rather than "p3-hpa2" because of + John's contributions. + + (*) Actually link in the IEEE output format (zoutieee.c); fix a + bunch of compiler warnings in that file. Note I don't know what + IEEE output is supposed to look like, so these changes were made + "blind". + +C.2.52 Version 0.98p3-hpa + + (*) Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully + buildable version for Unix systems (Makefile.in updates, etc.) + + (*) Changed insns.pl to create the instruction tables in nasm.h and + names.c, so that a new instruction can be added by adding it + *only* to insns.dat. + + (*) Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE, + FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel + guarantee will never be used; one of them is documented as UD2 + in Intel documentation, the other one just as "Undefined Opcode" + -- calling it UD1 seemed to make sense.) + + (*) MAX_SYMBOL was defined to be 9, but LOADALL286 and LOADALL386 + are 10 characters long. Now MAX_SYMBOL is derived from + insns.dat. + + (*) A note on the BASIC programs included: forget them. insns.bas is + already out of date. Get yourself a Perl interpreter for your + platform of choice at http://www.cpan.org/ports/index.html. + +C.2.53 Version 0.98 pre-release 3 + + (*) added response file support, improved command line handling, new + layout help screen + + (*) fixed limit checking bug, 'OUT byte nn, reg' bug, and a couple + of rdoff related bugs, updated Wishlist; 0.98 Prerelease 3. + +C.2.54 Version 0.98 pre-release 2 + + (*) fixed bug in outcoff.c to do with truncating section names + longer than 8 characters, referencing beyond end of string; 0.98 + pre-release 2 + +C.2.55 Version 0.98 pre-release 1 + + (*) Fixed a bug whereby STRUC didn't work at all in RDF. + + (*) Fixed a problem with group specification in PUBDEFs in OBJ. + + (*) Improved ease of adding new output formats. Contribution due to + Fox Cutter. + + (*) Fixed a bug in relocations in the `bin' format: was showing up + when a relocatable reference crossed an 8192-byte boundary in + any output section. + + (*) Fixed a bug in local labels: local-label lookups were + inconsistent between passes one and two if an EQU occurred + between the definition of a global label and the subsequent use + of a local label local to that global. + + (*) Fixed a seg-fault in the preprocessor (again) which happened + when you use a blank line as the first line of a multi-line + macro definition and then defined a label on the same line as a + call to that macro. + + (*) Fixed a stale-pointer bug in the handling of the NASM + environment variable. Thanks to Thomas McWilliams. + + (*) ELF had a hard limit on the number of sections which caused + segfaults when transgressed. Fixed. + + (*) Added ability for ndisasm to read from stdin by using `-' as the + filename. + + (*) ndisasm wasn't outputting the TO keyword. Fixed. + + (*) Fixed error cascade on bogus expression in `%if' - an error in + evaluation was causing the entire `%if' to be discarded, thus + creating trouble later when the `%else' or `%endif' was + encountered. + + (*) Forward reference tracking was instruction-granular not operand- + granular, which was causing 286-specific code to be generated + needlessly on code of the form `shr word [forwardref],1'. Thanks + to Jim Hague for sending a patch. + + (*) All messages now appear on stdout, as sending them to stderr + serves no useful purpose other than to make redirection + difficult. + + (*) Fixed the problem with EQUs pointing to an external symbol - + this now generates an error message. + + (*) Allowed multiple size prefixes to an operand, of which only the + first is taken into account. + + (*) Incorporated John Fine's changes, including fixes of a large + number of preprocessor bugs, some small problems in OBJ, and a + reworking of label handling to define labels before their line + is assembled, rather than after. + + (*) Reformatted a lot of the source code to be more readable. + Included 'coding.txt' as a guideline for how to format code for + contributors. + + (*) Stopped nested `%reps' causing a panic - they now cause a + slightly more friendly error message instead. + + (*) Fixed floating point constant problems (patch by Pedro Gimeno) + + (*) Fixed the return value of insn_size() not being checked for -1, + indicating an error. + + (*) Incorporated 3Dnow! instructions. + + (*) Fixed the 'mov eax, eax + ebx' bug. + + (*) Fixed the GLOBAL EQU bug in ELF. Released developers release 3. + + (*) Incorporated John Fine's command line parsing changes + + (*) Incorporated David Lindauer's OMF debug support + + (*) Made changes for LCC 4.0 support (`__NASM_CDecl__', removed + register size specification warning when sizes agree). + + C.3 NASM 0.9 Series + + Revisions before 0.98. + + C.3.1 Version 0.97 released December 1997 + + (*) This was entirely a bug-fix release to 0.96, which seems to have + got cursed. Silly me. + + (*) Fixed stupid mistake in OBJ which caused `MOV EAX,<constant>' to + fail. Caused by an error in the `MOV EAX,<segment>' support. + + (*) ndisasm hung at EOF when compiled with lcc on Linux because lcc + on Linux somehow breaks feof(). ndisasm now does not rely on + feof(). + + (*) A heading in the documentation was missing due to a markup error + in the indexing. Fixed. + + (*) Fixed failure to update all pointers on realloc() within + extended- operand code in parser.c. Was causing wrong behaviour + and seg faults on lines such as `dd 0.0,0.0,0.0,0.0,...' + + (*) Fixed a subtle preprocessor bug whereby invoking one multi-line + macro on the first line of the expansion of another, when the + second had been invoked with a label defined before it, didn't + expand the inner macro. + + (*) Added internal.doc back in to the distribution archives - it was + missing in 0.96 *blush* + + (*) Fixed bug causing 0.96 to be unable to assemble its own test + files, specifically objtest.asm. *blush again* + + (*) Fixed seg-faults and bogus error messages caused by mismatching + `%rep' and `%endrep' within multi-line macro definitions. + + (*) Fixed a problem with buffer overrun in OBJ, which was causing + corruption at ends of long PUBDEF records. + + (*) Separated DOS archives into main-program and documentation to + reduce download size. + + C.3.2 Version 0.96 released November 1997 + + (*) Fixed a bug whereby, if `nasm sourcefile' would cause a filename + collision warning and put output into `nasm.out', then `nasm + sourcefile -o outputfile' still gave the warning even though the + `-o' was honoured. Fixed name pollution under Digital UNIX: one + of its header files defined R_SP, which broke the enum in + nasm.h. + + (*) Fixed minor instruction table problems: FUCOM and FUCOMP didn't + have two-operand forms; NDISASM didn't recognise the longer + register forms of PUSH and POP (eg FF F3 for PUSH BX); TEST + mem,imm32 was flagged as undocumented; the 32-bit forms of CMOV + had 16-bit operand size prefixes; `AAD imm' and `AAM imm' are no + longer flagged as undocumented because the Intel Architecture + reference documents them. + + (*) Fixed a problem with the local-label mechanism, whereby strange + types of symbol (EQUs, auto-defined OBJ segment base symbols) + interfered with the `previous global label' value and screwed up + local labels. + + (*) Fixed a bug whereby the stub preprocessor didn't communicate + with the listing file generator, so that the -a and -l options + in conjunction would produce a useless listing file. + + (*) Merged `os2' object file format back into `obj', after + discovering that `obj' _also_ shouldn't have a link pass + separator in a module containing a non-trivial MODEND. Flat + segments are now declared using the FLAT attribute. `os2' is no + longer a valid object format name: use `obj'. + + (*) Removed the fixed-size temporary storage in the evaluator. Very + very long expressions (like `mov ax,1+1+1+1+...' for two hundred + 1s or so) should now no longer crash NASM. + + (*) Fixed a bug involving segfaults on disassembly of MMX + instructions, by changing the meaning of one of the operand-type + flags in nasm.h. This may cause other apparently unrelated MMX + problems; it needs to be tested thoroughly. + + (*) Fixed some buffer overrun problems with large OBJ output files. + Thanks to DJ Delorie for the bug report and fix. + + (*) Made preprocess-only mode actually listen to the `%line' markers + as it prints them, so that it can report errors more sanely. + + (*) Re-designed the evaluator to keep more sensible track of + expressions involving forward references: can now cope with + previously-nightmare situations such as: + + mov ax,foo | bar + foo equ 1 + bar equ 2 + + (*) Added the ALIGN and ALIGNB standard macros. + + (*) Added PIC support in ELF: use of WRT to obtain the four extra + relocation types needed. + + (*) Added the ability for output file formats to define their own + extensions to the GLOBAL, COMMON and EXTERN directives. + + (*) Implemented common-variable alignment, and global-symbol type + and size declarations, in ELF. + + (*) Implemented NEAR and FAR keywords for common variables, plus + far-common element size specification, in OBJ. + + (*) Added a feature whereby EXTERNs and COMMONs in OBJ can be given + a default WRT specification (either a segment or a group). + + (*) Transformed the Unix NASM archive into an auto-configuring + package. + + (*) Added a sanity-check for people applying SEG to things which are + already segment bases: this previously went unnoticed by the SEG + processing and caused OBJ-driver panics later. + + (*) Added the ability, in OBJ format, to deal with `MOV + EAX,<segment>' type references: OBJ doesn't directly support + dword-size segment base fixups, but as long as the low two bytes + of the constant term are zero, a word-size fixup can be + generated instead and it will work. + + (*) Added the ability to specify sections' alignment requirements in + Win32 object files and pure binary files. + + (*) Added preprocess-time expression evaluation: the `%assign' (and + `%iassign') directive and the bare `%if' (and `%elif') + conditional. Added relational operators to the evaluator, for + use only in `%if' constructs: the standard relationals = < > <= + >= <> (and C-like synonyms == and !=) plus low-precedence + logical operators &&, ^^ and ||. + + (*) Added a preprocessor repeat construct: `%rep' / `%exitrep' / + `%endrep'. + + (*) Added the __FILE__ and __LINE__ standard macros. + + (*) Added a sanity check for number constants being greater than + 0xFFFFFFFF. The warning can be disabled. + + (*) Added the %0 token whereby a variadic multi-line macro can tell + how many parameters it's been given in a specific invocation. + + (*) Added `%rotate', allowing multi-line macro parameters to be + cycled. + + (*) Added the `*' option for the maximum parameter count on multi- + line macros, allowing them to take arbitrarily many parameters. + + (*) Added the ability for the user-level forms of EXTERN, GLOBAL and + COMMON to take more than one argument. + + (*) Added the IMPORT and EXPORT directives in OBJ format, to deal + with Windows DLLs. + + (*) Added some more preprocessor `%if' constructs: `%ifidn' / + `%ifidni' (exact textual identity), and `%ifid' / `%ifnum' / + `%ifstr' (token type testing). + + (*) Added the ability to distinguish SHL AX,1 (the 8086 version) + from SHL AX,BYTE 1 (the 286-and-upwards version whose constant + happens to be 1). + + (*) Added NetBSD/FreeBSD/OpenBSD's variant of a.out format, complete + with PIC shared library features. + + (*) Changed NASM's idiosyncratic handling of FCLEX, FDISI, FENI, + FINIT, FSAVE, FSTCW, FSTENV, and FSTSW to bring it into line + with the otherwise accepted standard. The previous behaviour, + though it was a deliberate feature, was a deliberate feature + based on a misunderstanding. Apologies for the inconvenience. + + (*) Improved the flexibility of ABSOLUTE: you can now give it an + expression rather than being restricted to a constant, and it + can take relocatable arguments as well. + + (*) Added the ability for a variable to be declared as EXTERN + multiple times, and the subsequent definitions are just ignored. + + (*) We now allow instruction prefixes (CS, DS, LOCK, REPZ etc) to be + alone on a line (without a following instruction). + + (*) Improved sanity checks on whether the arguments to EXTERN, + GLOBAL and COMMON are valid identifiers. + + (*) Added misc/exebin.mac to allow direct generation of .EXE files + by hacking up an EXE header using DB and DW; also added + test/binexe.asm to demonstrate the use of this. Thanks to Yann + Guidon for contributing the EXE header code. + + (*) ndisasm forgot to check whether the input file had been + successfully opened. Now it does. Doh! + + (*) Added the Cyrix extensions to the MMX instruction set. + + (*) Added a hinting mechanism to allow [EAX+EBX] and [EBX+EAX] to be + assembled differently. This is important since [ESI+EBP] and + [EBP+ESI] have different default base segment registers. + + (*) Added support for the PharLap OMF extension for 4096-byte + segment alignment. + + C.3.3 Version 0.95 released July 1997 + + (*) Fixed yet another ELF bug. This one manifested if the user + relied on the default segment, and attempted to define global + symbols without first explicitly declaring the target segment. + + (*) Added makefiles (for NASM and the RDF tools) to build Win32 + console apps under Symantec C++. Donated by Mark Junker. + + (*) Added `macros.bas' and `insns.bas', QBasic versions of the Perl + scripts that convert `standard.mac' to `macros.c' and convert + `insns.dat' to `insnsa.c' and `insnsd.c'. Also thanks to Mark + Junker. + + (*) Changed the diassembled forms of the conditional instructions so + that JB is now emitted as JC, and other similar changes. + Suggested list by Ulrich Doewich. + + (*) Added `@' to the list of valid characters to begin an identifier + with. + + (*) Documentary changes, notably the addition of the `Common + Problems' section in nasm.doc. + + (*) Fixed a bug relating to 32-bit PC-relative fixups in OBJ. + + (*) Fixed a bug in perm_copy() in labels.c which was causing + exceptions in cleanup_labels() on some systems. + + (*) Positivity sanity check in TIMES argument changed from a warning + to an error following a further complaint. + + (*) Changed the acceptable limits on byte and word operands to allow + things like `~10111001b' to work. + + (*) Fixed a major problem in the preprocessor which caused seg- + faults if macro definitions contained blank lines or comment- + only lines. + + (*) Fixed inadequate error checking on the commas separating the + arguments to `db', `dw' etc. + + (*) Fixed a crippling bug in the handling of macros with operand + counts defined with a `+' modifier. + + (*) Fixed a bug whereby object file formats which stored the input + file name in the output file (such as OBJ and COFF) weren't + doing so correctly when the output file name was specified on + the command line. + + (*) Removed [INC] and [INCLUDE] support for good, since they were + obsolete anyway. + + (*) Fixed a bug in OBJ which caused all fixups to be output in 16- + bit (old-format) FIXUPP records, rather than putting the 32-bit + ones in FIXUPP32 (new-format) records. + + (*) Added, tentatively, OS/2 object file support (as a minor variant + on OBJ). + + (*) Updates to Fox Cutter's Borland C makefile, Makefile.bc2. + + (*) Removed a spurious second fclose() on the output file. + + (*) Added the `-s' command line option to redirect all messages + which would go to stderr (errors, help text) to stdout instead. + + (*) Added the `-w' command line option to selectively suppress some + classes of assembly warning messages. + + (*) Added the `-p' pre-include and `-d' pre-define command-line + options. + + (*) Added an include file search path: the `-i' command line option. + + (*) Fixed a silly little preprocessor bug whereby starting a line + with a `%!' environment-variable reference caused an `unknown + directive' error. + + (*) Added the long-awaited listing file support: the `-l' command + line option. + + (*) Fixed a problem with OBJ format whereby, in the absence of any + explicit segment definition, non-global symbols declared in the + implicit default segment generated spurious EXTDEF records in + the output. + + (*) Added the NASM environment variable. + + (*) From this version forward, Win32 console-mode binaries will be + included in the DOS distribution in addition to the 16-bit + binaries. Added Makefile.vc for this purpose. + + (*) Added `return 0;' to test/objlink.c to prevent compiler + warnings. + + (*) Added the __NASM_MAJOR__ and __NASM_MINOR__ standard defines. + + (*) Added an alternative memory-reference syntax in which prefixing + an operand with `&' is equivalent to enclosing it in square + brackets, at the request of Fox Cutter. + + (*) Errors in pass two now cause the program to return a non-zero + error code, which they didn't before. + + (*) Fixed the single-line macro cycle detection, which didn't work + at all on macros with no parameters (caused an infinite loop). + Also changed the behaviour of single-line macro cycle detection + to work like cpp, so that macros like `extrn' as given in the + documentation can be implemented. + + (*) Fixed the implementation of WRT, which was too restrictive in + that you couldn't do `mov ax,[di+abc wrt dgroup]' because + (di+abc) wasn't a relocatable reference. + + C.3.4 Version 0.94 released April 1997 + + (*) Major item: added the macro processor. + + (*) Added undocumented instructions SMI, IBTS, XBTS and LOADALL286. + Also reorganised CMPXCHG instruction into early-486 and Pentium + forms. Thanks to Thobias Jones for the information. + + (*) Fixed two more stupid bugs in ELF, which were causing `ld' to + continue to seg-fault in a lot of non-trivial cases. + + (*) Fixed a seg-fault in the label manager. + + (*) Stopped FBLD and FBSTP from _requiring_ the TWORD keyword, which + is the only option for BCD loads/stores in any case. + + (*) Ensured FLDCW, FSTCW and FSTSW can cope with the WORD keyword, + if anyone bothers to provide it. Previously they complained + unless no keyword at all was present. + + (*) Some forms of FDIV/FDIVR and FSUB/FSUBR were still inverted: a + vestige of a bug that I thought had been fixed in 0.92. This was + fixed, hopefully for good this time... + + (*) Another minor phase error (insofar as a phase error can _ever_ + be minor) fixed, this one occurring in code of the form + + rol ax,forward_reference + forward_reference equ 1 + + (*) The number supplied to TIMES is now sanity-checked for + positivity, and also may be greater than 64K (which previously + didn't work on 16-bit systems). + + (*) Added Watcom C makefiles, and misc/pmw.bat, donated by Dominik + Behr. + + (*) Added the INCBIN pseudo-opcode. + + (*) Due to the advent of the preprocessor, the [INCLUDE] and [INC] + directives have become obsolete. They are still supported in + this version, with a warning, but won't be in the next. + + (*) Fixed a bug in OBJ format, which caused incorrect object records + to be output when absolute labels were made global. + + (*) Updates to RDOFF subdirectory, and changes to outrdf.c. + + C.3.5 Version 0.93 released January 1997 + + This release went out in a great hurry after semi-crippling bugs + were found in 0.92. + + (*) Really _did_ fix the stack overflows this time. *blush* + + (*) Had problems with EA instruction sizes changing between passes, + when an offset contained a forward reference and so 4 bytes were + allocated for the offset in pass one; by pass two the symbol had + been defined and happened to be a small absolute value, so only + 1 byte got allocated, causing instruction size mismatch between + passes and hence incorrect address calculations. Fixed. + + (*) Stupid bug in the revised ELF section generation fixed + (associated string-table section for .symtab was hard-coded as + 7, even when this didn't fit with the real section table). Was + causing `ld' to seg-fault under Linux. + + (*) Included a new Borland C makefile, Makefile.bc2, donated by Fox + Cutter <lmb@comtch.iea.com>. + + C.3.6 Version 0.92 released January 1997 + + (*) The FDIVP/FDIVRP and FSUBP/FSUBRP pairs had been inverted: this + was fixed. This also affected the LCC driver. + + (*) Fixed a bug regarding 32-bit effective addresses of the form + `[other_register+ESP]'. + + (*) Documentary changes, notably documentation of the fact that + Borland Win32 compilers use `obj' rather than `win32' object + format. + + (*) Fixed the COMENT record in OBJ files, which was formatted + incorrectly. + + (*) Fixed a bug causing segfaults in large RDF files. + + (*) OBJ format now strips initial periods from segment and group + definitions, in order to avoid complications with the local + label syntax. + + (*) Fixed a bug in disassembling far calls and jumps in NDISASM. + + (*) Added support for user-defined sections in COFF and ELF files. + + (*) Compiled the DOS binaries with a sensible amount of stack, to + prevent stack overflows on any arithmetic expression containing + parentheses. + + (*) Fixed a bug in handling of files that do not terminate in a + newline. + + C.3.7 Version 0.91 released November 1996 + + (*) Loads of bug fixes. + + (*) Support for RDF added. + + (*) Support for DBG debugging format added. + + (*) Support for 32-bit extensions to Microsoft OBJ format added. + + (*) Revised for Borland C: some variable names changed, makefile + added. + + (*) LCC support revised to actually work. + + (*) JMP/CALL NEAR/FAR notation added. + + (*) `a16', `o16', `a32' and `o32' prefixes added. + + (*) Range checking on short jumps implemented. + + (*) MMX instruction support added. + + (*) Negative floating point constant support added. + + (*) Memory handling improved to bypass 64K barrier under DOS. + + (*) `$' prefix to force treatment of reserved words as identifiers + added. + + (*) Default-size mechanism for object formats added. + + (*) Compile-time configurability added. + + (*) `#', `@', `~' and c{?} are now valid characters in labels. + + (*) `-e' and `-k' options in NDISASM added. + + C.3.8 Version 0.90 released October 1996 + + First release version. First support for object file output. Other + changes from previous version (0.3x) too numerous to document. |