NASM — The Netwide Assembler

version 2.07

-~~..~:#;L .-:#;L,.- .~:#:;.T E8+U *T +U’ *T# .97 *L D97 ‘*L .97 ’*L "T;E+:, H7 I# T7 I# "*:. U: :8 *#+ , :8 T, 79 ,#B. .IE, "T;E* .IE, J *+;#:T*"

-~~.~:;. .~:;. E8+’ *;T’ *;, D9 *L *L H7 I# I# U: :8 :8 ,#B. .IE, .IE,

© 1996−2009 The NASM Development Team — All Rights Reserved This document is redistributable under the license given in the file "COPYING" distributed in the NASM archive. This release is dedicated to the memory of Charles A. Crayne. We miss you, Chuck.

Contents
Chapter 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.1 What Is NASM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.1.1 Why Yet Another Assembler?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.1.2 License Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.2 Contact Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 1.3 Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 1.3.1 Installing NASM under MS−DOS or Windows . . . . . . . . . . . . . . . . . . . . . . . . .15 1.3.2 Installing NASM under Unix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Chapter 2: Running NASM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 2.1 NASM Command−Line Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 2.1.1 The −o Option: Specifying the Output File Name . . . . . . . . . . . . . . . . . . . . . . . .17 2.1.2 The −f Option: Specifying the Output File Format . . . . . . . . . . . . . . . . . . . . . . .18 2.1.3 The −l Option: Generating a Listing File . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 2.1.4 The −M Option: Generate Makefile Dependencies . . . . . . . . . . . . . . . . . . . . . . . .18 2.1.5 The −MG Option: Generate Makefile Dependencies . . . . . . . . . . . . . . . . . . . . . . .18 2.1.6 The −MF Option: Set Makefile Dependency File . . . . . . . . . . . . . . . . . . . . . . . .18 2.1.7 The −MD Option: Assemble and Generate Dependencies. . . . . . . . . . . . . . . . . . . . .18 2.1.8 The −MT Option: Dependency Target Name. . . . . . . . . . . . . . . . . . . . . . . . . . .19 2.1.9 The −MQ Option: Dependency Target Name (Quoted) . . . . . . . . . . . . . . . . . . . . . .19 2.1.10 The −MP Option: Emit phony targets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 2.1.11 The −F Option: Selecting a Debug Information Format . . . . . . . . . . . . . . . . . . . .19 2.1.12 The −g Option: Enabling Debug Information. . . . . . . . . . . . . . . . . . . . . . . . . .19 2.1.13 The −X Option: Selecting an Error Reporting Format. . . . . . . . . . . . . . . . . . . . . .19 2.1.14 The −Z Option: Send Errors to a File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.1.15 The −s Option: Send Errors to stdout . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.1.16 The −i Option: Include File Search Directories . . . . . . . . . . . . . . . . . . . . . . . .20 2.1.17 The −p Option: Pre−Include a File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.1.18 The −d Option: Pre−Define a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.1.19 The −u Option: Undefine a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 2.1.20 The −E Option: Preprocess Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21

3

2.1.21 The −a Option: Don’t Preprocess At All . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 2.1.22 The −O Option: Specifying Multipass Optimization . . . . . . . . . . . . . . . . . . . . . .21 2.1.23 The −t Option: Enable TASM Compatibility Mode . . . . . . . . . . . . . . . . . . . . . .22 2.1.24 The −w and −W Options: Enable or Disable Assembly Warnings . . . . . . . . . . . . . . . .22 2.1.25 The −v Option: Display Version Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 2.1.26 The −y Option: Display Available Debug Info Formats . . . . . . . . . . . . . . . . . . . .23 2.1.27 The −−prefix and −−postfix Options. . . . . . . . . . . . . . . . . . . . . . . . . . .23 2.1.28 The NASMENV Environment Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 2.2 Quick Start for MASM Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 2.2.1 NASM Is Case−Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 2.2.2 NASM Requires Square Brackets For Memory References . . . . . . . . . . . . . . . . . . .24 2.2.3 NASM Doesn’t Store Variable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 2.2.4 NASM Doesn’t ASSUME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 2.2.5 NASM Doesn’t Support Memory Models . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 2.2.6 Floating−Point Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 2.2.7 Other Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 Chapter 3: The NASM Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 3.1 Layout of a NASM Source Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 3.2 Pseudo−Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 3.2.1 DB and Friends: Declaring Initialized Data . . . . . . . . . . . . . . . . . . . . . . . . . . .27 3.2.2 RESB and Friends: Declaring Uninitialized Data . . . . . . . . . . . . . . . . . . . . . . . .27 3.2.3 INCBIN: Including External Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 3.2.4 EQU: Defining Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 3.2.5 TIMES: Repeating Instructions or Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 3.3 Effective Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 3.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 3.4.1 Numeric Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 3.4.2 Character Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 3.4.3 Character Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 3.4.4 String Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 3.4.5 Unicode Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 3.4.6 Floating−Point Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 3.4.7 Packed BCD Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 3.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 3.5.1 |: Bitwise OR Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33

4

. . . . . . . . . .47 4. .. . . . . . . . . . . . .46 4. . . . . . . . . . .37 4. . . . . . . . . . . . . . . . .1 Concatenating Strings: %strcat . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . .33 3. . . . . . .44 4. . . . . . . . . . . . . . . . . . .3 Extracting Substrings: %substr . . . .3. . . . . . . . . . . . . . .33 3. . . . . . . . . . . . . . . .1. . . . . .4 << and >>: Bit Shift Operators . . . . . . . . . . . . . . . . . . . . . . . . .45 4. . . . . . .1 Overloading Multi−Line Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . .3. . . . . . . . . . . . . . .48 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 ^: Bitwise XOR Operator . . . . . . . . . . . . . .9 Local Labels . .1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 4. . . . . . .] . . . % and %%: Multiplication and Division. . . . .1 The Normal Way: %define . . . . . . . . . .1. . . . . . . . .34 3. . . .3 &: Bitwise AND Operator . . . . . . .9 Disabling Listing Expansion . . . . . . . . . . . . . . . .43 4. . . . . . .34 3. . . .2 String Length: %strlen . . . .2. . . . ! and SEG . . .2 Resolving %define: %xdefine . . . . . .37 4. . . . . . . . . ~. .5 The Macro Name Itself: %? and %?? . . . . . . . . . . . . . . . . . . . . .1. . . . . . . . .45 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Defining Strings: %defstr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 *. . . . . . . .8 Condition Codes as Macro Parameters . . . . . . . . . .3 Greedy Macro Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . −. .7 Preprocessor Variables: %assign . . .37 4. .3 Macro Indirection: %[. .3 Multi−Line Macros: %macro . .47 4. . . . . . . . . . .40 4. . . . . . . . . . . . .3. .2. . . . . . . . . . . . . . . . .5. . . . . . . .5 %0: Macro Parameter Counter. . . . . . . .5 + and −: Addition and Subtraction Operators . . .44 4.1. . . . . . . . . .40 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 String Manipulation in Macros . . . . . . . . . . . . .3. . . . . . . . . .4 Default Macro Parameters . .3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Critical Expressions . . . . . . .6 SEG and WRT . . . . . . . . .3. . .5. . . . .1. . . . . . . . . . . . . . . .6 Undefining Single−Line Macros: %undef . . . . .33 3. . . . . . . . . . . . . . . . . . . . .34 3. . . . . . . .6 %rotate: Rotating Macro Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Concatenating Macro Parameters .5. . . . . . . . . . . . . . . . . . . . . . .41 4. . . . . . . . . . . //. . . . . . . . . . . . /. . . .3. . . . . . . . . .35 Chapter 4: The NASM Preprocessor . . . . . . .39 4. .4 Concatenating Single Line Macro Tokens: %+ . . . . . . . . . . . .38 4. . . . . . . . . . . . .3. . .10 Undefining Multi−Line Macros: %unmacro.41 4. . . . . . . . .41 4. . . . . . . . . . . . . . . . . . . . . . . . . . . .39 4. . . .7 Unary Operators: +. .3.35 3. . . . . .41 4. . . . . . . . . . . . . . . . . .41 4. . . . . . .5. . .. . . . . .7 STRICT: Inhibiting Optimization . . . . . . . .5. . . . . . . . . . . . . . . . . . . . . . .42 4. .2 Macro−Local Labels . . . . . . . . . . . . . . . . . . . .1. . .1 Single−Line Macros . . .33 3. . . . . . . . . . . . . . . . . . . . . . . .3. . . . . . . . . . . . . . . . . . . . . . . . . . . . .5. . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 4. . . . . . .33 3. . . .3. . . . . . . . . . . . . . . . . . . . . . . .

. .59 4. . . . . . . . . . . . .11. . . . . . . . . . . . . . . . . . . . . . . .55 4.60 4. . . . . . . . . .60 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 4. . . . . .4.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 4. . . . . . . . .3 __NASM_VER__: NASM Version string . . . . . . . . . . . .8.5 Preprocessor Loops: %rep. . . . . . . .49 4. .4 Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 %ifidn and %ifidni: Testing Exact Text Identity . . . . . . . . . . . . .7 %iftoken: Test for a Single Token . . . . .7.3 %local Directive . . . . . . . . . . . . .54 4. . .2 __NASM_VERSION_ID__: NASM Version ID . . .1 %arg Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Example Use of the Context Stack: Block IFs . . . .6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11.4. .4 %repl: Renaming a Context . . . .54 4. . . . .1 %push and %pop: Creating and Removing Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 %if: Testing Arbitrary Numeric Expressions . . . . . . . . . . . . .4 %use: Include Standard Macro Package . .53 4. . . . . . . . . . . . . . .57 4. . . . . .6. . . . . . . . . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . . .6. . . . . . . .53 4. .51 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 4. . . . . . . . . . . . .3 Context−Local Single−Line Macros. . . . . . . . .4. . .7 The Context Stack . . . . . . . . . . . . . . . . . . . . . . . . . .4 __FILE__ and __LINE__: File Name and Line Number. .10 Other Preprocessor Directives . . . . . . . . . . . . .11. . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 4. . .4. . . . . . . . . . . . . . . . . . . .50 4. . .11 Standard Macros .49 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10. . . . . . . . . . . . . .2 %ifmacro: Testing Multi−Line Macro Existence .59 4. . . . . .11. . . . .8 %ifempty: Test for Empty Expansion . . . .3 %depend: Add Dependent Files . . . . . . . . .52 4. .10. . .60 4. . . . . . . . . . . . . . . . . . . .53 4. . . . . . .55 4. . . . . . . . . . . . . . . .2 %pathsearch: Search the Include Path . .6 %ifid. . . . . . .56 4. . . . . . . . . . . . . . .49 4. . .59 4. . . . . .1 %include: Including Other Files . . . . . . .8 Stack Relative Preprocessor Directives . . . . . . . . %ifstr: Testing Token Types . . . . . . . . . .1 %line Directive . . .9 Reporting User−Defined Errors: %error. . . .2 %!<env>: Read an environment variable. . . . . .50 4. . . .48 4. . . . . . . . . .7. . .53 4. . . . . . . . . .7. . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Source Files and Dependencies . . . . . . . . . . . . . . . . .61 6 . .7. . . . . . . . . .51 4. .4. . . . . . .6. . . . . .7. . . . . . . .5 __BITS__: Current BITS Mode . . . . . . . . . . . . . . . . . . . . . . . . .48 4. . . . . . . . . . . . .3 %ifctx: Testing the Context Stack. . . . . . . .8. . . . . . . . . . . . . . . . . . . . . . . . . . . . %ifnum. . . . . . . . . . . . . . . . .2 Context−Local Labels.59 4.58 4. . . . . . . .4. . . . . . . . . .1 NASM Version Macros . . . .4. . . . .8. . .2 %stacksize Directive . . . . . . . . . . . . .56 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . %warning. . . . . .59 4. . . . . . . . . %fatal . . . . . . . .11. .1 %ifdef: Testing Single−Line Macro Existence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1. .4 Map Files . . .11. . . . . . . . . . . . . . . . .1. . . . .4. . . . . . . . . . . . . . . . . .11. . . . . . . . . . . . .3 srec: Motorola S−Records Output . . . . . .73 7. . . . . . . .5 EXTERN: Importing Symbols from Other Modules . . . . . . .61 4. .11. . . . . . . . . . . . .72 7. . . . . . . . .4 ABSOLUTE: Defining Absolute Labels. . . . . .72 7. . . . . . . . . . . . . . .7 Assembly Date and Time Macros . . . . . . . . . . . . . . . . . . .2 bin Extensions to the SECTION Directive . . .65 5. . . . . .65 Chapter 6: Assembler Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 COMMON: Defining Common Data Areas . . . .72 7.73 7. . . . . . . . . . . . . . . . . . . . . . . .70 Chapter 7: Output Formats . . .11. . . . . . . . . . .66 6. . .68 6. . . . . . . . . . . . . . . . . . . . . .67 6. . . . . . . . . . . . . . . . . . . . . .3 UPPERCASE: Disabling Case Sensitivity in Output . . . . .1 USE16 & USE32: Aliases for BITS . . . . . . .9 FLOAT: Handling of floating−point constants . . . . . . . . . . . . . . . . . . . . . . . .6 GLOBAL: Exporting Symbols to Other Modules .1. . .70 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 __PASS__: Assembly Pass .62 4. . . . . . . . . . . . . .72 7. . . . . . . . . . . . . . . . . . . . . . . . . .62 4. . . . . . . . . .11. . . . . . . .69 6. . . . . .1 obj Extensions to the SEGMENT Directive . . . . . . . . . . . . . . .74 7. . . . . . . . . . . . . . . . . . . . .67 6. . . . . . . . . . . . . . . . . . . . .11. . . . . .66 6. . . . . . .67 6. . . . .1.75 7. . . . . .12 ALIGN and ALIGNB: Data Alignment . . . . . . . . . . . . .65 5. . . . . . . .62 4. . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . . . . .3 SECTION or SEGMENT: Changing and Defining Sections . . . . .3 Multisection Support for the bin Format . . . . . . . . . . . . .76 7 . . . . .4 IMPORT: Importing DLL Symbols . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . . . . . . .73 7. . . . . . . . . . . . . .4 obj: Microsoft OMF Object Files . . . . . . . .69 6. . .4. . . . . . . . . . . . . . . . . . . .1 altreg: Alternate Register Names .63 4. . . . . . . . . . . . . . .64 Chapter 5: Standard Macro Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 CPU: Defining CPU Dependencies . . . . . . AT and IEND: Declaring Instances of Structures . . . . . . . . . . . . . .67 6. . . . . . . . . . .3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 7. . . . . .11. . . . . . . . . . . . . . . . . . . . . . . . . . .61 4. . . . . .2 GROUP: Defining Groups of Segments . . . . .11 ISTRUC. . . . . . . . . . . . .1. . . . . . . . . . .1 ORG: Binary File Program Origin . . . . . . . . . . . . . . . . . .2 smartalign: Smart ALIGN Macro . . . . . . . . . . . . . . . . .2 ith: Intel Hex Output . . . . . . . . . . . . . .10 STRUC and ENDSTRUC: Declaring Structure Data Types . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 The __SECT__ Macro . . . . . . . . .1 bin: Flat−Form Binary Output . . . . . . . . . . . . . . . .1 BITS: Specifying Target Processor Mode . . .73 7. . . . . . . . . . . . . . . . . . . . . . .8 __USE_package__: Package Include Test. . . . . . . . . . . . . . . . . . .2 DEFAULT: Change the assembler defaults . .6 __OUTPUT_FORMAT__: Current Output Format . .74 7. . . . . . . . . . . .69 6. . . . . . . . . .

. . . . . . . . . . . . .1. . . . . . . . . . . .81 7. . . . . . . . . . . . . . .EXE Files . . . . . . . .84 7. . . . . . . . . . . .87 7.78 7.84 7. . . . . .8 obj Extensions to the COMMON Directive . . . . . . . . . . .13. . . . . . . . . . . . . . . . . . .90 8. . . . . . .EXE Files . . . . . . . . . . . . . . . . . . . . . .1 Using the obj Format To Generate . . . . .11 aoutb: NetBSD/FreeBSD/OpenBSD a. . . . . . .86 7.84 7. . . . . . . . . . . .90 8. . . . . . .14 dbg: Debugging Format . . . .1 ELF specific directive osabi. . . . . . . . . . . . . . .3 rdf Extensions to the GLOBAL Directive . . . . . . . . . . . . .79 7. . . . . . . . . . . . . .2 Producing . . .88 7. . . . . . . . . .1 win32 Extensions to the SECTION Directive . . . . . . .2 win64: Structured Exception Handling .5. .78 7. . . .out Object Files .9. . . . . . . . . . . . . . .87 7. . .6.4. . . . . . . . . . . . . . . .13. . . .84 7. . .. . . .2 win32: Safe Structured Exception Handling .85 7. . . . . . . . . . . . . . . . . . . .6 win64: Microsoft Win64 Object Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9.8 macho32 and macho64: Mach Object File Format . . . . . . . . . . . . . . . . . . .5 EXPORT: Exporting DLL Symbols . .88 7. . . . . . . . . . . .87 7. . . . . . . .9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 elf Extensions to the SECTION Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13. . . . . . . . . . . .EXE Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .COM Files .7 obj Extensions to the EXTERN Directive . . . . . . . . . . . . .10 aout: Linux a. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .out Object Files . . . . . .92 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9.77 7.9. . . . .84 7. . . . . . . . . . .88 7. . . . . . . . . . . . . .2 Using the bin Format To Generate . . . . . .2 Specifying a Module Name: The MODULE Directive . . . . . . . . . . .87 7. . . . . . . . . . . . . . . . .4. . . . . .3 Position−Independent Code: elf Special Symbols and WRT . . . . . . . . .9. .4 rdf Extensions to the EXTERN Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Producing . . .9 elf32 and elf64: Executable and Linkable Format Object Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Debug formats and ELF . . . . . . . .7. . . . . . . .1). . . . . . . .5. . . .6. . . . . . . .4 Thread Local Storage: elf Special Symbols and WRT. . . .5 elf Extensions to the GLOBAL Directive .90 8. . . . . . . . . . . . . . . . .80 7. . . .80 7. . . . . . . . . . .9. . . .4. .1. . . . . . . . . . . .12 as86: Minix/Linux as86 Object Files . . . . . . . . . . . . . .77 7. . . . . . .77 7. . . . . . . . . . .89 Chapter 8: Writing 16−bit Code (DOS. . . . . . .13 rdf: Relocatable Dynamic Object File Format . .13. . . . . . . .86 7. . . . . . . . . . . . . . . .7 coff: Common Object File Format . . . . . . . . . . . . . . . . . . . . . .9. . . . . . . . . . . . . . .1 Requiring a Library: The LIBRARY Directive .87 7. .start: Defining the Program Entry Point . . . . . . . . . . . .4. . . . . . . .88 7.76 7. . .7 16−bit code and ELF . .1 win64: Writing Position−Independent Code . . .6 . . . . . . . .5 win32: Microsoft Win32 Object Files . .91 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . Windows 3/3. . . . . . . . . . . . . .86 7. . . . .87 7. . . . . . . . . . . . . . . . . . . .6 elf Extensions to the COMMON Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.8. . . . .92 8. . . . . . . . . . . . . . . . .5. . . . . . . . . . . . . 108 9. . . . .4 c32. . . . . . . . .4 Accessing Data Items . 110 Chapter 11: Writing 64−bit Code (Unix. . . .2. . 102 9. . . 107 9. . . . . . . .4. . . . . . . . .2 Borland Pascal Segment Name Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 c16.2 Addressing Between Different−Size Segments . . 100 8. .1 Register Names in 64−bit Mode . . . .5. . . . . . . . 106 9. . . . . . . . . . . . . . . . . . . . . . . . . . .1 External Symbol Names . . . DJGPP). 109 10. . . . . . . . . . . . . . . .5 Calling Procedures Outside the Library . . . . . . . . .COM Files . . . . . . . 112 11.SYS Files . . . . . . . . . . . . . . . . 102 9.1. . . . . . . . . . . . . . . . . . . . . . . . . . . .93 8. . . . . . . . . . . . . . . . . . . . . . . . 100 Chapter 9: Writing 32−bit Code (Unix. . . . 105 9.93 8. . . . . . .3 Using c16. . . . . . . . . . . . . . . . . .2 Function Definitions and Function Calls. . . . . . . . . . .4. . . . . . . . . . . . . . . . . . . . . . . 112 11. . . . . . . . . . . . . .3 Producing . . . .1 The Pascal Calling Convention . . . . . . Win32. . . . .3 Other Mixed−Size Instructions . . . . . . . . . . . . . . . . 102 9. . . . .4.93 8. . . . . . . . . .4. . . . .6 Generating the Library File . . . . . . .COM Files . . . . . .2 Immediates and Displacements in 64−bit Mode . .3 Function Definitions and Function Calls. . . . . . . . . . . . 109 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Finding External and Common Data Items . . . . . . . . . . .2. . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Using the bin Format To Generate .92 8. .2 Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries.mac: Helper Macros for the 32−bit C Interface . . . . . .1. . . . . . . . . .2. . . . . . . . .94 8. . .1. . . . 108 Chapter 10: Mixing 16 and 32 Bit Code. . . . . . . . . 109 10. . . . . . . . . . . . . . . . 112 11. . . . . . . . . . . . . . . . . . . . .99 8.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 External Symbol Names . . .mac With Pascal Programs . . . . . . . . .2. . .5. . .3 Interfacing to 64−bit C Programs (Unix) . . . . 104 9. . . . . . . . . . . . . . . . . . . . . 113 9 . . . . . . . . . . . . . 113 11. . . . . . . . . . . . . . . . . . . 102 9. . . . . . . . . . . .2 Using the obj Format To Generate . . . .2 Finding Your Local Data Items . . . . . . . . . . . . . . . . . . . . . . . .1 Obtaining the Address of the GOT . 105 9. .4 Interfacing to 64−bit C Programs (Win64) . . . . . . . . . . . . . . . . . . . . 106 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Mixed−Size Jumps .98 8. . . . . . . . . . . . . . . . . . . . 104 9. . . . . . . . . . . . . .1 Interfacing to 32−bit C Programs. .mac: Helper Macros for the 16−bit C Interface . . . . . . . . . . . . . . . . . . . . . . .3 Accessing Data Items . . . . . . . . . . . . . . . .97 8. . . . . . . . . . . . . . . . . . . . . . . .97 8.2 Memory Models . . . . . . . .4 Exporting Symbols to the Library User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Interfacing to Borland Pascal Programs . . . . . . . . . . . . . . . . . . . . . Win64) . . . .4 Interfacing to 16−bit C Programs. . . .95 8. . . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . .1. . . . . . .2. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . 121 B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 B. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 COM Files: Specifying an Origin . 116 12. . . . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . MMX2) . . .1 NASM Generates Inefficient Code . . . . . . . . . . . . 154 B. . .. . . . 120 A. . . . . . . . . . . . . . . 115 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . 115 12. . . . . . . . . . . . . . . 148 B. . .3 Running NDISASM. .1. . . . . . . . . . . . . . .a. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 B. . . . . .5 XSAVE group (AVX and extended state) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . .4 Bugs and Improvements . . . . . . . . . . . .1 Introduction . . . . . . .3 Mixed Code and Data: Automatic (Intelligent) Synchronisation . . . .13 VMX Instructions . . . . . . . . . . . . .8 AMD Enhanced 3DNow! (Athlon) instructions . . . . .1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Special instructions. . . . . 153 B. . . . . . . . . . . . . . .3. .3 Katmai Streaming SIMD instructions (SSE –– a. . 154 10 . . . . . . 148 B. . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . 118 A. . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . .1. . . . . . . . .k. . . . . . . 153 B. . . . . .2 Bugs . . . . . . . . . . . . . . . 118 A. . . . . . . . .11 Willamette Streaming SIMD instructions (SSE2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 149 B. . . . . . . . . .17 New instructions in Barcelona . . . . . . . . 154 B. . . . . . . . . . . . . . . 118 A. . . . 149 B. .Chapter 12: Troubleshooting . . . . . . . . .. .1. . . .1. . . . .3 ORG Doesn’t Work . . . . 120 Appendix B: Instruction List . . . . . . . . . . . . . . . . . . . 118 A. . .14 Extended Page Tables VMX instructions .10 Willamette MMX instructions (SSE2 SIMD Integer Instructions) . . . .7 New MMX instructions introduced in Katmai. . . . . . . . . . .2 Conventional instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 A. . . .1. . . . . . . . . . . . . . . .4 TIMES Doesn’t Work . . . . . . . . . . . . . . . . . . . . . . . . . .6 Generic memory operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 118 A. . . .3. . .2 Getting Started: Installation . . . . . . .1. . . . . . . . . . . . . . . 151 B. . . . . . . . . . . . . . . . . .4 Introduced in Deschutes but necessary for SSE support . . . . . . . .2 Code Following Data: Synchronisation . . . . . . . . . . . . . . . . . . . . . . . . 115 12. . . . . . .1 Common Problems . . . . . . . . . . 116 Appendix A: Ndisasm . . .1. . . . . . . . .1. . . . . . . . . .1. 121 B. . . . 118 A. . . . . . . . . . .15 Tejas New Instructions (SSSE3) . . . . . . XMM. . . . . . . . . . . . . . . . . . . . . . . . . . .3. . .16 AMD SSE4A . . . . . . . . . . . . . . . . . . . . . 153 B. . . . . . . . . . . . . . . . KNI. . . . . . . . 149 B. . .9 Willamette SSE2 Cacheability Instructions . . .1. .3. . . . . . . 115 12. . . . . . . . . . . . . . . . 148 B. . . . . 115 12. . . . . . . . .1. . . . . . . .4 Other Options .2 My Jumps are Out of Range . . . . . . .1. .12 Prescott New Instructions (SSE3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 B. . . . . . 121 B. . . . . . . . . . . . . . . . . . .1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.

. . . . . .05 . . .1. . . . . . . . . . . . . . 174 B. . . . . . . .1.1 NASM 2 Series . . . . . . . .1. . .5 Version 0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 B. . . . . . . . . 186 C. . . . . . .2 Version 0. . . . . . . . . . . . . . . .98. . . . . . .1. . . . . . . . . . . . . . . .03. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . . .01 . . . . . . . . . . . . . . . . . . . . . . . . 186 C. .1 Version 2.8 Version 2. . . .B. . . . .2 NASM 0.1. . . . .34 . . . . . . . . . . . . . . 174 B. . . . . . . . 188 C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . . . 162 B.3 Version 0. . . . . . . . . . . . . . . . . . . . . .98 Series . . . .35 . . . . . . . . . .1. . . . .01 . . . . . . . . . . . . . .23 Intel new instructions in ??? . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98. . . . . . . . . . 190 C. . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 C. . .6 Version 2. . . . . . . . .29 Intel Fused Multiply−Add instructions (FMA) . . . . . . 188 C. . . . . . . . . . . . . . . . . . 185 C. . . . . . . . . . . . 178 B.18 Penryn New Instructions (SSE4. 154 B. .28 Intel AVX Carry−Less Multiplication instructions (CLMUL) . . . . . . . . . . . . . .1 Version 0. . . . . . . . . . . .1. . . . . .2. . . . . 161 B. . .1. . . .1. . . . . . . . . . . . . . . . .02 . .31 AMD XOP. . . . . . . . . . . . .2). . . . . . 181 Appendix C: NASM Version History . . . . . . . . . . . . . . . . . . . . . . 185 C. . .2. . . . . . . . . . .2.1. . . .38 . 161 B. . . . . . . . . .3 Version 2. . . .05. . . . . . . . . . . . . . . . . . . . . . . . . .25 Intel AVX AES instructions . . . . . . . . . . . . . . . . . . .27 Intel Carry−Less Multiplication instructions (CLMUL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .06 . . . . . . . .20 AMD SSE5 instructions . . . . . . . . . . . .4 Version 2. . . . .37 . . . . . . . . . . . . . . . . . . . . .1. . . 189 C. . . . . . . . . . . . . . . . . . . . 191 11 . . . . . .2 Version 2. . . . . . . . . . . . . .98. . . . . . . . . . . .22 Geode (Cyrix) 3DNow! additions . . . . . . . . . .36 . . . . . . . . . . . . . . . .10 Version 2.9 Version 2. . . . 185 C. . . . .2. . .21 Intel SMX. . . . . . . . . . . . . . . . . . . . . . . . . .00 . . . . . . .1. . . . FMA4 and CVT16 instructions (SSE5) .33 .1). . .98. .4 Version 0. . .01 . . . . . . . . . . . . . . . . . . . . . . . . .98. . . . . .39 . . . . . . .1. . . . .98. . . . . . . . . . . . . . . . . . . . 162 B. . . . . .1. 187 C.32 Systematic names for the hinting nop instructions . . . . . . . .2. . 187 C. .7 Version 2. . . . . . . . . . .1. . . . . .30 VIA (Centaur) security instructions . . . . . . . . . . .5 Version 2. . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . .19 Nehalem New Instructions (SSE4. . . . .6 Version 0. . . . . . . .1. . . . 174 B. . . . . . . . .7 Version 0. . . . . . . . . . 161 B. . . . . .26 Intel AVX instructions . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . . .2. . . . .03 . . . . . . . . . . . . . . . . . 186 C. . . . . . . . . . . . . . . . . . . . . . 189 C. . .1. .07 . . .1. . 185 C. . . . . . . . . . . . . . . . . .24 Intel AES instructions . . . . . . . . 190 C. . . . . . . . . . . .2. . . 188 C. . . . . . . . . . . . . . . . . . . . .04 . . . . . . . . . 156 B. .1. . . . . . . . 156 B. . . . . . . . . . . . . . . . . . . . 190 C. .1. . . . . . . . . . . . . . . . . . . . . 190 C. . . . . . . . . . . . . . . . . . .98. . . 178 B.

. . . . . . . . .37 Version 0. .10 . . . . . . . . . . . . . . . . . . . . . .98. . . . . . . . . . . . . .98. . . . .34 Version 0. . . . . . . . . 192 C. . . . 192 C. . . . . .2. . .13 . . .2. . . . . . .38 Version 0. . .2. .2. . . .98p1 . . . .98. . . . . . . . . . . . . . . . . . . . . . . . . . .18 . . . 194 C.2. . . .40 Version 0.2. . . .25alt.32 Version 0. .98. . . . . . .98. . . . . . . . . 192 C.31 Version 0. . . . . . . . . . . . . . . . . . .2. . . . . . .98. . . . . . . . . .12 Version 0. . .98. . . . . . .98. . . . . . .22 . . . . . . . . . .98. . . . .2. . . . .30 Version 0. . . . . . . . . . . . . . . . . . . . .29 Version 0. . . . .32 .08 .15 Version 0. . . . . . . . . . . 193 C. . 195 C. . . . . . . . . . . . . . . . .26 . . . . . . . . . . . .28 Version 0. . . . . . . .98. . . . . . . . . . . . . 194 C. . . .42 Version 0. . . . . . . . . .98. . 193 C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 C. . . . . 193 C. . . . . . . . . . . . .24 .98bf (bug−fixed) . . . .98. . . . . . . .98. . . . . . . . . .21 Version 0. . . . . . . . . . .06e released 01/09/01 . . . . . . . . . . . . . . . . . .98. .2. . . . . . . . . . . . . . . . . . . . . .27 Version 0. . . . . . . . . .11 Version 0. . . . . . .98. .2. . . .2. . . . .98. . . . . . . . . . . . . . . . . . . . . . . . . . . .23 . .98. . . . . .2. .98. . . . . . . . .19 . . . . . . . . . . . . .25 . . . . . . .2. . . . . . . . . . . . .09b with John Coffman patches released 28−Oct−2001 . . .98. . .2. . . . . . . . . . . . . . . . . . . .16 . . . . . . . . . . . . . . . .13 Version 0. . . . 193 C. . .14 Version 0. . . . . . .18 Version 0. . . .2. . . . .22 Version 0. 196 C. . . . . . . . .03 with John Coffman’s changes released 27−Jul−2000 . . . . . . . . . .2. . . . . . . . . . . . . . . . . .98. .19 Version 0. . . . . . . . .24p1. . . . . . . . . . .2. . . . . . . . .98 . . . . . . . . . . . . .2. . . .98. . . . . . . . . 199 C. . . . . . . . . .9 Version 0.98. .10 Version 0. . . . . . . . . . . . .2. . .98. . . . . . . . 192 C. . . . .2. . .98. . . . . . . . . . . . .28 . . . . . . . 193 C. .2.07 released 01/28/01 .16 Version 0. . . . . . . .8 Version 0. . . . . . . . . . . . . . . . . . 193 C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98. . . . . . . . . . . . . . . . 193 C. . . . . . . . . . . . . . . . 194 C. .36 Version 0. . . . . . . . .25 Version 0.03 . . . . . . . . . . . . 193 C.2. . . . . . . . . . . 195 C. . . . . . . . . . 193 C. . . . 195 C. . 193 C. . . . . . . . . . . . . .11 . . . . . . .2. . . . . . . . . . .31 . . . . .14 . . . . . . . . . .09 . . . . . . . . . . . . . . . . .2. . . . . . . . . .98p9 . . . . . .98. . . . . . . . . . . . . . . . . . . .2. 191 C. . . . . . . . . . . . . . . 194 C. . . . . . . .15 . . . . . .33 Version 0. . . . . . . . . . . . .C. . . . . . . . . .2. . . . . . . . 195 C. . . . . .2. .26 Version 0. . . . . 193 C. . . . 195 C. . . . . . . . . . . . . . . .2. . . . . . . . . . . . .2. . . . .98. 195 C. . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . . . .98. . . . 193 C. .98. . . . . . .2. . . . . 192 C. . . . . . . . . . . . . . . 192 C. . . . . . . . . . . . . . . . . . .2. . . . . .35 Version 0. . . . . . .98.39 Version 0. . . . .24 Version 0. . . . . . . . . . . . . . . . . . . . .17 Version 0. . . . . . . . .20 Version 0. . . . . . .12 . . . . . . . .2. . . . . . . . .17 .23 Version 0. .06f released 01/18/01 . 199 12 . . .2.20 . . . . . . . . . . . . .41 Version 0. . . . . . . . . . . . . . .30 . . . . . . . . . . . . .2. . . . 193 C. . . . . .98. . . . . . . . . . .21 . . . . . . . . . . . 193 C. . .

. . . . . . . . . . .43 Version 0. . . . . . . . . . . . .3. . . . . . 201 C. . . . . . . . . . . . . .C. . . . 204 C. . . . . . . . . . . . . .97 released December 1997 . .3. . . . . . . . 207 C. . . . . . . . .3. . . 206 C.2 Version 0. . .44 Version 0. . . . . . . . . . . . . . . 203 C. . . . . . . . . . . . . . . . . . . . . . . . . . .52 Version 0. 200 C. . .3. . . . . . . . . . . 202 C. 208 C. .5 . . . . . . . . . . . . 202 C. . . . . 201 C. . . . . . . . .45 Version 0.49 Version 0. .2. . .8 Version 0. . . . . . . . . . . . . .5 Version 0. . . . . . . .98p3. . . . . . .2. . . . . . . . . . .96 released November 1997 . . . . .98p3. . . . . . . . . . . . . . . . . . . . 200 C. . . . . . . . . . . . . . . . . . . .9 Series . . .2. . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Version 0. . . . .4 Version 0. . . . . . . . . .98p3−hpa . . 200 C. . . . . . . .2 .93 released January 1997. . . . .6 Version 0. . . . . . .3 NASM 0. . . . . . . . . . . . . .98p8 . . . . .50 Version 0. . .3. . . . . . . 202 C. . . . .98 pre−release 3 . . 201 C. . . . . . .98 pre−release 1 . . . . . . . . . . . . . . . .98p3.2. . . . . . . . .98p7 . . .98p3. . . . . . . . . . .54 Version 0. . . . . . . . . . . . . . .6 . . . . . . . . . . . . . . . . . . . . .98p3. . . . . . . . . . . . . . . . . . . . . . .1 Version 0. . . . . . . . .47 Version 0. .94 released April 1997 . .2. . . . . . . . . . . . . . . 200 C. . . . . . . . . . . .2. . . . . . . . . . . . . .51 Version 0. . .98p6 .3. . . . . . . . . . . . . . . . .92 released January 1997. . . . . 202 C. . 209 13 . . . .48 Version 0. . . . . . . . . . 208 C. . . . . . .95 released July 1997 . . . . . . . . . . . .4 . . . . .3.3 . . . . . . . . . . . . . . . . . .3. . . . . . . . . .53 Version 0. . . . . . . . . . . . . .2. . . . . . . . . . . . 208 C. . . . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . 201 C. 199 C. . . . . . . . . . . . . . . .90 released October 1996 . . . . . . . . . . . .55 Version 0. . . . . .98p3. . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . .98 pre−release 2 . .2. . . . . . . . . . . . . 203 C. .7 . . .3 Version 0. . . . . . .91 released November 1996 . . . . .2. . . . . . . . . . . . . .46 Version 0. . . . . . . . . . .2. . . . . .

1 Why Yet Another Assembler? The Netwide Assembler grew out of an idea on comp. It supports all currently known x86 architectural extensions. too. fixes. please send us bug reports. with the contradictions and quirks that entails (although it sorts out some of those by means of Ideal mode. for your coding pleasure. • Redistributions in binary form must reproduce the above copyright notice.) It’s expensive too. which means millions of directives and tons of red tape. • a86 is good.lang. including Linux and *BSD a. is an 80x86 and x86−64 assembler designed for portability and modularity. and it’s (was) expensive. 1. It will also output plain binary files. COFF. since it’s designed to be a back end to gcc.1 What Is NASM? The Netwide Assembler.lang. is NASM. are permitted provided that the following conditions are met: • Redistributions of source code must retain the above copyright notice. It supports a range of object file formats.) • as86 is specific to Minix and Linux.1. It’s DOS only.asm – I forget which). Redistribution and use in source and binary forms. And it’s DOS−only. and has strong support for macros. 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). similar to Intel’s but less complex. So its error checking is minimal. Plus you can’t write 16−bit code in it (properly. which was essentially that there didn’t seem to be a good free x86−series assembler around. 14 . with or without modification. Win32 and Win64. also known as the simplified BSD license. So here. and that maybe someone ought to write one. and ports over to DOS and Unix. this list of conditions and the following disclaimer. • MASM isn’t very good. But please. for the license conditions under which you may use NASM.x86 (or possibly alt. this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. from the point of view of anyone trying to actually write anything in it.2 License Conditions Please see the file LICENSE. but not free. and in particular you don’t get any 32−bit capability until you pay. • gas is free. but still strives for MASM compatibility. At present it’s still in prototype stage – we don’t promise that it can outperform any of these assemblers. Its syntax is designed to be simple and easy to understand. and (my version at least) doesn’t seem to have much (or any) documentation. Also. ELF. Copyright 1996−2009 the NASM Authors – All rights reserved. Mach−O. and we’ll improve it out of all recognition. 1. which always feeds it correct code. Microsoft 16−bit OBJ.Chapter 1: Introduction 1. NASM is now under the so−called 2−clause BSD license. Again. its syntax is horrible. and it runs only under DOS. supplied as part of any NASM distribution archive.asm. • TASM is better. helpful information. NASM. And its syntax is essentially MASM’s.out.1. but it’s not very good.

nasm−XXX. you may want to keep the documentation or test programs. BUT NOT LIMITED TO. or alternatively edit autoexec. See the file INSTALL in the source archive.x86.zip (where XXX denotes the version number of NASM contained in the archive). If it’s not there. LOSS OF USE. unpack it into its own directory (for example c:\nasm). OR CONSEQUENTIAL DAMAGES (INCLUDING. WHETHER IN CONTRACT.1 Installing NASM under MS−DOS or Windows Once you’ve obtained the appropriate archive for NASM. and the current development status. INDIRECT. 1. Note that a number of files are generated from other files by Perl scripts. OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY. the nasm directory will also contain the full NASM source code. NASM has a website at http://www.nasm.lang. The archive will contain a set of executable files: the NASM executable file nasm.dat. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. please subscribe to the nasm−devel email list. the NDISASM executable file ndisasm. google for us! New releases of NASM are available from the official web site. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT.2 first.zip or nasm−XXX−win32.exe.freshmeat. see link from the website.2 Contact Information The current version of NASM (since about 0. Although the NASM source distribution includes these generated files.exe.) That’s it – NASM is installed. so copy nasm.mac or the documentation.08) is maintained by a team of developers. these instructions may work under other versions of Windows as well. You don’t need the nasm directory to be present to run NASM (unless you’ve added it to your PATH). EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.zip.us/. 15 . DATA. standard.asm. nasm−XXX−dos.3 Installation 1. are available from www.exe to a directory on your PATH. and to the web site If you want information about NASM beta releases. If you want to report a bug.bat to add the nasm directory to your PATH (to do that under Windows XP. OR PROFITS. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES. The only file NASM needs to run is its own executable. however. STRICT LIABILITY. please read section 12.cpan. and a selection of Makefiles you can (hopefully) use to rebuild your copy of NASM from scratch. 1. comp. Ports of Perl for a variety of platforms.net/. go to Start > Control Panel > System > Advanced > Environment Variables. INCIDENTAL. EXEMPLARY. including DOS and Windows. so you can delete it if you need to save space.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES. you will need to rebuild them (and hence. BUT NOT LIMITED TO. and possibly additional utilities to handle the RDOFF file format. It is possible future source distributions may not include these files at all. If you’ve downloaded the DOS source archive. INCLUDING.3.org. will need a Perl interpreter) if you change insns.98. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE. Announcements are posted to http://www. accessible through the nasm−devel mailing list (see below for the link). SPECIAL.

if you want them.tar. when unpacked. Once NASM has auto−configured.1 and ndisasm. you can type make to build the nasm and ndisasm binaries. NASM is an auto−configuring package: once you’ve unpacked it.2 Installing NASM under Unix Once you’ve obtained the Unix source archive for NASM. or install the programs yourself. The archive./configure.1 in /usr/local/man/man1. which are in the rdoff subdirectory of the NASM archive. nasm−XXX. Alternatively. and then make install to install them in /usr/local/bin and install the man pages nasm. This shell script will find the best C compiler to use for building NASM and set up Makefiles accordingly. NASM also comes with a set of utilities for handling the RDOFF custom object−file format. unpack it into a directory such as /usr/local/src.3.gz (where XXX denotes the version number of NASM contained in the archive). cd to the directory it’s been unpacked into and type . you can give options such as −−prefix to the configure script (see the file INSTALL for more details).1. 16 . will create its own subdirectory nasm−XXX. You can build these with make rdf and install them with make rdf_install.

with the hex codes output from NASM displayed on the left of the original sources. To produce a listing file. unless it gives error messages. For Microsoft object file formats (obj. it will remove the . ieee. so that myfile.obj. as86.rdf. If you use Linux but aren’t sure whether your system is a.asm −l myfile. . this will also list the available output file formats.1 The −o Option: Specifying the Output File Name NASM will normally choose the name of your output file for you. If it says something like nasm: ELF 32−bit LSB executable i386 (386 and up) Version 1 then your system is ELF. For Unix object file formats (aout. ith and srec.asm into a raw binary file myfile.asm will assemble myfile. rdf. for example: nasm −f coff myfile.asm produces the output file myfile. your system is a. elf32. and for the bin format it will simply remove the extension. elf64. NASM is silent unless it goes wrong: you won’t see any output at all. macho32 and macho64) it will substitute . use the −l option to give a listing file name. coff.) Like Unix compilers and assemblers. For dbg. and are rare these days. and you should use −f aout instead (Linux a. If it says nasm: Linux/i386 demand−paged executable (QMAGIC) or something similar.lst To get further usage instructions from NASM.Chapter 2: Running NASM 2.asm −o myfile.ith and . 2.com. win32 and win64). And nasm −f bin myfile.srec. and what they are.com will assemble myfile. try typing nasm −h As −hf.o.dbg.asm into an ELF object file myfile.out or ELF.out systems have long been obsolete. it will use .1 NASM Command−Line Syntax To assemble a file. respectively.out. type file nasm (in the directory in which you put the NASM binary when you installed it). and you should use the option −f elf when you want NASM to produce Linux object files.o.1. 17 . you issue a command of the form nasm −f <format> <filename> [−o <output>] For example. . precisely how it does this is dependent on the object file format.asm extension (or whatever extension you like to use – NASM doesn’t care) from your source file name and substitute . nasm −f elf myfile.

3 The −l Option: Generating a Listing File If you supply the −l option to NASM. rather than to stdout. This can be used to list only sections of interest.1. which allows you to specify your desired output file name. There is no "user form" (without the brackets). in which addresses and generated code are listed on the left. This differs from the −M option in that if a nonexisting file is encountered.9) on the right. This can be redirected to a file for further processing.7 The −MD Option: Assemble and Generate Dependencies The −MD option acts as the combination of the −M and −MF options (i.2 The −f Option: Specifying the Output File Format If you do not supply the −f option to NASM. See section 2.1.e. 2.5 The −MG Option: Generate Makefile Dependencies This option can be used to generate makefile dependencies on stdout. For example: nasm −M −MF myfile. (the default.1. and turn it back on with [list +]. In the distribution versions of NASM. followed (with the usual optional space) by a file name. if you’ve compiled your own copy of NASM. the intervening space between −f and the output file format is optional. avoiding excessively long listings.22.dep 2. −MD does not inhibit the normal operation of the assembler. Use this to automatically generate updated dependencies with every assembly session.3. Like −o.asm −o program. unlike the −M or −MG options.) However.1.If the output file already exists. a filename has to be specified. For example: nasm −M myfile. 2.sys Note that this is a small o.lst If a list file is selected. NASM provides the −o command−line option. 2. NASM will overwrite it.1. For example: nasm −f bin program.1.asm −l myfile.out as the output file name instead. in which case it will give a warning and use nasm. either with or without an intervening space. and is different from a capital O . unless it has the same name as the input file.com nasm −f bin driver.asm −odriver. you may turn off listing for a section of your source with [list −]. so −f elf and −felf are both valid. For example: 18 . For example: nasm −f elf myfile. NASM will generate a source−listing file for you. A complete list of the available output file formats can be given by issuing the command nasm −hf.dep myfile.asm 2. the default is always bin.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. For situations in which this behaviour is unacceptable. and the actual source code. with expansions of multi−line macros (except those which specifically request no expansion in source listings: see section 4.asm > myfile. which is used to specify the number of optimisation passes required. it is assumed to be a generated file and is added to the dependency list without a prefix.4 The −M Option: Generate Makefile Dependencies This option can be used to generate makefile dependencies on stdout.1. you can redefine OF_DEFAULT at compile time and choose what you want the default to be. 2. it will choose an output file format for you itself. obviously). You invoke −o by following it with the name you wish for the output file.

8 The −MT Option: Dependency Target Name The −MT option can be used to override the default name of the dependency target. See section 2.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.03. Not all output formats currently support debugging output.1. to enable output. The other format.1. Prior to version 2. if any.01 and later automatically enable −g if −F is specified.asm(65) : error: specific error message where the only difference is that the line number is in parentheses instead of being delimited by colons.10 The −MP Option: Emit phony targets When used with any of the dependency generation options. This option can be used to generate debugging information in the specified format.01. the use of this switch did not enable output of the selected debug info format. 2. −g is silently ignored. section 7. If no debug information is currently implemented in the selected output format. This is normally the same as the output filename. specified by −Xvc is the style used by Microsoft Visual C++ and some other programs. two error reporting formats may be selected.9 The −MQ Option: Dependency Target Name (Quoted) The −MQ option acts as the −MT option. error is the severity of the error (this could be warning). Versions 2. 65 is the source file line number on which the error was detected. and specific error message is a more detailed text message which should help pinpoint the exact problem. see section 7. Currently. A complete list of the available debug file formats for an output format can be seen by issuing the command nasm −f <format> −y.asm:65: error: specific error message where filename.1. This is not foolproof.12 The −g Option: Enabling Debug Information.14.1.1. This prevents Make from complaining if a header file has been removed. They are the −Xvc option and the −Xgnu option. 2.asm is the name of the source file in which the error was detected.1.1. 2. 2.nasm −f elf −o myfile.26.03.1. For information on how to enable it when building from the sources. Use −g.asm 2.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. 19 . See also the Visual C++ output format. see section 2.1.o −MD myfile. See section 2.dep myfile.5. It looks like this: filename. as not all characters with special meaning are quotable in Make.12. Using −g without −F results in emitting debug info in the default format. to be used by a debugger (or will be).11. This should not be confused with the −f dbg output format option which is not built into NASM by default. 2. The GNU format is the default and looks like this: filename. the −MP option causes NASM to emit a phony target without dependencies for each header file. specified by the −o option. except it tries to quote characters that have special meaning in Makefile syntax. for the selected output format.

a trailing forward slash is similarly necessary.inc" at the start of the file..1.17 The −p Option: Pre−Include a File NASM allows you to specify files to be pre−included into your source file. (You can use this to your advantage. the string you provide as an argument to the −i option will be prepended exactly as written to the name of the include file.2.. in the interests of complete source−code portability.i" to search for the file foobar. You could code 20 . but it was changed since −E is an option conventionally used for preprocessing only. section 2. Therefore you can redirect the errors into a file by typing nasm −Z myfile.6. with disastrous results. 2.asm In earlier versions of NASM.1. similar to /usr/include on Unix systems. section 4.err −f obj myfile. it will search for the given file not only in the current directory.3). 2. NASM. Therefore the trailing backslash in the above example is necessary. Therefore you can include files from a macro library. For Makefile compatibility with many C compilers. this can make it hard to capture the errors if (for example) you want to load them into an editor. by the use of the −p option. NASM therefore provides the −Z option.2 or section 3. this option can also be specified as −I.1.1. 2. if you’re really perverse.asm (As usual.14. To assemble the file myfile.asm and pipe its output to the more program. For consistency with the −I. you should place one or more −i directives in the NASMENV environment variable (see section 2.) If you want to define a standard include search path. So running nasm myfile. −D and −U options. you can type: nasm −s −f obj myfile. 2. by noting that the option −ifoo will cause %include "bar.asm | more See also the −Z option.15 The −s Option: Send Errors to stdout The −s option redirects error messages to stdout rather than stderr. this option was called −E. but also in any directories specified on the command line by the use of the −i option. so it can be redirected under MS−DOS.1. does not understand the file naming conventions of the OS it is running on.6.28). and optional).inc is equivalent to running nasm myfile.1.asm −p myinc.i.2. taking a filename argument which causes errors to be sent to the specified files rather than standard error. for example. a space between −i and the path name is allowed.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.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.asm and placing the directive %include "myinc. Under Unix.16 The −i Option: Include File Search Directories When NASM sees the %include or %pathsearch directive in a source file (see section 4. this option can also be specified as −P.20.1. See section 2.1.1. by typing nasm −ic:\macrolib\ −f obj myfile. Since NASM usually produces its warning and error messages on stderr. the −d option gives an alternative to placing a %define directive.

the following command line: nasm myfile. this option can also be specified as −D. as well: the option −dFOO is equivalent to coding %define FOO. As above. you have to enable optimization. for example −dDEBUG. remove all the comments and preprocessor directives. this option can also be written −e.14. All operands take their long forms. 2. For Makefile compatibility with many C compilers.1. Conditional jumps default to the long form unless otherwise specified. For compatiblity with older version of NASM.1.21 The −a Option: Don’t Preprocess At All If NASM is being used as the back end to a compiler.1. to save time and increase compilation speeds. This is useful to override options specified at a different point in a Makefile. up to a point. 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. This means that if you want the shortest possible object code. except conditional jumps. • −O1: Minimal optimization. 2. expand all the macro references. this option can also be specified as −U. 2. and print the resulting file on standard output (or save it to a file.1. but immediate operands which will fit in a signed byte are optimized. either automatically or by a −p or −d option specified earlier on the command lines. You can miss off the macro value. Using the −O option. This is intended to match NASM 0.98 behavior. The syntax is: • −O0: No optimization. you can tell NASM to carry out different levels of optimization. This form of the directive may be useful for selecting assembly−time options which are then tested using %ifdef. requiring no argument. −E in older versions of NASM was the equivalent of the current −Z option. 2. 21 .nasm myfile.asm −dFOO=100 −uFOO would result in FOO not being a predefined macro in the program.asm −dFOO=100 as an alternative to placing the directive %define FOO 100 at the start of the file. For example. The −a option. if the −o option is also used).20 The −E Option: Preprocess Only NASM allows the preprocessor to be run on its own. it might be desirable to suppress preprocessing completely and assume the compiler has already done it. Using the −E option (which requires no arguments) will cause NASM to preprocess its input file.19 The −u Option: Undefine a Macro The −u option undefines a macro that would otherwise have been pre−defined. if a short form is not specified. unless the long form is specified.1. For Makefile compatibility with many C compilers. section 2. instructs NASM to replace its powerful preprocessor with a stub preprocessor which does nothing.22 The −O Option: Specifying Multipass Optimization NASM defaults to not optimizing operands which can fit into a signed byte.

When NASM’s −t option is used. Note that this is a capital O.23 The −t Option: Enable TASM Compatibility Mode NASM includes a limited form of compatibility with Borland’s TASM. • macro−selfref warns if a macro references itself. • orphan−labels covers warnings about source lines which contain no instruction but define a label without a trailing colon. Warnings do not prevent NASM from generating an output file and returning a success status to the operating system. endif. The GNU extensions allow this.1. ifdef. • float−denorm warns about floating point denormals. This warning class is enabled by default.1 for an example of why you might want to disable it. Note that you lose the ability to override the default address type for the instruction. Some conditions are even less severe than that: they are only sometimes worth mentioning to the user.1. you can enable warnings of this class by the command−line option −w+orphan−labels and disable it by −w−orphan−labels. In TASM compatible mode. • number−overflow covers warnings about numeric constants which don’t fit in 64 bits.1. This warning class is enabled by default. These conditions are reported like errors.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 come up with the word ‘warning’ before the message. 2. This number has no effect on the actual number of passes. overriding size specification unless the strict keyword has been used (see section 3. Disabled by default. include. NASM warns about this somewhat obscure condition by default. see section 4. Therefore NASM supports the −w command−line option. which is used to specify the output file name. E. the letter x may also be any number greater than one.• −Ox (where x is the actual letter x): Multipass optimization.[DWORD val] is valid syntax in TASM compatibility mode. Such warning classes are described by a name. the following changes are made: • local labels may be prefixed with @@ instead of . see section 4. • unprefixed forms of some directives supported (arg.7). see section 3. See section 2.3. 22 .1.4 for why you might want to disable it. The −Ox mode is recommended for most uses. For compatability with earlier releases. The suppressible warning classes are: • macro−params covers warnings about multi−line macros being invoked with the wrong number of parameters. • gnu−elf−extensions warns if 8−bit or 16−bit relocations are used in −f elf format. This warning class is enabled by default. Enabled by default. ifndef. • float−overflow warns about floating point overflow. • size override is supported within brackets.3. a size override inside square brackets changes the size of the operand. for example orphan−labels. This warning class is disabled by default. else. if. • macro−defaults warns when a macro has more default parameters than optional parameters. and is different from a small o. This warning class is disabled by default.g. which enables or disables certain classes of assembly warning. and not the address type of the operand as it does in NASM syntax. ifdifi. Minimize branch offsets and signed immediate bytes. mov eax. but not a sufficiently severe error to justify NASM refusing to generate an output file. elif.1 for more information. local) 2.

• float−underflow warns about floating point underflow.31. then NASM will treat this character as the separator character for options.98.1. so that the value −s −ic:\nasmlib will be treated as two separate options. Since version 2. This was changed with version 0. However. • error causes warnings to be treated as errors. This environment variable was previously called NASM. Enabled by default. • user controls %warning directives (see section 4. 2. To get round this. which are processed before the real command line. 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. Thus. 23 . E. Disabled by default.1. Disabled by default. The value of the variable is split up at white space.00. the program will interpret it as a list of extra command−line options. respectively.28 The NASMENV Environment Variable If you define an environment variable called NASMENV. that means that the value −dNAME="my name" won’t do what you might want. −−prefix _ will prepend the underscore to all global and external variables. 2. 2. −w+all enables all available warnings. The −−prefix and −−postfix options prepend or append (respectively) the given argument to all global or extern variables.1. You can use this to define standard search directories for include files.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.25 The −v Option: Display Version Info Typing NASM −v will display the version of NASM which you are using. but !−dNAME="my name" will work. • float−toolong warns about too many digits in floating−point numbers.g. disabled with [warning −warning−name] or reset to their original value with [warning *warning−name]. Warning classes may be enabled with [warning +warning−name].27 The −−prefix and −−postfix Options. The default format is indicated by an asterisk. by putting −i options in the NASMENV variable. and the date on which it was compiled. you can set warning classes across sections. You will need the version number if you report a bug. No "user form" (without the brackets) exists. as C sometimes (but not always) likes it. • all is an alias for all suppressible warning classes (not including error). So setting the NASMENV variable to the value !−s!−ic:\nasmlib is equivalent to setting it to −s −ic:\nasmlib. 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". In addition. Enabled by default. if you begin the NASMENV environment variable with some character that isn’t a minus sign.9).1. NASM has also supported the gcc−like syntax −Wwarning and −Wno−warning instead of −w+warning and −w−warning. NASM provides a feature whereby.

The correct syntax for the above is mov ax. NASM doesn’t support the LODS. on seeing var dw 0.[table+bx].2 Quick Start for MASM Users If you’re used to writing programs with MASM. you must code mov ax. by design. NASM will deliberately remember nothing about the symbol var except where it begins.2. such as mov ax.4) to ensure that all symbols exported to other code modules are forced to be upper case. it’s probably worth skipping this section. If you’re not already used to MASM.3 NASM Doesn’t Store Variable Types NASM. Foo or FOO. chooses not to remember the types of variables you declare. and will then be able to fill in the ambiguity in the size of the instruction mov var. as far as is practical. 24 .1 NASM Is Case−Sensitive One simple difference is that NASM is case−sensitive. that you declared var as a word−size variable. for example.bar. mov ax. in the interests of simplicity. MOVS. INS. where a memory reference is denoted by one portion outside square brackets and another portion inside. which explicitly specify the size of the components of the strings being manipulated.foo ax. and so you must explicitly code mov word [var]. This issue is even more confusing in a86.OBJ files. One of the design goals of NASM is that it should be possible.es:[di] is wrong and mov ax. foo bar equ dw 1 2 then the two lines of code mov mov ax.2. Likewise. but even then. and any access to the address of a variable doesn’t. you can invoke the UPPERCASE directive (documented in section 7.[bar]. NASM is very simple by comparison: everything is a label.2. and to access the contents of the variable bar.[es:di] is right. this section attempts to outline the major differences between MASM’s syntax and NASM’s. CMPS. mov ax.2. NASM will distinguish between labels differing only in case. also does not support the hybrid syntaxes supported by MASM and its clones. So an instruction of the form mov ax. SCAS.table[bx].foo will always refer to a compile−time constant.bar generate completely different opcodes.var has different behaviour depending on whether var was declared as var: dw 0 (a label) or var dw 0 (a word−size variable).2. so in a86. It makes a difference whether you call your label foo. MOVSW. 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. since the MASM code mov ax. despite having identical−looking syntaxes.2 NASM Requires Square Brackets For Memory References NASM was designed with simplicity of syntax in mind. You can’t do this in MASM: if you declare. For this reason. you can always code %idefine offset to make the preprocessor treat the OFFSET keyword as a no−op. This also means that NASM has no need for MASM’s OFFSET keyword. Whereas MASM will remember. If you’re assembling to DOS or OS/2 .2. whether it’s an EQU or the address of a variable.offset bar means exactly the same thing as NASM’s mov ax. If you’re trying to get large amounts of MASM code to assemble sensibly under NASM. NASM. 2. 2. for the user to look at a single line of NASM code and tell what opcode is generated by it. or with TASM in MASM−compatible (non−Ideal) mode. and SCASD. but only supports the forms such as LODSB. STOS. The rule is simply that any access to the contents of a memory location requires square brackets around the address. within a single module. NASM avoids this undesirable situation by having a much simpler syntax for memory references. 2. or with a86. or OUTS instructions.

The programmer has to keep track of which functions are supposed to be called with a far call and which with a near call. st1 etc. and will never automatically generate a segment override prefix. and a86 would call them simply 0. and must also keep track of which external variable definitions are far and which are near. NASM requires stack resb 64. however.2. 2. macros and directives work completely differently to MASM. In addition to all of this.95 and earlier was based on a misunderstanding by the authors. DUP is still not a supported syntax.6 Floating−Point Differences NASM uses different names to refer to floating−point registers from MASM: where MASM would call them ST(0). See chapter 4 and chapter 6 for further details. it also does not support the ASSUME directive. 25 . you can code ? equ 0 and then writing dw ? will at least do something vaguely useful. The idiosyncratic treatment employed by 0. 2.4 NASM Doesn’t ASSUME As part of NASM’s drive for simplicity. ST(1) and so on.2. NASM uses the keyword TWORD where MASM and compatible assemblers use TBYTE.5 NASM Doesn’t Support Memory Models NASM also does not have any directives to support different 16−bit memory models. NASM accepts RET itself as an alternate form for RETN). 1 and so on. the programmer is responsible for coding CALL FAR instructions where necessary when calling external functions. 2. NASM does not declare uninitialized storage in the same way as MASM: where a MASM programmer might use stack db 64 dup (?). intended to be read as ‘reserve 64 bytes’.96.2. in addition. For a limited amount of compatibility.7 Other Differences For historical reasons. NASM chooses to call them st0. since NASM treats ? as a valid character in symbol names. NASM now treats the instructions with ‘nowait’ forms in the same way as MASM−compatible assemblers.2. and is responsible for putting the correct form of RET instruction (RETN or RETF. As of version 0. NASM will not keep track of what values you choose to put in your segment registers.2.

NASM also supports a number of pseudo−instructions. LOCK or REPE can appear on a line by themselves. We recommend the latter syntax. A32. in the usual way. MMX instructions and even undocumented instructions are all supported.g. there is no clean syntactic way to proceed apart from es lodsb. The only characters which may be used as the first character of an identifier are letters. which has no operands and yet can require a segment override. and ?. A32. constants (section 3. described in section 3.4) or expressions (section 3.Chapter 3: The NASM Language 3. ebx.. FPU instructions. thus. Explicit address−size and operand−size prefixes A16.ax. NASM accepts a wide range of syntaxes: you can use two−operand forms like MASM supports. (with special meaning: see section 3. @. . For x87 floating−point instructions. You can also use the name of a segment register as an instruction prefix: coding es mov [bx]. an instruction and a comment is allowed.2. cr0: NASM does not use the gas–style syntax in which register names must be prefixed by a % sign). you can refer to $eax in NASM code to distinguish the symbol from the register. since it is consistent with other syntactic features of the language. (Note that this means that if you intend to code lodsb alone on a line. numbers. REP.9). _ and ?. the operand field is either required or forbidden by the presence and nature of the instruction field. NASM places no restrictions on white space within a line: labels may have white space before them.1 Layout of a NASM Source Line Like most assemblers. _. or you can use NASM’s native single−operand forms in most cases. ax.ax is equivalent to coding mov [es:bx]. 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. For example. but for instructions such as LODSB. you can code: 26 . An instruction is not required to use a prefix: prefixes such as CS. 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. or they can be effective addresses (see section 3. Instruction operands may take a number of forms: they can be registers. each NASM source line contains (unless it is a macro. Of course. if some other module you are linking with defines a symbol called eax. The instruction field may contain any machine instruction: Pentium and P6 instructions. NASM uses backslash (\) as the line continuation character. . O64 are provided – one example of their use is given in chapter 10. $. most of these fields are optional. or instructions may have no space before them. if a line ends with backslash. comment As usual. The instruction may be prefixed by LOCK. or anything. REPE/REPZ or REPNE/REPNZ. #.) Valid characters in labels are letters. a preprocessor directive or an assembler directive: see chapter 4 and chapter 6) some combination of the four fields label: instruction operands . In addition to actual machine instructions. the presence or absence of any combination of a label. and NASM will just generate the prefix bytes.5). O16 and O32. ~. A64. described simply by the register name (e. The colon after a label is also optional. bp.3). and type lodab by accident. the next line is considered to be a part of the backslash−ended line. Maximum length of an identifier is 4095 characters. then that’s still a valid source line which does nothing but define a label.

. They can be invoked in a wide range of ways: db db db db dw dw dw dw dd dd dq dq dt 0x55 0x55. the INCBIN command.0x57 ’a’. RESQ.fadd fadd fadd fadd st1 st0. DW. . QWORD or TWORD to indicate what size of memory operand it refers to.10. . It can be called in one of these three ways: 27 . DO and DY do not accept numeric constants as operands. DD. RESW.2. to declare initialized data in the output file. The current pseudo−instructions are DB. DQ. the EQU command. RESW.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. . The operand to a RESB–type pseudo−instruction is a critical expression: see section 3. RESQ. so does this Almost any x87 floating−point instruction that references memory must use one of the prefixes DWORD. . . words. DT. . are used in the instruction field anyway because that’s the most convenient place to put them. DQ. just the byte 0x55 three bytes in succession character constants are OK so are string constants 0x34 0x12 0x61 0x00 (it’s just a number) 0x61 0x62 (character constant) 0x61 0x62 0x63 0x00 (string) 0x78 0x56 0x34 0x12 floating−point constant eight byte constant double−precision float extended−precision float DT. though not real x86 machine instructions.’$’ 0x1234 ’a’ ’ab’ ’abc’ 0x12345678 1. RESD.8.2.0x56.st0 to st1 . so does this .st1 st1. much as in MASM.234567e20 0x123456789abcdef0 1. and the TIMES prefix. REST. which is the number of bytes. DD. doublewords or whatever to reserve.7.2. DO and DY are used. reserve 64 bytes reserve a word array of ten reals one YMM register 3. . . this sets st0 := st0 + st1 . .2. 3. REST. .0x55 ’hello’. RESO and RESY. DW. RESO and RESY are designed to be used in the BSS section of a module: they declare uninitialized storage space. For example: buffer: wordvar: realarray ymmval: resb resw resq resy 64 1 10 1 . DO and DY. RESD. . . 3. As stated in section 2.13. this sets st1 := st1 + st0 .2 RESB and Friends: Declaring Uninitialized Data RESB.1 DB and Friends: Declaring Initialized Data DB. NASM does not support the MASM/TASM syntax of reserving uninitialized space by writing DW ? or similar things: this is what it does instead. their uninitialized counterparts RESB. DT.2 Pseudo−Instructions Pseudo−instructions are things which. Each takes a single operand. . This can be handy for (for example) including graphics and sound data directly into a game executable file. .234567e20 1.234567e20 . 3.

the source line must contain a label. This macro can be overridden if desired.3 Effective Addresses An effective address is any operand to an instruction which references memory. or a complex macro. 3.[es:wordvar+bx] 28 . in NASM.dat". The action of EQU is to define the given label name to the value of its (only) operand. in that you can code zerobuf: times 64 db 0 or similar things.8). This is partly present as NASM’s equivalent of the DUP syntax supported by MASM–compatible assemblers. For example: wordvar dw mov mov mov 123 ax.4 EQU: Defining Constants EQU defines a symbol to a given constant value: when EQU is used. for example. 3.5 TIMES: Repeating Instructions or Data The TIMES prefix causes the instruction to be assembled multiple times. world’ times 64−$+buffer db ’ ’ which will store exactly enough spaces to make the total length of buffer up to 64. The argument to TIMES is not just a numeric constant.incbin incbin incbin "file. Note also that TIMES can’t be applied to macros: the reason for this is that TIMES is processed after the macro phase.[wordvar] ax. include the whole file skip the first 1024 bytes skip the first 1024.2. This definition is absolute. so you can do things like buffer: db ’hello.[wordvar+1] ax. 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.dat" "file. and cannot change later. the standard macro version searches for the file in the include file search path and adds the file to the dependency lists. 3. and actually include at most 512 INCBIN is both a directive and a standard macro. message msglen db equ ’hello.1024. but TIMES is more versatile than that. So. To repeat more than one line of code. use the preprocessor %rep directive. using the value of $ (see section 3.dat".2. Effective addresses.1024 "file. have a very simple syntax: they consist of an expression evaluating to the desired address. TIMES can be applied to ordinary instructions. enclosed in square brackets.5 for an explanation of $) at the point of definition. Finally. but a numeric expression. except that the latter will be assembled about 100 times faster due to the internal structure of the assembler. which allows the argument to TIMES to contain expressions such as 64−$+buffer as above. . This is not a preprocessor definition either: the value of msglen is evaluated once. rather than being evaluated wherever it is referenced and using the value of $ at the point of reference. . . The operand to TIMES is a critical expression (section 3.512 . msglen may not then be redefined later. world’ $−message defines msglen to be the constant 12.

so that things which don’t necessarily look legal are perfectly all right: mov mov eax. More complicated effective addresses. ie [label1+(label1−label2)] Some forms of effective address have more than one assembled form. Note. In addition. Similarly. If you need [eax+3] to be assembled using a double−word offset field instead of the one byte NASM will normally generate.[ebx*5] eax. NASM has a hinting mechanism which will cause [eax+ebx] and [ebx+eax] to generate different opcodes. In 64−bit mode. octal and binary respectively. 3. work in exactly the same way: mov mov eax. However. For example. so a hex number prefixed with a $ sign must have a digit after the $ rather than a letter. will be coded with no offset field. [byte eax] will code [eax+0] with a byte offset of zero. nasm will cause the high word of the offset to be lost. character. if you need to access data with a known offset that is larger than will fit in a 16−bit value.4 Constants NASM understands four different types of constant: numeric.4.2). and B for hexadecimal. Similarly. 3. WORD. you can code [dword eax+3]. you can force NASM to generate an effective address in a particular form by the use of the keywords BYTE. though.[bp+di+8] NASM is capable of doing algebra on these effective addresses. if you don’t specify that it is a dword offset. assembles as [ebx*4+ebx] .2).[label1*2−label2] . NASM will split [eax*2] into [eax+eax] because that allows the offset field to be absent and space to be saved. NASM will by default generate absolute addresses. 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. NASM allows you to specify numbers in a variety of number bases. for example es:wordvar[bx]. In particular.Anything not conforming to this simple system is not a valid memory reference in NASM. The normal form. string and floating−point. and NASM will generally generate the latter on the grounds that the former requires four bytes to store a zero offset. As special cases. in fact. current 29 . and [dword eax] will code it with a double−word offset of zero.1 Numeric Constants A numeric constant is simply a number. The keyword ABS overrides REL. or you can prefix 0x for hexadecimal in the style of C.1). or you can prefix $ for hexadecimal in the style of Borland Pascal. Q or O.8 for an example of such a code fragment) by using [byte eax+offset]. DWORD and NOSPLIT. it will also split [eax*2+offset] into [eax+eax+offset]. 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. [eax]. in most such cases NASM will generate the smallest form it can. there are distinct assembled forms for the 32−bit effective addresses [eax*2+0] and [eax+eax].[ebx*2+ecx+offset] ax. this is occasionally useful because [esi+ebp] and [ebp+esi] have different default segment registers. You can combat this behaviour by the use of the NOSPLIT keyword: [nosplit eax*2] will force [eax*2+0] to be generated literally. see the DEFAULT directive (section 6. such as those involving more than one register. For more information on this see the section on mixed−size addressing (section 10. in a variety of ways: you can suffix H or X. The REL keyword makes it produce RIP–relative addresses. that the $ prefix does double duty as a prefix on identifiers (see section 3. Since this is frequently the normally desired behaviour.

versions of NASM accept the prefix 0h for hexadecimal.") or backquotes (‘. . . .0c8h ax. Strings enclosed in backquotes support C−style \–escapes for special characters. . .‘).0200 ax. meaning a NUL character (ASCII 0).0hc8 ax.. The following escape sequences are recognized by backquoted strings: \’ \" \‘ \\ \? \a \b \t \n \v \f \r \e \377 \xFF \u1234 \U12345678 single quote (’) double quote (") backquote (‘) backslash (\) question mark (?) BEL (ASCII 7) BS (ASCII 8) TAB (ASCII 9) LF (ASCII 10) VT (ASCII 11) FF (ASCII 12) CR (ASCII 13) ESC (ASCII 27) Up to 3 octal digits − literal byte Up to 2 hexadecimal digits − literal byte 4 hexadecimal digits − Unicode character 8 hexadecimal digits − Unicode character All other escape sequences are reserved. and 0b for binary. .0o310 ax. Note that \0. .200 ax.4. 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. For example.0q310 ax. . .11001000b ax.0d200 ax.. . is a special case of the octal escape sequence.310q ax. double quotes (". the contents of those are represented verbatim. the following lines are all equivalent: 30 . .$0c8 ax..1100_1000b ax.0200d ax..’).. Unicode characters specified with \u or \U are converted to UTF−8. decimal still decimal explicitly decimal also decimal hex hex again: the 0 is required hex yet again still hex octal octal again octal yet again hex yet again binary same binary constant same binary constant yet again 3. Some examples (all producing exactly the same code): mov mov mov mov mov mov mov mov mov mov mov mov mov mov mov ax. 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).0b1100_1000 .2 Character Strings A character string consists of up to eight characters enclosed in either single quotes (’. . . 0o or 0q for octal.310o ax.0xc8 ax.

three−character or four−character constants are treated as strings when they are operands to DW. DT. Pathname in UTF−16 .’char’. 098h. For example: %define u(x) __utf16__(x) %define w(x) __utf32__(x) dw u(’C:\WINDOWS’). It is treated as a concatenation of maximum−size character constants for the conditions. quoted strings are treated as a string constants even if they are short enough to be a character constant. or to character constants in an expression context. equivalent character constants And the following are also equivalent: dd dd db ’ninechars’ ’nine’.3 Character Constants A character constant consists of a string up to eight bytes long. A string constant looks like a character constant. 0BAh .’l’.4. or as arguments to the special operators __float8__. __float16__. A character constant with more than one byte will be arranged with little−endian order in mind: if you code mov eax.4.0 . String in UTF−32 __utf16__ and __utf32__ can be applied either to strings passed to the DB family instructions. 3. It is treated as if it was an integer. it would read abcd rather than dcba. and so forth. 31 . and DO. and really looks like this Note that when used in a string−supporting context. 3. UTF−8 smiley face 3. __float128l__. so that if you were then to store the value into memory. namely the DB family and INCBIN (where it represents a filename.’l’.6 Floating−Point Constants Floating−point constants are acceptable only as arguments to DB. string constant . 0 dd w(‘A + B = \u206a‘). So the following are equivalent: db db ’hello’ ’h’. UTF−8 smiley face .’e’. respectively. doubleword string constant . 3.5 Unicode Strings The special operators __utf16__ and __utf32__ allows definition of Unicode strings.4. DD. __float32__. and __float128h__.4. This is also the sense of character constants understood by the Pentium’s CPUID instruction.4 String Constants String constants are character strings used in the context of some pseudo−instructions. UTF−8 smiley face . They take a string in UTF−8 format and converts it to (littleendian) UTF−16 or UTF−32. becomes three doublewords .0. DQ. used in an expression context. Similarly.) They are also used in certain preprocessor directives. 0 . __float80e__.’s’ ’ninechars’. DW. __float80m__. but 0x64636261.0.db ‘\u263a‘ db ‘\xe2\x98\xba‘ db 0E2h.’o’ . which would be silly. only longer. __float64__.’abcd’ then the constant generated is not 0x61626364. because otherwise db ’ab’ would have the same effect as db ’a’.

.e10 1.141592653589793238462 1. Some examples: db dw dd dd dd dq dq dq dq dt do −0. which declares an integer constant. then optionally a P followed by a binary (not hexadecimal) exponent in decimal notation. . NASM also support C99−style hexadecimal floating−point: 0x.0 1. then optionally more digits. This appears to be the most frequently used 8−bit floating−point format. "Quarter precision" IEEE 754r/SSE5 half precision an easy one underscores are permitted 1.0x2^2 = 4. quiet NaNs. and can use anywhere integer constants are used in an expression. although it is not covered by any formal standard.0x2^32 = 4 294 967 296. . For example: mov rax. This is exactly equivalent to: mov rax. which would significantly increase the size of the assembler for very little benefit. Double−precision constants 32 . respectively.e+4000 . They produce the binary representation of a specific floating−point number as an integer. period. . so that NASM can distinguish between dd 1. the assembler cannot guarantee the presence of a floating−point unit capable of handling the Intel number formats. −Inf. respectively. The special tokens __Infinity__.2 −0. . The period is mandatory.000 000 000 1 pi 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.5 1.. . then optionally an E followed by an exponent.e+10 1.5. optionally more hexadeximal digits.0x400921fb54442d18 NASM cannot do compile−time arithmetic on floating−point constants.e−10 3.2 1.0 which declares a floating−point constant. NaN .__float64__(3. and so for NASM to be able to do floating arithmetic it would have to include its own complete set of floating−point routines. the assembler itself can run on any system with an ANSI C compiler. and __float128l__ and __float128h__ produce the lower and upper 64−bit halves of a 128−bit floating−point number. would assign the binary representation of pi as a 64−bit floating point number into RAX. . and signalling NaNs.0 10 000 000 000. This is sometimes called a "minifloat.Floating−point constants are expressed in the traditional form: digits. . . and dd 1.222_222_222 0x1p+2 0x1p+32 1." The special operators are used to produce floating−point numbers in other contexts. then a period. This is because NASM is designed to be portable – although it always generates code to run on x86 processors.141592653589793238462) . Underscores to break up groups of digits are permitted in floating−point constants as well.e10 0.0 synonymous with 1. . __float80m__ and __float80e__ produce the 64−bit mantissa and 16−bit exponent of an 80−bit floating−point number. . hexadecimal digits. These are normally used as macros: %define Inf __Infinity__ %define NaN __QNaN__ dq +1. __QNaN__ (or __NaN__) and __SNaN__ can be used to generate infinities. Therefore.

like ANSI C.3. allowing calculations to involve the current assembly position: the $ and $$ tokens. NASM supports two special tokens in expressions.6 *. 3. / and // are both division operators: / is unsigned division and // is signed division. % and %% provide unsigned and signed modulo operators respectively. and can include up to 18 decimal digits.5. so you can code an infinite loop using JMP $.7 Packed BCD Constants x87−style packed BCD constants can be used in the same contexts as 80−bit floating−point numbers. so you can tell how far into the section you are by using ($−$$).5. $ evaluates to the assembly position at the beginning of the line containing the expression. 3. in increasing order of precedence. Since the % character is used extensively by the macro preprocessor. /. >> gives a bit−shift to the right.5.5 Expressions Expressions in NASM are similar in syntax to those in C. exactly as performed by the OR machine instruction.1 |: Bitwise OR Operator The | operator gives a bitwise OR.5. such a shift is always unsigned. 3.4.2 ^: Bitwise XOR Operator ^ provides the bitwise XOR operation. 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. Bitwise OR is the lowest−priority arithmetic operator supported by NASM. or 40. 3. in NASM. 33 .5. $$ evaluates to the beginning of the current section. So 5<<3 evaluates to 5 times 8. //. Similarly. 3. you should ensure that both the signed and unsigned modulo operators are followed by white space wherever they appear. Expressions are evaluated as 64−bit integers which are then adjusted to the appropriate size.3 &: Bitwise AND Operator & provides the bitwise AND operation.5. 3.5 + and −: Addition and Subtraction Operators The + and − operators do perfectly ordinary addition and subtraction. As with other numeric constants. % and %%: Multiplication and Division * is the multiplication operator. NASM. For example: dt dt dt dt 12_345_678_901_245_678p −12_345_678_901_245_678p +0p33 33p 3.4 << and >>: Bit Shift Operators << gives a bit−shift to the left. provides no guarantees about the sensible operation of the signed modulo operator. They are suffixed with p or prefixed with 0p. The arithmetic operators provided by NASM are listed here. just as it does in C. underscores can be used to separate digits.

by the use of the WRT (With Reference To) keyword. To declare a far pointer to a data item in a data segment. push dword 33 34 . and SEG provides the segment address of its operand (explained in more detail in section 3. TWORD. ~. ~ computes the one’s complement of its operand.ax bx. but functionally equivalent.5. you must code dw symbol. ! and SEG The highest−priority operators in NASM’s expression grammar are those which only apply to one argument. but will give them the smallest possible size. weird_seg is a segment base es.symbol will load ES:BX with a valid pointer to the symbol symbol. 3. So the code mov mov mov ax. They are not necessary in practice. you might occasionally want to refer to some symbol using a different segment base from the preferred one. QWORD.6 SEG and WRT When writing large 16−bit programs. though you can always invent one using the macro processor.22). + does nothing (it’s provided for symmetry with −).3.symbol wrt weird_seg to load ES:BX with a different. So you can do things like mov mov mov ax. where segment and offset both represent immediate values. with the optimizer on. DWORD. NASM lets you do this. − negates its operand.ax bx. NASM will use size specifiers (BYTE. defined as the segment base relative to which the offset of the symbol makes sense.7 STRICT: Inhibiting Optimization When assembling with the optimizer set to level 2 or higher (see section 2. WORD.weird_seg . −. you could code either of call call (seg procedure):procedure weird_seg:(procedure wrt weird_seg) (The parentheses are included for clarity. So to call a far procedure. and in BITS 16 mode. seg symbol NASM supports no convenient synonym for this.6). pointer to the symbol symbol. which must be split into multiple segments. ! is the logical negation operator. For example.seg symbol es.1. NASM supports the SEG operator to perform this function. 3. NASM supports far (inter−segment) calls and jumps by means of the syntax call segment:offset.) NASM supports the syntax call far procedure as a synonym for the first of the above usages. it is often necessary to be able to refer to the segment part of the address of a symbol. The SEG operator returns the preferred segment base of a symbol. Things can be more complex than this: since 16−bit segments and groups may overlap. JMP works identically to CALL in these examples. to show the intended parsing of the above instructions. The keyword STRICT can be used to inhibit optimization and force a particular operand to be emitted in the specified size. OWORD or YWORD).7 Unary Operators: +.

8 Critical Expressions Although NASM has an optional multi−pass optimizer.loop . some code In the above code fragment. For example. 3.loop are kept separate by virtue of each being associated with the previous non−local label.9 Local Labels NASM gives special treatment to symbols beginning with a period. each JNE instruction jumps to the line immediately before it.loop . in allowing access to local labels from other parts of the code.loop . which is defined to be an expression whose value is required to be computable in the first pass. there are some expressions which must be resolvable on the first pass. the same code (six bytes) is generated whether the STRICT keyword was used or not. It will just as firmly reject the slightly paradoxical code label: times (label−$+1) db 0 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 means that it is associated with the previous non−local label. because the two definitions of . whereas push strict dword 33 is encoded in six bytes. some more code jne ret . A label beginning with a single period is treated as a local label. The argument to the TIMES prefix is a critical expression. some code . when generating all the code. so that the second pass. 3.loop above is really 35 . This form of local label handling is borrowed from the old Amiga assembler DevPac. however. NASM goes one step further. some more code jne ret label2 . So one thing NASM can’t handle is code whose size depends on the value of a symbol declared after the code in question. So.loop . label: times (label−$) db 0 db ’Where am I?’ The argument to TIMES in this case could equally legally evaluate to anything at all. and which must therefore depend only on symbols defined before it. NASM will reject this example because it cannot tell the size of the TIMES line when it first sees it. These are called Critical Expressions. This is achieved by means of defining a local label in terms of the previous non−local label: the first definition of . for example: label1 . knows all the symbol addresses the code refers to.is encoded in three bytes 66 6A 21. With the optimizer off. with a full dword immediate operand 66 68 21 00 00 00. The first pass is used to determine the size of all the assembled code and data.

4. and it can’t be local because the macro that defined it wouldn’t know the label’s full name. this will jump three lines up NASM has the capacity to define other special symbols beginning with a double period: for example.6). ..local . which is probably only useful in macro definitions: if a label begins with the special prefix ..loop. . Such a label can’t be non−local because it would interfere with subsequent definitions of. you could write label3 .@foo . some more code . local labels. .local: jmp . So.@. 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.@foo: label2: . and the second defines a symbol called label2. then it does nothing to the local label mechanism. NASM therefore introduces a third type of label.. a non−local label this is really label1.local this is a special symbol another non−local label this is really label2. . and references to.loop Sometimes it is useful – in a macro. So you could code label1: . .defining a symbol called label1.local: . if you really needed to.. and some more jmp label1. 36 .loop.start is used to specify the entry point in the obj output format (see section 7.

1 Single−Line Macros 4. Thus the code %define a(x) %define b(x) mov 1+b(x) 2*x ax. so that %idefine foo bar would cause foo. If this happens. Hence. This behaviour can be useful: see section 9. 0x1F & ’D’ When the expansion of a single−line macro contains tokens which invoke another macro.a(8) byte [param(2. Preprocessor directives all begin with a % sign. Foo. and a ‘context stack’ mechanism for extra macro power.b) ((a)+(a)*(b)) mov which will expand to mov byte [(2)+(2)*(ebx)]. two forms of macro (single−line and multi−line).1 The Normal Way: %define Single−line macros are defined using the %define preprocessor directive. The preprocessor collapses all lines which end with a backslash (\) character into a single line.a(3) the macro a(3) will expand once. only foo will expand to bar: Foo or FOO will not. not at definition time. so you can do things like %define ctrl 0x1F & %define param(a. By using %idefine instead of %define (the ‘i’ stands for ‘insensitive’) you can define all the case variants of a macro at once. and will then expand no further. ctrl ’D’ will evaluate in the expected way to mov ax. becoming 1+a(3).1+2*8. if you code %define a(x) mov 1+a(x) ax. FOO. the preprocessor will only expand the first occurrence of the macro. There is a mechanism which detects when a macro call has occurred as a result of a previous expansion of the same macro. even though the macro b wasn’t defined at the time of definition of a.Chapter 4: The NASM Preprocessor NASM contains a powerful macro processor. fOO and so on all to expand to bar. 4.ebx)]. multi−level file inclusion. 37 . which supports conditional assembly.1. to guard against circular references and infinite loops. The definitions work in a similar way to C. Macros defined with %define are case sensitive: after %define foo bar. the expansion is performed at invocation time. Thus: %define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \ THIS_VALUE will work like a single−line macro without the backslash−newline sequence.1 for an example of its use.

You can pre−define single−line macros using the ‘−d’ option on the NASM command line: see section 2. %xdefine isTrue 1 %xdefine isFalse isTrue %xdefine isTrue 0 val1: db isFalse 1 isFalse %xdefine isTrue val2: db 38 . However.18. and the second time it is 1. This is because.2 Resolving %define: %xdefine To have a reference to an embedded single−line macro resolved at the time that the embedding macro is defined. Suppose you have the following code: %define %define %define val1: %define val2: isTrue 1 isFalse isTrue isTrue 0 db isTrue db isFalse 1 isFalse In this case.You can overload single−line macros: if you write %define foo(x) 1+x %define foo(x. As isFalse expands to isTrue. you need to change the above code to use %xdefine. when a single−line macro is defined using %define. it is expanded only when it is called.1. This is particularly useful when defining single−line macros with %assign (see section 4.1. 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. as opposed to when the embedding macro is expanded. the expansion will be the current value of isTrue. you need a different mechanism to the one offered by %define.y) 1+x*y the preprocessor will be able to handle both types of macro call.7). If you wanted isFalse to expand to the value assigned to the embedded macro isTrue at the time that isFalse was defined. and vice versa. so foo(3) will become 1+3 whereas foo(ebx. The solution is to use %xdefine. by counting the parameters you pass.2) will become 1+ebx*2.1. 4. and val2 is equal to 1. The first time it is called that is 0. 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. val1 is equal to 0. it will be expanded according to the most recent definition. or it’s case−insensitive counterpart %ixdefine.

.COM2addr . .and so on RESW RESW 1 1 . Macro to access BIOS variables by their names (from tBDA): %define BDA(x) BDASTART + tBIOSDA. For example.7 for details. reduce typing errors).] concatenates to adjacent tokens in the same way that multi−line macro parameters do. including in the names other macros. its structure endstruc Now. consider the following: %define BDASTART 400h struc tBIOSDA . 4. Expands due to %[.COM1addr bx.BDASTART + tBIOSDA.BDASTART + tBIOSDA. 4. the two statements: %xdefine Bar %define Bar Quux . it expands to 1. as that is what the embedded macro isTrue expanded to at the time that isFalse was defined. The Foo value to use the builtin macro __BITS__ (see section 4.. Foo32 and Foo64.. As an example.. each time that isFalse is called..] construct can be used to expand macros in contexts where macro expansion would otherwise not occur. in turn.4 Concatenating Single Line Macro Tokens: %+ Individual tokens in single line macros can be concatenated.3 Macro Indirection: %[. if we need to access the elements of tBIOSDA in different places. and can be reduced in size significantly by using the following macro: . this is supported for both single−and multi−line macros. in order to disambiguate it from the syntax %+1 used in multiline macros. whereas 39 .BDA(COM2addr) Using this feature.. to produce longer tokens for later processing. we can end up with: mov mov ax.BDA(COM1addr) bx. %+ x Now the above code can be written as: mov mov ax.COM2addr This will become pretty ugly (and tedious) if used in many places. in fact. 4.. %? refers to the macro name as invoked.3. Expands due to %xdefine %[Quux] .] The %[.5) to automatically select between them. if you have a set of macros named Foo16.1.11. Similarly. Please note that a space is required after %+. we can simplify references to a lot of macros (and. see section 4.1.Foo%[__BITS__] .5 The Macro Name Itself: %? and %?? The special symbols %? and %?? can be used to reference the macro name itself inside a macro expansion.. %[.Now. This can be useful if there are several similar macros that perform similar functions. you could write: mov ax.1.COM1addr . exactly the same effect. Start of BIOS data area .] have..

they can differ.1. or anything involving a register).Foo mov FOO. and must also evaluate to a pure number (rather than a relocatable reference such as a code or data address.1.%?? refers to the macro name as declared. 40 . 4.8). macros defined using %assign can be re−defined later.1. when the %assign directive is processed.%?? foo FOO will expand to: mov foo.1. %assign is useful for controlling the termination of %rep preprocessor loops: see section 4. since after %undef the macro foo is no longer defined.Foo The sequence: %idefine keyword $%? can be used to make a keyword "disappear". which differs from %assign in exactly the same way that %idefine differs from %define). For example: %idefine Foo mov %?. Like %define. Hide the PAUSE instruction 4. %assign is used to define single−line macros which take no parameters and have a numeric value. and it will be evaluated once. foo.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. The two are always the same for case−sensitive macros. 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. This value can be specified in the form of an expression. the following sequence: %define foo bar %undef foo mov eax. so you can do things like %assign i i+1 to increment the numeric value of a macro.6 Undefining Single−Line Macros: %undef Single−line macros can be removed with the %undef directive. For example: %idefine pause $%? . but for case−insensitive macros. For example. The expression passed to %assign is a critical expression (see section 3. foo will expand to the instruction mov eax.4 and section 9.19. for example in case a new instruction has been used as a label in older code. Another use for %assign is given in section 8.5 for an example of this.

define or redefine a single−line macro without parameters but converts the entire right−hand side.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. just as if an %assign had been used.4. after macro expansion. 4. ’12" screen’ .2 String Manipulation in Macros It’s often useful to be able to handle strings in macros. 4.2): %defstr PATH %!PATH . this would result in charcnt being assigned the value of 9. for example.2. The use of commas to separate strings is permitted but optional. with the %! construct (see section 4. An example of its use is probably more useful than the description: %substr mychar ’xyzw’ 1 %substr mychar ’xyzw’ 2 . In this example. and possibly use \–escapes inside ‘–quoted strings. charcnt would receive the value 9.. 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. The operating system PATH variable 4.. For example: %strcat alpha "Alpha: ". to a quoted string before definition. ’my string’ was a literal string but it could also have been a single−line macro that expands to a string. would assign the value ’Alpha: 12" screen’ to alpha.3 Extracting Substrings: %substr Individual letters or substrings in strings can be extracted using the %substr operator. and its case−insensitive counterpart %idefstr. For example: %defstr test TEST is equivalent to %define test ’TEST’ This can be used. 4. equivalent to %define mychar ’x’ . it may change the style of quoting of the input string or strings. as in the following example: %define sometext ’my string’ %strlen charcnt sometext As in the first case..1. "’bar’" . equivalent to %define mychar ’y’ 41 .1 Concatenating Strings: %strcat The %strcat operator concatenates quoted strings and assign them to a single−line macro. Similarly: %strcat beta ’"foo"\’. When producing a string value.10. would assign the value ‘"foo"\’bar’‘ to beta..8 Defining Strings: %defstr %defstr.2.2.

letter_a: db ’a’ . string_ab: db ’ab’ . . letter_a silly ’ab’. 4. %3 and so on. equivalent equivalent equivalent equivalent to to to to %define %define %define %define mychar mychar mychar mychar ’z’ ’yz’ ’yzw’ ’yz’ As with %strlen (see section 4. etc. With a macro taking more than one parameter. the first parameter is the single−line macro to be created and the second is the string.e. . %macro prologue 1 push mov sub %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 mov sub ebp ebp.2. crlf .−1 2.%substr %substr %substr %substr mychar mychar mychar mychar ’xyzw’ ’xyzw’ ’xyzw’ ’xyzw’ 3 2. −2 until one character before.2). like single−line macros. and the optional fourth parameter preceeded by comma) is the length. So you could code things like %macro silly 2 %1 %2: db %endmacro silly ’a’.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. Note that the first index is 1. Multi−line macros.10 42 .−2 . . are case−sensitive.esp esp. Index values out of range result in an empty string. −1 means until end of string. you can do that by enclosing the entire parameter in braces.12 ebp ebp.%1 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. subsequent parameters would be referred to as %2.2 2. string_ab silly {13. The third parameter specifies the first character to be selected. i. If you need to pass a comma as part of a parameter to a multi−line macro.esp esp. unless you define them using the alternative directive %imacro. A negative length means "until N−1 characters before the end of string".10}. crlf: db 13. not 0 and the last index is equal to the value that %strlen would assign given the same string.

9. and every time you call it NASM will make up a different ‘real’ name to substitute for the label %%skip. You do this by prefixing %% to the label name. however. for example.1 Overloading Multi−Line Macros As with single−line macros. The . since push is now defined to be a macro. This warning can be disabled by the use of the −w−macro−params command−line option (see section 2.ecx .2 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.@ prefix prevents macro−local labels from interfering with the local label mechanism.esp Ordinarily. as described in section 3. So you could define %macro prologue 0 push mov %endmacro to define an alternative form of the function prologue which allocates no local stack space. but the assembler will give a warning. 4. then a number.24). The names NASM invents are of the form . where the number 2345 changes with every macro call. Sometimes. So you can invent an instruction which executes a RET if the Z flag is set by doing this: %macro retz 0 %%skip jnz ret %%skip: %endmacro You can call this macro as many times as you want. and is being invoked with a number of parameters for which no definition has been given.1.3. no exception is made for macros with no parameters at all. you might want to ‘overload’ a machine instruction.. This time.3. you might want to define %macro push 2 push push %endmacro so that you could code push push ebx eax. The correct code will still be generated. then another period) in case they interfere with macro−local labels.4. this line is not a macro call . NASM will give a warning for the first of the above two lines..@ prefix.skip. 43 . You should avoid defining your own labels in this form (the .@2345.. multi−line macros can be overloaded by defining the same macro name several times with different numbers of parameters. but this one is %1 %2 ebp ebp.

" writefile 2.0x4c01 int 0x21 44 . NASM will take this into account when overloading macros. for example. and all the subsequent text is lumped into %2 and placed after the db. NASM now knows what to do when it sees a call to writefile with 2.4 Default Macro Parameters NASM also allows you to define a multi−line macro with a range of allowable parameter counts. possibly after extracting one or two smaller parameters from the front. So. in which case the call to it would have had to look like writefile [filehandle]. {"hello.3. in this case.%1 ah.13. 3. If you define a greedy macro. The greedy nature of the macro is indicated to NASM by the use of the + sign after the parameter count on the %macro line. world". So if you code: %macro writefile 2+ %%endstr db %2 dx. Of course.3. for example: %macro die 0−1 "Painful program death has occurred. If you do this.3.%%endstr−%%str bx.1 for a better way to write the above macro. the above macro could have been implemented as a non−greedy macro. meaning that if you invoke the macro with more parameters than it expects. See section 6.3 Greedy Macro Parameters Occasionally it is useful to define a macro which lumps its entire command line into one parameter definition.0x40 0x21 jmp %%str: %%endstr: mov mov mov mov int %endmacro then the example call to writefile above will work as expected: the text before the first comma.13. you are effectively telling NASM how it should expand the macro given any number of parameters from the actual number specified up to infinity. world". you can specify defaults for omitted parameters.%%str cx. [filehandle]. and will not allow you to define another form of writefile taking 4 parameters (for example).10 NASM allows you to define the last parameter of a macro to be greedy. 4 or more parameters. where you might want to be able to write writefile [filehandle]. all the spare parameters get lumped into the last defined one along with the separating commas. An example might be a macro to write a text string to a file in MS−DOS.%1 mov ax. and you choose which one you prefer for each macro definition. 4."hello.10} NASM provides both mechanisms for putting commas in macro parameters.4. is used as the first macro parameter and expanded when %1 is referred to.

3) can be called with an explicit error message.1. of course. or it can be called with no parameters.13. So if a macro definition began with the line %macro foobar 1−3 eax. 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. in the form of %rotate. and vice versa.3. $2 and so on) to be moved left by one place.6 %rotate: Rotating Macro Parameters Unix shell programmers will be familiar with the shift shell command. and more useful.5) in order to iterate through all the parameters of a macro. if %0 is n then %n is the last parameter.24 for more information. When quux is invoked. In general. see section 2. 4.5 %0: Macro Parameter Counter The parameter reference %0 will return a numeric constant giving the number of parameters received. The macro parameters are rotated to the left by that many places.%endmacro This macro (which makes use of the writefile macro defined in section 4. As its name suggests. since the %0 token (see section 4. 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.". it is impossible to provide a full set of default parameters.10 The maximum parameter count can be infinite. which allows the arguments passed to a shell script (referenced as $1.3.3.3. and %1 would always be taken from the macro call. in which case the parameter default is taken to be blank. you supply a minimum and maximum number of parameters for a macro of this type. %rotate is invoked with a single numeric argument (which may be an expression). This can be useful for macros which can take a variable number of parameters. 4.3. if not specified by the macro call. If the argument to %rotate is negative. it receives not one but two parameters.6. Examples of this usage are shown in section 4. %0 is mostly useful for macros that can take a variable number of parameters. and the argument previously referenced as $1 is no longer available at all. denoted by *. In this case. by changing the first line of the definition to %macro die 0−1+ "Painful program death has occurred. Examples are given in section 4. not when it is expanded.5) allows you to determine how many parameters were really passed to the macro call. 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. This defaulting mechanism can be combined with the greedy−parameter mechanism. It can be used as an argument to %rep (see section 4. the minimum number of parameters are then required in the macro call. would default to eax. 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: 45 . %2. and %3 if not specified would default to [ebx+2]. so that the argument previously referenced as $2 becomes available as $1.[ebx+2] then it could be called with between one and three parameters. so the die macro above could be made more powerful. which it will display on the error output stream before exiting. in which case it will use the default error message supplied in the macro definition.6. You may omit parameter defaults from the macro definition. and then you provide defaults for the optional ones. that is. something can be referred to as %2. NASM provides a similar mechanism.3.

This allows you to declare a family of symbols. from left to right. 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.3. which didn’t require the arguments to be given in reverse order. Note also the use of * as the maximum parameter count. It would be convenient. for example.7 Concatenating Macro Parameters NASM can concatenate macro parameters and macro indirection constructs on to other text surrounding them. so that the original second argument is now available as %1. so that the original last argument appears as %1. to have a POP equivalent. then cut−and−paste the line to where the pop needed to be done. 4. 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 db $−keytab %2 %endmacro keytab: keytab_entry F1. and change the name of the called macro to multipop.%macro %rep multipush 1−* %0 push %rotate 1 %endrep %endmacro %1 This macro invokes the PUSH instruction on each of its arguments in turn. If.128+1 keytab_entry F2. you would write the multipush macro call. This is then popped. for example. Thus the arguments are iterated through in reverse order. It begins by pushing its first argument. indicating that there is no upper limit on the number of parameters you may supply to the multipush macro.128+2 keytab_entry Return. then invokes %rotate to move all the arguments one place to the left. in a macro definition. 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 %endrep %endmacro %1 This macro begins by rotating its arguments one place to the right. Ideally. and the arguments are rotated right again. %1.13 which would expand to 46 . when using this macro. so the second−to−last argument becomes %1.

(This is unnecessary. you can refer to the macro parameter by means of %−1. 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. such as macro−local labels (section 4. because no inverse condition code exists. or retc po which will make the jump a JPE. it will generally expand multi−line macros by means of writing the macro call and then listing each line of the expansion. which informs NASM that this macro parameter is supposed to contain a condition code.7. for example defining labels foo1 and foo2 when passed the parameter foo.2 can be replaced by a general conditional−return macro like this: %macro retc 1 %%skip j%−1 ret %%skip: %endmacro This macro can now be invoked using calls like retc ne.8 Condition Codes as Macro Parameters NASM can give special treatment to a macro parameter which contains a condition code. 4. for some macros this clutters the listing up unnecessarily. This concatenation can also be applied to other preprocessor in−line objects. you can’t code %11 because that would be taken as the eleventh macro parameter. which will separate the first 1 (giving the number of the macro parameter) from the second (literal text to be concatenated to the parameter). See also the %+ operator. 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..2).3. which NASM will expand as the inverse condition code. %−1 will report an error if passed either of these. In all cases. the capability is there.3.3. 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. section 4. though. So the retz macro defined in section 4. however. %[.1. The %+1 macro−parameter reference is quite happy to interpret the arguments CXZ and ECXZ as valid condition codes. Far more usefully..keytab: keyposF1 keyposF2 keyposReturn equ db equ db equ db $−keytab 128+1 $−keytab 128+2 $−keytab 13 You can just as easily concatenate text on to the other end of a macro parameter.1. If you need to append a digit to a macro parameter.3. you can refer to the macro parameter %1 by means of the alternative syntax %+1.2) and context−local labels (section 4. you must code %{1}1. This allows you to see which instructions in the macro expansion are generating what code. nevertheless.9 Disabling Listing Expansion When NASM is generating a listing file from your program. which will cause the conditional−jump instruction in the macro expansion to come out as JE.) The single−line macro indirection construct. by writing %1foo. however.] (section 4.3). Instead.4. For a start. 47 . 4. behaves the same way as macro parameters for the purpose of concatenation.

The %else clause is optional.3. this appears if neither <condition> nor <condition2> was met %endif The inverse forms %ifn and %elifn are also supported. 4. since the argument specification does not match exactly. the equivalents to the %ifdef directive are %elifdef. Each has its corresponding %elif. and %elifn directives.nolist Or like this: %macro bar 1−5+.b. and only if. only appears if <condition> is not met but <condition2> is %else .f. Unlike the %undef directive. %ifndef.1 %ifdef: Testing Single−Line Macro Existence Beginning a conditional−assembly block with the line %ifdef MACRO will assemble the subsequent code if.4 Conditional Assembly Similarly to the C preprocessor.g.NASM therefore provides the . 4. like this: %macro foo 1.4. which you can include in a macro definition to inhibit the expansion of the macro in the listing file. when debugging a program. %ifn. however.c. For example: %macro foo 1−3 .d. then the %elif and %else blocks (if any) will be processed instead. For example. The general syntax of this feature looks like this: %if<condition> . If not. some code which only appears if <condition> is met %elif<condition2> . and %elifndef.10 Undefining Multi−Line Macros: %unmacro Multi−line macros can be removed with the %unmacro directive. The .nolist qualifier comes directly after the number of parameters. NASM allows sections of a source file to be assembled only if certain conditions are met.nolist a. %unmacro takes an argument specification.h 4. a single−line macro called MACRO is defined.nolist qualifier.e. and will only remove exact matches with that argument specification. Do something %endmacro %unmacro bar 1 does not remove the macro bar. but %macro bar 1−3 . Do something %endmacro %unmacro foo 1−3 removes the previously defined macro foo. You can have more than one %elif clause as well. for example. There are a number of variants of the %if directive. as is the %elif clause. you might want to write code such as 48 .

except that it checks for the existence of a multi−line macro. As with %ifdef. You can also test for macro definitions in %elif blocks by using %elifdef and %elifndef. 49 . and remove the option to generate the final release version of the program. and another name if one with that name does exist.7.4.2 %ifmacro: Testing Multi−Line Macro Existence The %ifmacro directive operates in the same way as the %ifdef directive.5.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. Additional tests can be performed in %elif blocks by using %elifmacro and %elifnmacro. and emits a warning if there would be a definition conflict. 4.13. is a critical expression (see section 3. For a sample use of %ifctx. The expression given to %if. 4. You can test for a macro not being defined by using %ifndef instead of %ifdef."Function performed successfully". 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 %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. see section 4. For example. you may be working with a large project and not have control over the macros in a library.4. %elifctx and %elifnctx are also supported. 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. %else %macro MyMacro 1−3 . see section 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. For more details of the context stack..4.10 %endif .8). the inverse and %elif forms %ifnctx. 4. perform some function %ifdef DEBUG writefile 2. and its counterpart %elif. You can test for the macro not existing by using the %ifnmacro instead of %ifmacro. 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. You may want to create a macro with one name if it doesn’t already exist.7.

are identical pieces of text.text2 will cause the subsequent code to be assembled if and only if text1 and text2. low−priority logical operators &&. less−than. for example. For example. The conditional assembly construct %ifid. but is case−insensitive. returns 1 if exactly one of its inputs is zero.4. after expanding single−line macros. The operators =. assembles the subsequent code if and only if the first token in the parameter exists and is an identifier. Like other %if constructs. %ifidn has a counterpart %elifidn. ^^ and || are provided. %ifstr tests for it being a string. <=. and 0 otherwise).5 %ifidn and %ifidni: Testing Exact Text Identity The construct %ifidn text1.%if extends the normal NASM expression syntax. The C−like forms == and != are supported as alternative forms of = and <>. For example. Similarly.3. %if has a counterpart %elif. These work like the C logical operators (although C has no logical XOR). and treat any non−zero input as 1 (so that ^^. %ifnum works similarly. The relational operators also return 1 for true and 0 for false. >= and <> test equality. and allows you to treat IP as a real register: %macro pushparam 1 %ifidni %1. <. %ifidni is similar to %ifidn. by providing a set of relational operators which are not normally available in expressions. 4. greater−than. %ifnidni and %elifnidni. >.ip call %%label %%label: %else push %1 %endif %endmacro Like other %if constructs. greater−or−equal and not−equal respectively.6 %ifid. but tests for the token being a numeric constant. the following macro pushes a register or number on the stack. %ifnum. %ifstr: Testing Token Types Some macros will want to perform different tasks depending on whether they are passed a number. the writefile macro defined in section 4. Differences in white space are not counted. 4. %ifidni has counterparts %elifidni. less−or−equal.3 can be extended to take advantage of %ifstr in the following fashion: %macro writefile 2−3+ %ifstr %2 jmp %if %0 = 3 %%str: %else %%str: %endif %%endstr db db %2. and negative forms %ifnidn and %elifnidn. taking one parameter (which may be blank).4. and negative forms %ifn and %elifn. in that they always return either 0 or 1. In addition. logical XOR and logical OR. a string. 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. supplying logical AND. or an identifier.%3 %2 50 . For example.

but %iftoken −1 will not. paste it to something else using %+) versus a multi−token sequence.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. strpointer is used as the address of an already−declared string. The conditional assembly construct %iftoken assembles the subsequent code if and only if the expanded parameters consist of exactly one token. The usual %elif. though useful.%%str cx.. since −1 contains two tokens: the unary minus operator −. The usual %eliftoken. 4. 4. 51 . cannot be used to invoke a multi−line macro multiple times. 10 In the first. and db %2.%3 bx.. whitespace excepted. %ifnempty. For example: %iftoken 1 will assemble the subsequent code.. Therefore NASM provides another form of loop. possibly surrounded by whitespace.%3 would be required). strpointer..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.%%endstr−%%str dx. 4. all but the first two would be lumped together into %3.%%endstr: mov mov %else mov mov %endif mov mov int %endmacro dx. length writefile [file]. and %elifnempty variants are also provided.4. because it is processed by NASM after macros have already been expanded.5 Preprocessor Loops: %rep NASM’s TIMES prefix. a string is given to the macro.0x40 0x21 Then the writefile macro can cope with being called in either of the following two ways: writefile [file]. and %elifntoken variants are also provided.g. which therefore declares it itself and works out the address and length for itself. this time at the preprocessor level: %rep..%1 ah. versions exist for each of %ifid.. %ifntoken. and the number 1.. The usual %elifempty. %ifn. 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.%2 cx. 13. in the second. and db %2 would be adequate) or more (in which case.. and %elifn. "hello".4. and length is used as its length. %ifnum and %ifstr.

%endrep takes no arguments) can be used to enclose a chunk of code. This is to prevent the possibility of NASM getting into an infinite loop in the preprocessor. 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.6.mac" will include the contents of the file macros. 4.1 %include: Including Other Files Using. Include files are searched for in the current directory (the directory you’re in when you run NASM. which can be an expression. once again. which is then replicated as many times as specified by the preprocessor: %assign i 0 %rep 64 inc %assign i i+1 %endrep word [table+2*i] This will generate a sequence of 64 INC instructions.mac has the form %ifndef MACROS_MAC %define MACROS_MAC 52 . you can use the %exitrep directive to terminate the loop. a very similar syntax to the C preprocessor. incrementing every word of memory from [table] to [table+126].6 Source Files and Dependencies These commands allow you to split your sources into multiple files. NASM’s preprocessor lets you include other source files into your code. as opposed to the location of the NASM executable or the location of the source file). or to break out of a repeat loop part way along. For more complex termination conditions. 4. plus any directories specified on the NASM command line using the −i option. This is done by the use of the %include directive: %include "macros.mac into the source file containing the %include directive. 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.The directives %rep and %endrep (%rep takes a numeric argument. Note that a maximum repeat count must still be given to %rep. The standard C idiom for preventing a file being included more than once is just as applicable in NASM: if the file macros.

UNTIL loop. but quotes are permitted. the following lines are equivalent: %use altreg %use ’altreg’ Standard macro packages are protected from multiple inclusion. 4.bin".4 %use: Include Standard Macro Package The %use directive is similar to %include.05 the unquoted form would be macro−expanded. if the file exists (otherwise. 4. because the second time the file is included nothing will happen because the macro MACROS_MAC will already be defined. and declare or redefines the specified single−line macro to be the include−path−resolved version of the filename.17). 4. 4.. Thus. by using the −p option on the NASM command line (see section 2.4) are used. but rather than including the contents of a file. %pathsearch MyFoo "foo.) For example. 53 ..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. 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. with −Ibins/ in the include path may end up defining the macro MyFoo to be "bins/foo.8.6.1.04 and 2. An example might be a REPEAT . Unlike the %include directive.%2 %endmacro This first resolves the location of the file into the macro dep. When a standard macro package is used. a testable single−line macro of the form __USE_package__ is also defined.bin" . package names for the %use directive do not require quotes. it includes a named standard macro package. and are described in chapter 5..11.6. It produces no output. in which the expansion of the REPEAT macro would need to be able to refer to a label which the UNTIL macro had defined.2 %pathsearch: Search the Include Path The %pathsearch directive takes a single−line macro name and a filename.6.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.. However. In NASM 2. For example.1. see section 4. You can force a file to be included even if there is no %include directive that explicitly includes it. and finally issues the assembler−level INCBIN directive. it is passed unchanged. for such a macro you would also want to be able to nest these loops.. The standard macro packages are part of NASM. then adds it to the dependency lists. now define some macros %endif then including the file more than once will not cause errors. this is no longer true. This is generally used in conjunction with %pathsearch.

and remove one using %pop.7. and so on. along with any labels associated with it. or access. each of which is characterized by a name. for example. 4. it must match the name of the current context. You add a new context to the stack using the %push directive. in just the same way: %define %$localmac 3 54 . If you need to define. If no name is given. 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 %pop %endmacro and invoked by means of. the usage %$foo is used to define a label which is local to the context on the top of the context stack. which is the name of the context. or %$$$foo for the context below that. 4.3 Context−Local Single−Line Macros NASM also allows you to define single−line macros which are local to a particular context.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. mov repeat add scasb until cx. you can use %$$foo.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. For example: %push foobar This pushes a new context called foobar on the stack. The preprocessor maintains a stack of contexts.string cx.7. taking one optional argument. If an argument is given.3 e %$begin which would scan every fourth byte of a string in search of the byte in AL. 4. the context is unnamed (this is normally used when both the %push and the %pop are inside a single macro definition. You can define labels that are local to a particular context on the stack.NASM provides this level of power by means of a context stack.) The directive %pop. labels local to the context below the top one on the stack. otherwise it will issue an error. You can have several contexts on the stack with the same name: they can still be distinguished. %push takes an optional argument.7. removes the top context from the context stack and destroys it.

after a subsequent %push. to have it respond differently to %ifctx). you can execute a %pop followed by a %push. NASM provides the directive %repl. 4. for example. Of course. 4.will define the single−line macro %$localmac to be local to the top context on the stack. 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 55 . without touching the associated macros and labels.4 %repl: Renaming a Context If you need to change the name of the top context on the stack (in order.5 Example Use of the Context Stack: Block IFs This example makes use of almost all the context−stack features. it can then still be accessed by the name %$$localmac.7. but this will have the side effect of destroying all context−local labels and macros associated with the context that was just popped. So you could replace the destructive code %pop %push newname with the non−destructive version %repl newname. which replaces a context with a different name.7. including the conditional−assembly construct %ifctx.

4. ax.bx 4.2) • %local (see section 4.1 %arg Directive The %arg directive is used to simplify the handling of parameters passed on the stack.7. It does this by the use of %repl.bx ax.This code is more robust than the REPEAT and UNTIL macros given in section 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. the endif macro has to be able to cope with the two distinct cases of either directly following an if.cx ax. Here is an example which shows the use of %arg without any external macros: 56 .5). because it uses conditional assembly to check that the macros are issued in the right order (for example. A sample usage of these macros might look like: cmp if ae cmp if ae mov else mov endif else cmp if ae mov endif endif The block−IF macros handle nesting quite happily. • %arg (see section 4. not calling endif before if) and issues a %error if they’re not.1) • %stacksize (see section 4. on top of the one describing the outer if.cx ax. by using conditional assembly to do different things depending on whether the context on top of the stack is if or else.2. It achieves this. The else macro has to preserve the context on the stack. C++ and Pascal. by means of pushing another context.8. again. or following an else.cx ax. in order to have the %$ifnot referred to by the if macro be the same as the one defined by the endif macro. thus else and endif always refer to the last unmatched if or else.cx bx. In addition.8. Stack based parameter passing is used by many high level languages. but has to change the context’s name so that endif will know there was an intervening else.8. and is not TASM compatible.8. describing the inner if.3) 4. While NASM has macros which attempt to duplicate this functionality (see section 8. the syntax is not particularly convenient to use. including C.

[j_ptr] ax.1) and the %local (see section 4. 4. %stacksize small This form also uses bp to address stack parameters. it expects that bp.3 %local Directive The %local directive is used to simplify the use of local temporary stack variables allocated in a stack frame. see text for explanation 57 .some_function: %push mycontext .1). tell NASM to use bp %arg i:word. Automatic local variables in C are an example of this kind of variable.3) directives. that rip is on the stack).2 %stacksize Directive The %stacksize directive is used in conjunction with the %arg (see section 4. This form is probably most useful when used in combination with the %local directive (see section 4.8.e.8. %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. j_ptr:word mov mov add ret %pop ax. An example of its use is the following: silly_swap: %push mycontext %stacksize small %assign %$localsize 0 . See section 4. %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.8. that ip and cs are on the stack). tell NASM to use bp . 4. save the current context .e. flat64. it expects an ENTER instruction).[i] bx. It tells NASM the default size to use for subsequent %arg and %local directives. underneath any local space which may have been allocated by ENTER. save the current context %stacksize large . ip and cs are on the top of the stack.3).[bx] . large or small.8.4. The %local directive is most useful when used with the %stacksize (see section 4.5 and adds the value in i to the value pointed to by j_ptr and returns the sum in the ax register. %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. restore original context This is similar to the procedure defined in section 8. that eip is on the stack).e.2 and is also compatible with the %arg directive (see section 4.7. In other words.e. It allows simplified reference to variables on the stack which have been allocated typically by using the ENTER instruction.8.1 for an explanation of push and pop and the use of context stacks. The %stacksize directive takes one required argument which is one of flat. but it is different from large because it also assumes that the old value of bp is pushed onto the stack (i.8.8.

%fatal The preprocessor directive %error will cause NASM to report an error if it occurs in assembled code. regardless of pass. then single−line macros are expanded in it. restore old bp . This is useful when there is no point in continuing the assembly further. do some setup %elifdef F2 .0 [old_ax]. you can ensure that they define the right macros by means of code like this: %ifdef F1 . and doing so is likely just going to cause a spew of confusing error messages. Failure to do so will result in one expression syntax error for each %local variable declared.cx bx. 4. see text for explanation . which can be used to display more information to the user. %warning. but allows assembly to continue: %ifdef F1 . %fatal terminates assembly immediately. assuming F1. rather than having to wait until the program crashes on being run and then not knowing what went wrong. do some setup %elifdef F2 .[old_ax] cx. %warning issues a warning. swap ax & bx .%local old_ax:word.9 Reporting User−Defined Errors: %error. do some different setup %else %error "Neither F1 nor F2 was defined. 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." %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. It is optional for the message string after %error. For example: 58 .dx ax.ax [old_dx]. If it is not. Similarly.bx dx. do some different setup %else %warning "Neither F1 nor F2 was defined. . %warning or %fatal to be quoted.[old_dx] . It then may be used in the construction of an appropriately sized ENTER instruction as shown in the example. So if other users are going to try to assemble your source files. old_dx:word enter mov mov mov mov mov mov leave ret %pop %$localsize. and swap dx & cx ." %endif Then any user who fails to understand the way your code is supposed to be assembled will be quickly warned of their mistake.

and you want the contents of FOO to be embedded in your program. with the current NASM input being the output of a pre−processor. Currently they include: • %line enables NASM to correctly handle the output of another preprocessor (see section 4. This could. you can use the %clear directive to empty the preprocessor of everything but context−local preprocessor variables and single−line macros. which are already defined when it starts to process any source file.10. This preprocessor directive is not generally of use to programmers. which could be used at some other point in your code.10 Other Preprocessor Directives NASM also has preprocessor directives which allow access to information from external sources.1 NASM Version Macros The single−line macros __NASM_MAJOR__.%if foo > 64 %assign foo_over foo−64 %error foo is foo_over bytes too large %endif 4. If you really need a program to be assembled with no pre−defined macros. suppose that you have an environment variable FOO. The rest of the standard macro set is described here.1).8 for notes on the %defstr directive. Most user−level assembler directives (see chapter 6) are implemented as macros which invoke primitive directives.10. Finally. filename is an optional parameter which specifies the file name of the original source file.1.10. NASM will report all file name and line numbers relative to the values specified therein. each line of the input file read in is considered to correspond to mmm lines of the original source file. For example. minor.2 %!<env>: Read an environment variable. __NASM_MINOR__. which can then be used in your program (see section 4.2). for example. After reading a %line preprocessor directive. be used to store the contents of an environment variable into a string. • %! enables NASM to read in the value of an environment variable. 4. nnn identifies the line of the original source file which this line corresponds to. The %line directive allows NASM to output messages which indicate the line number of the original source file. 4. The usage of the %line preprocessor directive is as follows: %line nnn[+mmm] [filename] In this directive. by may be of interest to preprocessor authors.11 Standard Macros NASM defines a set of standard macros. subminor and patch level parts of the version 59 . __NASM_SUBMINOR__ and ___NASM_PATCHLEVEL__ expand to the major. Typically this other file would be an original source file. 4.11. mmm is an optional parameter which specifies a line increment value. these are described in chapter 6. The %!<env> directive makes it possible to read the value of an environment variable at assembly time. instead of the file that is being read by NASM. 4.1 %line Directive The %line directive is used to notify NASM that the input line corresponds to a specific line number in another file.10. You could do that as follows: %defstr FOO %!FOO See section 4.

the returned number would be equivalent to: dd or db 1.98.98. __NASM_SUBMINOR__ would be defined to 32. the macro __NASM_SNAPSHOT__ is defined for automatically generated snapshot releases only. for example.number of NASM being used. under NASM 0. 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). rather than definition. So to determine where in a piece of code a crash is occurring. Hence.32p1. one could write a routine stillhere. eax eax.11.4 __FILE__ and __LINE__: File Name and Line Number Like the C preprocessor. So. __NASM_MINOR__ would be defined as 98.0 Note that the above lines are generate exactly the same code. The value is the equivalent to __NASM_MAJOR__. for 0.11. __NASM_SUBMINOR__ and ___NASM_PATCHLEVEL__ concatenated to produce a single doubleword. the second line is used just to give an indication of the order that the separate values will be present in memory. under NASM 0. So.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. You could then write a macro %macro notdeadyet 0 push mov call pop %endmacro and then pepper your code with calls to notdeadyet until you find the crash point.__LINE__ stillhere eax 60 .98.32p1 for example. These macros could be used. db would expand to db "0.32. NASM allows the user to find out the file name and line number containing the current instruction. and ___NASM_PATCHLEVEL__ would be defined as 1. Additionally. and __LINE__ expands to a numeric constant giving the current line number in the input file. for example.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. __NASM_MAJOR__ would be defined to be 0. 0x00622001 4.32" __NASM_VER__ 4.98. 4. since invoking __LINE__ inside a macro definition (either single−line or multi−line) will return the line number of the macro call.32 for example. __NASM_MINOR__.11. to communicate debugging information to a macro. which is passed a line number in EAX and outputs something like ‘line 155: still here’.98.

Type nasm −hf for a list. respectively.4. All instances of time and date macros in the same assembly session produce consistent output. excluding any leap seconds.11. 4. 1 January 1970 00:00:00 UTC. • The __DATE__ and __TIME__ macros give the assembly date and time as strings. where XX is a valid mode number of 16. 2010 in Moscow (timezone UTC+3) these macros would have the following values. win32 %define NEWLINE 13. respectively. otherwise it is computed using the local time as if it was UTC. 32 or 64. these macros are undefined. assuming.) If the host platform doesn’t provide UTC time.11.7 Assembly Date and Time Macros NASM provides a variety of macros that represent the timestamp of the assembly session. in ISO 8601 format ("YYYY−MM−DD" and "HH:MM:SS". This is computed using UTC time if available on the host platform. elf32 %define NEWLINE 10 %endif 4. as given by the −f option or NASM’s default.11. a properly configured environment with a correct clock: __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __POSIX_TIME__ "2010−01−01" "00:00:42" 20100101 000042 "2009−12−31" "21:00:42" 20091231 210042 1262293242 61 . This can be very useful for those who utilize mode−dependent macros.6 __OUTPUT_FORMAT__: Current Output Format The __OUTPUT_FORMAT__ standard macro holds the current Output Format. in the format YYYYMMDD and HHMMSS respectively.) • The __DATE_NUM__ and __TIME_NUM__ macros give the assembly date and time in numeric form. __BITS__ receives the specified mode number and makes it globally available. these macros are undefined. of course. • The __UTC_DATE__ and __UTC_TIME__ macros give the assembly date and time in universal time (UTC) as strings. 10 %elifidn __OUTPUT_FORMAT__. in ISO 8601 format ("YYYY−MM−DD" and "HH:MM:SS". For example. • The __POSIX_TIME__ macro is defined as a number containing the number of seconds since the POSIX epoch.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. If the host platform doesn’t provide UTC time. %ifidn __OUTPUT_FORMAT__. in the format YYYYMMDD and HHMMSS respectively. • The __UTC_DATE_NUM__ and __UTC_TIME_NUM__ macros give the assembly date and time universal time (UTC) in numeric form. in an assembly session started at 42 seconds after midnight on January 1.

The macros STRUC and ENDSTRUC are used to define a structure data type. and the semantics may change in future versions of NASM. and 2 on the final pass. In preprocess−only mode. Once STRUC has been issued. STRUC takes one or two parameters.11.1. The second. and when running only to generate dependencies (due to the −M or −MG option.word: .8 __USE_package__: Package Include Test When a standard macro package (see chapter 5) is included with the %use directive (see section 4. The name of the data type is defined as a symbol with the value of the base offset.str: endstruc resd resw resb resb 1 1 1 32 62 . For example. 4. you might code struc mytype resd resw resb resb 1 1 1 32 mt_long: mt_word: mt_byte: mt_str: endstruc The above code defines six symbols: mt_long as 0 (the offset from the beginning of a mytype structure to the longword field). to define a structure called mytype containing a longword. mt_byte as 6. mt_word as 4. 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. mt_str as 7.11. For example.9 __PASS__: Assembly Pass The macro __PASS__ is defined to be 1 on preparatory passes. see section 2. you can define the above structure like this: struc mytype . mytype_size as 39. you are defining the structure. then the macro __USE_ALTREG__ is defined. Avoid using this macro if at all possible. 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. and mytype itself as zero. a byte and a string of bytes. a word.long: . This allows testing if a particular package is invoked or not. if the altreg package is included (see section 5. and then invoke ENDSTRUC to finish the definition. and should define fields using the RESB family of pseudo−instructions.4). The first parameter is the name of the data type.1). instead.10 STRUC and ENDSTRUC: Declaring Structure Data Types The core of NASM contains no intrinsic means of defining data structures.6. optional parameter is the base offset of the structure. 4. a single−line macro of the form __USE_package__ is automatically defined. It is tremendously easy to generate very strange errors by misusing it.4.byte: . it is set to 3.4) it is set to 0. the preprocessor is sufficiently powerful that data structures can be implemented as a set of macros.11.

the next thing you typically want to do is to declare instances of that structure in your data segment.word. 13. mt_word is a constant just like any other constant. since it has no intrinsic structure support. mt_str.189 190. so the correct syntax is mov ax. AT and IEND: Declaring Instances of Structures Having defined a structure type. mytype.11.byte and mytype. 10. 0 Depending on personal taste. mt_byte. consider this standard stack frame setup: push ebp mov ebp. NASM. 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 db ’hello. Therefore the structure fields must be declared in the same order as they were specified in the structure definition. Sometimes you only have the address of the structure displaced by an offset. 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). and then to declare the specified data. For example: at mt_str. ax However. If the data to go in a structure field requires more than one source line to specify.11 ISTRUC.word]. so code such as mov ax. To declare a structure of type mytype in a program. dd dw db db 123456 1024 ’x’ ’hello. For example.134. −40 And access an element this way: mov [ebp + mytype.0 mt_long. mt_word.long.10.145. you can use –40 as a base offset: struc mytype. db db 123.156. you code something like this: mystruc: istruc mytype at at at at 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. ax 4.100.0 63 .This defines the offsets to the structure fields as mytype.str.[mystruc+mt_word] or mov ax.[mystruc+mytype. you could access an element by subtracting the offset: mov [ebp − 40 + mytype.167.[mystruc. esp sub esp.mt_word] is not valid. world’ 13. if you do not want to repeat this offset.word]. the remaining source lines can easily come after the AT line.word].178. 40 In this case. world’. NASM provides an easy way to do this in the ISTRUC mechanism. mytype.

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. the default for ALIGN is NOP. 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. and then apply the TIMES prefix to their second argument to perform the alignment. align on 4−byte boundary align on 16−byte boundary pad with 0s rather than NOPs align to 4 in the BSS equivalent to previous line Both macros require their first argument to be a power of two. and the default for ALIGNB is RESB 1.11. perform no error checking: they cannot warn you if their first argument fails to be a power of two. A final caveat: ALIGN and ALIGNB work relative to the beginning of the section.db 0 4. Again. paragraph or other boundary.resb 1 4 . being simple macros. . for example. you can just use ALIGN in code and data sections and ALIGNB in BSS sections. is a waste of effort.) The syntax of the ALIGN and ALIGNB macros is align align align align alignb 4 16 8. NASM does not check that the section’s alignment characteristics are sensible for the use of ALIGN or ALIGNB. . In each of these cases they will silently do the wrong thing. section 5. 64 . See also the smartalign standard macro package. and never need the second argument except for special purposes. Normally. 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.12 ALIGN and ALIGNB: Data Alignment The ALIGN and ALIGNB macros provides a convenient way to align code or data on a word. or if their second argument generates more than one byte of code. If the second argument is not specified. longword. So if the second argument is specified. ALIGN and ALIGNB. . . the two macros are equivalent.4.2. (Some assemblers call this directive EVEN.

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 ret See also section 11.1. ; mov al,bh

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.

65

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!

66

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.3 can be usefully rewritten in the following more sophisticated form: %macro writefile 2+ [section .data] %%str: %%endstr: __SECT__ db %2

67

mov mov mov mov int %endmacro

dx,%%str cx,%%endstr−%%str bx,%1 ah,0x40 0x21

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 kbuf_free kbuf resw resw resw 1 1 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 jmp 100h setup ; it’s a .COM program ; 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 runtimevar2 tsr_end: resw resd 1 20

68

Some assemblers use the name PUBLIC for this purpose. though._fscanf Some object−file formats provide extra features to the EXTERN directive. 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. In all cases. so that common intvar 4 is similar in function to 69 . the space it took up can be re−used as data storage for the running TSR. so that after the setup has finished running. like EXTERN.This defines some variables ‘on top of’ the setup code. the extra features are used by suffixing a colon to the symbol name followed by object−format specific text. You can declare the same variable as EXTERN more than once: NASM will quietly ignore the second and later redeclarations. then in order to prevent linker errors. The EXTERN directive takes as many arguments as you like. A common variable is much like a global variable declared in the uninitialized data section. some code GLOBAL. 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. 6. lets you specify whether global data items are functions or data: global hashlookup:function. but is assumed to be defined in some other module and needs to be referred to by this one. For example: global _main _main: . allows object formats to define private extensions by means of a colon. 6. The GLOBAL directive applying to a symbol must appear before the definition of the symbol. 6. Each argument is the name of a symbol: extern extern _printf _sscanf. You can’t declare a variable as EXTERN as well as something else. Not every object−file format can support external variables: the bin format cannot. For example.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. some other module must actually define the symbol and declare it as GLOBAL. hashtable:data Like EXTERN. The elf object format. the primitive form of GLOBAL differs from the user−level form only in that it can take only one argument at a time. for example. The symbol ‘tsr_end’ can be used to calculate the total size of the part of the TSR that needs to be made resident.7 COMMON: Defining Common Data Areas The COMMON directive is used to declare common variables.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.

floating−point constants are rounded to nearest. All instructions will be selected only if they apply to the selected CPU or lower. then at link time those variables will be merged. the obj format allows common variables to be NEAR or FAR. like EXTERN and GLOBAL. 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. and the elf format allows you to specify the alignment requirements of a common variable: common common commvar 4:near intarray 100:4 . For example. COMMON supports object−format specific extensions.global intvar section . works in ELF: 4 byte aligned Once again. works in OBJ . all instructions are available. and IEEE denormals are supported. The following options can be set to alter this behaviour: 70 . and references to intvar in all modules will point at the same piece of memory.bss intvar resd 1 The difference is that if more than one module defines the same common variable. 6. Like GLOBAL and EXTERN. 6. By default.8 CPU: Defining CPU Dependencies The CPU directive restricts assembly to those instructions which are available on the specified CPU.9 FLOAT: Handling of floating−point constants By default. the primitive form of COMMON differs from the user−level form only in that it can take only one argument at a time.

and __FLOAT__ contain the current state. ([FLOAT]). 71 . __FLOAT_ROUND__. __FLOAT__ contains the full set of floating−point settings. this value can be saved away and invoked later to restore the setting.• 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__. as long as the programmer has avoided the use of the brackeded primitive form.

As stated in section 2.data align=16 switches to the section . it does not permit any of the trickery that MASM’s version does. or whatever you like to use) from the input file name. section . Its sole function is to specify one offset which is added to all internal address references within the section.3. Using the bin format puts NASM by default into 16−bit mode (see section 6.1 ORG: Binary File Program Origin The bin format provides an additional directive to the list given in chapter 6: ORG. Pure binary output is also useful for operating system and boot loader development. 0x100 label 7.1). This is done by appending the ALIGN qualifier to the end of the section−definition line. along with its extensions to the base NASM syntax. it has a large number of available output formats. NASM’s ORG does exactly what the directive says: origin. For example.1. 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. The extensions are given with each format below. 72 . Each of these formats. See section 12. the default is for NASM to assemble binprog.1. The bin format supports multiple section names. you need to explicitly issue the BITS 32 or BITS 64 directive. see section 7. In order to use bin to write 32−bit or 64−bit code. 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. bin has no default output file name extension: instead. and substituting an extension defined by the output format.COM executables and .s. For details of how NASM handles sections in the bin format. For this reason.asm. Thus. 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. such as an OS kernel. selected using the −f option on the NASM command line. which allows you to jump around in the object file and overwrite code you have already generated.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.asm into a binary file called binprog.1. NASM chooses a default name for your output file based on the input file name and the chosen output format. 7.data and also specifies that it must be aligned on a 16−byte boundary. For example. is detailed in this chapter.1.1. it leaves your file name as it is once the original extension has been removed. . This will be generated by removing the extension (.1. Such ‘pure binary’ files are used by MS−DOS: .SYS device drivers are pure binary files.Chapter 7: Output Formats NASM is a portable assembler. the following code will generate the longword 0x00000104: org dd label: Unlike the ORG directive provided by MASM−compatible assemblers.3 for further comments.

• All sections are aligned on dword boundaries. • Arguments to org. [map symbols myfile. this is a flat memory image format with no support for relocation or linking.8. • Sections may not overlap. the square brackets must be used. It is usually used with ROM programmers and similar utilities.1. which defaults to nobits. • NASM creates the section.bss. srec provides a default output file−name extension of . The alignment value given may be any power of two. or symbols may be specified. Just as the bin format. follows=. start. vstart=. this is a flat memory image format with no support for relocation or linking. vstart. • Sections can be given a virtual start address.The parameter to ALIGN specifies how many low bits of the section start address must be forced to zero. E. 73 .start for each section. 7. • Any code which comes before an explicit SECTION directive is directed by default into the . which will be used for the calculation of all memory references within that section with vstart=. or at an arbitrary byte−granular position with start=.1. or vfollows= has been specified.srec. See section 3. It is usually used with ROM programmers and similar utilities.3 Multisection Support for the bin Format The bin format allows the use of multiple sections. and .4 Map Files Map files can be generated in −f bin format by means of the [map] option.g. of arbitrary names. No "user form" exists. and align= are critical expressions.3 srec: Motorola S−Records Output The srec file format produces Motorola S−records files. E.text section.ith. besides the "known" . ORG 0 is used by default. • Sections may be designated progbits or nobits.data. • Sections can be aligned at a specified boundary following the previous section with align=.<secname>. segments. unless start=. • If an ORG statement is not given.bss section will be placed after the last progbits section. All extensions supported by the bin file format is also supported by the ith file format. align=(1 << ALIGN_SHIFT) – ALIGN_SHIFT must be defined before it is used here. or a specified file. All extensions supported by the bin file format is also supported by the srec file format.2 ith: Intel Hex Output The ith file format produces Intel hex−format files. Default is progbits (except . • The . 7. Just as the bin format. • Sections can be ordered using follows=<section> or vfollows=<section> as an alternative to specifying an explicit start address. 7. of course). 7.bss names. unless a different alignment has been specified. Output may be directed to stdout (default). stderr. brief. ith provides a default output file−name extension of . . Map types of all (default).map]. which may be used in your code.text.g. sections.

DATA and BSS.ax ax. PUBLIC.data es. so that you can access the segment address of the segment. and requires that the portion of it described in this code module must be aligned on a 16−byte boundary. obj is not exclusively a 16−bit format. get preferred segment of foo . PRIVATE segments do not get combined with any others by the linker. COMMON and STACK specify the combination characteristics of the segment. so that you can write code which does things like extern foo mov mov mov mov mov mov ax.4. obj provides a default output file−name extension of . So.obj.data ds. but also declares it to be a private segment. In particular. this accesses ‘foo’ . and move it into DS .seg foo ds.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 .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. When you define a segment in an obj file. so does this 7. NASM defines the segment name as a symbol as well.ax word [dvar] . The available qualifiers are: • PRIVATE. a different segment . 32−bit obj format files are used by Borland’s Win32 compilers. for example: segment data dvar: dw 1234 segment code function: mov mov inc ret ax. PUBLIC and STACK segments get 74 . then NASM will invent its own segment called __NASMDEFSEG for you. segment code private align=16 defines the segment code. It is also the format used by OS/2. though: NASM has full support for the 32−bit extensions to the format. get segment address of data . now this reference will work The obj format also enables the use of the SEG and WRT operators. instead of using Microsoft’s newer win32 object file format.EXE files. Typical names for segments in obj format files are CODE.bx . For example. This is done by appending extra qualifiers to the end of the segment−definition line.ax ax. If your source file contains code before specifying an explicit SEGMENT directive. The obj format does not define any special segment names: you can call your segments anything you like.7.[ds:foo] [es:foo wrt data].

Therefore SEG var. some data segment bss . 7.2 GROUP: Defining Groups of Segments The obj format also allows segments to be grouped. 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. as shown above. although no linkers are currently known to make sensible use of this feature.4. no class. some uninitialized data group dgroup data bss which will define a group called dgroup to contain the segments data and bss. If you just refer to var. • Segments can be declared as USE16 or USE32. nevertheless. and also defines the group if it is not already defined. e. NASM will allow a segment to be part of more than one group. will return the group base rather than the segment base. whereby you can code segment data . so that a single segment register can be used to refer to all the segments in a group. but will generate a warning if you do this. 64 and 128 will all be rounded up to 256. not the segment. 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. however. The class name can be any word. and provides overlay information to an overlay−capable linker. and COMMON segments all get overlaid on top of each other rather than stuck end−to−end. the only values supported are 1. and 32. like CLASS. and so on. NASM therefore supplies the GROUP directive. no overlay. GROUP causes the group name to be defined as a symbol. • CLASS can be used to specify the segment class. 16. which causes the default segment base for anything in the segment to be the special group FLAT. is specified with an arbitrary word as an argument. then NASM will default to giving you the offset of var from the beginning of the group. NASM allows you to declare a segment such as SEGMENT SCREEN ABSOLUTE=0xB800 if you need to. The alignment value given may be any power of two from 1 to 4096. • The obj file format also allows segments to be declared as having a pre−defined absolute segment address. and USE16. you should declare 32−bit segments as FLAT. Like SEGMENT. • OVERLAY.g. ALIGN=1. 4. so that you can refer to a variable var in the data segment as var wrt data or as var wrt dgroup.concatenated together at link time. depending on which segment value is currently in your segment register. to specify how many low bits of the segment start address must be forced to zero. also. • ALIGN is used. and var is declared in a segment which is part of a group. 2. 256 and 4096. CLASS=CODE. 75 . NASM’s default segment attributes are PUBLIC. • When writing OS/2 object files. in reality. Note that alignment to 4096−byte boundaries is a PharLap extension to the format and may not be supported by all linkers. so if 8 is specified it will be rounded up to 16. this feature indicates to the linker that segments of the same class should be placed near each other in the output file. The ABSOLUTE and ALIGN keywords are mutually exclusive.

but the object file can be written entirely in upper case if desired.4. 7. group and symbol names that are written to the object file to be forced to upper case just before being written. If this name is the same as the internal name.dll A third optional parameter gives the name by which the symbol is known in the library you are importing it from. defines the special group FLAT with no segments in it. The IMPORT directive takes two required parameters. EXPORT takes one required parameter. You still need to declare the symbol as GLOBAL as well as using the EXPORT directive. even if it is the same as the internal name. it requires no parameters. for example. and gives the desired number. These parameters. For example: import WSAStartup wsock32.5 EXPORT: Exporting DLL Symbols The EXPORT format−specific directive defines a global symbol to be exported as a DLL symbol.3 UPPERCASE: Disabling Case Sensitivity in Output Although NASM itself is case sensitive.dll WSAAsyncSelect 7. you may leave the second parameter off.4. OS/2. sets the number of parameter words for the case in which the symbol is a call gate between 32−bit and 16−bit segments. Within a source file. • nodata indicates that the exported symbol is a function which does not make use of any initialized data. for use if you are writing a DLL in NASM. some OMF linkers are not. You still need to declare the symbol as EXTERN as well as using the IMPORT directive. NASM is still case−sensitive. For example: import asyncsel wsock32. The available attributes are: • resident indicates that the exported name is to be kept resident by the system loader. Further parameters can be given to define attributes of the exported symbol. • An attribute which is just a number indicates that the symbol should be exported with an identifying number (ordinal). as it was defined in your source file. separated by white space. you can still make WRT references to a group which does not contain the variable you are referring to. This is an optimisation for frequently used symbols imported by name. for use if you are writing a DLL’s import library in NASM. The UPPERCASE format−specific directive causes all segment.A group does not have to contain any segments. which are (respectively) the name of the symbol you wish to import and the name of the library you wish to import it from.4. For example: export export myfunc myfunc TheRealMoreFormalLookingFunctionName 76 . • parm=NNN. 7. 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. which is the name of the symbol you wish to export.4 IMPORT: Importing DLL Symbols The IMPORT format−specific directive defines a symbol to be imported from a DLL. 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. UPPERCASE is used alone on a line. If further parameters are given. the external name must also be specified. are separated by white space. like the second. where NNN is an integer. therefore it can be useful for NASM to output single−case object files.

4. Therefore NASM must allow you to specify the element size on your far common variables. say dgroup. move it into ES . particularly if you know that an external is going to be accessible from a given segment or group.4. five two−byte elements If no element size is specified. Some OMF linkers require the element size. since only far commons may have element sizes at all. having to type this every time you want to access foo can be a pain. This is done by the following syntax: common common c_5by2 c_2by5 10:far 5 10:far 2 .[foo wrt dgroup] However.. and the expression foo is equivalent to foo wrt dgroup. and ‘farvar’ is far Far common variables may be greater in size than 64Kb.start at the point where you wish execution to begin.4. and use offset ‘foo’ from it This is a little unwieldy. five two−byte elements. NASM allows you to specify which your variables should be by the use of the syntax common common nearvar 2:near farvar 10:far .. 7. the FAR keyword is not required when an element size is specified. you specify the entry point by declaring the special symbol . So to access the contents of foo you will usually need to do something like mov mov mov ax. Also.[es:foo] . 7. two five−byte elements .seg foo es. and so the OMF specification says that they are declared as a number of elements of a given size.4. 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. ‘nearvar’ is a near common .foo will give you the offset of foo from its preferred segment base (as specified in whichever module foo is actually defined in).export export myfunc myfunc 1234 .ax ax.8 obj Extensions to the COMMON Directive The obj format allows common variables to be either near or far. where execution will begin when the program is run. If the object file that defines the entry point is assembled using NASM. the default is 1. It can also be applied to common variables: see section 7. as well as the variable size. So a 10−byte far common variable could be declared as ten one−byte elements. This default−WRT mechanism can be used to make externals appear to be relative to any group or segment in your program. you could simply code mov ax. get preferred segment base . So if DS already contained dgroup.7 obj Extensions to the EXTERN Directive If you declare an external symbol with the directive extern foo then references such as mov ax. so the expression seg foo will now return dgroup.6 .8. to match when resolving common variables declared in more than one module.start: Defining the Program Entry Point OMF linkers require exactly one of the object files being linked to define the program entry point. two five−byte elements or one ten−byte element. export by ordinal myfunc myfunc resident parm=23 nodata 7. So the above declarations could equivalently be 77 .

defines the section to be a code section. The maximum you may specify is 64: the Win32 object file format contains no means to request a greater section alignment than this. to control the type and properties of sections you declare. win32 allows you to specify additional information on the SECTION directive line. but may (for example) pass information to the linker. and vice versa. but not executable.7). The available qualifiers are: • code. the defaults are 16−byte alignment for code sections.5. two five−byte elements . though the value does not matter. gives the alignment requirements of the section.common common c_5by2 c_2by5 10:5 10:2 . but not writable. five two−byte elements In addition to these extensions. • data and bss define the section to be a data section. Note that although Microsoft say that Win32 object files follow the COFF (Common Object File Format) standard. suitable for passing to Microsoft linkers such as Visual C++.4). This is due to a difference of opinion over the precise semantics of PC−relative relocations. So you can also declare things like common common common foo bar baz 10:wrt dgroup 16:far 2:wrt data 24:wrt data:6 7. used with a trailing number as in obj. declaring an info–type section called . For example. and also indicates to the linker that the type of the section is code. win32 provides a default output file−name extension of . This marks the section as readable and executable.4. analogously to code. If alignment is not explicitly specified. conversely. Informational sections get a default alignment of 1 byte (no alignment).data and . 7. the object files produced by Microsoft Win32 compilers are not compatible with COFF linkers such as DJGPP’s. Section types and properties are generated automatically by NASM for the standard section names . Note that Borland Win32 compilers do not use this format. or equivalently text. 8−byte alignment for rdata sections and 4−byte alignment for data (and BSS) sections.data . the coff format does not produce object files that Win32 linkers can generate correct output from. the COMMON directive in obj also supports default−WRT specification like EXTERN does (explained in section 7. which is not included in the executable file by the linker. • info defines the section to be an informational section. but use obj instead (see section 7. • align=. whereas bss declares an uninitialized data section. Data sections are marked as readable and writable. data declares an initialized data section.drectve causes the linker to interpret the contents of the section as command−line options.bss.text .obj. Microsoft compilers use this section to place constants in it.5 win32: Microsoft Win32 Object Files The win32 output format generates Microsoft Win32 object files.rdata . use NASM’s coff output format.text. • rdata declares an initialized data section that is readable but not writable. The defaults assumed by NASM if you do not specify the above qualifiers are: section section section section . but may still be overridden by these qualifiers. To produce COFF files suitable for DJGPP.bss code data rdata bss align=16 align=4 align=8 align=4 78 .1 win32 Extensions to the SECTION Directive Like the obj format. .

CANCEL to generate core dump’. If it’s not already present to be precise. Table omission is by default silent and therefore can be easily overlooked.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.text extern _MessageBoxA@16 %if __NASM_VERSION_ID__ >= 0x02030000 safeseh handler . it would still be perfectly possible.esp . • how to adapt/develop modules utilizing custom exception handling. incidentally suits as return value . One can instruct linker to refuse to produce binary without such table by passing /safeseh command line option. 7." As of version 2.text. From developer’s viewpoint the problem is two−fold: • how to adapt modules not deploying exception handlers of their own. Former can be easily achieved with any NASM version by adding following line to source code: $@feat. MB_OKCANCEL push DWORD caption push DWORD text push DWORD 0 call _MessageBoxA@16 sub eax.eax mov eax.0 caption:db ’SEGV’. then the table in question is omitted and above mentioned run−time checks will not be performed for application in question.Any other section name is treated by default like . cause exception pop DWORD [fs:0] . Without regard to this run−time check merits it’s natural to expect NASM to be capable of generating modules suitable for /safeseh linking. In order for an executable module to be equipped with such "safe exception handler table. if for whatever reason developer would choose to assign another value in source file.03 additional directive is implemented. which instructs the assembler to produce appropriately formatted input data for above mentioned "safe exception handler table. for exception handler ret global _main _main: push DWORD handler push DWORD [fs:0] mov DWORD [fs:0]. register handler as "safe handler" %endif handler: push DWORD 1 . I.5.03 NASM adds this absolute symbol automatically.0 79 ." all object modules on linker command line has to comply with certain criteria.4 ret text: db ’OK to rethrow.e. disengage exception handler add esp.1 .DWORD[eax] .00 equ 1 As of version 2." Its typical use would be: section . safeseh. engage exception handler xor eax. Registering custom exception handler on the other hand requires certain "magic. If one single module among them does not." 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.

something linker has no power over.. To be specific when it can’t be loaded at preferred address. dsptch: dq dq . It should be explicitly mentioned that such failure to register handler’s entry point with safeseh directive has undesired side effect at run−time. Finally. Most notably linker will refuse to link it with "’ADDR32’ relocation to ’..dll.text’ invalid without /LARGEADDRESSAWARE:NO". If exception is raised and unregistered handler is to be executed. all mentions of linker in this paragraph refer to Microsoft linker version 7.1 win64: Writing Position−Independent Code While REL takes good care of RIP−relative addressing. literally no notification is provided and user is left with no clue on what caused application failure. But this is only part of the problem! Trouble is that in . handler is engaged by simply manipulating [fs:0] location at run−time. 7. This object file is used exactly the same as the win32 object format (section 7. So [s]he will have to split jmp instruction as following: lea jmp rbx.dll load time. QWORD[dsptch+rax*8] case0 case1 Even novice Win64 assembler programmer will soon realize that the code is not 64−bit savvy.[rel dsptch] QWORD[rbx+rax*8] What happens behind the scene is that effective address in lea is encoded relative to instruction pointer.00 symbol and input data for "safe exception handler table" causes no backward incompatibilities and "safeseh" modules generated by NASM 2.. pages with such relocations will be rendered private to current process...lib /defaultlib:msvcrt.5).QWORD[rbx+rax*8] rbx case0−dsptch case1−dsptch 80 . Consider a switch dispatch table: jmp .[rel dsptch] rbx.exe binary with "safe exception handler table" and yet engage unregistered exception handler.03 and later can still be linked by earlier versions or non−Microsoft linkers.5) with the exception that it is meant to target 64−bit code and the x86−64 platform altogether. with regard to this exception. run−time that is. One can argue that system could at least have logged some kind "non−safe exception handler in x.x and later. Presence of @feat. dsptch: dq dq . Indeed.section . it’s trivial to fix: lea add jmp . there is one aspect that is easy to overlook for a Win64 programmer: indirect references.. And when this occurs.6 win64: Microsoft Win64 Object Files The win64 output format generates Microsoft Win64 object files.dll context caseN relocations will make their way to the final module and might have to be adjusted at . but no. it’s perfectly possible to produce . which is nearly 100% identical to the win32 object format (section 7.6. 7. in NASM. which kind of undermines the idea of sharing .drectve info db ’/defaultlib:user32. the application is abruptly terminated without any notification whatsoever.exe at address n" message in event log. rbx. But no worry..lib ’ As you might imagine. or in perfectly position−independent manner..

. Beside optional reference to custom handler. wrt . which is not necessarily what [s]he counted with. the stack unwind procedure will expect to find caller’s return address on the top of stack immediately followed by its frame. let’s discuss what’s in it and/or how it’s processed. Here is how to implement switch with these image−relative references: lea mov sub add jmp .imagebase wrt .e. While majority of subroutines written in assembler are not calling any other function..imagebase will become apparent in next paragraph. The latter ensures that it’s possible to identify leaf function’s caller by simply pulling the value from the top of the stack. For those acquainted with PE−COFF format base address denotes start of IMAGE_DOS_HEADER structure. If there is one. Just like in Win32 case.exe or . 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.imagebase One can argue that the operator is redundant. . Given that developer pushed caller’s non−volatile registers on stack.. Now. therefore the name. be it . .dsptch wrt . snippet before last works just fine with any NASM version and is not even Windows specific. Information is detailed enough to be able to reconstruct contents of caller’s non−volatile registers upon call to current callee. one can argue that system could at least have logged "unwind procedure went berserk in x. The real reason for implementing wrt .6. and then unwind 81 . Thus so called UNWIND_INFO structure is identified.imagebase wrt . would the value on top point at some code segment or even addressable space? Well... ok bad ok bad 7. which returns offset from base address of the current image. In Win64 leaf function is such function that does not call any other function nor modifies any Win64 non−volatile registers. developer can attempt copying caller’s return address to the top of stack and this would actually work in some very specific circumstances. And so caller’s context is reconstructed... execution flow is resumed (exception is said to be "handled"). Upon exception program counter value is noted..imagebase operator. i. Customarily one would meet the requirement by saving non−volatile registers on stack and restoring them upon return. when we understand significance of the UNWIND_INFO structure. dsptch: dd dd rbx. no trace of failure is left.DWORD[rbx+rax*4] rbx. But unless developer can guarantee that these circumstances are always met. including stack pointer. then offending subroutine is assumed to be "leaf" and just mentioned lookup procedure is attempted for its caller. Depending on the return value.exe at address n" in event log.imagebase case1 wrt . Relevant question is what happens then? Application is abruptly terminated without any notification whatsoever. First of all it is checked for presence of reference to custom language−specific exception handler..03 and later provides another alternative..rax rbx case0 wrt . but no.label . stack unwind procedure going berserk.imagebase is defined as 32−bit operand only: dd dq mov mov label wrt label wrt eax...NASM version 2. . or rest of UNWIND_INFO structure is processed as following.dll module.[rel dsptch] eax.imagebase . Indeed.imagebase .label rax...imagebase rbx. It should be noted that wrt . requirement for non−volatile registers’ immutability leaves developer with not more than 7 registers and no stack frame. If it’s not found. then it’s invoked. it’s more appropriate to assume worst case scenario. 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.2 win64: Structured Exception Handling Structured exception handing in Win64 is completely different matter from Win32. it carries information about current callee’s stack frame and where non−volatile registers are saved.

.xdata rdata align=8 xmain: db 9. As simplest example. another UNWIND_INFO structure is associated. CANCEL to generate core dump’.. this time.imagebase dd xmain wrt . placed into these two segments turn out image−relative. i.procedure is repeated.lib /defaultlib:msvcrt.[caption] mov r9. It should be noted that rdata align=n.rax mov rax.1 . for exception handler add rsp. can be omitted. as well as wrt . then [s]he will have to remember to adjust its value to obtain the real pointer. 82 .40 mov rcx.1 .0. The procedure is recursively repeated till exception is handled.imagebase. As for the moment of this writing NASM unfortunately does not facilitate generation of above mentioned detailed information about stack frame layout. References are required to be image−relative (which is the real reason for implementing wrt .pdata rdata align=4 dd main wrt . MB_OKCANCEL call MessageBoxA sub eax.imagebase section . which is then checked for presence of reference to language−specific handler.imagebase dd main_end wrt .pdata section is element of the "table comprising start and end addresses of function" along with reference to associated UNWIND_INFO structure.0. As last resort system "handles" it by generating memory core dump and terminating the application.imagebase section .40 ret global main main: xor rax.. Latter means that all 32−bit references.0 caption:db ’SEGV’.03 it implements building blocks for generating structures involved in stack unwinding. But as of version 2.[text] lea r8. incidentally suits as return value . are optional in these two segments’ contexts. i.xdata section is UNWIND_INFO structure describing function with no frame. here is how to deploy custom exception handler for leaf function: default rel section . with caller’s instruction pointer.. cause exception ret main_end: text: db ’OK to rethrow. not only above listed required ones.0 dd handler wrt .imagebase operator). etc.e.text extern MessageBoxA handler: sub rsp.0 section .e.. And what you see in . Why is it important to understand? Developer is allowed to append handler−specific data to UNWIND_INFO structure.drectve info db ’/defaultlib:user32..0 lea rdx. and if [s]he adds a 32−bit reference. but with designated exception handler.lib ’ What you see in .QWORD[rax] .

except for rsp. } context−>Rsp = (ULONG64)rsp. before stack layout is analyzed.r11 QWORD[rsp]. it’s perfectly possible to manipulate current callee’s context in custom handler in manner that permits further stack unwinding.QWORD[r11−24] rbx. which would surely be considered error−prone? Yes. if (context−>Rip<(ULONG64)magic_point) rsp = (ULONG64 *)context−>Rax.rsp r15 rbx rbp r11.DISPATCHER_CONTEXT *disp) { ULONG64 *rsp.context.QWORD[r11−8] rsp. is modified. besides manually composing fully−fledged UNWIND_INFO structure. As it turned out.disp−>ImageBase. In this case custom language−specific exception handler would look like this: EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec. CONTEXT *context. General idea is that handler would not actually "handle" the exception.rsp r11.NULL). dips−>ControlPc.−64 QWORD[r11]. destroy frame The keyword is that up to magic_point original rsp value remains in chosen volatile register and no non−volatile register. But it’s not uncommon that assembler programmer plans to utilize every single register and sometimes even have variable stack frame. context−>Rbx = rsp[−2]. In other words. Is there anything one can do with bare building blocks? I. copy rsp to volatile register .. RtlVirtualUnwind(UNW_FLAG_NHANDLER.sizeof(CONTEXT)).rax rsp.ULONG64 frame. there is.rcx r11. else { rsp = ((ULONG64 **)context−>Rsp)[0]. Consider following example: function: mov push push push mov sub and mov mov mov magic_point: . return ExceptionContinueSearch. While past magic_point rsp remains constant till the very end of the function.As already mentioned. &disp−>HandlerData.disp−>FunctionEntry. but instead restore callee’s context.QWORD[r11−16] r15.&disp−>EstablisherFrame. as it was at its entry point and thus mimic leaf function. handler would simply undertake part of unwinding procedure. save non−volatile registers .QWORD[rsp] . memcpy (disp−>ContextRecord. Recall that exception handler is called first. mov mov mov mov mov ret rax. pull original rsp value rbp. context−>Rbp = rsp[−3].e. context−>R15 = rsp[−1]. prepare variable stack frame .r11 . allocate stack frame .rax . in Win64 terms leaf function is one that does not call any other function nor modifies any non−volatile register. } 83 .disp−>ContextRecord. save original rsp value r11. check for exceptions .. including stack pointer.

Section types and properties are generated automatically by NASM for the standard section names. This field can be set by using the osabi directive with the numeric value (0−255) of the target system. 7. to control the type and properties of sections you declare. The defaults assumed by NASM if you do not specify the above qualifiers are: 84 . coff provides a default output file−name extension of . including Solaris x86. as used by Linux as well as Unix System V. the default value will be "UNIX System V ABI" (0) which will work on most systems which support ELF. used with a trailing number as in obj. UnixWare and SCO Unix.o.7 coff: Common Object File Format The coff output type produces COFF object files suitable for linking with the DJGPP linker. elf provides a default output file−name extension of . 7. • progbits defines the section to be one with explicit contents stored in the object file: an ordinary code or data section. elf allows you to specify additional information on the SECTION directive line.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. • write defines the section to be one which should be writable when the program is run. for example. such as a BSS section. but may still be overridden by these qualifiers. 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. nobits defines the section to be one with no explicit contents given.1 ELF specific directive osabi The ELF header specifies the application binary interface for the target operating system (OSABI). If this directive is not used.2 elf Extensions to the SECTION Directive Like the obj format. macho provides a default output file−name extension of . noexec defines it as one which should not.o.9. corresponding UNWIND_INFO structure does not have to contain any information about stack frame and its layout. nowrite defines it as one which should not. • tls defines the section to be one which contains thread local variables.o. 7. 7. • exec defines the section to be one which should have execute permission when the program is run.9. such as an informational or comment section. macho is a synonym for macho32. • align=. gives the alignment requirements of the section. noalloc defines it to be one which is not. 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.As custom handler mimics leaf function. The available qualifiers are: • alloc defines the section to be one which is loaded into memory when the program is run. elf is a synonym for elf32.

gotoff will give the distance from the beginning of the GOT to the specified location. • Referring to an external or global symbol using wrt . .sym causes NASM to write an ordinary relocation..9.plt causes the linker to build a procedure linkage table entry for the symbol. A fuller explanation of how to use these relocation types to write shared libraries entirely in NASM is given in section 9.. However.2.) 7.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.section section section section section section section section section section section . and end up with the address of the symbol.tdata .tbss .sym. • Referring to a symbol name using wrt . as the destination for CALL or JMP).lbss .. The distinction is a necessary one due to a peculiarity of the dynamic linker.rodata .3 Position−Independent Code: elf Special Symbols and WRT The ELF specification contains enough features to allow position−independent code (PIC) to be written. They are .) 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 . therefore NASM’s elf output format makes use of WRT for a different purpose.e..lrodata . load from the resulting address. but instead of making the relocation relative to the start of the section and then adding on the offset to the symbol. ... if it is to be an assembler which can write PIC.comment other progbits progbits progbits progbits progbits nobits nobits progbits nobits progbits progbits alloc alloc alloc alloc alloc alloc alloc alloc alloc noalloc alloc exec noexec noexec noexec noexec noexec noexec noexec noexec noexec noexec nowrite nowrite nowrite write write write write write write nowrite nowrite align=16 align=4 align=4 align=4 align=4 align=4 align=4 align=4 align=4 align=1 align=1 tls tls (Any section name other than those in the above table is treated by default like other in the above table. Since ELF does not support segment−base references. so that adding on the address of the GOT would give the real address of the location you wanted. Their functions are summarized here: • Referring to the symbol marking the global offset table base using wrt .got causes the linker to build an entry in the GOT containing the address of the symbol.got. it will write a relocation record aimed directly at the symbol in question.data . You can only use this in contexts which would generate a PC−relative relocation normally (i. elf defines five special symbols which you can use as the right−hand side of the WRT operator to obtain PIC relocation types. • Referring to a procedure name using wrt . namely the PIC−specific relocation types.. so you can add on the address of the GOT.plt and .. the WRT operator is not used for its normal purpose..bss .gotoff. which makes ELF shared libraries very flexible.gotpc. 85 . it also means NASM has to be able to generate a variety of ELF specific relocation types in ELF object files.ldata .text . . Please note that section names are case sensitive. since ELF contains no relocation type to refer to PLT entries absolutely. and the reference gives the distance from the beginning of the GOT to the entry.. and the reference gives the address of the PLT entry.

and even forward references) after the type specifier. 86 . or protected. allowing you to specify these features. The default is default of course. hidden.that.7.. to make hashlookup hidden: global hashlookup:function hidden You can also specify the size of the data associated with the symbol. separated (as usual) by a colon. 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. see section 9. so you can access the value of the symbol with code such as: mov mov eax.gottpoff] rcx.2. 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..9..6 elf Extensions to the COMMON Directive ELF also allows you to specify alignment requirements on common variables. (object is a synonym for data. you can control the ELF visibility of the symbol. and requires that it be aligned on a 4−byte boundary. For example. 7. internal. but are actually necessary when the program being written is a shared library. This is done by putting a number (which must be a power of two) after the name and size of the common variable.4 Thread Local Storage: elf Special Symbols and WRT • In ELF32 mode.[fs:rax] 7. For example. For more information.9. referring to an external or global symbol using wrt .[tid wrt . so you can access the value of the symbol with code such as: mov mov rax.ebx • In ELF64 mode.end − hashtable) hashtable: db this. These are not merely debugger conveniences.theother . Declaring the type and size of global symbols is necessary when writing shared library code.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.) For example: global hashlookup:function. Optionally.[rel tid wrt . hashtable:data exports the global symbol hashlookup as a function and hashtable as a data object.end: . 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. as a numeric expression (which may involve labels.9. NASM therefore supports some extensions to the GLOBAL directive.tlsie] [gs:eax]. Just add one of the visibility keywords: default. some data here This makes NASM automatically calculate the length of the table and place that information into the ELF symbol table.4.tlsie causes the linker to build an entry in the GOT containing the offset of the symbol within the TLS block.. Like this: global hashtable:data (hashtable.

o.out. but please note that only the ". Although its companion linker ld86 produces something close to ordinary a.data and . also.) These differ from other a.7. It supports only the three standard section names .out. and only the three standard section names . aoutb provides a default output file−name extension of .bss.11 aoutb: NetBSD/FreeBSD/OpenBSD a. NASM can generate GNU−compatible relocations.text" section is executable by default. NASM supports this format. some implementations of a. see section 7.. no special symbols. aoutb supports no special directives. to allow 16−bit code to be linked as ELF using GNU ld. in the form used by early Linux systems (current Linux systems use ELF. a warning is issued when one of these relocations is generated.5 for documentation of this.9.9. just in case it is useful. designed alongside NASM itself and reflecting in its file format the internal structure of the assembler.out object files in that the magic number in the first four bytes of the file is different. See section 7.text.9. which Linux’s implementation does not. as86 provides a default output file−name extension of . It supports no special directives. no special symbols.out is a very simple object format.text. in the form used by the various free BSD Unix clones. 87 . . no use of SEG or WRT. this object format is exactly the same as aout except for the magic number in the first four bytes of the file.text. to provide position−independent code relocation types.7 16−bit code and ELF The ELF32 specification doesn’t provide relocations for 8− and 16−bit values.o. RDOFF (Relocatable Dynamic Object File Format) is a home−grown object−file format.out object files.9. and no extensions to any standard directives.start.out provides a default output file−name extension of .9. However. It supports only the three standard section names . as as86. support position−independent code.o. However. If NASM is used with the −w+gnu−elf−extensions option. NetBSD.out binaries as output. Line number information is generated for all executable sections. but the GNU ld linker adds these as an extension. FreeBSD and OpenBSD.out object files. a. 7. and no extensions to any standard directives.13 rdf: Relocatable Dynamic Object File Format The rdf output format produces RDOFF object files.3 for full documentation of this feature.10 aout: Linux a.data and . 7. It supports no special directives.bss. a. 7. no use of SEG or WRT. aoutb also supports the same extensions to the GLOBAL directive as elf does: see section 7. the aoutb format supports position−independent code in the same way as the elf format. it also supports the same use of WRT as elf does. .12 as86: Minix/Linux as86 Object Files The Minix/Linux 16−bit assembler as86 has its own non−standard object file format.out Object Files The aout format generates a. . 7. as86 is a very simple object format (from the NASM user’s point of view). the object file format used to communicate between as86 and ld86 is not itself a. For simple object files.out Object Files The aoutb format generates a.data and .bss. 7. for example NetBSD’s.8 Debug formats and ELF ELF32 and ELF64 provide debug information in STABS and DWARF formats. so you can use it to write BSD shared libraries. The only special symbol supported is .

For example: library extern extern extern $libc _open:import _printf:import proc _errno:import data 88 . you can also specify whether an imported symbol is a procedure (function) or data object.13. to specify exported data object. either at load time or run time.RDOFF is not used by any well−known operating systems. RDOFF offers an additional import modifier. This is done by the LIBRARY directive.rdl 7. 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. It can be used.bss. which must be resolved later during a dynamic linking phase. 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). To declare an "imported" symbol.13. however. by run−time loader to perform dynamic linking.e. add the word data or object to the directive: global kernel_ticks:export data 7.data and .4 rdf Extensions to the EXTERN Directive By default the EXTERN directive in RDOFF declares a "pure external" symbol (i. 7. and a program which will load and execute an RDF executable under Linux. Like in ELF. may well wish to use RDOFF as their object format.2 Specifying a Module Name: The MODULE Directive Special RDOFF header record is used to store the name of the module.text. both contain an rdoff subdirectory holding a set of RDOFF utilities: an RDF linker. To avoid it. and the DOS archive which includes sources. the static linker will complain if such a symbol is not resolved). like: module $kernel. which takes one argument which is the name of the module: library mylib. The Unix NASM archive. rdf supports only the standard section names . all module names will be stripped too. you can also specify whether an exported symbol is a procedure (function) or data object. thus telling the linker do not strip it from target executable or library file.13. As in GLOBAL. Those writing their own systems.13. on the grounds that it is designed primarily for simplicity and contains very little file−header bureaucracy. you add the word proc or function after declaration: global sys_open:export proc Similarly. you should start module names with $. .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.core 7. an RDF file dump utility. You can mark a global symbol as exported. for example. an RDF static−library manager.3 rdf Extensions to the GLOBAL Directive RDOFF global symbols can contain additional information needed by the static linker.

dbg will not do this. this will not work well on files which were designed for a different object format. Then the preprocessed source is fed through the dbg format to generate the final diagnostic output. 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.asm which will generate a diagnostic file called filename. This workaround will still typically not work for programs intended for obj format.Here the directive LIBRARY is also included. dbg accepts any section name and any directives at all. keeping the rdf object format selected in order to make sure RDF special directives are converted into primitive form correctly.i. one can easily use the dbg format like this: nasm −f dbg filename.asm into rdfprog. For simple files. which gives the dynamic linker a hint as to where to find requested symbols.dbg. so the program will not assemble.asm nasm −a −f dbg rdfprog. 7.h or on the compiler command line. However. you can define OF_DBG in output/outform. The dbg format does not output an object file as such. If you are building your own NASM executable from the sources. 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. 89 . It is primarily intended to aid people who want to write their own output drivers. because the obj SEGMENT and GROUP directives have side effects of defining the segment and group names as symbols.i rdfprog. in order to do the preprocessing with the native object format selected: nasm −e −f rdf −o rdfprog. so that they can get a clearer idea of the various requests the main program makes of the output driver. for example) if you really need to get a dbg trace of an obj–specific source file. Therefore it can be useful to run NASM twice. and obtain the dbg output format. and logs them all to its output file.14 dbg: Debugging Format The dbg output format is not built into NASM in the default configuration. You will have to work around that by defining the symbols yourself (using EXTERN.i This preprocesses rdfprog. and in what order they happen.

since Windows does not support the . written by Anthony A.oulu. In general.net.stacktop This initial piece of code sets up DS to point to the data segment. 8.EXE Files Any large program written under DOS needs to be built as a .asm. the linker will not know what value to give the entry−point field in the output file header. initialising the segment registers. An LZH archiver can be found at ftp. Williams. A third. and a macro package is supplied to do this.com.SYS device drivers. It demonstrates the basic principles of defining a stack.EXE file: only .OBJ files together. you should ensure that exactly one of them has a start point defined (using the .EXE is given here.4.ax sp.EXE files using the bin output format (by using DB and DW to construct the . It covers how to link programs to produce .net.1. and how to interface assembly language code with 16−bit C compilers and with Borland Pascal. is available at alink. is available at www.Chapter 8: Writing 16−bit Code (DOS. segment code .COM files. ALINK.start: mov mov mov mov mov ax.fi. If no module defines a start point. how to write .start special symbol defined by the obj format: see section 7. A fourth linker.EXE file header).EXE file.6). There is another ‘free’ linker (though this one doesn’t come with sources) called FREELINK. Windows 3/3. Notice that interrupts are implicitly disabled for one instruction after a move into SS. also..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. However. and initializes SS and SP to point to the top of the provided stack.delorie.pcorner. NASM may also support .1 Producing .1 Using the obj Format To Generate . Thanks to Yann Guidon for contributing the code for this.EXE files by linking . available from www.J. NASM also supports the direct generation of simple DOS . This file is also provided in the test subdirectory of the NASM archives. written by DJ Delorie.EXE natively as another output format in future releases.EXE files have the necessary internal structure required to span more than one 64K segment.. When linking several . Most 16−bit programming language packages come with a suitable linker.EXE Files This section describes the usual method of generating . 8. there is a free linker called VAL. if more than one defines a start point.simtel. An example of a NASM source file which can be assembled to a .x. the linker will not know which value to use. Windows programs.OBJ files. have to be built as .OBJ files into a .sourceforge. you generate . available in LZH archive format from x2ftp. and declaring a start point. and then linking them together using a linker.com. under the name objexe. 90 .EXE or .stack ss. if you have none of these. djlink.COM format.OBJ file and linked on its own to a .EXE files.data ds.EXE files by using the obj output format to produce one or more .ax ax.

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 mov int dx,hello ah,9 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 int ax,0x4c00 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.

91

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.

92

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

93

%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.

94

not right−to−left.1). The word at [BP] holds the previous value of BP as it was pushed. at successively greater offsets. so part of the calling convention states that BP must be preserved by any C function. • The callee. and is able to deallocate them from the stack itself by passing an immediate argument to the RET or RETF instruction. Hence the callee. Floating−point results are sometimes (depending on the compiler) returned in ST0. so the caller does not have to do it. which tells it the number and type of the remaining ones. if it is going to set up BP as a frame pointer. in reverse order (right to left. so it typically adds an immediate constant to SP to remove them (instead of executing a number of slow POP instructions). you would define a function in C style in the following way.5. the function parameters are still on the stack. so that the first argument specified to the function is pushed last). which knows how many parameters it pushed. It is instructive to compare this calling convention with that for Pascal programs (described in section 8. the next word. holds the offset part of the return address. then pops the previous value of BP. must push the previous value first. should leave the value in AL. at [BP+2]. In the following description.4. AX or DX:AX depending on the size of the value. it is called _DATA. at [BP+4]. • The callee receives control. • The caller then executes a CALL instruction to pass control to the callee. Also. The following example is for small model: global _myfunc: push bp _myfunc 95 . or with a default data segment.3 Function Definitions and Function Calls The C calling convention in 16−bit programs is as follows. Thus. Therefore the callee knows how many parameters it should have been passed. in a large−model (far) function. the words caller and callee are used to denote the function doing the calling and the function which gets called. the segment is called _TEXT. if a function is accidentally called with the wrong number of parameters due to a prototype mismatch. one after another. and returns via RETN or RETF depending on memory model. in a function such as printf which takes a variable number of parameters. the parameters start after that. since it was pushed last. is accessible at this offset from BP. the caller was probably doing this too. pushed implicitly by CALL. In a small−model (near) function. so as to allocate space on the stack for local variables. • Once the callee has finished processing. 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. • When the caller regains control from the callee. • The callee may also wish to decrease SP further. Pascal has a simpler convention. Thus. so your code segment must also go by this name in order to be linked into the same place as the main code segment. which means that a compiler can give better guarantees about sequence points without performance suffering. the others follow. This CALL is either near or far depending on the memory model. In models with a single data segment. • The caller pushes the function’s parameters on the stack. and the parameters begin at [BP+6]. The leftmost parameter of the function. it restores SP from BP if it had allocated local stack space. does the removing. the parameters are pushed in left−to−right order. the pushing of the parameters in reverse order means that the function knows where to find its first parameter. Thus. and typically (although this is not actually necessary.In models with a single code segment. since no functions have variable numbers of parameters. 8. the segment part of the return address lives at [BP+4]. if it wishes to return a value to the caller. the stack will still be returned to a sensible state since the caller. which will then be accessible at negative offsets from BP. • The callee may then access its parameters relative to BP.

.0x40" above For a large−model function. you would do something like this: extern _printf . since large model does not affect the size of the int data type. you would have to initialize it first. and therefore has to contain a segment and offset part. and therefore must be pushed first.. if one of the parameters is a pointer. if DS was set up as the above example assumed.bp bp . and SP has to be increased by 6 rather than 4 afterwards to make up for the extra word of parameters. printf("This number −> %d <− should be 1234\n". The first argument (pushed last) to printf. In this example. whereas near pointers take up two. offset of "mystring" The integer value still takes up one word on the stack. since functions expect far calls in large model. you would replace RET by RETF. and then. however. PUSH DS would have been a shorter instruction than PUSH WORD SEG mystring.. Now push the segment. 64 bytes of local stack space . to call a C function from your assembly code. At the other end of the process.) Then the actual call becomes a far call. ‘byte’ saves space .byte 6 .0x40 bx. 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.10. Of course. it is assumed that DS already holds the segment base of the segment _DATA. some more code mov pop ret sp. is a data pointer. first parameter to function . segment _DATA myint mystring dw db 1234 ’This number −> %d <− should be 1234’. push push call add word [myint] word mystring _printf sp.sp sp... . then those data items. In large model... and look for the first parameter at [BP+6] instead of [BP+4]. The segment should be stored second in memory. . myint). (Of course. push push push call add word [myint] word seg mystring word mystring far _printf sp.[bp+4] . and.0 This piece of code is the small−model assembly equivalent of the C code int myint = 1234. undo "sub sp. pointer into my data segment . one of my integer variables . the function−call code might look more like this. If not.byte 4 .. 96 .mov sub mov bp. further down.

(An alternative. However. To access a C data structure.4.[_i] And to declare your own integer variable which C programs can access as extern int j. TASM compatible form of arg is also now built into NASM’s preprocessor. this sort of feature tends to be a configurable option in the C compiler. (The byte offset 6 is obtained by multiplying the desired array index. you need only declare the names as GLOBAL or EXTERN. 2 for short and int. a C variable declared as int i can be accessed from assembler as extern _i mov ax. so you have to specify alignment yourself if the C compiler generates it.mac of macros. if necessary): global _j _j dw 0 To access a C array. you need to know the size of the components of the array. 8. To do either of these. 3. } foo. 4 for long and float. as stated in section 8. might be four bytes long rather than three. NASM gives no special alignment to structure members in its own STRUC macro. Typically. you can access a[3] by coding mov ax. or to declare variables which C can access. so you have to find out how your own compiler does it. arg and endproc. These are intended to be used for C−style procedure definitions. since the int field would be aligned to a two−byte boundary.[bp + %$j] ax.) The sizes of the C base types in 16−bit compilers are: 1 for char.4 Accessing Data Items To get at the contents of C variables. (Again. See section 4. either using command−line options or #pragma lines.8.mac: Helper Macros for the 16−bit C Interface Included in the NASM archives.4. you might find that a structure like struct { char c. You can either do this by converting the C structure definition into a NASM structure definition (using STRUC).[bx] 97 . is a file c16.[_a+6]. int variables are two bytes long. so if a C program declares an array as int a[10]. It defines three macros: proc.) An example of an assembly function using the macro set is given here: proc %$i %$j _nearproc arg arg mov mov add ax. and they automate a lot of the work involved in keeping track of the calling convention. you do this (making sure you are assembling in the _DATA segment.1. you should read your C compiler’s manual to find out how it organizes data structures. 2.5 c16.4.) Thus.8 for details. or by calculating the one offset and using just that. the names require leading underscores. int i. you need to know the offset from the base of the structure to the field you are interested in. in the misc directory.[bp + %$i] bx. and 8 for double. by the size of the array element. For example.

The macro set contains no intrinsic dependency on whether data pointers are far or not. When we load from j. giving the size of the argument. all static data declared in a Pascal program goes into the default data segment. since it is likely that many function parameters will be of type int. are far.[bp + %$j] es. Note that the arg macro has an EQU as the first line of its expansion. A context−local variable is used. because j is now a far pointer. the EQU works. The large−model equivalent of the above function would look like this: %define FARCODE proc %$i %$j _farproc arg arg mov mov mov add 4 ax. small and compact−model code) by default.5 Interfacing to Borland Pascal Programs Interfacing to Borland Pascal programs is similar in concept to interfacing to 16−bit C programs. You can have it generate far functions (medium. defining %$i to be an offset from BP. local to the context pushed by the proc macro and popped by the endproc macro. and since the label before the macro call gets prepended to the first line of the expanded macro. 8.) However. The macro set produces code for near functions (tiny. 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. and no data item can be more than 64K long.endproc This defines _nearproc to be a procedure taking two arguments. • Some data types.[bp + %$j + 2] ax.[bp + %$i] bx. we must load a segment and an offset. 2 is assumed. arg can take an optional parameter. This changes the kind of return instruction generated by endproc. the first (i) an integer and the second (j) a pointer to an integer. If no size is given.[bx] endproc This makes use of the argument to the arg macro to define a parameter of size 4. All data pointers. you don’t have to do that. are far. The differences are: • The leading underscore required for interfacing to C programs is not required for Pascal. are stored differently. which is the one whose segment address will be in DS when control is passed to your assembly code. • The memory model is always large: functions are far. large and huge−model code) by means of coding %define FARCODE. and also changes the starting point for the argument offsets. It returns i + *j. data pointers are far. 98 . however. and all Pascal functions that assembly routines are able to call. but only those functions that are local to a Pascal unit and never called from outside it. All assembly functions that Pascal calls. Of course. • The function calling convention is different – described below. some functions are near. (Actually. such as strings. so that the same argument name can be used in later procedures.

The word at [BP] holds the previous value of BP as it was pushed. However. To return a result of type String. and typically (although this is not actually necessary. since it was pushed last. in the following way: global myfunc bp bp. • The callee may also wish to decrease SP further. • The caller then executes a far CALL instruction to pass control to the callee. Results of type Real (Borland’s own custom floating−point data type. giving the number of bytes taken up by the parameters on the stack. one after another. It uses the form of RETF with an immediate parameter. The restrictions are described below. second parameter to function . The pointer is not a parameter.1 The Pascal Calling Convention The 16−bit Pascal calling convention is as follows. Hence the callee. 64 bytes of local stack space . The parameters begin at [BP+6].bp bp 4 .0x40 bx. and the callee places the returned string value at that location. Floating−point results are returned in ST0. undo "sub sp. taking two Integer–type parameters. The rightmost parameter of the function. Thus. should leave the value in AL. In the following description. and returns via RETF. holds the offset part of the return address. AX or DX:AX depending on the size of the value. not handled directly by the FPU) are returned in DX:BX:AX. the caller was probably doing this too.[bp+8] bx. 8. you would define a function in Pascal style. and the next one at [BP+4] the segment part.0x40" above .• 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. so that the first argument specified to the function is pushed first). total size of params is 4 99 . if it wishes to return a value to the caller. then pops the previous value of BP. if it is going to set up BP as a frame pointer. The next word. is accessible at this offset from BP. • The callee. • Once the callee has finished processing. so part of the calling convention states that BP must be preserved by any function. first parameter to function . the others follow. the function parameters have already been removed from the stack. must push the previous value first. • The callee may then access its parameters relative to BP. • The caller pushes the function’s parameters on the stack. some more code mov pop retf sp. which will then be accessible at negative offsets from BP.5. it restores SP from BP if it had allocated local stack space. • When the caller regains control from the callee.sp sp. • The callee receives control. 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. at successively greater offsets. at [BP+2]. the words caller and callee are used to denote the function doing the calling and the function which gets called. so it needs to do nothing further. so as to allocate space on the stack for local variables. This causes the parameters to be removed from the stack as a side effect of the return instruction. the caller pushes a pointer to a temporary string before pushing the parameters. and should not be removed from the stack by the RETF instruction.[bp+6] myfunc: push mov sub mov mov . in normal order (left to right.

GROUP directives and segment attributes are also ignored. can also be used to simplify writing functions to be called from Pascal programs.. and also causes procedure return instructions to be generated with an operand. an integer and a pointer to an integer..[bp + %$j] es.. 8. and then. push push push call word seg mystring word mystring word [myint] far SomeFunc . 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.4.mac macro package.. CSEG. Defining PASCAL does not change the code which calculates the argument offsets. or something ending in _BSS.5. This definition ensures that functions are far (it implies FARCODE).. Now push the segment. you would do something like this: extern SomeFunc . • Any other segments in the object file are completely ignored. DSEG. 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.5.At the other end of the process. which returns the sum of the integer and the contents of the 100 . if you code %define PASCAL. conceptually. as the example in section 8.[bp + %$i] bx. and. Int: Integer).5: it defines a function taking two arguments. .mac With Pascal Programs The c16. to call a Pascal function from your assembly code. offset of "mystring" . described in section 8.[bp + %$j + 2] ax. further down. For example: %define PASCAL proc %$j %$i _pascalproc arg 4 arg mov mov mov add ax.5. • Uninitialized data must be in a segment whose name is either DATA.. 8.4. SomeFunc(@mystring. or something ending in _TEXT.[bx] endproc This defines the same routine. you must declare your function’s arguments in reverse order.2 Borland Pascal Segment Name Restrictions Since Borland Pascal’s internal unit file format is completely different from OBJ.3 Using c16. myint). • initialized data must be in a segment whose name is either CONST or something ending in _DATA. . one of my variables This is equivalent to the Pascal code procedure SomeFunc(String: PChar.

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.pointer. 101 .

all Win32 compilers. • The callee may then access its parameters relative to EBP. 9. pushed implicitly by CALL. DJGPP) This chapter attempts to cover some of the common issues involved when writing 32−bit code.1.1 External Symbol Names Most 32−bit C compilers share the convention used by 16−bit compilers. as given in section 8. The leftmost parameter of the function. not all of them do: the ELF specification states that C symbols do not have a leading underscore on their assembly−language names. and typically (although this is not actually necessary. at [EBP+8]. so that the first argument specified to the function is pushed last). The parameters start after that. still applies when working in 32 bits. at successively greater 102 . 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. • The caller pushes the function’s parameters on the stack.27. and how to write position−independent code for shared libraries. about interfacing to 16−bit C programs. and NetBSD and FreeBSD.1. 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. 9. DJGPP. 9. and in particular all code running under Win32. the next doubleword. runs in flat memory model. all use the leading underscore. though. must push the previous value first. the words caller and callee are used to denote the function doing the calling and the function which gets called.Chapter 9: Writing 32−bit Code (Unix. one after another. The doubleword at [EBP] holds the previous value of EBP as it was pushed. for these compilers. The older Linux a. the caller was probably doing this too. • The caller then executes a near CALL instruction to pass control to the callee. The absence of memory models or segmentation worries simplifies things a lot. the leading underscore should not be used. or to be linked with C code generated by a Unix−style C compiler such as DJGPP. For ELF. Hence the callee. the macros cextern and cglobal. to run under Win32 or Unix. When writing flat−model application code. is accessible at this offset from EBP. if it is going to set up EBP as a frame pointer. • The callee receives control. However. It covers how to write assembly code to interface with 32−bit C routines.1. will still work. Almost all 32−bit code. in reverse order (right to left.2 Function Definitions and Function Calls The C calling convention in 32−bit programs is as follows. and that you should ignore all segment registers completely.4. However. Every address is 32 bits long and contains only an offset part. In the following description. the others follow.1 Interfacing to 32−bit C Programs A lot of the discussion in section 8. See also section 2. at [EBP+4]. Win32.out C compiler. you never need to use a segment override or modify any segment register. DJGPP or any of the PC Unix variants. holds the return address.1. since it was pushed last. so part of the calling convention states that EBP must be preserved by any C function. 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.4. 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.

segment _DATA myint mystring dd db 1234 ’This number −> %d <− should be 1234’. Thus. in that the callee clears the stack by passing a parameter to the RET instruction. There is an alternative calling convention used by Win32 programs for Windows API calls. so it typically adds an immediate constant to ESP to remove them (instead of executing a number of slow POP instructions)... This is slightly closer to the Pascal convention. mov esp. which will then be accessible at negative offsets from EBP. ‘byte’ saves space . if it wishes to return a value to the caller.offsets. Thus. However. one of my integer variables . if a function is accidentally called with the wrong number of parameters due to a prototype mismatch. the parameters are still pushed in right−to−left order.10. push push call add dword [myint] dword mystring _printf esp. does the removing. pointer into my data segment . which tells it the number and type of the remaining ones. • The callee may also wish to decrease ESP further. to call a C function from your assembly code.. the function parameters are still on the stack.esp esp. so as to allocate space on the stack for local variables. • Once the callee has finished processing. then pops the previous value of EBP. first parameter to function . which knows how many parameters it pushed.0 103 .0x40 ebx.[ebp+8] _myfunc . should leave the value in AL. AX or EAX depending on the size of the value.ebp / pop ebp At the other end of the process. you would do something like this: extern _printf . and also for functions called by the Windows API such as window procedures: they follow what Microsoft calls the __stdcall convention. you would define a function in C style in the following way: global _myfunc: push mov sub mov ebp ebp. • The callee. the stack will still be returned to a sensible state since the caller. it restores ESP from EBP if it had allocated local stack space. and returns via RET (equivalently. Floating−point results are typically returned in ST0. RETN). Thus. in a function such as printf which takes a variable number of parameters. then those data items. 64 bytes of local stack space . further down. • When the caller regains control from the callee.. the pushing of the parameters in reverse order means that the function knows where to find its first parameter. and then. some more code leave ret .byte 8 .

the names require leading underscores. a C variable declared as int i can be accessed from assembler as extern _i mov eax. this sort of feature is sometimes a configurable option in the C compiler. You can either do this by converting the C structure definition into a NASM structure definition (using STRUC). Pointers.3 Accessing Data Items To get at the contents of C variables. being 32−bit addresses. These are intended to be used for C−style procedure definitions. For example. so if a C program declares an array as int a[10]. } foo. It defines three macros: proc.1. and they automate a lot of the work involved in keeping track of the calling convention.) The sizes of the C base types in 32−bit compilers are: 1 for char.1. Typically. myint). (The byte offset 12 is obtained by multiplying the desired array index. since the int field would be aligned to a four−byte boundary. NASM gives no special alignment to structure members in its own STRUC macro. 9. you should read your C compiler’s manual to find out how it organizes data structures.4 c32. you do this (making sure you are assembling in the _DATA segment.[ebx] endproc 104 .mac: Helper Macros for the 32−bit C Interface Included in the NASM archives. so you have to specify alignment yourself if the C compiler generates it. you need to know the size of the components of the array. as stated in section 9. long and float. by the size of the array element. if necessary): _j global _j dd 0 To access a C array.[_a+12].[ebp + %$j] eax. 4 for int. you need only declare the names as GLOBAL or EXTERN. To access a C data structure. 3. An example of an assembly function using the macro set is given here: proc %$i %$j _proc32 arg arg mov mov add eax.This piece of code is the assembly equivalent of the C code int myint = 1234. might be eight bytes long rather than five. are also 4 bytes long. and 8 for double.mac of macros. is a file c32. either using command−line options or #pragma lines.1.1. int variables are four bytes long.[_i] And to declare your own integer variable which C programs can access as extern int j. you can access a[3] by coding mov ax. arg and endproc. int i. 9. (Again. so you have to find out how your own compiler does it. To do either of these. or to declare variables which C can access. in the misc directory. 4.[ebp + %$i] ebx.) Thus. you need to know the offset from the base of the structure to the field you are interested in. or by calculating the one offset and using just that. However. you might find that a structure like struct { char c. 2 for short. printf("This number −> %d <− should be 1234\n".

9. The contents of the library’s code section must therefore not depend on where it is loaded in memory.get_GOT wrt . so as long as it’s being copied it can be relocated too. NASM supports this as the aoutb output format. and since the label before the macro call gets prepended to the first line of the expanded macro.4 for a caveat). local to the context pushed by the proc macro and popped by the endproc macro.2.1 Obtaining the Address of the GOT Each code module in your shared library should define the GOT as an external symbol: extern extern _GLOBAL_OFFSET_TABLE_ __GLOBAL_OFFSET_TABLE_ . If no size is given. so that the same argument name can be used in later procedures.out object file format under Linux because it contains support for position−independent code (PIC). it has to be copied into memory anyway rather than just paged in from the library file. take a different approach by hacking PIC support into the a. So you can put ordinary types of relocation in the data section without too much worry (but see section 9. defining %$i to be an offset from BP._GLOBAL_OFFSET_TABLE_+$$−.2. the EQU works. in ELF . 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. 4 is assumed. you can obtain the address of the GOT.2 Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries ELF replaced the older a. Note that the arg macro has an EQU as the first line of its expansion.gotpc .out At the beginning of any function in your shared library which plans to access your data or BSS sections. NetBSD. A context−local variable is used. or GOT. you cannot get at your variables by writing code like this: mov eax. the function body comes here 105 .This defines _proc32 to be a procedure taking two arguments. the first (i) an integer and the second (j) a pointer to an integer. WRONG Instead. This is typically done by writing the function in this form: func: push mov push call .esp ebx . giving the size of the argument. so if you can find out where your library is loaded (which is typically done using a CALL and POP combination). which makes writing shared libraries much easier. so you can write BSD shared libraries in NASM too. since it is likely that many function parameters will be of type int or pointers. you must first calculate the address of the GOT. the linker provides an area of memory called the global offset table. Of course.. in BSD a.out format.[myvar] .get_GOT ebx ebx. It returns i + *j. and its close cousins FreeBSD and OpenBSD.get_GOT: pop add ebp ebp. 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. NASM supports the ELF position−independent code features. so you can write Linux ELF shared libraries in NASM. arg can take an optional parameter. 9. the GOT is situated at a constant distance from your library’s code. you don’t have to do that. Therefore.

they are shared between code modules in the library. using the above . adding it to EBX as above will place the real address of myvar in EAX. The way this works is like this: lea eax. without having to know in advance where the program was loaded (since the CALL instruction is encoded relative to the current position).3 Finding External and Common Data Items If your library needs to get at an external variable (external to the library.. and the fourth to last line..[ebx+myvar wrt . not just to one of the modules within it). save and restore the EBX register. don’t worry: it’s never necessary to obtain the address of the GOT by any other means._GLOBAL_OFFSET_TABLE_+$$−%%getgot wrt . so you do things the same way for both ELF and BSD. EBX contains the address of the GOT. and subtracts the value of . and the last three lines are standard C function epilogue. the special symbol assigned to the GOT) is given as an offset from the beginning of the section. The .. you can then use it to obtain the addresses of your data items. by the time that instruction has finished. you must use the . ELF encodes it as the offset from the operand field of the ADD instruction.got type.2 Finding Your Local Data Items Having got the GOT.gotoff is calculated.2. when the shared library is linked. 9. because PIC shared libraries use this register to store the address of the GOT. again.. The interesting bit is the CALL instruction and the following two lines.gotoff] The expression myvar wrt .) So the instruction then adds the beginning of the section.mov mov pop ret ebx. so you can put those three instructions into a macro and safely ignore them: %macro get_GOT 0 %%getgot ebx ebx.gotoff special WRT type. but do not get exported from the library to the program that loaded it. Therefore. Note that due to a peculiarity of the way BSD a.[ebp−4] esp.ebp ebp (For BSD. the symbol _GLOBAL_OFFSET_TABLE requires a second leading underscore. but NASM simplifies this deliberately.gotpc call %%getgot: pop add %endmacro 9. to get the real address of the GOT. there must be at least one non−local symbol in the same section as the address you’re trying to access.out format handles this relocation type. to be the offset to the local variable myvar from the beginning of the GOT.got type to get at it. If you didn’t follow that.get_GOT. With the WRT . The CALL and POP combination obtains the address of the label . Therefore. They will still be in your ordinary data and BSS sections.. they can be accessed using the . gives you the offset from the GOT base to a GOT entry containing the address 106 .gotpc qualifier specified. If you declare variables as GLOBAL without specifying a size for them.) The first two lines of this function are simply the standard C prologue to set up a stack frame. The ADD instruction makes use of one of the special PIC relocation types: GOTPC relocation. Most variables will reside in the sections you have declared.. the symbol referenced (here _GLOBAL_OFFSET_TABLE_. The third line. so you can access them in the same way as local variables. instead of giving you the offset from the GOT base to the variable.2.gotoff mechanism.. (Actually..get_GOT which it knows is in EBX.

WRONG NASM will interpret this code as an ordinary relocation.got] This loads the address of extvar out of an entry in the GOT. you would have to code global array: . declare it as a function Be careful: If you export a variable to the library user.end−array resd 128 . The linker.of the variable. 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. it has become). So you will have to access your own global variable with the .got mechanism rather than . etc. where you declared it. The linker will set up this GOT entry when it builds the library. as if it were external (which. Common variables must also be accessed in this way.. So to obtain the address of an external variable extvar in EAX.sym which makes use of the special WRT type . rather than just relocating by section base. whereas funcptr: dd my_function wrt . you can’t do it by means of the standard sort of code: dataptr: dd global_data_item . if you need to store the address of an exported global in one of your data sections. 9. by declaring it as GLOBAL and supplying a size.. effectively. you must write dataptr: dd global_data_item wrt .2. rather than in your library’s data section. And to export a data item such as an array. then. and builds the GOT so as to ensure it has every necessary entry present. and the dynamic linker will place the correct address in it at load time. This is because the dynamic linker has to build procedure linkage table entries for any exported functions.sym to instruct NASM to search the symbol table for a particular symbol at that address. you would code mov eax. collects together every relocation of type . Instead of the above code.. and if they are data.data section (or whatever)..got. you have to give the size of the data item.end: array:data array. when it builds the shared library. the variable will end up living in the data section of the main program. So to export a function to users of the library. and also moves exported data items away from the library’s data section in which they were declared.4 Exporting Symbols to the Library User If you want to export symbols to the user of the library. Equally. you must use global func: func:function push . in which global_data_item is merely an offset from the beginning of the . so this reference will end up pointing at your data section instead of at the exported global which resides elsewhere.[ebx+extvar wrt .sym 107 . you have to declare whether they are functions or data.. give the size too ebp .gotoff..

you then generate your shared library with a command such as ld −shared −o library. with a version number.1 −o library. WRT . Either address is a valid way to call the function.5 Calling Procedures Outside the Library Calling procedures outside your shared library has to be done by means of a procedure linkage table. so function calls to other shared libraries or to routines in the main program can be transparently passed off to their real destinations.so. to store the final library file name.2.plt.o # for ELF # for BSD For ELF.o files.so module1. and create library.so.o module2. Within the PLT there is code to jump to offsets contained in the GOT.plt.2 into the library directory. 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 . if your shared library is going to reside in system directories such as /usr/lib or /lib.6 Generating the Library File Having written some code modules and assembled them to .2 *. which is where the calling program will believe the function lives. so the library code can make calls to the PLT in a position−independent way. you must use another special PIC relocation type. into the library: ld −shared −soname library. 108 .so.o module2. it is usually worth using the −soname flag to the linker.so...will give the address of the procedure linkage table for the function.1. 9. or PLT. The PLT is placed at a known offset from where the library is loaded.o You would then copy library. 9.o ld −Bshareable −o library.1 as a symbolic link to it.2.1.so module1. To call an external routine.

jumping from a 32−bit segment to a 16−bit one. wrong! will not work. or jumps between different−size segments.2 Addressing Between Different−Size Segments If your OS is mixed 16 and 32−bit. The Linux kernel setup code gets round the inability of as86 to generate the required instruction by coding it manually. since each is explicitly forcing NASM into a mode it was in anyway. So you can do 109 .Chapter 10: Mixing 16 and 32 Bit Code This chapter tries to cover some of the issues. and everything after it can be pure 32−bit. such as loading the kernel. However. by means of the WORD prefix: jmp word 0x8765:0x4321 . they will be ignored. for example. In a fully 32−bit OS. or if you are writing a DOS extender. encountered when writing operating system code such as protected−mode initialisation routines. right The DWORD prefix (strictly speaking. which require code that operates in mixed segment sizes. this tends to be the only mixed−size instruction you need. you may be able to get away with using an ordinary 16−bit addressing operation for the purpose. you will want to do 32−bit addressing from 16−bit mode. If the data you are trying to access in a 32−bit segment lies within the first 64K of the segment. since it is declaring the offset field to be a doubleword. At some point. or vice versa.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. You can do the reverse operation. NASM can go one better than that. This jump must specify a 48−bit far address. jmp 0x1234:0x56789ABC . by actually generating the right instruction itself. 10. so just coding. since both are unambiguous) forces the offset part to be treated as far. it must be assembled in a 16−bit segment. using DB instructions. The easiest way to do this is to make sure you use a register for the address. but NASM will accept either form. but sooner or later. 10. or the DWORD prefix in 32−bit mode. since any effective address containing a 32−bit register is forced to be a 32−bit address. it should come after the colon. since the offset part of the address will be truncated to 0x9ABC and the jump will be an ordinary 16−bit far one. you then have to boot it by switching into protected mode and jumping to the 32−bit kernel start address. such as code in a 16−bit segment trying to modify data in a 32−bit one. since the target segment is a 32−bit one. Here’s how to do it right: jmp dword 0x1234:0x56789ABC . you will probably end up writing code in a 16−bit segment which has to access data in a 32−bit segment. in the assumption that you are deliberately writing a jump from a 16−bit segment to a 32−bit one. largely related to unusual forms of addressing and jump instructions. since everything before it can be done in pure 16−bit code. you are likely to have to deal with some 16−bit segments and some 32−bit ones. 32 to 16 bit If the WORD prefix is specified in 16−bit mode.

1. For example: call dword far [fs:word 0x4321] This instruction contains an address specified by a 16−bit offset. These instructions. since they take no parameters.offset_into_32_bit_segment_specified_by_fs dword [fs:eax]. a32 and a64 prefixes can be applied to any instruction in NASM’s instruction table.1. NASM is not fussy about whether the DWORD prefix comes before or after the segment override. To access a string in a 16−bit segment when coding in a 32−bit one. but most of them can generate all the useful forms without them. a32 or a64 prefixes to force a particular one of SP. the corresponding a16 prefix can be used. You can also specify WORD or DWORD prefixes along with the FAR prefix to indirect far jumps or calls. and XLATB. when applied to segment registers in 32−bit mode. The two can quite easily be different: mov word [dword 0x12345678]. it loads a 48−bit far pointer from that (16−bit segment and 32−bit offset). might seem to have no easy way to make them perform 32−bit addressing when assembled in a 16−bit segment. If you are coding LODSB in a 16−bit segment but it is supposed to be accessing a string in a 32−bit segment.mov mov eax.0x11223344 This is fine.0x9ABC This moves 16 bits of data to an address specified by a 32−bit offset. SCASx. LODSx. Also. you can use the operand−size prefix o16: 110 . 10. STOSx and so on) or the XLATB instruction. you should load the desired address into ESI and then code a32 lodsb The prefix forces the addressing size to 32 bits. and it will be forced to be a 32−bit address: mov dword [fs:dword my_offset]. meaning that LODSB loads from [DS:ESI] instead of [DS:SI]. The prefixes are necessary only for instructions with implicit addressing: CMPSx. in case the stack segment in use is a different size from the code segment.0x11223344 Don’t confuse the DWORD prefix outside the square brackets. with the one inside the square brackets which controls the length of the address itself. also have the slightly odd behaviour that they push and pop 4 bytes at a time. The a16.0x11223344 Also as in section 10.3 Other Mixed−Size Instructions The other way you might want to access data might be using the string instructions (LODSx. STOSx. but slightly cumbersome (since it wastes an instruction and a register) if you already know the precise offset you are aiming at. This is the purpose of NASM’s a16. INSx. of which the top two are ignored and the bottom two give the value of the segment register being manipulated. so arguably a nicer−looking way to code the above instruction is mov dword [dword fs:my_offset]. the various push and pop instructions (PUSHA and POPF as well as the more usual PUSH and POP) can accept a16. OUTSx. The x86 architecture does allow 32−bit effective addresses to specify nothing but a 4−byte offset. To force the 16−bit behaviour of segment−register push and pop instructions. ESP or RSP to be used as a stack pointer. and calls that address. As in section 10. PUSH and POP. so why shouldn’t NASM be able to generate the best instruction for the purpose? It can. MOVSx. you need only prefix the address with the DWORD keyword. a32 and a64 prefixes. which controls the size of the data stored at the address.

) 111 . (You can also use the o32 prefix to force the 32−bit behaviour when in 16−bit mode. but this seems less useful.o16 push o16 push ss 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.

respecitively: AL/AH. All 64−bit code uses a flat memory model. Position independence in 64−bit mode is significantly simpler. but of course pointers are 64 bits long. simply specify the equivalent 32−bit register. 16−. EBP. RBX. 64−bit platforms differ in the sizes of the fundamental datatypes.qword foo . ESP. 32− and 64−bit references. RDX. CX. When loading a value into a 32−bit register (but not an 8− or 16−bit register). EBX.1 Register Names in 64−bit Mode NASM uses the following names for general−purpose registers in 64−bit mode. It is possible to use those names by definiting them as macros. RSI. ESI. define them as macros. If this is not desirable. RDI. Win64) This chapter attempts to cover some of the common issues involved when writing 64−bit code. immediates and displacements are generally only 32 bits wide.imm64 NASM will produce this instruction whenever the programmer uses MOV with an immediate into a 64−bit register. additionally. CL/CH. 64−bit programming is relatively similar to 32−bit programming. SI. Furthermore. if one wants to use numeric names for the low 8 registers. the default instruction size is still 32 bits. R8D−R15D RAX.foo mov rax. EDX. It covers how to write assembly code to interface with 64−bit C routines. RSP.2 Immediates and Displacements in 64−bit Mode In 64−bit mode. not just from 32−bit platforms but from each other. since segmentation is not available in 64−bit mode. 11.1) can be used for this purpose. EDI.Chapter 11: Writing 64−bit Code (Unix. ECX. uses the names R8L−R15L for 8−bit references to the higher registers. which still add their bases. see the REL keyword (section 3. it is probably best to use the types defined in the Standard C header <inttypes. since the processor supports RIP–relative addressing directly. similarly. If a specific size data type is desired. to run under Win64 or Unix. however. BP. On most 64−bit platforms. BX. using the directive DEFAULT REL (section 6. BPL. SIL. R8W−R15W EAX. SPL. all existing platforms pass arguments in registers rather than on the stack. DX. R8B−R15B AX. or specify the immediate as DWORD: mov rax. it is probably desirable to make that the default. BL/BH. SP. The standard macro package altreg (see section 5. NASM will therefore truncate most displacements and immediates to 32 bits. DL/DH.3). DI. 11. 64−bit platforms use SSE2 by default for floating point. (identical) 112 . The Intel documentation. and how to write position−independent code for shared libraries. 64−bit immediate . The only instruction which takes a full 64−bit immediate is: MOV reg64. Please see the ABI documentation for your platform. the upper 32 bits of the corresponding 64−bit register are set to zero. R8−R15 This is consistent with the AMD documentation and most other assemblers. for 8−. DIL. In 64−bit mode. RBP. RCX.h>.2). which will be automatically zero−extended by the processor. The one exception is the FS and GS registers.

RDX. long double are passed on the stack. 64−bit absolute disp A sign−extended absolute displacement can access from –2 GB to +2 GB.4 Interfacing to 64−bit C Programs (Win64) The Win64 ABI is described at: http://msdn2. 32−bit absolute disp. and thus are available for use by the function without saving. int c) a is passed in RDI. plus RAX. 32−bit relative disp d:o. The only instructions which take a full 64−bit displacement is loading or storing.[foo] eax.3 Interfacing to 64−bit C Programs (Unix) On Unix.[foo] mov eax.com/en−gb/library/ms794533.foo mov rax. b in XMM0. and returned in ST0 and ST1.aspx What follows is a simplified summary. 11. These registers. in that order. .org/documentation/abi. Additional integer arguments are passed on the stack. respectively. R8. the concepts apply equally well for NASM−style assembly. 32−bit immediate.[abs qword foo] . a zero−extended absolute displacement can access from 0 to 4 GB. RSI. 5 and 7 bytes. Floating−point arguments are passed in XMM0 to XMM7. R10 and R11 are destroyed by function calls. The first six integer arguments (from the left) are passed in RDI.pdf Although written for AT&T−syntax assembly. 11. 32−bit immediate. and c in ESI. EAX or RAX (but no other registers) to an absolute 64−bit address. address truncated to 32 bits(!) error 64−bit absolute disp . Floating point is done using SSE registers. Since this is a relatively rarely used instruction (64−bit code generally uses relative addressing). and R9. All SSE and x87 registers are destroyed by function calls. except for long double. in that order.[a32 foo] mov eax. What follows is a simplified summary. On 64−bit Unix.x86−64.[a32 foo] eax.dword foo . so for the case of void foo(long a. zero−extended . AX. sign−extended The length of these instructions are 10.[qword foo] default rel mov mov mov mov eax. Integer return values are passed in RAX and RDX. 32−bit absolute disp. the 64−bit ABI is defined by the document: http://www. using MOV. AL.[qword foo] eax. 113 . .microsoft.mov eax. long is 64 bits. return is XMM0 and XMM1. sign−extended . Integer and SSE register arguments are counted separately. . the programmer has to explicitly declare the displacement size as QWORD: default abs mov eax. RCX. zero−extended . double b.

long long or _int64 is 64 bits. in that order. double b. so for the case of void foo(long long a. R10 and R11 are destroyed by function calls. except for long double. plus RAX. Additional integer arguments are passed on the stack. RDX. b in XMM1. R8 and R9. On Win64. return is XMM0 only. Integer return values are passed in RAX only. and thus are available for use by the function without saving. long is 32 bits. These registers. Floating−point arguments are passed in XMM0 to XMM3.The first four integer arguments are passed in RCX. and c in R8D. 114 . Floating point is done using SSE registers. Integer and SSE register arguments are counted together. int c) a is passed in RCX.

like this: ORG 0 . 12. but in fact has a more practical reason as well. some boot sector code ORG 510 DW 0xAA55 This is not the intended use of the ORG directive in NASM.1. will generate the form of the instruction which leaves room for a 32−bit offset. it’s up to the user.22. NASM reports ‘short jump out of range’ instead of making the jumps longer. code on instructions such as ADD ESP. people who are used to MASM tend to code ORG 0 . You need to code ADD ESP. This. So.1 Common Problems 12.Chapter 12: Troubleshooting This chapter describes some of the common problems that users have been known to encounter with NASM.1. 12.8. See section 2. and will not work. not the assembler. This is a deliberate design feature. Alternatively.1 NASM Generates Inefficient Code We sometimes get ‘bug’ reports about NASM generating inefficient. This isn’t a bug. so it cannot decide for itself that it should generate Jcc NEAR type instructions.BYTE 8 if you want the space−efficient form of the instruction. it could replace the out−of−range short JNE instruction with a very short JE instruction that jumps over a JMP NEAR. again. connected to predictability of output: NASM.1.8. this is a sensible solution for processors below a 386. NASM has no means of being told what type of processor the code it is generating will be run on. It also gives instructions for reporting bugs in NASM if you find a difficulty that isn’t listed here. and answers them.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. but hardly efficient on processors which have good branch prediction and could have used JNE NEAR instead.1. to decide what instructions should be generated. some boot sector code TIMES 510−($−$$) DB 0 DW 0xAA55 115 . or even ‘wrong’.2 My Jumps are Out of Range Similarly. because it doesn’t know that it’s working for a 386 or above. 12. on seeing ADD ESP. is partly a predictability issue. once again.22). The correct way to solve this problem in NASM is to use the TIMES directive.1. 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. people complain that when they issue conditional jumps (which are SHORT by default) that try to jump too far.

If you do report a bug. tell us whether you’ve compiled your own executable from the DOS source archive.) 116 . and exactly how you invoked it. or whether you were using the standard distribution binaries out of the archive. so you won’t end up with a boot sector that you have to disassemble to find out what’s wrong with it.1. Please read section 2. Win16. (If you’re compiling in an IDE. The solution. whatever. NetBSD. • If you’re running NASM under DOS or Win32. as in the previous section. and don’t report the bug if it’s listed in there as a deliberate feature. $ isn’t a pure number: it’s an offset from a section base. and the exact linker command line. please give us all of the following information: • What operating system you’re running NASM under.) Then read section 12. • Which version of NASM you’re using. Give us the precise command line. DOS.2. so they don’t exchange information unnecessarily.text section should start at 0.net/projects/nasm/ (click on "Bugs"). what version. try to reproduce the problem using one of the standard binaries. and the contents of the NASMENV environment variable if any.2 first. 12. and what command line or options you used.1. If you were using a locally built executable. even though it has been told by the ORG directive that the . but don’t just send us mail saying ‘This is a bug’ if the documentation says we did it on purpose. In consequence. but involves a section base. This will solve the problem and generate sensible code.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. So from the evaluator’s point of view. Win32. If the problem involves linking against object files generated by a compiler. (If you think the feature is badly thought out. 12.The TIMES directive will insert exactly enough zero bytes into the output to move the assembly point up to 510. just like 510. Any that you find should be reported firstly via the bugtracker at https://sourceforge. That doesn’t usually stop there being plenty we didn’t know about. is to code the TIMES line in the form TIMES 510−($−$$) DB 0 in which $ and $$ are offsets from the same section base. so the difference between them is also a pure number and can happily be fed to TIMES. Linux. and don’t bother reporting the bug if it’s listed there. though. as this will make it easier for us to reproduce your problem prior to fixing it. NASM is a modular assembler: the various component parts are designed to be easily separable for re−use. tell us what compiler. NASM will catch the problem at assembly time and report it. and so their difference is a pure number. and how you invoked them. what version of it you’ve got. tell us what linker you’re using. VMS (I’d be impressed). Therefore the difference between $ and 510 is also not a pure number. This method also has the advantage that if you accidentally fill your boot sector too full.2 Bugs We have never yet released a version of NASM with any known bugs. please try to reproduce the problem with the command−line version of the compiler. Values involving section bases cannot be passed as arguments to TIMES. the bin output format. feel free to send us reasons why you think it should be changed. does not pass that information back to the expression evaluator. If the problem only becomes visible at link time. • Which versions of any supplementary programs you’re using. or if that fails then through one of the contacts in section 1.

‘NASM generates an error message that I believe it shouldn’t be generating at all’. the problem involves NASM failing to generate an object file while TASM can generate an equivalent file without trouble. ‘the object file produced from this source code crashes my linker’. or whether the problem is related to portability issues between our development platforms and yours. 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. If this causes copyright problems (e. 117 . or what isn’t happening that should.g. Examples might be: ‘NASM generates an error message saying Line 3 for an error that’s actually on Line 5’. (Of course. • If you believe the output file from NASM to be faulty. you can only reproduce the bug in restricted−distribution code) then bear in mind the following two points: firstly.• If at all possible. we may be able to provide an FTP site you can upload the suspect files to. 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. ‘NASM fails to generate an error message that I believe it should be generating’. some errors do only crop up in large files. ‘the ninth byte of the output file is 66 and I think it should be 77 instead’. and secondly. then send us both object files.) • A description of what the problem actually is. for example. so this may not be possible. send it to us. That allows us to determine whether our own copy of NASM generates the same file. the better. we would prefer not to be mailed large chunks of code anyway. Alternatively. We can handle binary files mailed to us as MIME attachments. but mailing them is easier for us. and even BinHex. • Any other information or data files that might be helpful. and that we will delete all our copies of it as soon as we have found and fixed the bug or bugs in question. so we can see what TASM is doing differently from us. ‘It doesn’t work’ is not a helpful description! Please describe exactly what is happening that shouldn’t be. If. The smaller the file. send us a NASM source file which exhibits the problem. uuencoded.

and not make as much use of it as possible. if you are on a Unix system. and it will not understand DOS . Its argument may be expressed in any of the NASM numeric formats: decimal by default. and then contains some machine code. NDISASM. producing machine instructions wherever it can (although most of them will look bizarre. NDISASM works in 16−bit mode by default.EXE files like debug will. like objdump. which assumes by default that any file you give it is loaded at zero. NDISASM.3 for installation instructions. 32− or 64−bit code equally easily.3. The Netwide Disassembler does nothing except to produce disassemblies of binary source files. A. Two more command line options are −r which reports the version number of NDISASM you are running. so here’s a disassembler which shares the instruction table (and some other bits of code) with NASM. and generating ‘DB’ instructions ever so often if it’s totally stumped. Then it will reach the code section. rather than at zero.COM file: ndisasm −o100h filename. NDISASM does not have any understanding of object file formats. The −u switch (for USE32) also invokes 32−bit mode. e.3. 118 . ‘FS OR AX. a disassembler must assume that the first instruction in the file is loaded at address 0x100. has a man page which you may want to put somewhere useful. It seemed a shame to have an x86 assembler.1 COM Files: Specifying an Origin To disassemble a DOS . if it begins with ‘$’ or ‘0x’ or ends in ‘H’ it’s hex. A.COM file correctly. A.2 Getting Started: Installation See section 1.2 Code Following Data: Synchronisation Suppose you are disassembling a file which contains some data which isn’t machine code.g.0x240A’). A. It just disassembles. and some may have unusual prefixes.3 Running NDISASM To disassemble a file. provided of course that you remember to specify which it is to work with.1 Introduction The Netwide Disassembler is a small companion program to the Netwide Assembler. The −o option allows you to declare a different origin for the file you are disassembling. like NASM.com will do the trick. and −h which gives a short summary of command line options. if it ends in ‘Q’ it’s octal. and if it ends in ‘B’ it’s binary. NDISASM will faithfully plough through the data section. NASM. NDISASM A. will therefore need to be informed of this. Hence. you will typically use a command of the form ndisasm −b {16|32|64} filename NDISASM can disassemble 16−.Appendix A: Ndisasm The Netwide Disassembler. If no −b switch is present. complete with a full instruction table. to disassemble a .

and so you will see all the instructions in your code section. for example in the middle of one of the instructions in your code section. So it will start disassembly exactly from the sync point. 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. would be to read the JMP instruction. or indeed as many synchronisation points as you like (although NDISASM can only handle 8192 sync points internally). NDISASM may obediently place a sync point in a totally random place. Auto−sync mode automatically generates a sync point for any forward−referring PC−relative jump or call instruction that NDISASM encounters.com rather than ndisasm −o100h −s20h file. you can specify a ‘synchronisation’ point.3. it should be stressed that auto−sync mode is not guaranteed to catch all the sync points. surely.. you would have to do ndisasm −o100h −s120h file. this mechanism will automatically put sync points in all the right places. and so the sync point can’t be placed anywhere useful). Auto−sync mode doesn’t prevent you from declaring manual sync points: it just adds automatically generated ones to the ones you provide. is yes: using either of the synonymous switches −a (for automatic sync) or −i (for intelligent sync) will enable auto−sync mode. (Since NDISASM is one−pass. and then the correct first instruction in the code section will not be seen because the starting point skipped over it. starting with the final byte of the data section. and save you from having to place any sync points manually. So if you want to synchronize after 32 bytes of a . For some kinds of file.com As stated above. why should you have to specify the sync point manually? What you’d do in order to find where the sync point would be. you’ll have to use manual sync points. Another caveat with auto−sync mode is that if. This isn’t really ideal.Supposing NDISASM has just finished generating a strange machine instruction from part of the data section. if it encounters a PC−relative jump whose target has already been processed. then some data. On the other hand.3 Mixed Code and Data: Automatic (Intelligent) Synchronisation Suppose you are disassembling the boot sector of a DOS floppy (maybe it has a virus.) Only PC−relative jumps are processed. It’s entirely possible that another spurious instruction will get generated. The definition of a sync point is this: NDISASM guarantees to hit sync points exactly during disassembly. 119 . So you may end up with a wrong disassembly even if you use auto−sync. and its file position is now one byte before the beginning of the code section. just by repeating the −s option. Hence a sync point is needed. or use the −k option (documented below) to suppress disassembly of the data area. Typically. and you need to understand the virus so that you know what kinds of damage it might have done you). To avoid this. something in your data section should disassemble to a PC−relative call or jump instruction. you can specify multiple sync markers if you need to.. by some unpleasant fluke. this will contain a JMP instruction. It’s perfectly feasible to specify −i and some −s options. So can NDISASM do that for you? The answer. it will discard that instruction and output a ‘db’ instead. not the file position. So there is a very good chance of NDISASM being misaligned when the data ends and the code begins. and you may still have to place some manually. there isn’t much I can do about this. there isn’t much it can do about it. A.COM file. then the rest of the code. If it is thinking about generating an instruction which would cause it to jump over a sync point. of course. Again. Sync points are specified using the −s option: they are measured in terms of the program origin. and then to use its target address as a sync point. If you have problems. However.

4 Bugs and Improvements There are no known bugs. with patches if possible. should be sent to nasm−bugs@lists.3.net/projects/nasm/ and we’ll try to fix them. disassembly will start at byte 10 in the file. A. and this will be given offset 10. However. 120 . This means that the header is not counted towards the disassembly offset: if you give −e10 −o10.sourceforge.net.4 Other Options The −e option skips a header on the file. The −k option is provided with two comma−separated numeric arguments. Feel free to send contributions and new features as well.A. by ignoring the first N bytes. any you find. 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. the first of which is an assembly offset and the second is a number of bytes to skip. or to the developer’s site at https://sourceforge. not 20.

reg32 reg64.1.reg16 mem.reg64 rm16.reg8 reg8..Appendix B: Instruction List B. The third column shows the processor type in which the instruction was introduced and.mem reg32.2 Conventional instructions AAA AAD AAD AAM AAM AAS ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC 8086..NOLONG 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 imm imm mem.NOLONG 8086.reg64 reg8.reg8 mem.NOLONG 8086. For each instruction.NOLONG 8086.NOLONG 8086.reg8 reg16. B.reg64 reg64.reg16 reg32.1.reg32 reg32.reg16 reg16.mem reg8.1 Special instructions. when appropriate.imm8 121 . one or more usage flags.1 Introduction The following sections show the instructions which NASM currently supports.mem reg16. DB DW DD DQ DT DO DY RESB RESW RESD RESQ REST RESO RESY imm 8086 B.mem reg64. there is a separate entry for each supported addressing mode.NOLONG 8086.reg32 mem.

imm rm64.reg16 reg16.imm32 mem.reg8 mem.ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD ADD AND AND AND AND rm32.imm rm8.imm8 rm64.reg32 reg64.reg16 reg16.imm reg_ax.reg32 mem.reg32 reg32.imm8 mem.imm rm32.imm8 rm32.imm8 mem.reg64 reg8.mem reg32.imm rm8.imm mem.imm16 mem.imm32 mem.reg16 reg32.imm8 reg_al.imm16 mem.reg16 mem.reg64 rm16.reg8 reg8.imm8 rm64.sbyte32 reg_eax.mem reg64.imm rm32.imm8 reg_al.reg8 reg8.imm reg_eax.reg16 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 8086 8086 8086 8086 122 .imm rm16.reg8 reg16.imm reg_rax.sbyte32 reg_eax.mem reg16.sbyte16 reg_ax.imm reg_rax.reg8 mem.sbyte64 reg_rax.imm rm64.imm rm16.sbyte64 reg_rax.imm reg_eax.reg64 reg64.sbyte16 reg_ax.imm reg_ax.mem reg8.imm mem.

reg64 reg32 reg64 mem.mem reg16.reg8 reg16.imm rm8.reg64 reg64.mem reg32.reg16 reg16.reg16 reg32.mem reg16.imm reg_ax.AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND ARPL ARPL BB0_RESET BB1_RESET BOUND BOUND BSF BSF BSF BSF BSF BSF BSR BSR BSR BSR BSR BSR BSWAP BSWAP BT BT BT BT mem.reg16 mem.reg16 reg32.reg16 reg16.mem reg64.imm reg_rax.ND 186.imm16 mem.mem reg64.mem reg8.mem reg64.sbyte64 reg_rax.PROT.mem reg16.NOLONG PENT.imm rm32.reg64 reg8.imm8 rm32.mem reg32.sbyte16 reg_ax.imm rm16.NOLONG 386 386 386 386 X64 X64 386 386 386 386 X64 X64 486 X64 386 386 386 386 123 .imm8 rm64.CYRIX.reg32 mem.imm32 mem.ND PENT.CYRIX.reg32 reg64.reg64 reg16.reg64 rm16.imm reg_eax.reg16 reg32.PROT.reg32 reg32.NOLONG 286.NOLONG 386.reg16 reg16.reg32 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 286.mem reg32.reg32 reg32.mem reg32.reg32 reg64.sbyte32 reg_eax.imm mem.imm rm64.imm8 mem.mem reg16.reg32 reg64.imm8 reg_al.

reg64 rm16.NOLONG 8086 8086 8086.reg32 reg32.imm mem.NOLONG 8086.reg64 rm16.reg16 reg16.imm rm32.reg16 reg16.imm rm64.NOLONG 8086.imm rm32.reg64 reg64.reg32 reg32.NOLONG 8086.imm rm64.ND.reg64 reg64.NOLONG X64 8086 386 X64 8086 8086 124 .NOLONG 386.imm rm32.imm rm32.imm imm imm|near imm|far imm16 imm16|near imm16|far imm32 imm32|near imm32|far imm:imm imm16:imm imm:imm16 imm32:imm imm:imm32 mem|far mem|far mem16|far mem32|far mem64|far mem|near mem16|near X64 X64 386 386 X64 386 386 386 386 X64 X64 386 386 X64 386 386 386 386 X64 X64 386 386 X64 386 386 386 386 X64 X64 386 386 X64 8086 8086 8086.reg64 reg64.reg64 rm16.reg32 mem.NOLONG 8086.reg64 reg64.imm mem.ND.reg16 reg16.NOLONG 386.imm mem.reg32 mem.reg16 mem.NOLONG 386 386 386.imm rm64.reg32 mem.ND.reg32 reg32.BT BT BT BT BT BTC BTC BTC BTC BTC BTC BTC BTC BTC BTR BTR BTR BTR BTR BTR BTR BTR BTR BTS BTS BTS BTS BTS BTS BTS BTS BTS CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL CALL mem.reg64 rm16.imm rm64.reg16 mem.reg16 mem.

mem reg8.reg8 mem.CALL CALL CALL CALL CALL CALL CALL CALL CALL CBW CDQ CDQE CLC CLD CLGI CLI CLTS CMC CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMP CMPSB CMPSD mem32|near mem64|near reg16 reg32 reg64 mem mem16 mem32 mem64 mem.mem reg32.imm8 mem.reg64 rm16.sbyte16 reg_ax.reg16 reg32.imm reg_eax.NOLONG X64 8086 8086 386.imm rm16.AMD 8086 286.imm reg_ax.imm reg_rax.imm32 386.imm16 mem.imm rm8.imm mem.reg32 reg64.imm8 rm64.NOLONG X64 8086 386 X64 8086 8086 X64.sbyte64 reg_rax.imm rm64.imm8 reg_al.reg32 mem.reg16 mem.mem reg16.NOLONG X64 8086 386.PRIV 8086 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 8086 386 125 .reg64 reg64.reg8 reg8.sbyte32 reg_eax.reg8 reg16.mem reg64.reg16 reg16.imm rm32.reg32 reg32.imm8 rm32.reg64 reg8.

CYRIX X64 8086 386 8086.NOLONG 8086 8086 386 X64 8086 8086 386 X64 P6.NOLONG 8086.ND 486.ND 486.reg32 mem.FPU 8086.reg32 reg32.FPU 8086.FPU 8086.reg64 mem.reg16 mem.reg8 mem.ND 486.fpu0 fpu0.reg32 reg32.FPU.fpu0 X64 8086 PENT PENT PENT PENT PENT PENT X64 X64 486.FPU 8086.UNDOC.ND 486.MMX 186 8086 8086 8086.reg16 reg16.ND PENT X64 PENT PENT.fpureg fpureg fpureg.NOLONG 386.FPU 8086.reg8 reg8.imm imm imm:imm mem32 mem64 fpureg|to fpureg fpureg.CYRIX PENT.reg32 mem mem reg16 reg32 rm8 rm16 rm32 rm64 rm8 rm16 rm32 rm64 imm.UNDOC.ND 8086.reg16 reg16.ND 126 .UNDOC.UNDOC.FPU 8086.FPU 8086.NOLONG 8086.FPU 8086.ND 486.FPU 8086.reg16 mem.reg64 reg64.UNDOC.reg8 mem.CMPSQ CMPSW CMPXCHG CMPXCHG CMPXCHG CMPXCHG CMPXCHG CMPXCHG CMPXCHG CMPXCHG CMPXCHG486 CMPXCHG486 CMPXCHG486 CMPXCHG486 CMPXCHG486 CMPXCHG486 CMPXCHG8B CMPXCHG16B CPUID CPU_READ CPU_WRITE CQO CWD CWDE DAA DAS DEC DEC DEC DEC DEC DEC DIV DIV DIV DIV DMINT EMMS ENTER EQU EQU F2XM1 FABS FADD FADD FADD FADD FADD FADD FADD FADDP FADDP FADDP mem.UNDOC.FPU 8086.reg8 reg8.CYRIX PENT.FPU.

FPU P6.FPU 8086.FPU.FPU P6.fpureg fpureg fpu0.FPU P6.FPU.fpureg fpureg fpu0.FPU P6.fpureg mem32 mem64 fpureg fpu0.ND 8086.FPU 8086.FPU P6.FPU P6.FPU.FPU 8086.FPU.ND P6.FPU 8086.FPU.fpureg mem32 mem64 fpureg|to 8086.FPU 127 .FPU.FPU 8086.FPU 8086.FPU 8086.fpureg fpureg fpu0.ND 8086.FPU 8086.ND P6.FPU 8086.ND P6.FPU 8086.ND P6.FPU P6.FPU 8086.ND 8086.FPU P6.FPU.fpureg fpureg fpu0.FPU 8086.FPU.FPU 8086.FPU P6.FPU P6.fpureg mem32 mem64 fpureg fpu0.fpureg fpureg fpu0.FPU 8086.FPU.FPU.FPU P6.FPU P6.FPU P6.FPU P6.FPU 8086.FPU P6.FPU P6.FPU.FPU P6.FPU 8086.FPU P6.FBLD FBLD FBSTP FBSTP FCHS FCLEX FCMOVB FCMOVB FCMOVB FCMOVBE FCMOVBE FCMOVBE FCMOVE FCMOVE FCMOVE FCMOVNB FCMOVNB FCMOVNB FCMOVNBE FCMOVNBE FCMOVNBE FCMOVNE FCMOVNE FCMOVNE FCMOVNU FCMOVNU FCMOVNU FCMOVU FCMOVU FCMOVU FCOM FCOM FCOM FCOM FCOM FCOMI FCOMI FCOMI FCOMIP FCOMIP FCOMIP FCOMP FCOMP FCOMP FCOMP FCOMP FCOMPP FCOS FDECSTP FDISI FDIV FDIV FDIV mem80 mem mem80 mem fpureg fpu0.FPU 386.FPU 8086.fpureg fpureg fpu0.fpureg fpureg fpu0.fpureg fpureg fpu0.FPU P6.ND P6.ND P6.FPU 8086.fpureg fpureg fpu0.ND P6.FPU P6.FPU P6.FPU.ND P6.ND P6.

FPU 8086.FPU 8086.fpu0 mem32 mem64 fpureg|to fpureg.FPU 8086.fpu0 fpureg fpu0.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FDIV FDIV FDIV FDIV FDIVP FDIVP FDIVP FDIVR FDIVR FDIVR FDIVR FDIVR FDIVR FDIVR FDIVRP FDIVRP FDIVRP FEMMS FENI FFREE FFREE FFREEP FFREEP FIADD FIADD FICOM FICOM FICOMP FICOMP FIDIV FIDIV FIDIVR FIDIVR FILD FILD FILD FIMUL FIMUL FINCSTP FINIT FIST FIST FISTP FISTP FISTP FISTTP FISTTP FISTTP FISUB FISUB FISUBR FISUBR FLD fpureg fpureg.FPU 8086.FPU PRESCOTT.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU.fpu0 fpureg fpureg mem32 mem16 mem32 mem16 mem32 mem16 mem32 mem16 mem32 mem16 mem32 mem16 mem64 mem32 mem16 mem32 mem16 mem32 mem16 mem64 mem16 mem32 mem64 mem32 mem16 mem32 mem16 mem32 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.ND 8086.FPU.FPU 128 .FPU 8086.FPU.FPU 8086.FPU 8086.ND PENT.UNDOC 8086.fpureg fpureg fpureg.FPU 8086.fpureg fpureg fpureg.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU PRESCOTT.FPU.FPU.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU.FPU 8086.fpu0 fpu0.FPU 8086.3DNOW 8086.UNDOC 286.ND 8086.FPU 8086.FPU 8086.ND 8086.FPU PRESCOTT.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 286.

FPU.FPU 8086.SW 8086.SW 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU.ND 8086.FPU 8086.FPU 286.FPU 8086.FPU 8086.FPU 386.FPU 8086.FPU 8086.ND 8086.FPU 8086.SW 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU.fpu0 mem mem mem mem reg_ax mem mem mem32 mem64 fpureg mem mem mem32 mem64 8086.FPU.FPU 8086.FPU 8086.FPU 8086.FPU.FPU 8086.FPU 8086.ND 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 129 .fpureg fpureg fpureg.FPU.FPU 8086.FLD FLD FLD FLD FLD1 FLDCW FLDENV FLDL2E FLDL2T FLDLG2 FLDLN2 FLDPI FLDZ FMUL FMUL FMUL FMUL FMUL FMUL FMUL FMULP FMULP FMULP FNCLEX FNDISI FNENI FNINIT FNOP FNSAVE FNSTCW FNSTENV FNSTSW FNSTSW FPATAN FPREM FPREM1 FPTAN FRNDINT FRSTOR FSAVE FSCALE FSETPM FSIN FSINCOS FSQRT FST FST FST FST FSTCW FSTENV FSTP FSTP mem64 mem80 fpureg mem mem mem32 mem64 fpureg|to fpureg.FPU 8086.FPU.FPU 8086.SW 286.FPU 8086.FPU 8086.FPU 8086.fpu0 fpureg fpu0.FPU 8086.ND 8086.FPU 386.FPU.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 8086.FPU 386.

FPU 8086.FPU 8086.ND 8086.UNDOC.FPU 386.FPU 8086.FPU 8086.UNDOC.UNDOC.fpu0 mem32 mem64 fpureg|to fpureg.FPU 8086.ND 8086.FPU 386.FPU 8086.FPU 8086.FPU.FPU P6.ND 130 .ND 8086.FPU 8086.FPU 386.fpu0 fpu0.PRIV 386.fpureg fpureg fpu0.fpureg fpureg fpu0.ND 386.reg32 reg32.FPU P6.FPU 8086.ND 386.FPU 8086.FPU 8086.FPU 8086.FPU.ND 386.fpureg fpureg fpu0.FPU 8086.FPU 8086.FPU 8086.ND P6.reg32 8086.FPU 8086.FPU 8086.ND 386.FPU P6.FPU 8086.FPU 8086.FPU P6.FPU 8086.FSTP FSTP FSTP FSTSW FSTSW FSUB FSUB FSUB FSUB FSUB FSUB FSUB FSUBP FSUBP FSUBP FSUBR FSUBR FSUBR FSUBR FSUBR FSUBR FSUBR FSUBRP FSUBRP FSUBRP FTST FUCOM FUCOM FUCOM FUCOMI FUCOMI FUCOMI FUCOMIP FUCOMIP FUCOMIP FUCOMP FUCOMP FUCOMP FUCOMPP FXAM FXCH FXCH FXCH FXCH FXTRACT FYL2X FYL2XP1 HLT IBTS IBTS IBTS IBTS ICEBP mem80 fpureg mem reg_ax mem32 mem64 fpureg|to fpureg.FPU.FPU.FPU 8086.ND 8086.FPU 8086.FPU 386.fpureg fpureg fpureg.SW 286.FPU 386.fpureg fpureg fpureg.ND 386.reg16 mem.FPU.SD.SW.fpu0 fpureg fpu0.FPU.FPU 8086.ND 386.fpu0 fpureg fpu0.FPU 8086.ND P6.FPU.reg16 reg16.FPU.FPU 8086.fpureg mem.ND 8086.FPU.ND 8086.FPU.UNDOC.fpureg fpureg fpureg.fpu0 fpureg fpu0.FPU 8086.FPU 8086.FPU.

sbyte32 reg16.reg32.reg64 reg16.ND X64 X64.reg64.mem.mem reg32.IDIV IDIV IDIV IDIV IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IMUL IN IN IN rm8 rm16 rm32 rm64 rm8 rm16 rm32 rm64 reg16.ND 386 386.ND 186 186.imm reg_eax.imm reg32.mem.imm8 reg32.ND 186 186.reg16.reg32.imm reg32.sbyte32 reg32.imm reg16.sbyte16 reg16.imm16 reg16.ND 386 386.reg16.reg16.ND 386 386.imm32 reg64.imm reg_al.ND 386 386.imm8 reg64.reg16.imm8 reg16.mem.ND 186 186.ND X64 X64.sbyte16 reg16.reg32.mem reg16.mem.ND X64 X64.imm32 reg64.mem.imm reg64.imm reg16.ND X64 X64.mem.mem reg64.imm32 reg64.reg16 reg32.imm16 reg16.imm reg64.ND 386 386.imm8 reg64.imm8 reg64.sbyte64 reg32.imm16 reg16.imm32 reg32.imm reg64.imm8 reg32.reg64.mem.reg64.imm8 reg16.ND 186 186.sbyte64 reg64.imm reg32.imm32 reg32.ND 386 386.imm8 reg16.reg32 reg64.mem.sbyte32 reg64.ND 186 186.mem.ND X64 X64.imm32 reg32.reg32.ND 8086 8086 386 131 .imm8 reg32.sbyte16 reg32.imm 8086 8086 386 X64 8086 8086 386 X64 386 386 386 386 X64 X64 186 186.reg64.sbyte64 reg64.mem.imm reg_ax.mem.mem.ND X64 X64.

NOLONG 8086.reg_dx reg_ax.NOLONG 386.AMD 8086 386 X64 8086 8086.reg_ecx reg_eax.NOLONG 486.ND 386 8086.NOLONG X86_64.reg_ecx reg_rax.NOLONG 386 X64 8086 8086.NOLONG 8086 8086.AMD X86_64.NOLONG 8086 8086 386 X64 186 386 186 8086 386.AMD X64.ND 8086.IN IN IN INC INC INC INC INC INC INCBIN INSB INSD INSW INT INT01 INT1 INT03 INT3 INTO INVD INVLPG INVLPGA INVLPGA INVLPGA INVLPGA IRET IRETD IRETQ IRETW JCXZ JECXZ JRCXZ JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP reg_al.AMD.ND.PRIV 486.reg_dx reg16 reg32 rm8 rm16 rm32 rm64 8086 8086 386 8086.NOLONG X64 8086 386 X64 imm mem reg_ax.ND 8086 8086.NOLONG 386.PRIV X86_64.NOLONG 8086.NOLONG 8086.NOLONG 386 386.ND 386.ND 8086 8086.NOLONG 8086.ND.ND.NOLONG 386.reg_dx reg_eax.reg_ecx imm imm imm imm|short imm imm imm|near imm|far imm16 imm16|near imm16|far imm32 imm32|near imm32|far imm:imm imm16:imm imm:imm16 imm32:imm imm:imm32 mem|far mem|far mem16|far mem32|far mem64|far 132 .ND 8086.

PROT.PRIV 386 386 286.PROT.PROT.mem reg32.JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMP JMPE JMPE JMPE JMPE JMPE LAHF LAR LAR LAR LAR LAR LAR LAR LAR LAR LAR LAR LAR LDS LDS LEA LEA LEA LEAVE LES LES LFENCE LFS LFS LGDT LGS LGS LIDT LLDT LLDT LLDT LMSW LMSW LMSW LOADALL LOADALL286 LODSB mem|near mem16|near mem32|near mem64|near reg16 reg32 reg64 mem mem16 mem32 mem64 imm imm16 imm32 rm16 rm32 reg16.reg16 reg16.PROT X64.ND 386.PROT 386.mem mem reg16.mem mem mem mem16 reg16 mem mem16 reg16 8086 8086 386.AMD 386 386 286.PROT.NOLONG 8086 386 X64 186 8086.reg64 reg64.PRIV 286.reg32 reg32.mem reg32.NOLONG X64 8086 386.mem reg16.mem reg32.PROT X64.SW X64.NOLONG X64 8086 8086 386.PROT.mem reg64.mem reg64.NOLONG X64.PROT.mem reg32.mem reg32.PRIV 286.PRIV 286.mem reg16.PROT.UNDOC 286.PROT X64.reg64 reg32.mem reg32.NOLONG 386.SW 286.ND X64.mem reg16.SW 386.mem reg16.PROT.PROT X64.UNDOC 8086 133 .PRIV 286.reg32 reg16.reg32 reg64.PRIV 286.reg16 reg32.reg16 reg64.NOLONG X64 IA64 IA64 IA64 IA64 IA64 8086 286.PRIV 386.NOLONG 386.PROT 386.PROT 8086.reg64 reg16.PRIV 286.

reg16 reg_sreg.reg32 reg32.reg_rcx imm imm.reg64 reg32.PROT X64.LODSD LODSQ LODSW LOOP LOOP LOOP LOOP LOOPE LOOPE LOOPE LOOPE LOOPNE LOOPNE LOOPNE LOOPNE LOOPNZ LOOPNZ LOOPNZ LOOPNZ LOOPZ LOOPZ LOOPZ LOOPZ LSL LSL LSL LSL LSL LSL LSL LSL LSL LSL LSL LSL LSS LSS LTR LTR LTR MFENCE MONITOR MONITOR MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV imm imm.PROT.NOLONG 386 X64 286.reg_rcx imm imm.SW 286.reg32 reg64.reg_cx imm.PRIV 286.mem reg32.PRIV X64.PROT.NOLONG 386 X64 8086 8086.PROT.NOLONG 386 X64 8086 8086.reg16 reg32.NOLONG 386 X64 8086 8086.reg_cx imm.AMD PRESCOTT PRESCOTT.reg_ecx imm.reg_ecx imm.PROT.reg_sreg reg16.mem_offs 386 X64 8086 8086 8086.PROT.PROT X64.PROT 386 386 286.reg_ecx imm.NOLONG 386 X64 8086 8086.reg_ecx imm.PROT X64.reg64 reg64.PROT.mem_offs reg_ax.reg32 reg_al.SW X64.PROT X64.PROT 386.mem_offs reg_rax.mem reg_sreg.SW 386.reg_rcx reg16.reg64 reg16.ND X64.reg_cx imm.PROT.reg16 reg64.mem reg32.ND 386.mem reg16.reg_rcx imm imm.mem mem mem16 reg16 reg_eax.reg_ecx.mem reg64.reg_sreg reg_sreg.mem_offs reg_eax.reg_sreg reg32.PRIV 286.reg_ecx imm.reg_cx imm.ND 8086 8086 386 8086 8086 386 8086 8086 386 X64 134 .reg32 reg16.PROT.reg_cx imm.reg_rcx imm imm.PROT 386.reg16 reg16.reg_edx mem.

PRIV.MMX.SD PENT.reg32 reg_dreg.mem mmxreg.SSE PENT.reg64 reg8.SD X64 X64.ND 386.SD PENT.reg8 reg8.reg16 mem.mem reg64.reg_ax mem_offs.reg64 reg8.PRIV.reg_al mem_offs.MMX X64.PRIV 386.xmmreg mmxreg.PRIV 386.reg16 reg32.reg_dreg reg64.reg_rax reg32.NOLONG.reg64 reg32.reg32 mem.mmxreg xmmreg.reg_dreg reg_dreg.imm reg64.PRIV.reg32 reg_creg.reg_eax mem_offs.reg_creg reg_creg.mmxreg reg32.reg32 mem.reg_treg reg_treg.imm rm64.PRIV.imm16 mem.imm32 mmxreg.reg32 mem.NOLONG X64.mem reg16.MMX X64.imm mem.MMX PENT.reg16 reg16.ND 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 X64 8086 8086 386 X64 8086 8086 386 PENT.reg8 mem.imm reg64.imm rm16.reg32 reg64.imm rm32.imm reg16.reg64 reg32.SD X64.MMX 135 .imm32 rm8.PRIV 386.reg_creg reg64.reg8 reg16.MMX.mmxreg mmxreg.PRIV 386.MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOVD MOVD MOVD MOVD MOVD MOVD MOVD MOVD MOVQ MOVQ MOVQ mem_offs.reg64 reg64.NOLONG X64.MMX PENT.mem reg8.mem xmmreg.reg32 reg32.reg32 mem.mmxrm mmxrm.imm reg32.imm8 mem.NOLONG.NOLONG X64.rm64 8086 8086 386 X64 386.mem reg32.NOLONG X64.xmmreg reg32.

reg64 reg64.reg64 reg8.reg16 mem.rm8 reg64.reg8 reg8.MOVQ MOVSB MOVSD MOVSQ MOVSW MOVSX MOVSX MOVSX MOVSX MOVSX MOVSX MOVSXD MOVSX MOVZX MOVZX MOVZX MOVZX MOVZX MOVZX MUL MUL MUL MUL MWAIT MWAIT NEG NEG NEG NEG NOP NOP NOP NOP NOT NOT NOT NOT OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR rm64.rm32 reg16.reg8 reg16.ND 8086 8086 386 X64 8086 P6 P6 X64 8086 8086 386 X64 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 136 .reg64 X64.rm8 reg32.reg32 mem.rm32 reg64.reg32 reg64.rm16 reg64.mem reg16.mem reg16.mem reg16.rm16 reg64.rm16 reg64.reg8 reg32.mem reg32.reg16 reg32.mmxreg reg16.rm8 reg32.reg32 reg32.rm16 rm8 rm16 rm32 rm64 reg_eax.reg_ecx rm8 rm16 rm32 rm64 rm16 rm32 rm64 rm8 rm16 rm32 rm64 mem.MMX 8086 386 X64 8086 386 386 386 386 X64 X64 X64 X64.ND 386 386 386 386 X64 X64 8086 8086 386 X64 PRESCOTT PRESCOTT.reg8 reg32.reg16 reg16.reg8 mem.mem reg64.rm8 reg64.mem reg8.

imm8 reg_al.mmxrm mmxreg.mmxrm mmxreg.MMX.CYRIX PENT.mmxrm mmxreg.MMX PENT.MMX PENT.reg_eax reg_dx.mmxrm mmxreg.reg_al reg_dx.mmxrm mmxreg.reg_ax reg_dx.MMX PENT.MMX PENT.OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OUT OUT OUT OUT OUT OUT OUTSB OUTSD OUTSW PACKSSDW PACKSSWB PACKUSWB PADDB PADDD PADDSB PADDSIW PADDSW PADDUSB PADDUSW PADDW PAND PANDN PAUSE PAVEB PAVGUSB PCMPEQB PCMPEQD PCMPEQW PCMPGTB PCMPGTD PCMPGTW PDISTIB PF2ID PFACC PFADD PFCMPEQ rm16.MMX PENT.MMX.MMX PENT.3DNOW PENT.mmxrm mmxreg.mmxrm mmxreg.mmxrm mmxreg.imm rm32.imm mem.CYRIX PENT.mmxrm mmxreg.sbyte32 reg_eax.imm8 mem.MMX PENT.imm8 rm32.MMX.mmxrm 8086 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 8086 8086 386 8086 8086 386 186 386 186 PENT.imm32 imm.mmxrm mmxreg.sbyte64 reg_rax.CYRIX PENT.3DNOW PENT.mmxrm mmxreg.reg_eax mmxreg.MMX PENT.MMX PENT.MMX PENT.MMX PENT.imm rm8.mmxrm mmxreg.mmxrm mmxreg.mmxrm mmxreg.mmxrm mmxreg.MMX PENT.MMX 8086 PENT.mmxrm mmxreg.mem mmxreg.mmxrm mmxreg.reg_ax imm.MMX PENT.imm rm16.MMX PENT.3DNOW PENT.3DNOW PENT.imm reg_rax.MMX PENT.mmxrm mmxreg.reg_al imm.sbyte16 reg_ax.mmxrm mmxreg.mmxrm mmxreg.imm reg_ax.mmxrm mmxreg.MMX PENT.imm reg_eax.mmxrm mmxreg.mmxrm mmxreg.imm8 rm64.3DNOW 137 .imm rm64.MMX PENT.mmxrm mmxreg.imm16 mem.

mmxrm mmxreg.3DNOW PENT.MMX.MMX PENT.CYRIX PENT.MMX PENT.3DNOW PENT.imm mmxreg.UNDOC.MMX PENT.NOLONG 386.mmxrm mmxreg.NOLONG 186.mmxrm mmxreg.MMX.MMX PENT.MMX PENT.mmxrm mmxreg.mmxrm mmxreg.CYRIX 8086 386.3DNOW PENT.3DNOW PENT.mmxrm mmxreg.NOLONG 8086 386.mmxrm mmxreg.mmxrm mmxreg.imm mmxreg.mem mmxreg.NOLONG X64 8086 386.NOLONG 386 186.PFCMPGE PFCMPGT PFMAX PFMIN PFMUL PFRCP PFRCPIT1 PFRCPIT2 PFRSQIT1 PFRSQRT PFSUB PFSUBR PI2FD PMACHRIW PMADDWD PMAGW PMULHRIW PMULHRWA PMULHRWC PMULHW PMULLW PMVGEZB PMVLZB PMVNZB PMVZB POP POP POP POP POP POP POP POP POP POPA POPAD POPAW POPF POPFD POPFQ POPFW POR PREFETCH PREFETCHW PSLLD PSLLD PSLLQ PSLLQ PSLLW PSLLW PSRAD PSRAD PSRAW mmxreg.CYRIX PENT.mmxrm mmxreg.3DNOW PENT.mmxrm PENT.mmxrm mmxreg.MMX PENT.MMX.mmxrm mmxreg.mmxrm mmxreg.CYRIX PENT.mem reg16 reg32 reg64 rm16 rm32 rm64 reg_cs reg_dess reg_fsgs mmxreg.3DNOW PENT.ND 8086.MMX PENT.mmxrm mmxreg.3DNOW PENT.mem mmxreg.MMX.MMX.CYRIX PENT.3DNOW PENT.mmxrm mmxreg.imm mmxreg.MMX PENT.mem mmxreg.CYRIX PENT.3DNOW PENT.3DNOW PENT.3DNOW PENT.MMX.mmxrm mmxreg.mmxrm mmxreg.mmxrm mmxreg.CYRIX PENT.MMX PENT.mmxrm mmxreg.3DNOW PENT.MMX.3DNOW PENT.NOLONG X64 8086 PENT.mmxrm mmxreg.3DNOW PENT.mmxrm mmxreg.mmxrm mem mem mmxreg.mmxrm mmxreg.MMX.mem mmxreg.MMX PENT.mmxrm mmxreg.MMX PENT.3DNOW PENT.mmxrm mmxreg.NOLONG X64 8086.CYRIX PENT.mmxrm mmxreg.MMX 138 .imm mmxreg.3DNOW PENT.MMX PENT.

mmxrm mmxreg.NOLONG 386.imm rm32.mmxrm mmxreg.mmxrm mmxreg.MMX PENT.AR0.mmxrm reg16 reg32 reg64 rm16 rm32 rm64 reg_cs reg_dess reg_fsgs imm8 imm16 imm32 imm32 imm64 mmxreg.mmxrm rm8.unity rm8.MMX PENT.mmxrm mmxreg.NOLONG 386 186 186.mmxrm mmxreg.mmxrm mmxreg.mmxrm mmxreg.imm mmxreg.NOLONG X64 8086 386.mmxrm mmxreg.MMX PENT.NOLONG 186.AR0.unity PENT.imm rm64.MMX PENT.reg_cl rm32.mmxrm mmxreg.MMX PENT.MMX.AR0.MMX PENT.NOLONG X64 8086.MMX PENT.MMX PENT.unity rm16.NOLONG.mmxrm mmxreg.mmxrm mmxreg.NOLONG 8086.MMX PENT.mmxrm mmxreg.MMX PENT.NOLONG X64 8086 PENT.mmxrm mmxreg.SD X64.mmxrm mmxreg.unity rm32.imm rm16.imm mmxreg.reg_cl rm8.MMX PENT.MMX PENT.MMX 8086 8086 186 8086 8086 186 386 386 386 X64 139 .MMX PENT.SZ 386.MMX 8086 386.NOLONG 8086 386.mmxrm mmxreg.PSRAW PSRLD PSRLD PSRLQ PSRLQ PSRLW PSRLW PSUBB PSUBD PSUBSB PSUBSIW PSUBSW PSUBUSB PSUBUSW PSUBW PUNPCKHBW PUNPCKHDQ PUNPCKHWD PUNPCKLBW PUNPCKLDQ PUNPCKLWD PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSHA PUSHAD PUSHAW PUSHF PUSHFD PUSHFQ PUSHFW PXOR RCL RCL RCL RCL RCL RCL RCL RCL RCL RCL mmxreg.reg_cl rm16.imm mmxreg.SZ 186.NOLONG.CYRIX PENT.imm mmxreg.MMX PENT.MMX PENT.mmxrm mmxreg.MMX PENT.MMX PENT.MMX PENT.MMX PENT.SZ 386.

SW 8086 8086.reg_cl rm64.imm rm8.reg_cl rm64.imm rm64.imm rm32.reg_cl rm32.imm rm8.unity rm16.mem80 mem80 X64 X64 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 P6.imm reg_sreg.reg_cl rm32.reg_cl rm16.CYRIX.imm rm64.unity rm32.unity rm32.unity rm8.unity rm16.reg_cl rm8.reg_cl rm64.CYRIXM PENT.RCL RCL RCR RCR RCR RCR RCR RCR RCR RCR RCR RCR RCR RCR RDSHR RDMSR RDPMC RDTSC RDTSCP RET RET RETF RETF RETN RETN ROL ROL ROL ROL ROL ROL ROL ROL ROL ROL ROL ROL ROR ROR ROR ROR ROR ROR ROR ROR ROR ROR ROR ROR RDM RSDC RSLDT RSM rm64.reg_cl rm8.SW 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 P6.reg_cl rm16.imm rm64.unity rm16.imm rm16.imm rm32.unity rm64.unity rm64.reg_cl rm32.SW 8086 8086.PRIV P6 PENT X86_64 8086 8086.reg_cl rm64.imm rm16.CYRIXM PENTM 140 .reg_cl rm8.CYRIXM 486.unity rm8.ND 486.imm rm32 imm imm imm rm8.unity rm8.imm rm16.unity rm64.unity rm32.imm rm32.reg_cl rm16.

sbyte64 reg_rax.imm reg_eax.imm rm16.reg_cl rm32.reg8 reg8.unity rm32.mem reg16.imm rm64.imm rm8.unity rm16.mem reg64.reg_cl rm16.reg_cl rm8.ND 186.ND 8086.reg_cl rm64.reg_cl rm16.imm8 rm64.imm8 rm32.unity rm16.mem reg8.ND 186.unity rm64.imm rm32.imm rm16.ND 8086.reg16 mem.ND X64.imm8 reg_al.imm rm32.ND 8086.imm mem.reg64 reg64.unity rm8.ND X64.reg8 reg16.RSTS SAHF SAL SAL SAL SAL SAL SAL SAL SAL SAL SAL SAL SAL SALC SAR SAR SAR SAR SAR SAR SAR SAR SAR SAR SAR SAR SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB SBB mem80 rm8.ND 386.unity rm64.imm reg_rax.reg_cl rm64.mem reg32.reg64 rm16.reg16 reg16.reg8 mem.sbyte32 reg_eax.reg32 reg64.unity rm8.imm 486.sbyte16 reg_ax.reg16 reg32.reg64 reg8.reg32 reg32.ND 386.CYRIXM 8086 8086.unity rm32.reg32 mem.imm rm64.ND 8086.imm reg_ax.reg_cl rm8.ND X64.ND 386.reg_cl rm32.UNDOC 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 386 X64 8086 8086 8086 386 386 X64 X64 141 .

SBB SBB SBB SBB SBB SBB SBB SCASB SCASD SCASQ SCASW SFENCE SGDT SHL SHL SHL SHL SHL SHL SHL SHL SHL SHL SHL SHL SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHLD SHR SHR SHR SHR SHR SHR SHR SHR SHR SHR SHR SHR SHRD SHRD SHRD SHRD

rm8,imm rm16,imm rm32,imm rm64,imm mem,imm8 mem,imm16 mem,imm32

mem rm8,unity rm8,reg_cl rm8,imm rm16,unity rm16,reg_cl rm16,imm rm32,unity rm32,reg_cl rm32,imm rm64,unity rm64,reg_cl rm64,imm mem,reg16,imm reg16,reg16,imm mem,reg32,imm reg32,reg32,imm mem,reg64,imm reg64,reg64,imm mem,reg16,reg_cl reg16,reg16,reg_cl mem,reg32,reg_cl reg32,reg32,reg_cl mem,reg64,reg_cl reg64,reg64,reg_cl rm8,unity rm8,reg_cl rm8,imm rm16,unity rm16,reg_cl rm16,imm rm32,unity rm32,reg_cl rm32,imm rm64,unity rm64,reg_cl rm64,imm mem,reg16,imm reg16,reg16,imm mem,reg32,imm reg32,reg32,imm

8086 8086 386 X64 8086 8086 386 8086 386 X64 8086 X64,AMD 286 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 3862 3862 3862 3862 X642 X642 386 386 386 386 X64 X64 8086 8086 186 8086 8086 186 386 386 386 X64 X64 X64 3862 3862 3862 3862

142

SHRD SHRD SHRD SHRD SHRD SHRD SHRD SHRD SIDT SLDT SLDT SLDT SLDT SLDT SLDT SKINIT SMI SMINT SMINTOLD SMSW SMSW SMSW SMSW STC STD STGI STI STOSB STOSD STOSQ STOSW STR STR STR STR STR SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB

mem,reg64,imm reg64,reg64,imm mem,reg16,reg_cl reg16,reg16,reg_cl mem,reg32,reg_cl reg32,reg32,reg_cl mem,reg64,reg_cl reg64,reg64,reg_cl mem mem mem16 reg16 reg32 reg64 reg64

mem mem16 reg16 reg32

mem mem16 reg16 reg32 reg64 mem,reg8 reg8,reg8 mem,reg16 reg16,reg16 mem,reg32 reg32,reg32 mem,reg64 reg64,reg64 reg8,mem reg8,reg8 reg16,mem reg16,reg16 reg32,mem reg32,reg32 reg64,mem reg64,reg64 rm16,imm8

X642 X642 386 386 386 386 X64 X64 286 286 286 286 386 X64,ND X64 X64 386,UNDOC P6,CYRIX,ND 486,CYRIX,ND 286 286 286 386 8086 8086 X64 8086 8086 386 X64 8086 286,PROT 286,PROT 286,PROT 386,PROT X64 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086

143

SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SVDC SVLDT SVTS SWAPGS SYSCALL SYSENTER SYSEXIT SYSRET TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST UD0 UD1 UD2B UD2 UD2A UMOV

rm32,imm8 rm64,imm8 reg_al,imm reg_ax,sbyte16 reg_ax,imm reg_eax,sbyte32 reg_eax,imm reg_rax,sbyte64 reg_rax,imm rm8,imm rm16,imm rm32,imm rm64,imm mem,imm8 mem,imm16 mem,imm32 mem80,reg_sreg mem80 mem80

mem,reg8 reg8,reg8 mem,reg16 reg16,reg16 mem,reg32 reg32,reg32 mem,reg64 reg64,reg64 reg8,mem reg16,mem reg32,mem reg64,mem reg_al,imm reg_ax,imm reg_eax,imm reg_rax,imm rm8,imm rm16,imm rm32,imm rm64,imm mem,imm8 mem,imm16 mem,imm32

mem,reg8

386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 486,CYRIXM 486,CYRIXM,ND 486,CYRIXM X64 P6,AMD P6 P6,PRIV P6,PRIV,AMD 8086 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 X64 8086 8086 386 X64 8086 8086 386 186,UNDOC 186,UNDOC 186,UNDOC,ND 186 186,ND 386,UNDOC,ND

144

UMOV UMOV UMOV UMOV UMOV UMOV UMOV UMOV UMOV UMOV UMOV VERR VERR VERR VERW VERW VERW FWAIT WBINVD WRSHR WRMSR XADD XADD XADD XADD XADD XADD XADD XADD XBTS XBTS XBTS XBTS XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG XCHG

reg8,reg8 mem,reg16 reg16,reg16 mem,reg32 reg32,reg32 reg8,mem reg8,reg8 reg16,mem reg16,reg16 reg32,mem reg32,reg32 mem mem16 reg16 mem mem16 reg16

rm32 mem,reg8 reg8,reg8 mem,reg16 reg16,reg16 mem,reg32 reg32,reg32 mem,reg64 reg64,reg64 reg16,mem reg16,reg16 reg32,mem reg32,reg32 reg_ax,reg16 reg_eax,reg32na reg_rax,reg64 reg16,reg_ax reg32na,reg_eax reg64,reg_rax reg_eax,reg_eax reg8,mem reg8,reg8 reg16,mem reg16,reg16 reg32,mem reg32,reg32 reg64,mem reg64,reg64 mem,reg8 reg8,reg8 mem,reg16 reg16,reg16 mem,reg32

386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 386,UNDOC,ND 286,PROT 286,PROT 286,PROT 286,PROT 286,PROT 286,PROT 8086 486,PRIV P6,CYRIXM PENT,PRIV 486 486 486 486 486 486 X64 X64 386,SW,UNDOC,ND 386,UNDOC,ND 386,SD,UNDOC,ND 386,UNDOC,ND 8086 386 X64 8086 386 X64 386,NOLONG 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386

145

imm8 rm32.reg32 mem.imm reg_rax.imm rm32.reg32 reg32.reg64 reg8.mem reg16.imm8 rm64.mem reg16.imm8 reg_al.ND 8086.mem reg64.reg8 reg8.mem reg8.imm8 mem.ND 8086.imm rm64.ND 8086 146 .ND 386.sbyte64 reg_rax.reg32 reg64.XCHG XCHG XCHG XLATB XLAT XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR XOR CMOVcc CMOVcc CMOVcc CMOVcc CMOVcc CMOVcc Jcc Jcc Jcc Jcc Jcc Jcc Jcc Jcc reg32.reg32 mem.sbyte32 reg_eax.imm reg_ax.reg16 reg16.imm16 mem.reg8 mem.mem reg64.reg16 mem.reg16 reg32.reg8 reg16.imm reg_eax.mem reg32.mem reg32.reg64 imm|near imm16|near imm32|near imm|short imm imm imm imm 386 X64 X64 8086 8086 8086 8086 8086 8086 386 386 X64 X64 8086 8086 8086 8086 386 386 X64 X64 8086 386 X64 8086 8086 8086 386 386 X64 X64 8086 8086 386 X64 8086 8086 386 P6 P6 P6 P6 X64 X64 386 386 386 8086.reg64 mem.reg64 reg64.sbyte16 reg_ax.imm32 reg16.reg16 reg32.imm rm16.reg64 reg64.reg64 rm16.imm mem.reg32 reg64.imm rm8.

xmmrm xmmreg.xmmreg reg32.SSE KATMAI.xmmreg.AR1.xmmrm xmmreg.MMX KATMAI.SSE KATMAI.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SSE.AR1 KATMAI.SSE KATMAI.SD.SSE.SSE KATMAI.ND KATMAI.SD KATMAI.SSE.1.xmmrm xmmreg.xmmrm xmmreg. MMX2) ADDPS ADDSS ANDNPS ANDPS CMPEQPS CMPEQSS CMPLEPS CMPLESS CMPLTPS CMPLTSS CMPNEQPS CMPNEQSS CMPNLEPS CMPNLESS CMPNLTPS CMPNLTSS CMPORDPS CMPORDSS CMPUNORDPS CMPUNORDSS CMPPS CMPPS CMPSS CMPSS COMISS CVTPI2PS CVTPS2PI CVTSI2SS CVTSI2SS CVTSI2SS CVTSS2SI CVTSS2SI CVTSS2SI CVTSS2SI CVTTPS2PI CVTTSS2SI CVTTSS2SI DIVPS DIVSS LDMXCSR MAXPS MAXSS MINPS MINSS MOVAPS MOVAPS MOVAPS MOVAPS MOVHPS xmmreg.SSE KATMAI.SSE.xmmrm xmmreg.SSE KATMAI.SSE.xmmrm xmmreg.AR1 X64.AR1 KATMAI.xmmrm xmmreg.xmmrm reg32.SSE KATMAI.xmmrm xmmreg.AR1 X64.xmmrm xmmreg.SD.SSE KATMAI.SSE KATMAI.xmmrm xmmreg.SSE.a.xmmrm xmmreg.SSE 147 .SSE.AR1 KATMAI.SSE KATMAI.SSE KATMAI.SSE KATMAI.SD.xmmrm xmmreg.xmmrm xmmreg.xmmreg xmmreg.SETcc SETcc mem reg8 386 386 B.SSE KATMAI.xmmrm mem xmmreg.AR1 X64.SD.SD.xmmrm xmmreg.xmmrm xmmreg.mmxrm mmxreg.mem KATMAI.SSE KATMAI.xmmrm xmmreg.xmmreg reg64.rm64 reg32.SSE KATMAI.k.SSE KATMAI.mem reg64.xmmrm xmmreg.SSE KATMAI.imm xmmreg.SD.mem xmmreg.MMX KATMAI.SSE.SSE KATMAI.xmmreg xmmreg.SSE KATMAI.SSE KATMAI.MMX KATMAI.SSE KATMAI.rm32 xmmreg.xmmrm xmmreg.xmmrm xmmreg.SSE KATMAI.xmmreg.xmmrm xmmreg.SSE KATMAI.SSE KATMAI.AR1 KATMAI.imm xmmreg.SD KATMAI.SSE KATMAI.mem.SSE KATMAI.AR1 X64.3 Katmai Streaming SIMD instructions (SSE –– a.xmmrm xmmreg.mem.xmmrm xmmreg.SSE KATMAI.imm xmmreg.SSE KATMAI.SSE. XMM.SSE KATMAI.SSE.mem mem.xmmreg xmmreg.xmmrm xmmreg.imm xmmreg.SSE. KNI.SSE.SSE KATMAI.SD.xmmrm xmmreg.SSE.SSE KATMAI.xmmrm xmmreg.SSE.SSE KATMAI.mem mmxreg.xmmrm reg64.SSE KATMAI.SD.SSE KATMAI.

mem mem.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SSE KATMAI.MOVHPS MOVLHPS MOVLPS MOVLPS MOVHLPS MOVMSKPS MOVMSKPS MOVNTPS MOVSS MOVSS MOVSS MOVSS MOVUPS MOVUPS MOVUPS MOVUPS MULPS MULSS ORPS RCPPS RCPSS RSQRTPS RSQRTSS SHUFPS SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS UCOMISS UNPCKHPS UNPCKLPS XORPS mem.SSE KATMAI.SSE KATMAI.6 Generic memory operations PREFETCHNTA PREFETCHT0 PREFETCHT1 PREFETCHT2 SFENCE mem mem mem mem KATMAI KATMAI KATMAI KATMAI KATMAI 148 .mem mem.SSE KATMAI.5 XSAVE group (AVX and extended state) XGETBV XSETBV XSAVE XRSTOR NEHALEM NEHALEM.SSE KATMAI.xmmrm xmmreg.xmmreg xmmreg.xmmreg xmmreg.SSE KATMAI.SSE KATMAI.SSE KATMAI.xmmrm xmmreg.SSE KATMAI.SSE KATMAI.SSE KATMAI.SSE KATMAI.xmmreg xmmreg.SSE KATMAI.mem mem.xmmrm xmmreg.SSE KATMAI.xmmreg reg64.xmmrm mem xmmreg.SSE KATMAI.SSE KATMAI.1.SSE X64.SSE KATMAI.SSE KATMAI.SSE B.xmmrm xmmreg.imm xmmreg.xmmreg xmmreg.xmmreg xmmreg.xmmreg mem.1.SSE KATMAI.xmmrm xmmreg.SSE KATMAI.xmmreg xmmreg.1.xmmrm xmmreg.FPU P6.xmmrm xmmreg.SSE KATMAI.SSE KATMAI.xmmrm xmmreg.xmmreg xmmreg.FPU B.xmmreg.SSE KATMAI.xmmreg reg32.SSE KATMAI.xmmreg xmmreg.SSE KATMAI.SSE KATMAI.xmmrm xmmreg.xmmreg xmmreg.SSE.mem.SSE.SSE KATMAI.4 Introduced in Deschutes but necessary for SSE support FXRSTOR FXSAVE mem mem P6.xmmrm xmmreg.PRIV NEHALEM NEHALEM mem mem B.xmmrm xmmreg.SSE KATMAI.SSE KATMAI.SD KATMAI.SSE KATMAI.SSE.SSE KATMAI.xmmreg xmmreg.xmmrm KATMAI.

mmxrm mmxreg.SSE2 149 .xmmreg mmxreg.MMX KATMAI.mem.xmmreg mem mem.MMX KATMAI.3DNOW PENT.mem xmmreg.xmmreg xmmreg.mmxrm mmxreg.mmxrm mmxreg.SO WILLAMETTE.SSE2 WILLAMETTE.SO WILLAMETTE.mmxrm mmxreg.SSE2 WILLAMETTE.reg64 mem.9 Willamette SSE2 Cacheability Instructions MASKMOVDQU CLFLUSH MOVNTDQ MOVNTI MOVNTI MOVNTPD LFENCE MFENCE xmmreg.SSE2 WILLAMETTE.xmmreg xmmreg.MMX KATMAI.mmxrm mmxreg.10 Willamette MMX instructions (SSE2 SIMD Integer Instructions) MOVD MOVD MOVD MOVD MOVDQA MOVDQA MOVDQA MOVDQA MOVDQU MOVDQU MOVDQU MOVDQU MOVDQ2Q MOVQ MOVQ MOVQ xmmreg.3DNOW B.SO WILLAMETTE.xmmreg xmmreg.SSE2 WILLAMETTE.SSE2 WILLAMETTE.MMX2 B.SD WILLAMETTE.xmmreg WILLAMETTE.SSE2.SSE2.SSE2 WILLAMETTE.mmxrm PENT.MMX KATMAI.SSE2 WILLAMETTE.mmxreg mem.MMX KATMAI.SSE2.xmmreg mem.reg32 reg32.mmxrm.mmxreg.mmxrm mmxreg.SSE2.3DNOW PENT.B.MMX KATMAI.reg32.3DNOW PENT.xmmreg mem.MMX KATMAI.1.SD X64 WILLAMETTE.xmmreg xmmreg.7 New MMX instructions introduced in Katmai MASKMOVQ MOVNTQ PAVGB PAVGW PEXTRW PINSRW PINSRW PINSRW PMAXSW PMAXUB PMINSW PMINUB PMOVMSKB PMULHUW PSADBW PSHUFW mmxreg.SSE2.mem xmmreg.SO WILLAMETTE.mmxrm reg32.mmxreg mmxreg.xmmreg WILLAMETTE.MMX KATMAI.MMX KATMAI.SSE2 WILLAMETTE.SD WILLAMETTE.imm mmxreg.1.SO WILLAMETTE.mem xmmreg.1.1.imm mmxreg.xmmreg xmmreg.mmxrm mmxreg.rm16.reg32 mem.xmmreg mem.mmxrm mmxreg.MMX KATMAI.MMX KATMAI.mmxrm mmxreg.SSE2 WILLAMETTE.imm mmxreg.SSE2 WILLAMETTE.MMX KATMAI.SSE2.xmmreg mem.SSE2 B.mmxrm mmxreg.SSE2 WILLAMETTE.8 AMD Enhanced 3DNow! (Athlon) instructions PF2IW PFNACC PFPNACC PI2FW PSWAPD mmxreg.SSE2.mmxreg mmxreg.SSE2.imm KATMAI.mmxrm reg32.MMX KATMAI.xmmreg mem.SSE2 WILLAMETTE.imm mmxreg.xmmreg xmmreg.MMX KATMAI.MMX KATMAI.SO WILLAMETTE.3DNOW PENT.

SSE2.SSE2.SO WILLAMETTE.SO WILLAMETTE.xmmreg xmmreg.SSE2.imm WILLAMETTE.SO WILLAMETTE.SO WILLAMETTE.SO WILLAMETTE.xmmrm xmmreg.SSE2.xmmrm xmmreg.xmmreg.mem16.SO WILLAMETTE.imm xmmreg.SO WILLAMETTE.xmmrm xmmreg.xmmrm reg32.xmmrm reg32.SO WILLAMETTE.reg16.imm xmmreg.SO WILLAMETTE.SO WILLAMETTE.SO WILLAMETTE.SSE2.SSE2 WILLAMETTE.xmmrm xmmreg.xmmrm mmxreg.xmmrm xmmreg.SSE2.xmmrm mmxreg.SSE2 WILLAMETTE.AR1 WILLAMETTE.imm xmmreg.xmmrm xmmreg.SO WILLAMETTE.xmmrm xmmreg.MMX WILLAMETTE.SSE2.SO WILLAMETTE.SO WILLAMETTE.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SSE2.SO WILLAMETTE.SSE2.xmmrm xmmreg.xmmreg.mem.SO WILLAMETTE.SO WILLAMETTE.SSE2.SSE2 WILLAMETTE.xmmrm xmmreg.SSE2.ND WILLAMETTE.imm xmmreg.SO WILLAMETTE.xmmrm xmmreg.SSE2.imm xmmreg.mem.xmmrm xmmreg.SSE2.imm xmmreg.SSE2.MOVQ MOVQ MOVQ MOVQ2DQ PACKSSWB PACKSSDW PACKUSWB PADDB PADDW PADDD PADDQ PADDQ PADDSB PADDSW PADDUSB PADDUSW PAND PANDN PAVGB PAVGW PCMPEQB PCMPEQW PCMPEQD PCMPGTB PCMPGTW PCMPGTD PEXTRW PINSRW PINSRW PINSRW PINSRW PMADDWD PMAXSW PMAXUB PMINSW PMINUB PMOVMSKB PMULHUW PMULHW PMULLW PMULUDQ PMULUDQ POR PSADBW PSHUFD PSHUFD PSHUFHW PSHUFHW PSHUFLW PSHUFLW PSLLDQ PSLLW PSLLW xmmreg.xmmreg.imm xmmreg.SO WILLAMETTE.xmmrm xmmreg.SSE2.SO WILLAMETTE.xmmrm xmmreg.SSE2.SSE2.imm xmmreg.SSE2.SSE2.rm64 rm64.xmmrm xmmreg.xmmrm xmmreg.SSE2.xmmrm xmmreg.SSE2 WILLAMETTE.SSE2 WILLAMETTE.SSE2.SO WILLAMETTE.SO WILLAMETTE.xmmrm xmmreg.xmmrm xmmreg.mem.SO WILLAMETTE.imm xmmreg.SSE2.xmmrm xmmreg.xmmrm xmmreg.SSE22 WILLAMETTE.SSE2.xmmrm xmmreg.SSE2 X64.xmmrm xmmreg.SSE2.SSE2 X64.xmmrm xmmreg.SO WILLAMETTE.SSE2.mmxrm xmmreg.mmxrm xmmreg.SSE2 WILLAMETTE.xmmreg xmmreg.SO WILLAMETTE.mem xmmreg.SSE2.SSE2.SO WILLAMETTE.mmxreg xmmreg.SO WILLAMETTE.xmmrm xmmreg.SSE22 WILLAMETTE.imm xmmreg.SSE2.SO WILLAMETTE.SSE2.xmmrm xmmreg.SSE2.SSE2.SO WILLAMETTE.SSE2 WILLAMETTE.SO WILLAMETTE.SSE2.SO WILLAMETTE.SSE2.SO WILLAMETTE.SO WILLAMETTE.SSE2 WILLAMETTE.reg32.mem.xmmrm xmmreg.SSE2.SSE2 WILLAMETTE.SSE2.xmmreg.SO WILLAMETTE.xmmrm xmmreg.SSE22 WILLAMETTE.AR1 150 .imm xmmreg.SSE2.SSE2 WILLAMETTE.SSE2.

PSLLD PSLLD PSLLQ PSLLQ PSRAW PSRAW PSRAD PSRAD PSRLDQ PSRLW PSRLW PSRLD PSRLD PSRLQ PSRLQ PSUBB PSUBW PSUBD PSUBQ PSUBQ PSUBSB PSUBSW PSUBUSB PSUBUSW PUNPCKHBW PUNPCKHWD PUNPCKHDQ PUNPCKHQDQ PUNPCKLBW PUNPCKLWD PUNPCKLDQ PUNPCKLQDQ PXOR

xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,imm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm

WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO

B.1.11 Willamette Streaming SIMD instructions (SSE2)
ADDPD ADDSD ANDNPD ANDPD CMPEQPD CMPEQSD CMPLEPD CMPLESD CMPLTPD CMPLTSD CMPNEQPD CMPNEQSD CMPNLEPD CMPNLESD CMPNLTPD CMPNLTSD CMPORDPD CMPORDSD xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2

151

CMPUNORDPD CMPUNORDSD CMPPD CMPSD COMISD CVTDQ2PD CVTDQ2PS CVTPD2DQ CVTPD2PI CVTPD2PS CVTPI2PD CVTPS2DQ CVTPS2PD CVTSD2SI CVTSD2SI CVTSD2SI CVTSD2SI CVTSD2SS CVTSI2SD CVTSI2SD CVTSI2SD CVTSS2SD CVTTPD2PI CVTTPD2DQ CVTTPS2DQ CVTTSD2SI CVTTSD2SI CVTTSD2SI CVTTSD2SI DIVPD DIVSD MAXPD MAXSD MINPD MINSD MOVAPD MOVAPD MOVAPD MOVAPD MOVHPD MOVHPD MOVLPD MOVLPD MOVMSKPD MOVMSKPD MOVSD MOVSD MOVSD MOVSD MOVUPD MOVUPD MOVUPD MOVUPD

xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm,imm xmmreg,xmmrm,imm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm mmxreg,xmmrm xmmreg,xmmrm xmmreg,mmxrm xmmreg,xmmrm xmmreg,xmmrm reg32,xmmreg reg32,mem reg64,xmmreg reg64,mem xmmreg,xmmrm xmmreg,mem xmmreg,rm32 xmmreg,rm64 xmmreg,xmmrm mmxreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm reg32,xmmreg reg32,mem reg64,xmmreg reg64,mem xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmreg xmmreg,xmmreg mem,xmmreg xmmreg,mem mem,xmmreg xmmreg,mem mem,xmmreg xmmreg,mem reg32,xmmreg reg64,xmmreg xmmreg,xmmreg xmmreg,xmmreg mem,xmmreg xmmreg,mem xmmreg,xmmreg xmmreg,xmmreg mem,xmmreg xmmreg,mem

WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE22 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,AR1 X64,SSE2,AR1 X64,SSE2,AR1 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SD,AR1,ND WILLAMETTE,SSE2,SD,AR1 X64,SSE2,AR1 WILLAMETTE,SSE2,SD WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,AR1 WILLAMETTE,SSE2,AR1 X64,SSE2,AR1 X64,SSE2,AR1 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 X64,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO

152

MULPD MULSD ORPD SHUFPD SHUFPD SQRTPD SQRTSD SUBPD SUBSD UCOMISD UNPCKHPD UNPCKLPD XORPD

xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmreg,imm xmmreg,mem,imm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm

WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2 WILLAMETTE,SSE2 WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO WILLAMETTE,SSE2,SO

B.1.12 Prescott New Instructions (SSE3)
ADDSUBPD ADDSUBPS HADDPD HADDPS HSUBPD HSUBPS LDDQU MOVDDUP MOVSHDUP MOVSLDUP xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm xmmreg,mem xmmreg,xmmrm xmmreg,xmmrm xmmreg,xmmrm PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3,SO PRESCOTT,SSE3 PRESCOTT,SSE3 PRESCOTT,SSE3

B.1.13 VMX Instructions
VMCALL VMCLEAR VMLAUNCH VMLOAD VMMCALL VMPTRLD VMPTRST VMREAD VMREAD VMRESUME VMRUN VMSAVE VMWRITE VMWRITE VMXOFF VMXON mem VMX VMX VMX X64,VMX X64,VMX VMX VMX VMX,NOLONG,SD X64,VMX VMX X64,VMX X64,VMX VMX,NOLONG,SD X64,VMX VMX VMX

mem mem rm32,reg32 rm64,reg64

reg32,rm32 reg64,rm64 mem

B.1.14 Extended Page Tables VMX instructions
INVEPT INVEPT INVVPID INVVPID reg32,mem reg64,mem reg32,mem reg64,mem VMX,SO,NOLONG VMX,SO,LONG VMX,SO,NOLONG VMX,SO,LONG

153

B.1.15 Tejas New Instructions (SSSE3)
PABSB PABSB PABSW PABSW PABSD PABSD PALIGNR PALIGNR PHADDW PHADDW PHADDD PHADDD PHADDSW PHADDSW PHSUBW PHSUBW PHSUBD PHSUBD PHSUBSW PHSUBSW PMADDUBSW PMADDUBSW PMULHRSW PMULHRSW PSHUFB PSHUFB PSIGNB PSIGNB PSIGNW PSIGNW PSIGND PSIGND mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm,imm xmmreg,xmmrm,imm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm mmxreg,mmxrm xmmreg,xmmrm SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3 SSSE3,MMX SSSE3

B.1.16 AMD SSE4A
EXTRQ EXTRQ INSERTQ INSERTQ MOVNTSD MOVNTSS xmmreg,imm,imm xmmreg,xmmreg xmmreg,xmmreg,imm,imm xmmreg,xmmreg mem,xmmreg mem,xmmreg SSE4A,AMD SSE4A,AMD SSE4A,AMD SSE4A,AMD SSE4A,AMD SSE4A,AMD,SD

B.1.17 New instructions in Barcelona
LZCNT LZCNT LZCNT reg16,rm16 reg32,rm32 reg64,rm64 P6,AMD P6,AMD X64,AMD

B.1.18 Penryn New Instructions (SSE4.1)
BLENDPD BLENDPS BLENDVPD BLENDVPS xmmreg,xmmrm,imm xmmreg,xmmrm,imm xmmreg,xmmrm,xmm0 xmmreg,xmmrm,xmm0 SSE41 SSE41 SSE41 SSE41

154

xmmrm xmmreg.xmm0 xmmreg.imm reg32.xmmrm xmmreg.imm xmmreg.imm reg64.xmmrm.X64 SSE41.xmmrm reg32.SW SSE41 SSE41.xmmrm xmmreg.imm xmmreg.rm8.imm rm64.X64 SSE41 SSE41.imm rm32.xmmreg.xmmreg.xmmrm xmmreg.mem.xmmrm xmmreg.xmmreg.reg32.xmmrm xmmreg.SD SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41.imm mem16.imm xmmreg.xmmrm xmmreg.mem.imm xmmreg.xmmreg.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.imm SSE41 SSE41 SSE41 SSE41.imm xmmreg.xmmreg.mem.imm xmmreg.imm xmmreg.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmreg.imm xmmreg.xmmrm xmmreg.rm64.X64 SSE41.imm reg64.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm.xmmreg.xmmrm xmmreg.rm32.xmmreg.DPPD DPPS EXTRACTPS EXTRACTPS INSERTPS MOVNTDQA MPSADBW PACKUSDW PBLENDVB PBLENDW PCMPEQQ PEXTRB PEXTRB PEXTRB PEXTRD PEXTRQ PEXTRW PEXTRW PEXTRW PHMINPOSUW PINSRB PINSRB PINSRB PINSRD PINSRD PINSRQ PINSRQ PMAXSB PMAXSD PMAXUD PMAXUW PMINSB PMINSD PMINUD PMINUW PMOVSXBW PMOVSXBD PMOVSXBQ PMOVSXWD PMOVSXWQ PMOVSXDQ PMOVZXBW PMOVZXBD PMOVZXBQ PMOVZXWD PMOVZXWQ PMOVZXDQ PMULDQ PMULLD PTEST ROUNDPD ROUNDPS xmmreg.SD SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 155 .xmmreg.SD SSE41 SSE41 SSE41.SD SSE41.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.imm xmmreg.xmmrm.xmmrm.X64 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41.xmmrm.imm reg64.imm rm32.imm xmmreg.X64 SSE41 SSE41 SSE41.SD SSE41.xmmrm xmmreg.xmmrm xmmreg.X64 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41 SSE41.xmmrm xmmreg.xmmrm.mem xmmreg.imm xmmreg.xmmrm.xmmreg.SW SSE41 SSE41.imm xmmreg.imm mem8.xmmrm.xmmrm xmmreg.

AMD SSE5.xmmreg xmmreg.AMD SSE5.ROUNDSD ROUNDSS xmmreg.xmmreg.AMD SSE5.xmmreg xmmreg.xmmreg.xmmrm.=0 xmmreg.xmmrm xmmreg.imm xmmreg.1.=0 xmmreg.rm32 reg64.xmmrm.xmmreg.imm xmmreg.xmmrm.=0 xmmreg.xmmreg.xmmrm.X64 B.AMD SSE5.xmmrm xmmreg.AMD SSE5.rm16 reg32.=0.AMD SSE5.xmmreg.=0.AMD SSE5.imm SSE41 SSE41 B.xmmrm.AMD SSE5.xmmrm.xmmreg.xmmrm.xmmreg.=0 xmmreg.AMD SSE5.xmmreg.=0.xmmreg.AMD SSE5.=0 xmmreg.xmmrm xmmreg.=0 xmmreg.SD NEHALEM.xmmrm.=0 xmmreg.=0 xmmreg.AMD SSE5.xmmrm.xmmrm.=0.AMD SSE5.=0 xmmreg.xmmrm.AMD SSE5.X64 SSE42 SSE42 SSE42 SSE42 SSE42 NEHALEM.AMD SSE5.xmmreg xmmreg.xmmreg.xmmreg.xmmrm.AMD SSE5.=0 xmmreg.=0.xmmreg xmmreg.xmmrm.xmmreg xmmreg.X64 SSE42.imm xmmreg.19 Nehalem New Instructions (SSE4.xmmrm.xmmrm.xmmreg.=0 xmmreg.=0.AMD SSE5.1.=0 xmmreg.=0.xmmreg.xmmrm reg16.=0.=0.xmmrm.AMD SSE5.=0 xmmreg.xmmrm.=0.xmmreg.xmmreg.xmmrm.xmmrm.AMD SSE5.xmmreg.xmmrm.SW NEHALEM.xmmrm.AMD SSE5.AMD SSE5.xmmrm xmmreg.xmmreg xmmreg.=0.xmmrm.=0.xmmrm.imm xmmreg.xmmreg.xmmreg.AMD SSE5.xmmreg.xmmrm xmmreg.xmmrm.AMD 156 .AMD SSE5.xmmrm xmmreg.=0 xmmreg.xmmreg.rm64 xmmreg.imm xmmreg.xmmrm.rm8 reg64.AMD SSE5.xmmrm.=0 xmmreg.=0.xmmreg.=0.xmmrm.AMD SSE5.xmmreg xmmreg.xmmreg SSE5.2) CRC32 CRC32 CRC32 CRC32 CRC32 PCMPESTRI PCMPESTRM PCMPISTRI PCMPISTRM PCMPGTQ POPCNT POPCNT POPCNT reg32.=0.xmmreg.AMD SSE5.xmmrm.20 AMD SSE5 instructions FMADDPS FMADDPS FMADDPS FMADDPS FMADDPD FMADDPD FMADDPD FMADDPD FMADDSS FMADDSS FMADDSS FMADDSS FMADDSD FMADDSD FMADDSD FMADDSD FMSUBPS FMSUBPS FMSUBPS FMSUBPS FMSUBPD FMSUBPD FMSUBPD FMSUBPD FMSUBSS FMSUBSS FMSUBSS FMSUBSS FMSUBSD FMSUBSD FMSUBSD FMSUBSD FNMADDPS FNMADDPS xmmreg.xmmrm xmmreg.=0 xmmreg.AMD SSE5.xmmreg.xmmrm xmmreg.xmmreg xmmreg.xmmreg.AMD SSE5.AMD SSE5.rm8 reg32.xmmrm.rm64 SSE42 SSE42 SSE42 SSE42.rm16 reg32.xmmrm xmmreg.=0.xmmrm.AMD SSE5.rm32 reg64.AMD SSE5.AMD SSE5.xmmrm.xmmreg.=0.AMD SSE5.=0.AMD SSE5.

xmmreg xmmreg.SO SSE5.xmmreg.xmmreg.xmmrm xmmreg.=0.AMD.xmmreg.xmmrm.SO SSE5.imm xmmreg.AMD.=0 xmmreg.xmmreg.xmmrm xmmreg.=0 xmmreg.xmmreg.AMD SSE5.xmmreg xmmreg.xmmreg.AMD SSE5.SO SSE5.xmmreg xmmreg.xmmreg.=0 xmmreg.xmmreg.AMD SSE5.xmmrm SSE5.xmmrm xmmreg.xmmreg.xmmreg.AMD SSE5.=0 xmmreg.xmmrm.AMD.=0 xmmreg.xmmreg.AMD.SO SSE5.AMD.SO SSE5.xmmrm.xmmrm xmmreg.xmmreg.=0 xmmreg.xmmrm.xmmreg.AMD.xmmrm xmmreg.AMD.AMD SSE5.xmmreg.SO SSE5.xmmreg.=0 xmmreg.xmmreg.SO SSE5.xmmreg.xmmreg.xmmrm xmmreg.AMD SSE5.xmmreg.=0 xmmreg.AMD SSE5.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.AMD.FNMADDPS FNMADDPS FNMADDPD FNMADDPD FNMADDPD FNMADDPD FNMADDSS FNMADDSS FNMADDSS FNMADDSS FNMADDSD FNMADDSD FNMADDSD FNMADDSD FNMSUBPS FNMSUBPS FNMSUBPS FNMSUBPS FNMSUBPD FNMSUBPD FNMSUBPD FNMSUBPD FNMSUBSS FNMSUBSS FNMSUBSS FNMSUBSS FNMSUBSD FNMSUBSD FNMSUBSD FNMSUBSD COMEQPS COMLTPS COMLEPS COMUNORDPS COMUNEQPS COMUNLTPS COMUNLEPS COMORDPS COMUEQPS COMULTPS COMULEPS COMFALSEPS COMNEQPS COMNLTPS COMNLEPS COMTRUEPS COMPS COMEQPD COMLTPD COMLEPD COMUNORDPD COMUNEQPD COMUNLTPD xmmreg.xmmrm.SO SSE5.xmmrm.xmmreg.AMD.xmmrm.AMD.AMD SSE5.xmmreg.AMD SSE5.xmmrm.xmmreg.SO 157 .xmmreg.xmmrm.=0 xmmreg.xmmreg.AMD.xmmrm.xmmrm.=0.xmmreg.=0.xmmrm.AMD.xmmrm.=0 xmmreg.xmmrm xmmreg.=0.xmmrm.AMD.xmmreg.=0.xmmreg.xmmrm xmmreg.=0 xmmreg.=0.=0 xmmreg.AMD SSE5.=0.=0.AMD.AMD SSE5.xmmreg.xmmrm xmmreg.xmmreg.SO SSE5.AMD SSE5.AMD SSE5.xmmreg xmmreg.xmmrm xmmreg.xmmreg.SO SSE5.AMD SSE5.SO SSE5.xmmrm.SO SSE5.xmmreg xmmreg.xmmreg.SO SSE5.xmmrm xmmreg.AMD SSE5.xmmreg.=0 xmmreg.SO SSE5.xmmreg.xmmrm.xmmreg.AMD SSE5.AMD SSE5.AMD SSE5.=0.AMD SSE5.AMD SSE5.SO SSE5.SO SSE5.SO SSE5.=0.xmmrm xmmreg.xmmrm.SO SSE5.xmmrm xmmreg.xmmrm.xmmrm xmmreg.AMD.xmmrm xmmreg.=0 xmmreg.AMD SSE5.=0.=0.xmmrm xmmreg.xmmrm xmmreg.AMD SSE5.xmmrm xmmreg.xmmreg.AMD.xmmrm.=0.=0.xmmrm.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.AMD SSE5.xmmrm.AMD.AMD.xmmreg.AMD.xmmrm.=0 xmmreg.AMD SSE5.AMD.xmmreg.SO SSE5.xmmrm xmmreg.xmmrm.=0 xmmreg.xmmreg.AMD SSE5.xmmrm xmmreg.xmmreg.xmmreg.xmmreg.xmmreg xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmreg.xmmreg.xmmreg.AMD SSE5.xmmrm xmmreg.SO SSE5.AMD SSE5.xmmrm.AMD SSE5.SO SSE5.AMD SSE5.AMD.AMD SSE5.xmmreg.xmmrm xmmreg.AMD.xmmreg xmmreg.

xmmrm xmmreg.SD SSE5.xmmrm xmmreg.AMD.xmmreg.xmmrm xmmreg.xmmreg.xmmreg.xmmreg.AMD.imm xmmreg.xmmreg.xmmrm xmmreg.SD SSE5.xmmrm xmmreg.xmmrm.AMD.imm xmmreg.imm xmmreg.xmmreg.xmmreg.SO SSE5.xmmrm xmmreg.SD SSE5.xmmreg.xmmreg.AMD SSE5.AMD SSE5.xmmreg.SD SSE5.xmmrm xmmreg.SO SSE5.SD SSE5.SO SSE5.SO SSE5.xmmrm xmmreg.AMD.SO SSE5.xmmreg.AMD SSE5.AMD.xmmrm xmmreg.AMD SSE5.xmmreg.xmmrm xmmreg.SO SSE5.SD SSE5.xmmrm xmmreg.xmmrm xmmreg.AMD SSE5.xmmrm xmmreg.SD SSE5.xmmrm xmmreg.xmmrm xmmreg.SO SSE5.AMD SSE5.AMD.xmmreg.xmmrm xmmreg.AMD.xmmrm xmmreg.xmmrm xmmreg.SO SSE5.xmmreg.SD SSE5.SD SSE5.AMD.AMD.xmmreg.xmmrm xmmreg.xmmrm.xmmrm xmmreg.AMD SSE5.AMD SSE5.xmmrm xmmreg.AMD.AMD.xmmrm xmmreg.AMD.xmmrm xmmreg.xmmreg.AMD.xmmrm xmmreg.SD SSE5.xmmrm xmmreg.xmmrm xmmreg.xmmreg.xmmrm xmmreg.AMD.xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.xmmreg.SO SSE5.AMD SSE5.AMD.SO 158 .xmmrm xmmreg.AMD.xmmreg.AMD.xmmrm.xmmreg.xmmrm SSE5.xmmreg.xmmreg.xmmreg.AMD.AMD SSE5.xmmrm xmmreg.SO SSE5.AMD.AMD SSE5.SD SSE5.xmmreg.xmmrm xmmreg.xmmreg.xmmreg.AMD SSE5.xmmreg.xmmreg.AMD.AMD SSE5.AMD.xmmreg.SD SSE5.xmmrm xmmreg.SO SSE5.AMD SSE5.xmmrm xmmreg.SO SSE5.xmmreg.xmmrm xmmreg.xmmrm xmmreg.AMD.AMD.xmmrm xmmreg.xmmrm xmmreg.AMD.SO SSE5.xmmrm xmmreg.xmmreg.SD SSE5.COMUNLEPD COMORDPD COMUEQPD COMULTPD COMULEPD COMFALSEPD COMNEQPD COMNLTPD COMNLEPD COMTRUEPD COMPD COMEQSS COMLTSS COMLESS COMUNORDSS COMUNEQSS COMUNLTSS COMUNLESS COMORDSS COMUEQSS COMULTSS COMULESS COMFALSESS COMNEQSS COMNLTSS COMNLESS COMTRUESS COMSS COMEQSD COMLTSD COMLESD COMUNORDSD COMUNEQSD COMUNLTSD COMUNLESD COMORDSD COMUEQSD COMULTSD COMULESD COMFALSESD COMNEQSD COMNLTSD COMNLESD COMTRUESD COMSD PCOMLTB PCOMLEB PCOMGTB PCOMGEB PCOMEQB PCOMNEQB PCOMFALSEB PCOMTRUEB xmmreg.AMD.AMD SSE5.AMD.xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmreg.xmmreg.SD SSE5.xmmreg.SD SSE5.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.xmmreg.SO SSE5.xmmreg.xmmreg.xmmreg.xmmreg.xmmreg.AMD SSE5.xmmreg.xmmreg.xmmreg.AMD.xmmreg.xmmreg.AMD.xmmreg.xmmreg.xmmrm xmmreg.xmmrm xmmreg.AMD.AMD.SD SSE5.SO SSE5.AMD.xmmreg.AMD.SO SSE5.AMD SSE5.xmmreg.SD SSE5.xmmrm xmmreg.SO SSE5.AMD.SO SSE5.AMD.

xmmrm xmmreg.xmmreg.SO SSE5.SO SSE5.xmmreg.xmmreg.AMD.xmmrm xmmreg.xmmreg.SO SSE5.xmmreg.xmmreg.xmmrm.SO SSE5.AMD.SO SSE5.xmmreg.AMD.xmmrm xmmreg.AMD.AMD.SO SSE5.xmmrm xmmreg.xmmreg.PCOMB PCOMLTW PCOMLEW PCOMGTW PCOMGEW PCOMEQW PCOMNEQW PCOMFALSEW PCOMTRUEW PCOMW PCOMLTD PCOMLED PCOMGTD PCOMGED PCOMEQD PCOMNEQD PCOMFALSED PCOMTRUED PCOMD PCOMLTQ PCOMLEQ PCOMGTQ PCOMGEQ PCOMEQQ PCOMNEQQ PCOMFALSEQ PCOMTRUEQ PCOMQ PCOMLTUB PCOMLEUB PCOMGTUB PCOMGEUB PCOMEQUB PCOMNEQUB PCOMFALSEUB PCOMTRUEUB PCOMUB PCOMLTUW PCOMLEUW PCOMGTUW PCOMGEUW PCOMEQUW PCOMNEQUW PCOMFALSEUW PCOMTRUEUW PCOMUW PCOMLTUD PCOMLEUD PCOMGTUD PCOMGEUD PCOMEQUD PCOMNEQUD PCOMFALSEUD xmmreg.xmmreg.AMD.xmmrm xmmreg.AMD.xmmrm xmmreg.xmmrm xmmreg.SO SSE5.SO SSE5.SO SSE5.SO SSE5.SO SSE5.xmmreg.AMD.xmmreg.SO SSE5.xmmreg.SO 159 .SO SSE5.SO SSE5.AMD.SO SSE5.AMD.xmmreg.xmmrm xmmreg.xmmrm xmmreg.AMD.SO SSE5.xmmrm.SO SSE5.SO SSE5.AMD.xmmrm xmmreg.xmmrm.AMD.SO SSE5.SO SSE5.AMD.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.xmmreg.SO SSE5.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.SO SSE5.xmmreg.AMD.SO SSE5.xmmrm xmmreg.xmmrm xmmreg.AMD.AMD.xmmreg.xmmreg.xmmrm xmmreg.SO SSE5.SO SSE5.AMD.xmmreg.xmmrm xmmreg.AMD.xmmreg.xmmrm xmmreg.xmmreg.xmmreg.xmmrm xmmreg.SO SSE5.SO SSE5.xmmreg.xmmrm xmmreg.AMD.AMD.AMD.xmmrm xmmreg.xmmrm xmmreg.SO SSE5.xmmreg.xmmrm SSE5.SO SSE5.AMD.xmmreg.AMD.AMD.xmmreg.xmmreg.xmmreg.xmmreg.xmmrm xmmreg.AMD.SO SSE5.imm xmmreg.AMD.AMD.xmmreg.SO SSE5.AMD.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.AMD.xmmreg.xmmrm xmmreg.xmmreg.AMD.SO SSE5.SO SSE5.xmmrm xmmreg.xmmrm xmmreg.AMD.xmmreg.imm xmmreg.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.xmmrm.xmmreg.xmmrm xmmreg.AMD.xmmrm xmmreg.xmmreg.xmmrm xmmreg.xmmreg.SO SSE5.AMD.SO SSE5.xmmreg.xmmreg.xmmrm.SO SSE5.xmmrm xmmreg.AMD.xmmrm xmmreg.AMD.AMD.xmmrm xmmreg.xmmrm xmmreg.AMD.SO SSE5.SO SSE5.SO SSE5.SO SSE5.xmmrm xmmreg.imm xmmreg.AMD.xmmreg.imm xmmreg.SO SSE5.xmmreg.xmmreg.SO SSE5.AMD.xmmrm xmmreg.xmmreg.SO SSE5.imm xmmreg.xmmreg.xmmreg.xmmreg.xmmreg.imm xmmreg.AMD.xmmreg.AMD.AMD.xmmrm xmmreg.AMD.xmmreg.xmmreg.SO SSE5.SO SSE5.SO SSE5.xmmrm xmmreg.xmmrm.xmmrm xmmreg.AMD.AMD.xmmrm xmmreg.xmmreg.AMD.AMD.SO SSE5.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.AMD.xmmreg.xmmreg.SO SSE5.AMD.AMD.SO SSE5.

xmmreg xmmreg.AMD SSE5.xmmreg xmmreg.xmmrm xmmreg.=0.AMD SSE5.xmmrm.AMD.xmmreg.=0.xmmreg.SO SSE5.AMD SSE5.xmmreg.xmmrm xmmreg.xmmreg.xmmreg.AMD SSE5.xmmrm.xmmrm.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.=0.xmmrm.AMD SSE5.xmmreg.=0 xmmreg.xmmrm.=0 xmmreg.=0 xmmreg.xmmrm.AMD SSE5.=0 xmmreg.xmmreg.=0 xmmreg.AMD SSE5.AMD SSE5.=0.AMD.xmmreg xmmreg.AMD SSE5.=0 xmmreg.SO SSE5.xmmreg.AMD SSE5.xmmreg.xmmreg.PCOMTRUEUD PCOMUD PCOMLTUQ PCOMLEUQ PCOMGTUQ PCOMGEUQ PCOMEQUQ PCOMNEQUQ PCOMFALSEUQ PCOMTRUEUQ PCOMUQ PERMPS PERMPS PERMPS PERMPS PERMPD PERMPD PERMPD PERMPD PCMOV PCMOV PCMOV PCMOV PPERM PPERM PPERM PPERM PMACSSWW PMACSWW PMACSSWD PMACSWD PMACSSDD PMACSDD PMACSSDQL PMACSDQL PMACSSDQH PMACSDQH PMADCSSWD PMADCSWD PROTB PROTB PROTW PROTW PROTD PROTD PROTQ PROTQ PSHLB PSHLB PSHLW PSHLW PSHLD PSHLD xmmreg.AMD SSE5.xmmrm xmmreg.SO SSE5.xmmrm xmmreg.xmmreg.xmmreg.xmmreg xmmreg.xmmrm.xmmreg.=0.xmmrm xmmreg.xmmrm.xmmreg.xmmrm xmmreg.AMD SSE5.AMD SSE5.xmmreg.xmmreg.=0 xmmreg.xmmreg.AMD SSE5.xmmreg.=0 xmmreg.xmmrm.xmmrm.AMD SSE5.xmmreg.xmmrm.xmmrm.AMD SSE5.xmmreg.AMD SSE5.AMD SSE5.AMD SSE5.xmmreg.xmmreg xmmreg.AMD SSE5.xmmreg.=0 xmmreg.xmmrm xmmreg.xmmreg xmmreg.AMD SSE5.xmmrm.xmmrm.=0 xmmreg.AMD SSE5.xmmreg.=0.=0.=0 xmmreg.AMD SSE5.=0 xmmreg.SO SSE5.AMD SSE5.xmmreg xmmreg.xmmreg.xmmreg.xmmreg xmmreg.xmmrm.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.AMD SSE5.AMD.xmmrm xmmreg.AMD SSE5.xmmreg.=0 xmmreg.=0 xmmreg.xmmreg.xmmrm xmmreg.AMD.xmmrm.xmmreg.xmmreg SSE5.xmmrm xmmreg.AMD SSE5.AMD.xmmrm.=0 xmmreg.xmmrm.xmmreg.xmmreg.xmmreg xmmreg.xmmreg.SO SSE5.AMD.=0 xmmreg.xmmrm.xmmreg.AMD SSE5.xmmrm xmmreg.AMD SSE5.AMD SSE5.imm xmmreg.=0 xmmreg.SO SSE5.xmmrm.AMD SSE5.xmmreg.AMD SSE5.AMD SSE5.SO SSE5.AMD SSE5.AMD.AMD.AMD SSE5.=0 xmmreg.xmmrm xmmreg.xmmrm.xmmreg.SO SSE5.xmmrm.=0.AMD.SO SSE5.AMD.xmmrm.xmmrm.AMD SSE5.xmmreg.xmmreg.AMD 160 .xmmrm xmmreg.xmmreg xmmreg.AMD.xmmrm xmmreg.xmmrm.xmmrm.AMD SSE5.xmmreg.AMD SSE5.xmmrm.=0 xmmreg.xmmrm.xmmreg.xmmrm.AMD SSE5.xmmrm.AMD SSE5.=0 xmmreg.xmmreg.xmmrm xmmreg.xmmreg.xmmreg.xmmrm xmmreg.xmmrm.SO SSE5.xmmrm.xmmreg.AMD SSE5.xmmrm.

xmmrm.xmmrm.xmmrm xmmreg.xmmreg xmmreg.xmmrm.mem16 reg32.AMD SSE5.xmmrm xmmreg.xmmrm xmmrm.AMD SSE5.AMD SSE5.AMD SSE5.AMD SSE5.xmmreg xmmreg.mmxrm PENT.xmmrm xmmreg.mmxrm mmxreg.AMD SSE5.xmmrm xmmreg.xmmreg xmmreg.xmmrm.reg16 NEHALEM NEHALEM NEHALEM NEHALEM 161 .AMD SSE5.AMD SSE5.imm SSE5.AMD SSE5.AMD SSE5.CYRIX B.imm xmmreg.AMD SSE5.AMD SSE5.22 Geode (Cyrix) 3DNow! additions PFRCPV PFRSQRTV mmxreg.AMD SSE5.1.xmmreg xmmreg.xmmrm.AMD SSE5.xmmreg.AMD SSE5.imm xmmreg.AMD SSE5.xmmrm xmmreg.CYRIX PENT.3DNOW.xmmrm xmmreg.xmmrm.xmmrm xmmreg.xmmrm xmmreg.AMD B.21 Intel SMX GETSEC KATMAI B.AMD SSE5.mem32 reg64.xmmrm xmmreg.1.AMD SSE5.AMD SSE5.AMD SSE5.AMD SSE5.xmmrm xmmreg.imm xmmreg.xmmrm xmmreg.AMD SSE5.mem64 mem16.xmmrm xmmreg.xmmreg.AMD SSE5.xmmrm xmmreg.AMD SSE5.xmmrm xmmreg.AMD SSE5.xmmreg xmmreg.AMD SSE5.xmmrm xmmreg.AMD SSE5.AMD SSE5.imm xmmreg.xmmreg.xmmrm xmmreg.AMD SSE5.xmmreg.xmmrm xmmreg.imm xmmreg.xmmrm.AMD SSE5.AMD SSE5.xmmrm xmmreg.xmmrm.xmmrm.xmmrm.xmmrm xmmreg.AMD SSE5.AMD SSE5.xmmrm.xmmrm xmmreg.AMD SSE5.3DNOW.xmmrm xmmreg.AMD SSE5.1.imm xmmreg.xmmrm.xmmreg.xmmrm xmmreg.xmmreg xmmreg.PSHLQ PSHLQ PSHAB PSHAB PSHAW PSHAW PSHAD PSHAD PSHAQ PSHAQ FRCZPS FRCZPD FRCZSS FRCZSD CVTPH2PS CVTPS2PH PHADDBW PHADDBD PHADDBQ PHADDWD PHADDWQ PHADDDQ PHADDUBW PHADDUBD PHADDUBQ PHADDUWD PHADDUWQ PHADDUDQ PHSUBBW PHSUBWD PHSUBDQ PROTB PROTW PROTD PROTQ ROUNDPS ROUNDPD ROUNDSS ROUNDSD xmmreg.AMD SSE5.xmmrm.xmmrm xmmreg.23 Intel new instructions in ??? MOVBE MOVBE MOVBE MOVBE reg16.xmmrm xmmreg.AMD SSE5.imm xmmreg.AMD SSE5.

xmmrm.WESTMERE.xmmreg*.WESTMERE.xmmreg*.SANDYBRIDGE.xmmrm AVX.ymmrm AVX.WESTMERE.SO ymmreg.SY xmmreg.xmm0 AVX.ymmreg*.xmmrm.xmmrm AVX.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.ymmrm AVX.SY ymmreg.ymmrm.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SO ymmreg.ymmreg*.xmmrm xmmreg.ymmrm AVX.xmmrm AVX.xmmrm xmmreg.ymm0 AVX.reg32 mem64.ymmrm AVX.SY xmmreg.SD ymmreg.SANDYBRIDGE.xmmreg*.SO AVX.SANDYBRIDGE.xmmreg AVX.SANDYBRIDGE.ymmreg.SO xmmreg.xmmreg*.ymmreg*.xmmreg*.SD 162 .xmmrm xmmreg.ymmrm.SD xmmreg.SO B.SANDYBRIDGE.ymmrm AVX.SO ymmreg.xmmreg.SANDYBRIDGE.xmmrm AVX.SANDYBRIDGE.xmmrm.SO ymmreg.SO ymmreg.SY xmmreg.imm AVX.SO ymmreg.ymmreg*.SY xmmreg.imm AVX.ymmrm AVX.ymmrm AVX.xmmreg*.SO ymmreg.WESTMERE.SY xmmreg.1.SY xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO ymmreg.SO SSE.xmmrm AVX.SO AVX.xmmrm.xmmreg*.SANDYBRIDGE.mem AVX.SANDYBRIDGE.SY ymmreg.ymmreg AVX.ymmreg*.ymmreg.SY xmmreg.SO ymmreg.ymmrm.ymmrm.SANDYBRIDGE.ymmreg*.xmmrm xmmreg.SY xmmreg.xmmreg AVX.SANDYBRIDGE.xmmrm AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.xmmreg*.SY xmmreg.SY xmmreg.SO ymmreg.SO SSE.SO AVX.SO AVX.SO AVX.SO SSE.imm SSE.SANDYBRIDGE.WESTMERE.SANDYBRIDGE.ymmrm.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE xmmreg.xmmreg*.xmmrm.24 Intel AES instructions AESENC AESENCLAST AESDEC AESDECLAST AESIMC AESKEYGENASSIST xmmreg.xmmrm AVX.SANDYBRIDGE.xmmreg*.ymm0 AVX.MOVBE MOVBE mem32.SANDYBRIDGE.xmmreg*.reg64 NEHALEM NEHALEM B.SO SSE.xmmrm AVX.imm AVX.xmmrm xmmreg.SANDYBRIDGE.imm AVX.xmm0 AVX.xmmreg*.SO B.SO ymmreg.SANDYBRIDGE.1.SANDYBRIDGE.SANDYBRIDGE.ymmrm.SO ymmreg.xmmrm AVX.SANDYBRIDGE.ymmreg*.25 Intel AVX AES instructions VAESENC VAESENCLAST VAESDEC VAESDECLAST VAESIMC VAESKEYGENASSIST xmmreg.1.xmmrm xmmreg.ymmreg*.SO SSE.SANDYBRIDGE.SY xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm.SO xmmreg.xmmreg.ymmrm AVX.xmmreg*.mem AVX.xmmrm xmmreg.SANDYBRIDGE.xmmrm AVX.26 Intel AVX instructions VADDPD VADDPD VADDPS VADDPS VADDSD VADDSS VADDSUBPD VADDSUBPD VADDSUBPS VADDSUBPS VANDPD VANDPD VANDPS VANDPS VANDNPD VANDNPD VANDNPS VANDNPS VBLENDPD VBLENDPD VBLENDPS VBLENDPS VBLENDVPD VBLENDVPD VBLENDVPD VBLENDVPD VBLENDVPS VBLENDVPS VBLENDVPS VBLENDVPD VBROADCASTSS VBROADCASTSS xmmreg.xmmreg*.xmmrm.xmmrm xmmreg.ymmreg*.xmmrm xmmreg.SY xmmreg.xmmrm xmmreg.WESTMERE.imm AVX.ymmreg AVX.

SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.xmmreg*.ymmreg*.xmmreg*.SANDYBRIDGE.ymmreg*.SO AVX.SY AVX.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.SANDYBRIDGE.SO AVX.xmmreg*.SO AVX.xmmreg*.SO AVX.SO AVX.mem xmmreg.ymmreg*.ymmreg*.SANDYBRIDGE.SY AVX.ymmreg*.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.ymmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.SO 163 .SY AVX.xmmrm ymmreg.SANDYBRIDGE.xmmreg*.SO AVX.SANDYBRIDGE AVX.SY AVX.ymmreg*.xmmrm ymmreg.xmmrm ymmreg.ymmreg*.SO AVX.ymmrm xmmreg.SY AVX.SANDYBRIDGE.SO AVX.xmmreg*.SANDYBRIDGE.SY AVX.ymmrm xmmreg.ymmreg*.SY AVX.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.SANDYBRIDGE.ymmrm xmmreg.xmmreg*.xmmreg*.ymmrm xmmreg.ymmrm xmmreg.xmmreg*.xmmrm AVX.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SO AVX.ymmreg*.ymmreg*.xmmreg*.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.ymmrm xmmreg.SY AVX.ymmrm xmmreg.SO AVX.xmmrm ymmreg.SANDYBRIDGE.SO AVX.SO AVX.xmmrm ymmreg.SY AVX.xmmreg*.ymmrm xmmreg.ymmrm xmmreg.xmmreg*.SANDYBRIDGE.SO AVX.xmmrm ymmreg.xmmrm ymmreg.VBROADCASTSD VBROADCASTF128 VCMPEQPD VCMPEQPD VCMPLTPD VCMPLTPD VCMPLEPD VCMPLEPD VCMPUNORDPD VCMPUNORDPD VCMPNEQPD VCMPNEQPD VCMPNLTPD VCMPNLTPD VCMPNLEPD VCMPNLEPD VCMPORDPD VCMPORDPD VCMPEQ_UQPD VCMPEQ_UQPD VCMPNGEPD VCMPNGEPD VCMPNGTPD VCMPNGTPD VCMPFALSEPD VCMPFALSEPD VCMPNEQ_OQPD VCMPNEQ_OQPD VCMPGEPD VCMPGEPD VCMPGTPD VCMPGTPD VCMPTRUEPD VCMPTRUEPD VCMPEQ_OSPD VCMPEQ_OSPD VCMPLT_OQPD VCMPLT_OQPD VCMPLE_OQPD VCMPLE_OQPD VCMPUNORD_SPD VCMPUNORD_SPD VCMPNEQ_USPD VCMPNEQ_USPD VCMPNLT_UQPD VCMPNLT_UQPD VCMPNLE_UQPD VCMPNLE_UQPD VCMPORD_SPD VCMPORD_SPD VCMPEQ_USPD VCMPEQ_USPD VCMPNGE_UQPD ymmreg.SY AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SY AVX.ymmreg*.SANDYBRIDGE.xmmrm ymmreg.xmmreg*.SY AVX.SY AVX.SANDYBRIDGE.ymmrm xmmreg.ymmreg*.SANDYBRIDGE.SANDYBRIDGE.SY AVX.SY AVX.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.xmmrm ymmreg.SO AVX.xmmrm ymmreg.ymmrm xmmreg.xmmreg*.SANDYBRIDGE.xmmreg*.ymmreg*.ymmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.SO AVX.ymmreg*.ymmreg*.SO AVX.SY AVX.xmmreg*.xmmrm ymmreg.SANDYBRIDGE.ymmrm xmmreg.xmmrm ymmreg.SO AVX.ymmrm xmmreg.SO AVX.ymmrm xmmreg.SANDYBRIDGE.SO AVX.SO AVX.ymmrm xmmreg.SY AVX.SO AVX.SO AVX.SO AVX.SY AVX.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmrm ymmreg.ymmreg*.ymmrm xmmreg.xmmrm ymmreg.SY AVX.SANDYBRIDGE.xmmrm ymmreg.ymmrm xmmreg.SY AVX.ymmrm xmmreg.SY AVX.SANDYBRIDGE.ymmrm xmmreg.xmmreg*.SANDYBRIDGE.ymmreg*.SY AVX.SO AVX.ymmrm xmmreg.ymmreg*.SY AVX.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.ymmrm xmmreg.xmmreg*.SY AVX.xmmreg*.ymmrm xmmreg.SY AVX.mem ymmreg.xmmreg*.xmmreg*.xmmreg*.

xmmreg*.SY AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SY AVX.ymmrm xmmreg.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.xmmrm ymmreg.SO AVX.SANDYBRIDGE.xmmreg*.SO AVX.ymmreg*.ymmrm xmmreg.SANDYBRIDGE.ymmreg*.xmmreg*.ymmrm xmmreg.xmmreg*.xmmreg*.ymmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.SO AVX.SY AVX.ymmreg*.ymmreg*.SANDYBRIDGE.SY AVX.SANDYBRIDGE.ymmrm xmmreg.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.ymmreg*.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.ymmrm xmmreg.xmmreg*.imm xmmreg.SO AVX.SO AVX.ymmrm xmmreg.ymmreg*.ymmreg*.ymmreg*.SY AVX.xmmreg*.SY AVX.xmmrm ymmreg.SO AVX.xmmrm ymmreg.SANDYBRIDGE.xmmreg*.ymmrm xmmreg.SO AVX.xmmrm.VCMPNGE_UQPD VCMPNGT_UQPD VCMPNGT_UQPD VCMPFALSE_OSPD VCMPFALSE_OSPD VCMPNEQ_OSPD VCMPNEQ_OSPD VCMPGE_OQPD VCMPGE_OQPD VCMPGT_OQPD VCMPGT_OQPD VCMPTRUE_USPD VCMPTRUE_USPD VCMPPD VCMPPD VCMPEQPS VCMPEQPS VCMPLTPS VCMPLTPS VCMPLEPS VCMPLEPS VCMPUNORDPS VCMPUNORDPS VCMPNEQPS VCMPNEQPS VCMPNLTPS VCMPNLTPS VCMPNLEPS VCMPNLEPS VCMPORDPS VCMPORDPS VCMPEQ_UQPS VCMPEQ_UQPS VCMPNGEPS VCMPNGEPS VCMPNGTPS VCMPNGTPS VCMPFALSEPS VCMPFALSEPS VCMPNEQ_OQPS VCMPNEQ_OQPS VCMPGEPS VCMPGEPS VCMPGTPS VCMPGTPS VCMPTRUEPS VCMPTRUEPS VCMPEQ_OSPS VCMPEQ_OSPS VCMPLT_OQPS VCMPLT_OQPS VCMPLE_OQPS VCMPLE_OQPS ymmreg.xmmreg*.xmmreg*.SY AVX.ymmrm xmmreg.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.ymmrm xmmreg.SY AVX.SO AVX.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.ymmrm xmmreg.SY AVX.ymmreg*.ymmreg*.SANDYBRIDGE.ymmreg*.SY AVX.xmmreg*.SO AVX.ymmreg*.xmmrm ymmreg.SO AVX.xmmreg*.SANDYBRIDGE.imm ymmreg.SO AVX.SO AVX.xmmrm ymmreg.SO AVX.xmmrm ymmreg.xmmrm ymmreg.xmmrm ymmreg.ymmreg*.SY AVX.ymmrm xmmreg.SANDYBRIDGE.SO AVX.ymmreg*.SO AVX.SY AVX.SANDYBRIDGE.xmmrm ymmreg.SANDYBRIDGE.ymmrm xmmreg.xmmreg*.xmmreg*.SY AVX.SY AVX.SY AVX.ymmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.ymmrm xmmreg.SO AVX.xmmreg*.xmmreg*.SANDYBRIDGE.xmmrm ymmreg.xmmreg*.ymmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.SY AVX.SY AVX.ymmreg*.SO AVX.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.xmmrm ymmreg.ymmrm xmmreg.SANDYBRIDGE.xmmreg*.ymmreg*.ymmrm xmmreg.ymmreg*.SY AVX.ymmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.SO AVX.xmmrm ymmreg.SY AVX.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.ymmreg*.SO AVX.ymmrm.ymmrm xmmreg.SANDYBRIDGE.ymmreg*.SY AVX.SANDYBRIDGE.SANDYBRIDGE.SO AVX.ymmrm xmmreg.SY AVX.SANDYBRIDGE.SO AVX.ymmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.xmmreg*.ymmreg*.xmmrm ymmreg.ymmrm AVX.SO AVX.xmmreg*.SANDYBRIDGE.SY AVX.SANDYBRIDGE.ymmreg*.SANDYBRIDGE.SY AVX.SY 164 .xmmreg*.SY AVX.SY AVX.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SY AVX.xmmrm ymmreg.ymmreg*.xmmrm ymmreg.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.ymmreg*.xmmrm ymmreg.ymmrm xmmreg.SO AVX.

ymmreg*.ymmrm xmmreg.xmmrm xmmreg.SO AVX.SANDYBRIDGE.SY AVX.xmmrm xmmreg.xmmreg*.SANDYBRIDGE AVX.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.xmmrm xmmreg.xmmreg*.xmmreg*.SANDYBRIDGE.ymmreg*.xmmrm xmmreg.SANDYBRIDGE AVX.xmmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.SO AVX.SANDYBRIDGE AVX.SY AVX.xmmreg*.xmmrm ymmreg.xmmrm xmmreg.SANDYBRIDGE.SY AVX.xmmreg*.SANDYBRIDGE AVX.xmmreg*.ymmrm xmmreg.xmmreg*.SANDYBRIDGE.ymmrm.SANDYBRIDGE AVX.xmmreg*.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE.ymmreg*.xmmrm xmmreg.xmmreg*.ymmreg*.ymmrm xmmreg.SANDYBRIDGE.xmmreg*.ymmrm xmmreg.SO AVX.ymmreg*.SO AVX.xmmreg*.xmmrm.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE AVX.xmmreg*.xmmreg*.xmmreg*.SY AVX.xmmrm ymmreg.xmmreg*.xmmrm ymmreg.SANDYBRIDGE.xmmreg*.SO AVX.xmmrm ymmreg.SANDYBRIDGE AVX.imm ymmreg.SANDYBRIDGE.ymmrm xmmreg.xmmreg*.SANDYBRIDGE.xmmrm ymmreg.SY AVX.xmmrm xmmreg.SANDYBRIDGE AVX.xmmrm ymmreg.xmmreg*.xmmreg*.SANDYBRIDGE 165 .xmmreg*.xmmrm xmmreg.SY AVX.ymmrm xmmreg.xmmreg*.SY AVX.xmmrm xmmreg.ymmreg*.SANDYBRIDGE AVX.SANDYBRIDGE AVX.xmmreg*.SY AVX.SANDYBRIDGE AVX.SANDYBRIDGE.SO AVX.xmmreg*.xmmreg*.xmmrm xmmreg.xmmrm AVX.xmmreg*.ymmreg*.xmmrm xmmreg.SO AVX.SANDYBRIDGE AVX.ymmrm xmmreg.xmmreg*.xmmrm xmmreg.xmmrm ymmreg.xmmreg*.SO AVX.SANDYBRIDGE.xmmreg*.xmmreg*.SO AVX.xmmrm xmmreg.xmmreg*.SANDYBRIDGE.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.ymmrm xmmreg.SANDYBRIDGE.SY AVX.SY AVX.SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE AVX.xmmreg*.ymmreg*.SANDYBRIDGE AVX.xmmreg*.SANDYBRIDGE.ymmrm xmmreg.xmmrm xmmreg.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.ymmrm xmmreg.ymmreg*.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE.SY AVX.ymmrm xmmreg.SANDYBRIDGE.SY AVX.xmmreg*.ymmrm xmmreg.xmmrm ymmreg.ymmreg*.ymmreg*.xmmrm xmmreg.xmmrm xmmreg.SO AVX.ymmreg*.SANDYBRIDGE AVX.xmmrm xmmreg.SO AVX.xmmrm ymmreg.VCMPUNORD_SPS VCMPUNORD_SPS VCMPNEQ_USPS VCMPNEQ_USPS VCMPNLT_UQPS VCMPNLT_UQPS VCMPNLE_UQPS VCMPNLE_UQPS VCMPORD_SPS VCMPORD_SPS VCMPEQ_USPS VCMPEQ_USPS VCMPNGE_UQPS VCMPNGE_UQPS VCMPNGT_UQPS VCMPNGT_UQPS VCMPFALSE_OSPS VCMPFALSE_OSPS VCMPNEQ_OSPS VCMPNEQ_OSPS VCMPGE_OQPS VCMPGE_OQPS VCMPGT_OQPS VCMPGT_OQPS VCMPTRUE_USPS VCMPTRUE_USPS VCMPPS VCMPPS VCMPEQSD VCMPLTSD VCMPLESD VCMPUNORDSD VCMPNEQSD VCMPNLTSD VCMPNLESD VCMPORDSD VCMPEQ_UQSD VCMPNGESD VCMPNGTSD VCMPFALSESD VCMPNEQ_OQSD VCMPGESD VCMPGTSD VCMPTRUESD VCMPEQ_OSSD VCMPLT_OQSD VCMPLE_OQSD VCMPUNORD_SSD VCMPNEQ_USSD VCMPNLT_UQSD VCMPNLE_UQSD VCMPORD_SSD VCMPEQ_USSD xmmreg.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SY AVX.SO AVX.SANDYBRIDGE.ymmreg*.ymmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.SANDYBRIDGE.SO AVX.xmmrm xmmreg.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SY AVX.SANDYBRIDGE.imm xmmreg.

SANDYBRIDGE.SD AVX.xmmreg*.xmmreg*.SANDYBRIDGE.SD AVX.xmmreg*.xmmreg*.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmrm xmmreg.SANDYBRIDGE.xmmreg*.xmmrm xmmreg.SANDYBRIDGE AVX.xmmreg*.imm xmmreg.xmmreg*.SANDYBRIDGE AVX.xmmreg*.SD AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.xmmrm xmmreg.xmmrm.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SO AVX.xmmrm xmmreg.SD AVX.SANDYBRIDGE.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmreg*.imm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE AVX.xmmreg*.SD AVX.SD AVX.SD AVX.SD AVX.xmmrm xmmreg.mem128 AVX.xmmreg*.xmmrm xmmreg.SD AVX.SD AVX.SANDYBRIDGE.SANDYBRIDGE AVX.xmmreg*.xmmrm.xmmrm xmmreg.xmmreg*.SD AVX.SANDYBRIDGE.SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.SD AVX.SANDYBRIDGE AVX.xmmreg*.SD AVX.xmmreg*.SD AVX.SANDYBRIDGE.xmmreg*.SD AVX.SD AVX.xmmreg*.SD AVX.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.SY AVX.xmmrm xmmreg.xmmreg*.xmmrm ymmreg.SD AVX.xmmreg*.xmmrm xmmreg.xmmrm xmmreg.xmmreg*.SD AVX.xmmrm xmmreg.SD AVX.xmmreg*.xmmrm xmmreg.SANDYBRIDGE 166 .xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE AVX.mem256 xmmreg.SO AVX.SD AVX.SD AVX.SD AVX.xmmreg*.SD AVX.xmmreg*.SD AVX.xmmreg*.SANDYBRIDGE.xmmrm xmmreg.SANDYBRIDGE.xmmreg xmmreg.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE AVX.SANDYBRIDGE.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SD AVX.SD AVX.xmmrm xmmreg.SD AVX.VCMPNGE_UQSD VCMPNGT_UQSD VCMPFALSE_OSSD VCMPNEQ_OSSD VCMPGE_OQSD VCMPGT_OQSD VCMPTRUE_USSD VCMPSD VCMPEQSS VCMPLTSS VCMPLESS VCMPUNORDSS VCMPNEQSS VCMPNLTSS VCMPNLESS VCMPORDSS VCMPEQ_UQSS VCMPNGESS VCMPNGTSS VCMPFALSESS VCMPNEQ_OQSS VCMPGESS VCMPGTSS VCMPTRUESS VCMPEQ_OSSS VCMPLT_OQSS VCMPLE_OQSS VCMPUNORD_SSS VCMPNEQ_USSS VCMPNLT_UQSS VCMPNLE_UQSS VCMPORD_SSS VCMPEQ_USSS VCMPNGE_UQSS VCMPNGT_UQSS VCMPFALSE_OSSS VCMPNEQ_OSSS VCMPGE_OQSS VCMPGT_OQSS VCMPTRUE_USSS VCMPSS VCOMISD VCOMISS VCVTDQ2PD VCVTDQ2PD VCVTDQ2PS VCVTDQ2PS VCVTPD2DQ VCVTPD2DQ VCVTPD2DQ VCVTPD2DQ VCVTPD2PS VCVTPD2PS xmmreg.SD AVX.xmmrm xmmreg.SD AVX.SANDYBRIDGE AVX.xmmreg*.mem128 xmmreg.xmmrm xmmreg.SD AVX.xmmrm xmmreg.SD AVX.SANDYBRIDGE.xmmreg*.xmmreg*.xmmrm xmmreg.SD AVX.xmmreg*.xmmreg xmmreg.ymmreg xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE AVX.xmmreg*.SD AVX.

SANDYBRIDGE.mem xmmreg.ymmreg*.rm32 xmmreg.SANDYBRIDGE.ymmreg*.xmmrm reg64.xmmrm xmmreg.xmmrm reg64.SANDYBRIDGE.SO AVX.rm64 xmmreg.SANDYBRIDGE AVX.xmmrm ymmreg.xmmrm.ymmreg*.ymmreg xmmreg.SANDYBRIDGE AVX.xmmrm xmmreg.SY AVX.xmmreg*.xmmrm reg32.SANDYBRIDGE.SD AVX.mem128 xmmreg.SANDYBRIDGE AVX.ymmreg.SY AVX.SANDYBRIDGE AVX.SY AVX.SO AVX.SY AVX.ND AVX.xmmreg*.SANDYBRIDGE.SD.LONG AVX.xmmreg*.xmmrm ymmreg.xmmreg*.SANDYBRIDGE AVX.xmmrm ymmreg.xmmreg*.SY AVX.rm64 xmmreg.SANDYBRIDGE.mem mem32 AVX.SANDYBRIDGE.SANDYBRIDGE.SO AVX.xmmreg*.SANDYBRIDGE.xmmreg*.xmmrm ymmreg.xmmrm ymmreg.xmmreg*.LONG AVX.xmmreg*.xmmreg*.xmmreg.SO AVX.imm xmmreg.ymmrm xmmreg.SY AVX.imm rm32.SO AVX.mem ymmreg.xmmreg.SD.SANDYBRIDGE.xmmrm.ymmreg*.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.rm32 xmmreg.SO AVX.SANDYBRIDGE.ND AVX.SD.SANDYBRIDGE.SD 167 .SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm reg32.xmmreg*.SANDYBRIDGE AVX.imm xmmreg.ymmreg*.SANDYBRIDGE.SD AVX.xmmrm xmmreg.SANDYBRIDGE.xmmrm ymmreg.SD AVX.mem256 xmmreg.SANDYBRIDGE.xmmrm ymmreg.ymmrm xmmreg.ymmrm xmmreg.ymmreg*.xmmreg*.SANDYBRIDGE.ymmrm.SANDYBRIDGE.LONG AVX.SO AVX.VCVTPD2PS VCVTPD2PS VCVTPS2DQ VCVTPS2DQ VCVTPS2PD VCVTPS2PD VCVTSD2SI VCVTSD2SI VCVTSD2SS VCVTSI2SD VCVTSI2SD VCVTSI2SD VCVTSI2SS VCVTSI2SS VCVTSI2SS VCVTSS2SD VCVTSS2SI VCVTSS2SI VCVTTPD2DQ VCVTTPD2DQ VCVTTPD2DQ VCVTTPD2DQ VCVTTPS2DQ VCVTTPS2DQ VCVTTSD2SI VCVTTSD2SI VCVTTSS2SI VCVTTSS2SI VDIVPD VDIVPD VDIVPS VDIVPS VDIVSD VDIVSS VDPPD VDPPS VDPPS VEXTRACTF128 VEXTRACTPS VHADDPD VHADDPD VHADDPS VHADDPS VHSUBPD VHSUBPD VHSUBPS VHSUBPS VINSERTF128 VINSERTPS VLDDQU VLDQQU VLDDQU VLDMXCSR xmmreg.xmmrm reg64.ymmrm xmmreg.SO AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE AVX.mem xmmreg.imm xmmreg.SANDYBRIDGE AVX.imm ymmreg.SO AVX.SY AVX.ymmrm xmmreg.imm xmmrm.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SANDYBRIDGE.ymmrm ymmreg.SO AVX.SANDYBRIDGE.ymmrm reg32.SO AVX.mem ymmreg.SY AVX.LONG AVX.xmmreg*.SANDYBRIDGE.xmmrm.xmmreg*.ymmreg*.SANDYBRIDGE AVX.xmmreg*.SANDYBRIDGE.SY AVX.SANDYBRIDGE.imm xmmreg.SD.xmmreg xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.LONG AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.SD AVX.xmmrm xmmreg.xmmrm reg64.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SD AVX.xmmreg*.SY AVX.xmmrm reg32.xmmreg*.SD AVX.ymmreg xmmreg.xmmrm.xmmrm xmmreg.SY AVX.mem256 xmmreg.xmmreg*.SANDYBRIDGE AVX.LONG AVX.SANDYBRIDGE.ymmrm xmmreg.

SY AVX.xmmreg xmmreg.SANDYBRIDGE.xmmrm xmmreg.xmmreg mem.SO AVX.SD AVX.SY AVX.SANDYBRIDGE.mem mem.SANDYBRIDGE.SANDYBRIDGE AVX.ymmreg xmmreg.mem mem.LONG AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.xmmreg*.ymmrm ymmrm.SY AVX.SANDYBRIDGE AVX.xmmreg ymmreg.SY AVX.SANDYBRIDGE AVX.SO AVX.SANDYBRIDGE.SY AVX.SO AVX.rm32 xmmreg.SANDYBRIDGE.SY AVX.SANDYBRIDGE.ymmrm ymmrm.SO AVX.ymmreg.xmmreg*.SANDYBRIDGE.ymmreg xmmreg.xmmreg*.SANDYBRIDGE 168 .xmmreg rm64.SO AVX.SANDYBRIDGE.ymmrm ymmrm.SY AVX.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.xmmrm xmmrm.ymmrm xmmreg.SO AVX.SY AVX.SANDYBRIDGE.SY AVX.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE.SY AVX.ymmreg.xmmreg.ymmrm xmmreg.ymmreg.ymmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SY AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmrm xmmreg.SANDYBRIDGE.xmmreg.ymmreg ymmreg.xmmreg xmmreg.xmmrm xmmreg.xmmreg ymmreg.ymmrm xmmreg.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg xmmreg.xmmrm ymmreg.xmmreg*.SY AVX.SO AVX.SANDYBRIDGE.xmmrm ymmreg.xmmreg.SANDYBRIDGE.ymmreg xmmreg.SY AVX.SY AVX.SO AVX.mem ymmreg.SO AVX.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.ymmrm ymmrm.xmmrm xmmrm.xmmreg.SANDYBRIDGE AVX.SY AVX.SY AVX.SANDYBRIDGE.SY AVX.SY AVX.mem ymmreg.SD AVX.SO AVX.ymmreg*.xmmrm xmmrm.SY AVX.xmmreg*.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE AVX.SO AVX.SANDYBRIDGE.ymmrm xmmreg.rm64 rm32.xmmreg*.LONG AVX.ymmreg xmmreg.SANDYBRIDGE.xmmreg.SO AVX.xmmreg ymmreg.ymmreg*.ymmreg*.SANDYBRIDGE.VMASKMOVDQU VMASKMOVPS VMASKMOVPS VMASKMOVPS VMASKMOVPS VMASKMOVPD VMASKMOVPD VMASKMOVPD VMASKMOVPD VMAXPD VMAXPD VMAXPS VMAXPS VMAXSD VMAXSS VMINPD VMINPD VMINPS VMINPS VMINSD VMINSS VMOVAPD VMOVAPD VMOVAPD VMOVAPD VMOVAPS VMOVAPS VMOVAPS VMOVAPS VMOVQ VMOVQ VMOVD VMOVQ VMOVD VMOVQ VMOVDDUP VMOVDDUP VMOVDQA VMOVDQA VMOVQQA VMOVQQA VMOVDQA VMOVDQA VMOVDQU VMOVDQU VMOVQQU VMOVQQU VMOVDQU VMOVDQU VMOVHLPS VMOVHPD VMOVHPD VMOVHPS xmmreg.SO AVX.SANDYBRIDGE.SANDYBRIDGE.mem AVX.ymmreg ymmreg.SD AVX.ymmrm ymmrm.SANDYBRIDGE.xmmrm xmmrm.SANDYBRIDGE.SANDYBRIDGE AVX.SO AVX.xmmreg*.SANDYBRIDGE.xmmreg*.ymmrm ymmrm.SANDYBRIDGE.xmmreg xmmreg.SD AVX.xmmreg*.xmmreg xmmreg.SY AVX.xmmreg xmmreg.xmmrm ymmreg.ymmreg*.ymmreg xmmreg.xmmreg mem.SANDYBRIDGE.xmmrm xmmrm.SANDYBRIDGE.mem mem.SY AVX.xmmreg ymmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm xmmreg.xmmrm ymmreg.

SY AVX.xmmreg mem.xmmrm ymmreg.SANDYBRIDGE.xmmreg mem.xmmreg*.xmmreg*.xmmrm.SO AVX.SANDYBRIDGE.xmmreg mem.SANDYBRIDGE.SY AVX.xmmreg ymmreg.xmmreg*.xmmrm ymmreg.SANDYBRIDGE.ymmreg*.SO AVX.SANDYBRIDGE.xmmrm xmmrm.SANDYBRIDGE.SO AVX.LONG AVX.mem mem.xmmreg*.xmmreg xmmreg.SANDYBRIDGE.SANDYBRIDGE.VMOVHPS VMOVLHPS VMOVLPD VMOVLPD VMOVLPS VMOVLPS VMOVMSKPD VMOVMSKPD VMOVMSKPD VMOVMSKPD VMOVMSKPS VMOVMSKPS VMOVMSKPS VMOVMSKPS VMOVNTDQ VMOVNTQQ VMOVNTDQ VMOVNTDQA VMOVNTPD VMOVNTPD VMOVNTPS VMOVNTPS VMOVSD VMOVSD VMOVSD VMOVSD VMOVSHDUP VMOVSHDUP VMOVSLDUP VMOVSLDUP VMOVSS VMOVSS VMOVSS VMOVSS VMOVUPD VMOVUPD VMOVUPD VMOVUPD VMOVUPS VMOVUPS VMOVUPS VMOVUPS VMPSADBW VMULPD VMULPD VMULPS VMULPS VMULSD VMULSS VORPD VORPD VORPS VORPS mem.xmmrm ymmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SANDYBRIDGE AVX.xmmrm xmmreg.SANDYBRIDGE AVX.mem xmmreg.xmmreg mem.SANDYBRIDGE.ymmrm AVX.ymmreg xmmreg.xmmreg xmmreg.ymmreg*.SO AVX.SY AVX.ymmreg reg32.SO AVX.SO AVX.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE AVX.SO AVX.SY AVX.SANDYBRIDGE.SY AVX.xmmreg xmmreg.ymmrm xmmreg.SANDYBRIDGE AVX.ymmreg xmmreg.xmmreg xmmreg.xmmreg xmmreg.ymmreg mem.SANDYBRIDGE.xmmreg reg64.SANDYBRIDGE AVX.SY AVX.xmmreg*.SY AVX.ymmreg*.xmmreg*.SANDYBRIDGE.SANDYBRIDGE AVX.ymmrm xmmreg.imm xmmreg.mem mem.SY AVX.SY AVX.xmmreg mem.mem xmmreg.xmmreg*.SANDYBRIDGE.ymmreg*.SD AVX.SANDYBRIDGE.xmmreg reg64.xmmreg ymmreg.SO AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SO AVX.ymmrm ymmrm.xmmrm ymmreg.SO AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.LONG AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.ymmreg xmmreg.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE.SY AVX.SANDYBRIDGE AVX.ymmreg reg64.xmmreg*.SO AVX.xmmreg reg32.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.mem mem.LONG AVX.SY AVX.xmmreg reg32.SANDYBRIDGE.SANDYBRIDGE AVX.SANDYBRIDGE.SANDYBRIDGE AVX.ymmreg xmmreg.ymmrm xmmreg.SO AVX.SANDYBRIDGE AVX.xmmrm xmmrm.SO AVX.ymmrm xmmreg.xmmreg xmmreg.xmmreg*.ymmreg mem.SANDYBRIDGE.SANDYBRIDGE AVX.SANDYBRIDGE.ymmreg reg32.xmmrm ymmreg.LONG AVX.ymmreg mem.xmmreg*.xmmreg*.xmmreg reg64.xmmrm ymmreg.SANDYBRIDGE.SY 169 .SANDYBRIDGE AVX.xmmreg xmmreg.SANDYBRIDGE.ymmrm ymmrm.xmmrm xmmreg.ymmrm xmmreg.SO AVX.SY AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.

SANDYBRIDGE.xmmreg*.SY ymmreg.SY ymmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmrm AVX.xmmrm.imm AVX.SO xmmreg.SO xmmreg.imm AVX.xmmreg.xmmrm AVX.SANDYBRIDGE.xmmreg*.imm AVX.ymmrm.xmmrm.xmmreg.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.imm AVX.SANDYBRIDGE.SO xmmreg.xmmrm.xmmrm.SY ymmreg.SO xmmreg.SO ymmreg.xmmreg*.SANDYBRIDGE.xmmrm.SANDYBRIDGE.SO xmmreg.SO ymmreg.xmmreg.imm AVX.SO xmmreg.ymmreg AVX.ymmrm.ymmreg.SO xmmreg.xmmrm.xmmrm.SO xmmreg.SO xmmreg.SO ymmreg.SO xmmreg.SO xmmreg.SO xmmreg.xmmreg.ymmreg.SANDYBRIDGE.xmmrm AVX.xmmreg*.ymmrm AVX.SANDYBRIDGE.xmmreg*.xmmrm.xmmrm AVX.SO xmmreg.xmmreg AVX.SANDYBRIDGE.xmmrm AVX.imm AVX.SANDYBRIDGE.SO xmmreg.SO xmmreg.ymmrm.SANDYBRIDGE.SANDYBRIDGE.xmmreg.SO xmmreg.xmmrm AVX.SANDYBRIDGE.SO xmmreg.SANDYBRIDGE.SANDYBRIDGE.ymmrm.SO xmmreg.xmmreg*.SANDYBRIDGE.SO ymmreg.xmmreg.xmmrm AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmrm.xmmrm AVX.xmmreg*.xmmrm AVX.xmmrm AVX.xmmreg AVX.ymmreg.xmmrm.xmmreg*.ymmreg.xmmrm AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg.SO xmmreg.SO xmmreg.ymmrm AVX.SO xmmreg.ymmreg.SANDYBRIDGE.imm AVX.ymmreg.ymmrm AVX.xmmreg*.SO xmmreg.xmmrm.xmmrm AVX.xmmreg*.xmmreg*.SO xmmreg.SANDYBRIDGE.SY xmmreg.xmmreg*.SO xmmreg.xmmrm AVX.ymmreg.SANDYBRIDGE.xmmreg AVX.SANDYBRIDGE.SANDYBRIDGE.ymmreg.SANDYBRIDGE.SO xmmreg.xmmreg*.SANDYBRIDGE.VPABSB VPABSW VPABSD VPACKSSWB VPACKSSDW VPACKUSWB VPACKUSDW VPADDB VPADDW VPADDD VPADDQ VPADDSB VPADDSW VPADDUSB VPADDUSW VPALIGNR VPAND VPANDN VPAVGB VPAVGW VPBLENDVB VPBLENDW VPCMPESTRI VPCMPESTRM VPCMPISTRI VPCMPISTRM VPCMPEQB VPCMPEQW VPCMPEQD VPCMPEQQ VPCMPGTB VPCMPGTW VPCMPGTD VPCMPGTQ VPERMILPD VPERMILPD VPERMILPD VPERMILPD VPERMILTD2PD VPERMILTD2PD VPERMILTD2PD VPERMILTD2PD VPERMILMO2PD VPERMILMO2PD VPERMILMO2PD VPERMILMO2PD VPERMILMZ2PD VPERMILMZ2PD VPERMILMZ2PD VPERMILMZ2PD VPERMIL2PD VPERMIL2PD VPERMIL2PD xmmreg.ymmreg AVX.SO xmmreg.xmmreg*.imm AVX.SO ymmreg.SANDYBRIDGE.SO xmmreg.xmmrm AVX.imm AVX.ymmrm.xmmrm AVX.SO xmmreg.SO xmmreg.SANDYBRIDGE.xmmrm AVX.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SO xmmreg.SANDYBRIDGE.SANDYBRIDGE.ymmreg AVX.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.SY 170 .SO xmmreg.imm AVX.xmmrm AVX.xmmreg.xmmrm AVX.xmmrm AVX.SANDYBRIDGE.ymmreg.SO xmmreg.xmmreg*.xmmreg*.xmmreg*.xmmreg*.ymmreg.xmmreg*.imm AVX.SANDYBRIDGE.xmmreg.xmmrm AVX.ymmreg.SANDYBRIDGE.SANDYBRIDGE.xmmrm AVX.SY xmmreg.ymmrm AVX.SY xmmreg.xmmrm AVX.xmmreg.xmmreg AVX.SO xmmreg.SO xmmreg.xmmreg.xmmreg.SANDYBRIDGE.SO ymmreg.SO xmmreg.xmmrm AVX.xmmrm AVX.xmmrm AVX.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SO xmmreg.ymmreg.SY xmmreg.xmmrm.SO xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmrm.xmmrm AVX.xmmreg.SANDYBRIDGE.xmmreg*.xmmrm AVX.xmmreg*.SO xmmreg.xmmrm AVX.xmmrm AVX.SY xmmreg.xmmreg*.xmmreg.xmmrm AVX.xmmrm AVX.

LONG reg32.ymmreg.ymmrm.xmmreg.SO xmmreg.SANDYBRIDGE.LONG xmmreg.imm AVX.rm32.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg.imm AVX.SO ymmreg.xmmreg*.xmmrm AVX.SW reg64.ymmrm AVX.xmmreg*.rm8.SO ymmreg.SANDYBRIDGE.ymmreg.xmmreg.xmmreg*.ymmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SO ymmreg.VPERMIL2PD VPERMILPS VPERMILPS VPERMILPS VPERMILPS VPERMILTD2PS VPERMILTD2PS VPERMILTD2PS VPERMILTD2PS VPERMILMO2PS VPERMILMO2PS VPERMILMO2PS VPERMILMO2PS VPERMILMZ2PS VPERMILMZ2PS VPERMILMZ2PS VPERMILMZ2PS VPERMIL2PS VPERMIL2PS VPERMIL2PS VPERMIL2PS VPERM2F128 VPEXTRB VPEXTRB VPEXTRB VPEXTRW VPEXTRW VPEXTRW VPEXTRW VPEXTRW VPEXTRW VPEXTRD VPEXTRD VPEXTRQ VPHADDW VPHADDD VPHADDSW VPHMINPOSUW VPHSUBW VPHSUBD VPHSUBSW VPINSRB VPINSRB VPINSRB VPINSRW VPINSRW VPINSRW VPINSRD VPINSRD VPINSRQ VPINSRQ VPMADDWD VPMADDUBSW ymmreg.xmmreg*.ymmrm.SANDYBRIDGE.ymmreg.SY ymmreg.LONG reg32.ymmrm.SO xmmreg.ymmreg AVX.xmmrm AVX.imm AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmreg.SO xmmreg.xmmreg*.ymmrm.xmmreg*.SANDYBRIDGE.SO xmmreg.imm AVX.imm AVX.mem.xmmreg.SANDYBRIDGE.SANDYBRIDGE.SY xmmreg.SANDYBRIDGE.mem.SO ymmreg.SANDYBRIDGE.imm AVX.imm AVX.xmmreg.ymmrm AVX.xmmrm AVX.ymmrm.ymmrm AVX.AR3 xmmreg.imm AVX.SANDYBRIDGE.SO 171 .ymmrm.ymmreg.xmmrm AVX.SANDYBRIDGE.xmmrm AVX.xmmrm.ymmreg.xmmreg*.imm AVX.ymmreg.SY ymmreg.SANDYBRIDGE.SO xmmreg.xmmreg.imm AVX.SO xmmreg.ymmreg.SANDYBRIDGE mem.ymmreg AVX.SY reg64.SANDYBRIDGE.AR3 xmmreg.reg32.SO xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg.SANDYBRIDGE.SY xmmreg.SO xmmreg.imm AVX.ymmreg AVX.imm AVX.ymmreg.imm AVX.SY ymmreg.xmmrm.imm AVX.LONG rm32.SANDYBRIDGE mem.xmmreg.xmmrm AVX.SY xmmreg.xmmreg.LONG xmmreg.LONG reg32.xmmreg.imm AVX.AR3 xmmreg.xmmreg.mem.xmmreg AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm AVX.imm AVX.SANDYBRIDGE.ymmrm.SO xmmreg.rm64.SANDYBRIDGE.SANDYBRIDGE reg64.AR3 xmmreg.SANDYBRIDGE.SANDYBRIDGE.imm AVX.xmmrm AVX.SANDYBRIDGE.xmmreg*.xmmreg.SANDYBRIDGE.SO ymmreg.LONG xmmreg.SANDYBRIDGE.AR3.imm AVX.xmmreg*.SANDYBRIDGE.SY xmmreg.ymmreg.SY ymmreg.SANDYBRIDGE.imm AVX.SY xmmreg.ymmreg.xmmreg*.xmmreg.xmmreg AVX.xmmreg*.ymmreg.xmmreg*.xmmreg.SD rm64.SANDYBRIDGE.AR3 xmmreg.xmmreg*.SW reg64.reg32.imm AVX.imm AVX.ymmreg.xmmreg.xmmreg*.ymmreg.xmmrm AVX.imm AVX.imm AVX.SANDYBRIDGE.xmmrm AVX.xmmreg.xmmrm.xmmrm.SANDYBRIDGE.SO xmmreg.SANDYBRIDGE.mem.ymmreg.SANDYBRIDGE.SY xmmreg.AR3.xmmreg.xmmreg.SANDYBRIDGE.xmmreg.SANDYBRIDGE.AR3 xmmreg.SO ymmreg.xmmreg.SANDYBRIDGE.xmmrm AVX.imm AVX.xmmreg*.imm AVX.SANDYBRIDGE.imm AVX.xmmreg.SANDYBRIDGE.imm AVX.SANDYBRIDGE.ymmreg.imm AVX.xmmrm AVX.SY ymmreg.AR3 xmmreg.SO xmmreg.xmmrm.SANDYBRIDGE.imm AVX.ymmrm.xmmreg.xmmrm.imm AVX.xmmreg*.SO xmmreg.SANDYBRIDGE.ymmrm AVX.SANDYBRIDGE.xmmrm AVX.xmmreg.SANDYBRIDGE mem.xmmreg.rm16.AR3 xmmreg.xmmreg.xmmreg*.xmmreg AVX.ymmreg.

SANDYBRIDGE.xmmreg*.SW AVX.xmmreg*.xmmreg*.xmmreg*.LONG AVX.imm xmmreg.xmmreg*.SO AVX.imm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.xmmrm.xmmrm AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmreg reg32.xmmrm xmmreg.xmmreg*.SD AVX.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm xmmreg.VPMAXSB VPMAXSW VPMAXSD VPMAXUB VPMAXUW VPMAXUD VPMINSB VPMINSW VPMINSD VPMINUB VPMINUW VPMINUD VPMOVMSKB VPMOVMSKB VPMOVSXBW VPMOVSXBD VPMOVSXBQ VPMOVSXWD VPMOVSXWQ VPMOVSXDQ VPMOVZXBW VPMOVZXBD VPMOVZXBQ VPMOVZXWD VPMOVZXWQ VPMOVZXDQ VPMULHUW VPMULHRSW VPMULHW VPMULLW VPMULLD VPMULUDQ VPMULDQ VPOR VPSADBW VPSHUFB VPSHUFD VPSHUFHW VPSHUFLW VPSIGNB VPSIGNW VPSIGND VPSLLDQ VPSRLDQ VPSLLW VPSLLW VPSLLD VPSLLD VPSLLQ VPSLLQ VPSRAW VPSRAW VPSRAD xmmreg.xmmreg*.SANDYBRIDGE.SO AVX.imm xmmreg.xmmreg*.xmmrm xmmreg.xmmreg xmmreg.SANDYBRIDGE AVX.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SO 172 .SD AVX.SANDYBRIDGE.SANDYBRIDGE AVX.SO AVX.SO AVX.xmmreg*.xmmrm xmmreg.xmmrm xmmreg.SD AVX.SANDYBRIDGE.xmmrm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE AVX.xmmrm xmmreg.xmmrm.SANDYBRIDGE.imm xmmreg.SO AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SO AVX.SO AVX.xmmreg*.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.SO AVX.xmmrm xmmreg.xmmreg*.SO AVX.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.SO AVX.xmmreg*.imm xmmreg.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SO AVX.SO AVX.imm xmmreg.SANDYBRIDGE.SO AVX.xmmreg*.xmmreg*.xmmreg*.xmmrm xmmreg.SO AVX.SANDYBRIDGE.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE AVX.xmmreg*.xmmreg*.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SANDYBRIDGE.imm xmmreg.SANDYBRIDGE AVX.SANDYBRIDGE AVX.SO AVX.xmmrm xmmreg.xmmrm.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE AVX.SANDYBRIDGE.SO AVX.SO AVX.SANDYBRIDGE AVX.xmmrm reg64.SANDYBRIDGE.xmmrm xmmreg.SW AVX.SO AVX.xmmrm xmmreg.SANDYBRIDGE.xmmreg*.xmmreg*.SO AVX.SO AVX.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.SO AVX.SANDYBRIDGE.xmmrm xmmreg.SANDYBRIDGE AVX.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmrm xmmreg.SO AVX.SO AVX.xmmreg*.xmmreg*.SO AVX.xmmrm xmmreg.xmmrm xmmreg.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SO AVX.xmmrm xmmreg.xmmreg*.xmmreg*.SANDYBRIDGE.xmmrm xmmreg.xmmrm xmmreg.SD AVX.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO AVX.xmmreg*.SANDYBRIDGE.xmmreg*.SO AVX.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmreg*.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.SANDYBRIDGE AVX.xmmrm xmmreg.

xmmrm.xmmreg*.xmmreg*.xmmrm xmmreg.xmmrm ymmreg.xmmrm xmmreg.SANDYBRIDGE.SO AVX.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.xmmreg*.xmmreg*.xmmrm xmmreg.SY AVX.xmmrm xmmreg.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SO AVX.xmmrm xmmreg.imm ymmreg.xmmrm xmmreg.SD AVX.SO AVX.imm xmmreg.SANDYBRIDGE.SO AVX.SD AVX.SO AVX.xmmreg*.VPSRAD VPSRLW VPSRLW VPSRLD VPSRLD VPSRLQ VPSRLQ VPTEST VPTEST VPSUBB VPSUBW VPSUBD VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW VPUNPCKHBW VPUNPCKHWD VPUNPCKHDQ VPUNPCKHQDQ VPUNPCKLBW VPUNPCKLWD VPUNPCKLDQ VPUNPCKLQDQ VPXOR VRCPPS VRCPPS VRCPSS VRSQRTPS VRSQRTPS VRSQRTSS VROUNDPD VROUNDPD VROUNDPS VROUNDPS VROUNDSD VROUNDSS VSHUFPD VSHUFPD VSHUFPS VSHUFPS VSQRTPD VSQRTPD VSQRTPS VSQRTPS VSQRTSD VSQRTSS VSTMXCSR VSUBPD VSUBPD VSUBPS VSUBPS xmmreg.SO AVX.xmmrm xmmreg.ymmrm AVX.xmmrm xmmreg.xmmrm xmmreg.SO AVX.SO AVX.SANDYBRIDGE.SANDYBRIDGE.SO AVX.SO AVX.xmmrm ymmreg.SANDYBRIDGE AVX.SANDYBRIDGE.xmmrm xmmreg.xmmreg*.SANDYBRIDGE.SO AVX.xmmreg*.xmmreg*.SANDYBRIDGE.SY AVX.xmmreg*.imm ymmreg.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.SO AVX.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.SY 173 .ymmrm xmmreg.SO AVX.SO AVX.SANDYBRIDGE.xmmreg*.imm ymmreg.xmmreg*.ymmrm.SANDYBRIDGE.SY AVX.SANDYBRIDGE.ymmrm xmmreg.xmmrm xmmreg.xmmreg*.SO AVX.SANDYBRIDGE AVX.SANDYBRIDGE AVX.xmmreg*.xmmrm xmmreg.SANDYBRIDGE.xmmreg*.SO AVX.imm xmmreg.imm xmmreg.SANDYBRIDGE.SO AVX.SANDYBRIDGE.imm xmmreg.ymmrm xmmreg.xmmreg*.SANDYBRIDGE AVX.xmmreg*.SO AVX.SANDYBRIDGE.SO AVX.SANDYBRIDGE.imm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.xmmrm ymmreg.xmmrm xmmreg.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.imm xmmreg.SO AVX.ymmrm xmmreg.SO AVX.imm xmmreg.ymmrm.xmmreg*.SO AVX.xmmreg*.SY AVX.xmmreg*.SY AVX.ymmreg*.SO AVX.SD AVX.SANDYBRIDGE.xmmreg*.SD AVX.SANDYBRIDGE.xmmreg*.xmmreg*.xmmrm xmmreg.xmmreg*.SANDYBRIDGE.SO AVX.xmmrm xmmreg.SO AVX.SANDYBRIDGE.xmmreg*.SANDYBRIDGE.ymmreg*.xmmrm ymmreg.xmmrm.xmmrm xmmreg.xmmrm.SY AVX.xmmreg*.xmmrm xmmreg.xmmrm.ymmrm.SANDYBRIDGE.SO AVX.imm ymmreg.xmmreg*.ymmreg*.SO AVX.SY AVX.xmmreg*.SD AVX.ymmreg*.xmmrm ymmreg.SANDYBRIDGE.SY AVX.SO AVX.xmmreg*.ymmrm.ymmrm xmmreg.imm xmmreg.SANDYBRIDGE.imm xmmreg.SANDYBRIDGE.SO AVX.SANDYBRIDGE.ymmrm xmmreg.SY AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm.xmmreg*.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.SANDYBRIDGE.xmmreg*.SANDYBRIDGE AVX.SO AVX.imm xmmreg.xmmrm xmmreg.xmmrm xmmreg.xmmrm mem xmmreg.SO AVX.xmmrm.SANDYBRIDGE.SANDYBRIDGE AVX.SY AVX.SANDYBRIDGE.

ymmrm xmmreg.SANDYBRIDGE.1.xmmrm xmmreg.xmmrm xmmreg.ymmreg.SO FMA.SO AVX.ymmrm xmmreg.WESTMERE.xmmrm xmmreg.FUTURE.ymmrm xmmreg.xmmrm.SD AVX.ymmrm xmmreg.SO AVX.SANDYBRIDGE.SY AVX.SY AVX.xmmrm xmmreg.ymmrm xmmreg.SO AVX.FUTURE.ymmreg*.SY FMA.xmmrm xmmreg.SY FMA.SANDYBRIDGE.SY AVX.FUTURE.SANDYBRIDGE.xmmreg*.SO AVX.SY AVX.ymmreg*.xmmrm ymmreg.28 Intel AVX Carry−Less Multiplication instructions (CLMUL) VPCLMULLQLQDQ VPCLMULHQLQDQ VPCLMULLQHQDQ VPCLMULHQHQDQ VPCLMULQDQ xmmreg.SO FMA.xmmreg*.xmmreg.imm SSE.ymmrm FMA.SO AVX.xmmrm xmmreg.xmmreg*.xmmrm xmmreg.1.SANDYBRIDGE AVX.ymmreg*.xmmreg*.ymmrm xmmreg.SO FMA.ymmrm xmmreg.SO B.SANDYBRIDGE.SO AVX.1.xmmrm ymmreg.xmmreg*.xmmreg.xmmrm ymmreg.SY AVX.xmmrm ymmreg.SANDYBRIDGE.xmmreg*.SO AVX.xmmreg.SO FMA.29 Intel Fused Multiply−Add instructions (FMA) VFMADD132PS VFMADD132PS VFMADD132PD VFMADD132PD VFMADD312PS VFMADD312PS VFMADD312PD VFMADD312PD VFMADD213PS VFMADD213PS VFMADD213PD VFMADD213PD VFMADD123PS VFMADD123PS xmmreg.SANDYBRIDGE.SANDYBRIDGE.SO FMA.ymmrm xmmreg.SY FMA.xmmrm xmmreg.xmmrm xmmreg.SY AVX.ymmreg.ymmrm xmmreg.VSUBSD VSUBSS VTESTPS VTESTPS VTESTPD VTESTPD VUCOMISD VUCOMISS VUNPCKHPD VUNPCKHPD VUNPCKHPS VUNPCKHPS VUNPCKLPD VUNPCKLPD VUNPCKLPS VUNPCKLPS VXORPD VXORPD VXORPS VXORPS VZEROALL VZEROUPPER xmmreg.SO FMA.xmmreg*.xmmrm.SANDYBRIDGE B.FUTURE.WESTMERE.SY FMA.xmmrm xmmreg.WESTMERE.SANDYBRIDGE.xmmreg*.SO B.xmmrm ymmreg.SANDYBRIDGE.xmmrm ymmreg.ymmreg.xmmreg.ymmreg*.xmmrm xmmreg.SO SSE.WESTMERE.SANDYBRIDGE.SO SSE.xmmreg.SY AVX.SANDYBRIDGE.27 Intel Carry−Less Multiplication instructions (CLMUL) PCLMULLQLQDQ PCLMULHQLQDQ PCLMULLQHQDQ PCLMULHQHQDQ PCLMULQDQ xmmreg.xmmreg*.SO AVX.SANDYBRIDGE.SANDYBRIDGE.xmmrm ymmreg.xmmrm ymmreg.ymmreg.SANDYBRIDGE.ymmreg.SO AVX.xmmreg*.WESTMERE.SANDYBRIDGE AVX.ymmrm xmmreg.ymmrm AVX.ymmreg.SANDYBRIDGE.FUTURE.SO FMA.SO AVX.SY AVX.SANDYBRIDGE.ymmrm xmmreg.SANDYBRIDGE.ymmrm xmmreg.FUTURE.SY FMA.imm AVX.SANDYBRIDGE AVX.xmmrm ymmreg.SANDYBRIDGE.xmmrm ymmreg.SO SSE.xmmreg*.FUTURE.FUTURE.xmmrm ymmreg.FUTURE.SANDYBRIDGE.xmmreg*.xmmreg.SY FMA.SY 174 .FUTURE.xmmreg.SANDYBRIDGE.xmmrm ymmreg.xmmreg*.SANDYBRIDGE.FUTURE.FUTURE.SO SSE.SO AVX.xmmrm ymmreg.xmmrm ymmreg.ymmreg.SANDYBRIDGE.SO AVX.ymmreg*.xmmrm ymmreg.ymmreg*.FUTURE.xmmrm xmmreg.SD AVX.ymmrm xmmreg.FUTURE.

ymmrm xmmreg.ymmreg.ymmreg.FUTURE.xmmrm ymmreg.FUTURE.ymmrm xmmreg.xmmreg.ymmrm xmmreg.SO FMA.ymmreg.xmmreg.ymmrm xmmreg.xmmreg.xmmreg.ymmreg.FUTURE.SO FMA.xmmrm ymmreg.ymmrm xmmreg.xmmrm ymmreg.xmmrm ymmreg.ymmrm xmmreg.FUTURE.xmmreg.SO FMA.ymmrm xmmreg.SO 175 .FUTURE.ymmrm xmmreg.FUTURE.FUTURE.FUTURE.ymmreg.SO FMA.ymmreg.ymmrm xmmreg.SY FMA.SO FMA.SY FMA.xmmrm ymmreg.xmmrm ymmreg.xmmreg.SY FMA.xmmreg.SO FMA.FUTURE.ymmreg.xmmreg.xmmrm ymmreg.FUTURE.FUTURE.xmmreg.FUTURE.xmmrm ymmreg.ymmreg.FUTURE.SY FMA.SO FMA.xmmrm ymmreg.SO FMA.SO FMA.ymmreg.xmmrm ymmreg.FUTURE.xmmreg.xmmrm ymmreg.FUTURE.FUTURE.ymmreg.SY FMA.SO FMA.xmmrm ymmreg.FUTURE.ymmreg.FUTURE.FUTURE.xmmreg.FUTURE.FUTURE.xmmrm FMA.xmmreg.ymmreg.xmmreg.SO FMA.xmmrm ymmreg.FUTURE.FUTURE.xmmrm ymmreg.FUTURE.SO FMA.FUTURE.SY FMA.FUTURE.ymmrm xmmreg.FUTURE.SY FMA.SO FMA.FUTURE.FUTURE.FUTURE.xmmrm ymmreg.FUTURE.ymmreg.SY FMA.FUTURE.ymmrm xmmreg.FUTURE.ymmreg.SY FMA.xmmreg.SO FMA.xmmreg.SO FMA.SY FMA.SO FMA.SY FMA.SY FMA.SY FMA.xmmrm ymmreg.SO FMA.ymmrm xmmreg.ymmreg.FUTURE.xmmrm ymmreg.SO FMA.SO FMA.xmmreg.xmmreg.ymmreg.ymmrm xmmreg.SY FMA.ymmreg.FUTURE.SY FMA.xmmrm ymmreg.SO FMA.ymmreg.ymmrm xmmreg.ymmreg.FUTURE.xmmreg.SY FMA.xmmrm ymmreg.xmmrm ymmreg.SY FMA.ymmrm xmmreg.xmmrm ymmreg.SO FMA.ymmreg.FUTURE.SY FMA.xmmrm ymmreg.SY FMA.ymmrm xmmreg.FUTURE.FUTURE.SY FMA.xmmreg.FUTURE.FUTURE.xmmreg.FUTURE.FUTURE.ymmreg.SO FMA.SY FMA.ymmrm xmmreg.ymmrm xmmreg.SO FMA.ymmrm xmmreg.FUTURE.xmmreg.SY FMA.ymmreg.xmmreg.xmmreg.FUTURE.SY FMA.ymmreg.FUTURE.xmmrm ymmreg.SY FMA.FUTURE.xmmreg.ymmreg.ymmrm xmmreg.FUTURE.xmmrm ymmreg.ymmrm xmmreg.ymmrm xmmreg.FUTURE.ymmreg.xmmreg.xmmrm ymmreg.xmmreg.xmmreg.ymmrm xmmreg.FUTURE.FUTURE.SY FMA.ymmrm xmmreg.SY FMA.ymmrm xmmreg.SO FMA.FUTURE.xmmrm ymmreg.SO FMA.VFMADD123PD VFMADD123PD VFMADD231PS VFMADD231PS VFMADD231PD VFMADD231PD VFMADD321PS VFMADD321PS VFMADD321PD VFMADD321PD VFMADDSUB132PS VFMADDSUB132PS VFMADDSUB132PD VFMADDSUB132PD VFMADDSUB312PS VFMADDSUB312PS VFMADDSUB312PD VFMADDSUB312PD VFMADDSUB213PS VFMADDSUB213PS VFMADDSUB213PD VFMADDSUB213PD VFMADDSUB123PS VFMADDSUB123PS VFMADDSUB123PD VFMADDSUB123PD VFMADDSUB231PS VFMADDSUB231PS VFMADDSUB231PD VFMADDSUB231PD VFMADDSUB321PS VFMADDSUB321PS VFMADDSUB321PD VFMADDSUB321PD VFMSUB132PS VFMSUB132PS VFMSUB132PD VFMSUB132PD VFMSUB312PS VFMSUB312PS VFMSUB312PD VFMSUB312PD VFMSUB213PS VFMSUB213PS VFMSUB213PD VFMSUB213PD VFMSUB123PS VFMSUB123PS VFMSUB123PD VFMSUB123PD VFMSUB231PS VFMSUB231PS VFMSUB231PD xmmreg.FUTURE.ymmrm xmmreg.ymmreg.SO FMA.

xmmrm ymmreg.xmmreg.xmmreg.FUTURE.SO FMA.SY FMA.xmmreg.SO FMA.SY FMA.ymmrm xmmreg.FUTURE.ymmreg.ymmreg.xmmrm ymmreg.FUTURE.FUTURE.ymmreg.xmmreg.SO FMA.ymmreg.xmmrm ymmreg.SY FMA.ymmreg.ymmreg.ymmrm xmmreg.ymmrm xmmreg.SY FMA.xmmrm ymmreg.ymmrm xmmreg.SO FMA.SY FMA.FUTURE.FUTURE.ymmrm xmmreg.xmmrm ymmreg.ymmreg.ymmreg.SY 176 .ymmrm xmmreg.SY FMA.FUTURE.FUTURE.xmmrm ymmreg.xmmrm ymmreg.FUTURE.SY FMA.FUTURE.FUTURE.ymmrm xmmreg.ymmreg.ymmreg.FUTURE.FUTURE.FUTURE.SO FMA.xmmreg.SO FMA.ymmrm xmmreg.SO FMA.ymmrm xmmreg.FUTURE.FUTURE.SY FMA.FUTURE.xmmrm ymmreg.FUTURE.SO FMA.SO FMA.xmmreg.SY FMA.ymmrm xmmreg.SO FMA.SY FMA.ymmrm xmmreg.FUTURE.xmmrm ymmreg.SY FMA.ymmrm xmmreg.xmmrm ymmreg.ymmrm xmmreg.SO FMA.ymmreg.FUTURE.FUTURE.ymmrm xmmreg.FUTURE.xmmreg.xmmreg.FUTURE.xmmrm ymmreg.ymmreg.FUTURE.SY FMA.ymmreg.ymmrm xmmreg.FUTURE.xmmrm ymmreg.xmmreg.xmmreg.xmmreg.ymmreg.VFMSUB231PD VFMSUB321PS VFMSUB321PS VFMSUB321PD VFMSUB321PD VFMSUBADD132PS VFMSUBADD132PS VFMSUBADD132PD VFMSUBADD132PD VFMSUBADD312PS VFMSUBADD312PS VFMSUBADD312PD VFMSUBADD312PD VFMSUBADD213PS VFMSUBADD213PS VFMSUBADD213PD VFMSUBADD213PD VFMSUBADD123PS VFMSUBADD123PS VFMSUBADD123PD VFMSUBADD123PD VFMSUBADD231PS VFMSUBADD231PS VFMSUBADD231PD VFMSUBADD231PD VFMSUBADD321PS VFMSUBADD321PS VFMSUBADD321PD VFMSUBADD321PD VFNMADD132PS VFNMADD132PS VFNMADD132PD VFNMADD132PD VFNMADD312PS VFNMADD312PS VFNMADD312PD VFNMADD312PD VFNMADD213PS VFNMADD213PS VFNMADD213PD VFNMADD213PD VFNMADD123PS VFNMADD123PS VFNMADD123PD VFNMADD123PD VFNMADD231PS VFNMADD231PS VFNMADD231PD VFNMADD231PD VFNMADD321PS VFNMADD321PS VFNMADD321PD VFNMADD321PD ymmreg.ymmreg.ymmrm xmmreg.FUTURE.xmmrm ymmreg.SO FMA.xmmreg.xmmreg.xmmrm ymmreg.xmmreg.SO FMA.SO FMA.FUTURE.FUTURE.SY FMA.FUTURE.xmmrm ymmreg.SY FMA.xmmrm ymmreg.FUTURE.FUTURE.ymmrm xmmreg.ymmreg.ymmrm xmmreg.xmmreg.ymmreg.ymmrm FMA.FUTURE.FUTURE.SY FMA.SY FMA.xmmrm ymmreg.SY FMA.ymmreg.ymmrm xmmreg.ymmreg.ymmrm xmmreg.ymmreg.ymmreg.ymmrm xmmreg.SY FMA.xmmreg.FUTURE.xmmreg.FUTURE.SY FMA.xmmreg.ymmrm xmmreg.FUTURE.xmmrm ymmreg.ymmrm xmmreg.FUTURE.FUTURE.xmmreg.xmmrm ymmreg.SO FMA.ymmreg.SO FMA.xmmrm ymmreg.SY FMA.xmmrm ymmreg.ymmrm xmmreg.xmmrm ymmreg.ymmreg.ymmreg.FUTURE.FUTURE.xmmrm ymmreg.SO FMA.FUTURE.SO FMA.ymmrm xmmreg.SY FMA.ymmreg.FUTURE.SO FMA.xmmreg.ymmreg.xmmreg.FUTURE.xmmrm ymmreg.xmmreg.SY FMA.FUTURE.FUTURE.FUTURE.FUTURE.ymmrm xmmreg.xmmrm ymmreg.xmmreg.SO FMA.SO FMA.SO FMA.SY FMA.ymmreg.FUTURE.SO FMA.FUTURE.SY FMA.SO FMA.SO FMA.FUTURE.xmmreg.SY FMA.xmmreg.SO FMA.FUTURE.SY FMA.FUTURE.xmmrm ymmreg.FUTURE.xmmreg.

xmmreg.SY FMA.ymmreg.xmmreg.xmmrm xmmreg.FUTURE.FUTURE.FUTURE FMA.FUTURE.FUTURE FMA.FUTURE.xmmreg.FUTURE.FUTURE FMA.SD FMA.xmmrm xmmreg.ymmrm xmmreg.xmmreg.FUTURE.FUTURE.ymmrm xmmreg.xmmrm xmmreg.SD FMA.ymmreg.SD FMA.ymmreg.FUTURE.ymmrm xmmreg.ymmrm xmmreg.SO FMA.xmmreg.xmmrm xmmreg.ymmreg.xmmrm xmmreg.FUTURE.FUTURE.FUTURE FMA.xmmrm xmmreg.FUTURE FMA.xmmrm xmmreg.FUTURE.FUTURE.FUTURE FMA.xmmreg.xmmrm xmmreg.FUTURE.FUTURE.FUTURE FMA.SD FMA.FUTURE.ymmrm xmmreg.FUTURE.xmmreg.SY FMA.xmmrm ymmreg.xmmrm ymmreg.SD FMA.ymmreg.xmmrm xmmreg.xmmreg.xmmreg.FUTURE FMA.xmmreg.FUTURE.FUTURE.FUTURE.xmmrm xmmreg.FUTURE.xmmrm xmmreg.xmmreg.SD FMA.xmmrm xmmreg.SD FMA.xmmrm FMA.SY FMA.FUTURE FMA.SD FMA.SD FMA.SD FMA.ymmreg.ymmreg.ymmrm xmmreg.xmmreg.xmmrm xmmreg.xmmrm xmmreg.SO FMA.xmmrm ymmreg.xmmrm xmmreg.xmmreg.xmmrm ymmreg.xmmrm xmmreg.xmmrm ymmreg.xmmreg.FUTURE.xmmrm xmmreg.FUTURE FMA.xmmrm xmmreg.xmmreg.SO FMA.xmmreg.ymmrm xmmreg.SO FMA.FUTURE.FUTURE FMA.FUTURE.FUTURE.SO FMA.ymmrm xmmreg.xmmrm ymmreg.SD FMA.xmmreg.ymmrm xmmreg.SO FMA.xmmreg.FUTURE.FUTURE.xmmreg.xmmreg.SO FMA.xmmreg.xmmreg.SO FMA.FUTURE FMA.ymmrm xmmreg.xmmrm ymmreg.xmmreg.FUTURE.SO FMA.SY FMA.xmmreg.xmmreg.FUTURE.ymmreg.xmmrm xmmreg.SY FMA.SY FMA.SY FMA.xmmrm ymmreg.ymmrm xmmreg.ymmreg.SO FMA.xmmrm xmmreg.xmmreg.FUTURE.SD FMA.ymmreg.xmmreg.SY FMA.xmmrm ymmreg.FUTURE.xmmreg.xmmrm xmmreg.xmmreg.SO FMA.xmmrm ymmreg.xmmreg.SO FMA.FUTURE.xmmrm xmmreg.FUTURE.SY FMA.SY FMA.xmmrm xmmreg.SD FMA.FUTURE.xmmrm xmmreg.FUTURE.xmmreg.FUTURE.FUTURE FMA.FUTURE.SD 177 .SD FMA.ymmreg.xmmreg.SY FMA.xmmrm ymmreg.FUTURE FMA.FUTURE.SY FMA.xmmrm ymmreg.xmmrm xmmreg.xmmreg.VFNMSUB132PS VFNMSUB132PS VFNMSUB132PD VFNMSUB132PD VFNMSUB312PS VFNMSUB312PS VFNMSUB312PD VFNMSUB312PD VFNMSUB213PS VFNMSUB213PS VFNMSUB213PD VFNMSUB213PD VFNMSUB123PS VFNMSUB123PS VFNMSUB123PD VFNMSUB123PD VFNMSUB231PS VFNMSUB231PS VFNMSUB231PD VFNMSUB231PD VFNMSUB321PS VFNMSUB321PS VFNMSUB321PD VFNMSUB321PD VFMADD132SS VFMADD132SD VFMADD312SS VFMADD312SD VFMADD213SS VFMADD213SD VFMADD123SS VFMADD123SD VFMADD231SS VFMADD231SD VFMADD321SS VFMADD321SD VFMSUB132SS VFMSUB132SD VFMSUB312SS VFMSUB312SD VFMSUB213SS VFMSUB213SD VFMSUB123SS VFMSUB123SD VFMSUB231SS VFMSUB231SD VFMSUB321SS VFMSUB321SD VFNMADD132SS VFNMADD132SD VFNMADD312SS VFNMADD312SD VFNMADD213SS xmmreg.xmmreg.xmmrm xmmreg.xmmreg.ymmreg.xmmreg.FUTURE.xmmrm xmmreg.FUTURE.xmmreg.xmmreg.ymmrm xmmreg.xmmrm xmmreg.xmmreg.xmmreg.xmmreg.

xmmrm xmmreg.SO xmmreg.FUTURE FMA.FUTURE B.30 VIA (Centaur) security instructions XSTORE XCRYPTECB XCRYPTCBC XCRYPTCTR XCRYPTCFB XCRYPTOFB MONTMUL XSHA1 XSHA256 PENT.FUTURE FMA.CYRIX PENT.xmmrm AMD.CYRIX PENT.SSE5.SO ymmreg.SD xmmreg.CYRIX PENT.CYRIX PENT.SO ymmreg.ymmreg*.SD FMA.SSE5 xmmreg.SSE5.SSE5 xmmreg.SO ymmreg.VFNMADD213SD VFNMADD123SS VFNMADD123SD VFNMADD231SS VFNMADD231SD VFNMADD321SS VFNMADD321SD VFNMSUB132SS VFNMSUB132SD VFNMSUB312SS VFNMSUB312SD VFNMSUB213SS VFNMSUB213SD VFNMSUB123SS VFNMSUB123SD VFNMSUB231SS VFNMSUB231SD VFNMSUB321SS VFNMSUB321SD xmmreg.FUTURE FMA.SO ymmreg.SSE5.xmmreg.xmmrm xmmreg.ymmrm.SSE5.FUTURE FMA.SY xmmreg.FUTURE.ymmreg*.ymmreg*.xmmreg.FUTURE FMA.1.xmmreg AMD.SSE5.xmmrm xmmreg.SD FMA.ymmrm AMD.SSE5.ymmrm*.xmmrm xmmreg.xmmrm AMD.ymmrm AMD.xmmreg.FUTURE.xmmreg*.FUTURE FMA.xmmreg.xmmreg.xmmrm xmmreg.xmmreg.xmmreg*.FUTURE.SSE5.xmmreg.SO 178 .imm AMD.FUTURE.xmmreg.FUTURE.xmmrm*. FMA4 and CVT16 instructions (SSE5) VCVTPH2PS VCVTPH2PS VCVTPH2PS VCVTPS2PH VCVTPS2PH VCVTPS2PH VFMADDPD VFMADDPD VFMADDPD VFMADDPD VFMADDPS VFMADDPS VFMADDPS VFMADDPS VFMADDSD VFMADDSD VFMADDSS VFMADDSS VFMADDSUBPD VFMADDSUBPD VFMADDSUBPD xmmreg.ymmreg*.xmmrm xmmreg.SD FMA.1.xmmreg.xmmreg.xmmreg*.xmmreg.SSE5.xmmrm xmmreg.CYRIX PENT.SD FMA.ymmreg AMD.xmmrm AMD.SD xmmreg.xmmreg*.xmmrm xmmreg.xmmreg AMD.FUTURE.SO ymmrm.SSE5.CYRIX B.xmmrm xmmreg.SSE5.xmmreg AMD.xmmreg AMD.xmmrm xmmreg.xmmreg*.xmmrm.SSE5 ymmreg.xmmreg.SSE5 xmmrm.ymmreg*.xmmrm FMA.FUTURE.ymmrm.xmmreg.SSE5.SO xmmrm.ymmreg AMD.xmmreg*.xmmreg.xmmrm xmmreg.xmmreg*.xmmreg.SSE5.xmmrm AMD.xmmreg.SO ymmreg.FUTURE.xmmreg.ymmreg AMD.FUTURE FMA.xmmreg*.ymmreg*.xmmrm.SY xmmreg.SD FMA.xmmreg.FUTURE FMA.SO ymmreg.SY xmmreg.xmmreg.xmmrm AMD.xmmreg*.xmmreg.xmmrm.xmmrm xmmreg.ymmreg.xmmreg AMD.31 AMD XOP.CYRIX PENT.ymmreg.SSE5.xmmrm xmmreg.CYRIX PENT.FUTURE FMA.xmmrm xmmreg.SY xmmreg.xmmrm xmmreg.imm AMD.SD FMA.SD FMA.imm AMD.imm AMD.SD FMA.FUTURE.xmmrm.SY xmmreg.xmmrm xmmreg.xmmreg*.SSE5.xmmreg*.imm AMD.SSE5.xmmrm xmmreg.xmmrm.ymmrm.xmmrm xmmreg.CYRIX PENT.imm AMD.xmmreg.xmmreg.xmmrm.xmmreg.xmmreg.ymmreg.SSE5.SD FMA.SSE5.

ymmreg*.ymmreg.SSE5.xmmrm AMD.ymmreg*.ymmrm.xmmrm.xmmreg AMD.xmmrm AMD.SO ymmreg.xmmrm AMD.xmmreg.ymmrm.xmmrm.SY xmmreg.ymmrm* AMD.xmmreg*.SSE5.xmmrm AMD.ymmrm AMD.xmmreg*.SO ymmreg.xmmrm AMD.SSE5.xmmreg*.ymmreg*.SSE5.SSE5.ymmreg.xmmreg*.SSE5.SO ymmreg.ymmreg*.xmmreg*.xmmreg AMD.xmmrm AMD.xmmrm AMD.SSE5.SO ymmreg.xmmreg*.ymmrm* AMD.SSE5.xmmreg AMD.SY xmmreg.SO ymmreg.SSE5 xmmreg.xmmrm AMD.SSE5.xmmrm.ymmreg*.xmmrm* AMD.SO ymmreg.SY 179 .xmmreg*.SY xmmreg.ymmrm AMD.ymmreg*.xmmrm.xmmrm AMD.xmmrm.ymmreg*.SO ymmreg.SD xmmreg.xmmreg*.xmmreg AMD.SSE5.xmmreg AMD.xmmreg.SY xmmreg.xmmreg.ymmreg*.ymmreg*.SO ymmreg.xmmreg*.SO ymmreg.ymmrm.ymmrm.xmmrm.ymmrm.ymmrm AMD.SSE5.ymmrm.SSE5.xmmreg*.ymmrm.ymmreg.xmmreg*.SY xmmreg.SSE5.SSE5.SD xmmreg.ymmreg.xmmrm* AMD.SSE5.xmmreg AMD.xmmreg.SSE5.SSE5.xmmreg.xmmreg AMD.SO ymmreg.ymmrm AMD.ymmreg.xmmreg*.SY xmmreg.SO ymmreg.xmmreg.xmmreg.ymmrm AMD.SY xmmreg.SSE5.SSE5.SO ymmreg.SY xmmreg.SO ymmreg.ymmreg.SO ymmreg.xmmrm.SY xmmreg.xmmreg.ymmreg*.xmmreg.SY xmmreg.ymmreg*.SY xmmreg.xmmrm AMD.ymmrm.ymmreg AMD.SSE5.xmmreg*.ymmreg AMD.SSE5.SSE5.SSE5.SO ymmreg.xmmreg.SY xmmreg.SSE5.SO ymmreg.xmmreg AMD.ymmreg.ymmreg AMD.SSE5.xmmreg*.xmmreg AMD.ymmreg AMD.xmmreg*.SSE5.xmmreg*.xmmreg*.ymmreg*.xmmreg*.SSE5.ymmreg AMD.ymmrm AMD.ymmrm.SD xmmreg.xmmreg*.xmmrm.SSE5.SSE5 xmmreg.SSE5.SY xmmreg.SY xmmreg.SSE5 xmmreg.ymmrm AMD.SSE5.ymmreg*.xmmreg*.ymmreg.xmmrm.SO ymmreg.SSE5.ymmreg*.xmmreg*.xmmrm.SSE5 xmmreg.xmmreg AMD.SSE5.xmmreg.SY xmmreg.ymmreg AMD.ymmreg AMD.SD xmmreg.ymmreg*.SD xmmreg.xmmreg AMD.xmmreg AMD.SSE5 xmmreg.SSE5.xmmrm AMD.SSE5 xmmreg.SY xmmreg.xmmreg*.SO ymmreg.SSE5.xmmrm AMD.xmmrm.SY xmmreg.SSE5.ymmreg AMD.VFMADDSUBPD VFMADDSUBPS VFMADDSUBPS VFMADDSUBPS VFMADDSUBPS VFMSUBADDPD VFMSUBADDPD VFMSUBADDPD VFMSUBADDPD VFMSUBADDPS VFMSUBADDPS VFMSUBADDPS VFMSUBADDPS VFMSUBPD VFMSUBPD VFMSUBPD VFMSUBPD VFMSUBPS VFMSUBPS VFMSUBPS VFMSUBPS VFMSUBSD VFMSUBSD VFMSUBSS VFMSUBSS VFNMADDPD VFNMADDPD VFNMADDPD VFNMADDPD VFNMADDPS VFNMADDPS VFNMADDPS VFNMADDPS VFNMADDSD VFNMADDSD VFNMADDSS VFNMADDSS VFNMSUBPD VFNMSUBPD VFNMSUBPD VFNMSUBPD VFNMSUBPS VFNMSUBPS VFNMSUBPS VFNMSUBPS VFNMSUBSD VFNMSUBSD VFNMSUBSS VFNMSUBSS VFRCZPD VFRCZPD VFRCZPS VFRCZPS ymmreg.ymmreg.SSE5.ymmreg*.xmmreg*.SO ymmreg.ymmreg*.SSE5.xmmreg AMD.SD xmmreg.SSE5.xmmrm AMD.SSE5.xmmreg*.xmmreg AMD.xmmreg*.xmmreg.SY xmmreg.xmmreg.ymmreg*.xmmreg.SY xmmreg.SSE5.xmmrm.xmmrm AMD.xmmreg*.SSE5.SSE5.ymmrm AMD.SSE5.SSE5.xmmreg*.ymmreg.xmmrm.xmmrm.SSE5.xmmrm.SSE5.SSE5.xmmreg*.xmmrm AMD.ymmreg*.xmmreg AMD.xmmreg*.ymmreg AMD.ymmrm AMD.SY xmmreg.xmmreg*.xmmreg.ymmrm AMD.SO ymmreg.

xmmrm.xmmreg*.xmmrm AMD.SO xmmreg.SSE5.SSE5.imm AMD.SSE5.SO xmmreg.SSE5 xmmreg.xmmrm* AMD.xmmrm* AMD.SSE5.SO xmmreg.SO xmmreg.xmmreg.SO xmmreg.SSE5.SSE5.xmmreg*.SSE5.xmmreg*.xmmreg AMD.xmmreg*.xmmreg*.xmmreg AMD.SY xmmreg.xmmrm.imm AMD.xmmrm*.xmmreg AMD.SO ymmreg.xmmreg*.xmmrm.SO xmmreg.SSE5.SO xmmreg.SO xmmreg.SSE5.SSE5.xmmrm* AMD.xmmrm.SSE5.imm AMD.xmmreg*.xmmreg AMD.imm AMD.SSE5.SSE5 xmmreg.SO xmmreg.SO xmmreg.SSE5.xmmreg AMD.SSE5.SSE5.xmmrm.xmmreg*.SSE5.ymmreg*.xmmrm* AMD.xmmreg*.SY xmmreg.xmmreg AMD.xmmrm* AMD.xmmreg AMD.SO xmmreg.xmmreg AMD.xmmrm.SSE5.SO xmmreg.xmmrm*.SSE5.SO xmmreg.SO xmmreg.SO xmmreg.SSE5.SSE5.SO xmmreg.xmmrm*.xmmreg AMD.SO 180 .xmmrm.xmmrm AMD.imm AMD.SD xmmreg.SSE5.SO xmmreg.xmmrm* AMD.SSE5.xmmrm.xmmrm*.SO xmmreg.SSE5.xmmrm* AMD.xmmrm* AMD.xmmreg*.SO xmmreg.imm AMD.SO xmmreg.SSE5.ymmreg*.SO xmmreg.imm AMD.xmmrm.SSE5.SO xmmreg.xmmreg*.imm AMD.SSE5.xmmrm* AMD.xmmrm* AMD.xmmrm AMD.SSE5.SSE5.xmmrm.ymmrm.xmmreg AMD.SO xmmreg.xmmreg AMD.SO xmmreg.xmmrm* AMD.xmmrm*.SO xmmreg.xmmrm*.SO xmmreg.xmmrm* AMD.SO xmmreg.xmmreg*.xmmreg AMD.SSE5.xmmrm.SSE5.SSE5.xmmrm.xmmrm* AMD.xmmrm.xmmreg AMD.SSE5.SSE5.SO xmmreg.VFRCZSD VFRCZSS VPCMOV VPCMOV VPCMOV VPCMOV VPCOMB VPCOMD VPCOMQ VPCOMUB VPCOMUD VPCOMUQ VPCOMUW VPCOMW VPHADDBD VPHADDBQ VPHADDBW VPHADDDQ VPHADDUBD VPHADDUBQ VPHADDUBWD VPHADDUDQ VPHADDUWD VPHADDUWQ VPHADDWD VPHADDWQ VPHSUBBW VPHSUBDQ VPHSUBWD VPMACSDD VPMACSDQH VPMACSDQL VPMACSSDD VPMACSSDQH VPMACSSDQL VPMACSSWD VPMACSSWW VPMACSWD VPMACSWW VPMADCSSWD VPMADCSWD VPPERM VPPERM VPROTB VPROTB VPROTB VPROTD VPROTD VPROTD VPROTQ VPROTQ VPROTQ VPROTW xmmreg.ymmrm AMD.SO ymmreg.xmmreg AMD.xmmrm.SO xmmreg.xmmrm*.SSE5.SSE5.SO xmmreg.SSE5.xmmreg AMD.SO xmmreg.SSE5.xmmreg AMD.xmmreg AMD.SO xmmreg.SSE5.SO xmmreg.xmmrm* AMD.xmmrm.SSE5.SSE5.imm AMD.xmmrm.SO xmmreg.SO xmmreg.xmmreg*.SO xmmreg.imm AMD.xmmreg*.SO xmmreg.xmmreg*.SSE5.xmmreg*.SO xmmreg.xmmreg*.xmmreg*.xmmrm* AMD.SO xmmreg.xmmrm.SSE5.xmmreg*.xmmreg AMD.SSE5.xmmrm.ymmreg.SSE5.xmmreg*.xmmrm.xmmrm AMD.SSE5.SO xmmreg.xmmreg*.ymmreg AMD.xmmreg*.SO xmmreg.SO xmmreg.xmmrm.xmmreg*.SSE5.xmmreg*.xmmreg.xmmreg*.xmmreg*.SSE5.xmmreg*.SO xmmreg.xmmrm.SSE5.xmmrm.SSE5.xmmrm* AMD.SSE5.xmmrm* AMD.xmmrm AMD.SO xmmreg.imm AMD.SO xmmreg.SSE5.

UNDOC X64.UNDOC X64.xmmrm xmmreg.UNDOC X64.SSE5.SO AMD.xmmrm*.xmmrm*.UNDOC P6.UNDOC P6.xmmrm*.SSE5.UNDOC X64.SO AMD.SSE5.xmmrm*.SO AMD.UNDOC 181 .UNDOC P6.xmmrm*.SSE5.xmmreg*.SO AMD.UNDOC X64.SSE5.xmmreg xmmreg.xmmreg xmmreg.SSE5.UNDOC X64.xmmreg*.SO AMD.SO AMD.SSE5.xmmreg xmmreg.SO AMD.xmmrm*.xmmreg*.SSE5.UNDOC P6.UNDOC P6.SSE5.SO AMD.xmmreg*.UNDOC P6.SO AMD.UNDOC X64.SSE5.UNDOC P6.SO AMD.SSE5.xmmreg*.xmmreg*.SO AMD.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.xmmrm*.xmmreg xmmreg.SSE5.SO AMD.SO AMD.xmmrm xmmreg.UNDOC X64.UNDOC P6.xmmrm xmmreg.xmmreg xmmreg.SO AMD.xmmreg xmmreg.xmmrm xmmreg.SO AMD.xmmrm xmmreg.xmmrm xmmreg.xmmreg*.xmmreg xmmreg.UNDOC P6.SSE5.UNDOC X64.1.xmmreg*.SSE5.UNDOC P6.UNDOC P6.imm xmmreg.xmmrm xmmreg.SO AMD.UNDOC P6.SO B.32 Systematic names for the hinting nop instructions HINT_NOP0 HINT_NOP0 HINT_NOP0 HINT_NOP1 HINT_NOP1 HINT_NOP1 HINT_NOP2 HINT_NOP2 HINT_NOP2 HINT_NOP3 HINT_NOP3 HINT_NOP3 HINT_NOP4 HINT_NOP4 HINT_NOP4 HINT_NOP5 HINT_NOP5 HINT_NOP5 HINT_NOP6 HINT_NOP6 HINT_NOP6 HINT_NOP7 HINT_NOP7 HINT_NOP7 HINT_NOP8 HINT_NOP8 HINT_NOP8 HINT_NOP9 HINT_NOP9 HINT_NOP9 HINT_NOP10 HINT_NOP10 HINT_NOP10 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 P6.UNDOC P6.UNDOC P6.xmmrm xmmreg.UNDOC P6.xmmrm*.UNDOC P6.VPROTW VPROTW VPSHAB VPSHAB VPSHAD VPSHAD VPSHAQ VPSHAQ VPSHAW VPSHAW VPSHLB VPSHLB VPSHLD VPSHLD VPSHLQ VPSHLQ VPSHLW VPSHLW xmmreg.xmmreg xmmreg.SSE5.UNDOC P6.xmmreg*.xmmrm*.SSE5.xmmrm AMD.UNDOC P6.UNDOC X64.SSE5.SO AMD.SSE5.

UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.HINT_NOP11 HINT_NOP11 HINT_NOP11 HINT_NOP12 HINT_NOP12 HINT_NOP12 HINT_NOP13 HINT_NOP13 HINT_NOP13 HINT_NOP14 HINT_NOP14 HINT_NOP14 HINT_NOP15 HINT_NOP15 HINT_NOP15 HINT_NOP16 HINT_NOP16 HINT_NOP16 HINT_NOP17 HINT_NOP17 HINT_NOP17 HINT_NOP18 HINT_NOP18 HINT_NOP18 HINT_NOP19 HINT_NOP19 HINT_NOP19 HINT_NOP20 HINT_NOP20 HINT_NOP20 HINT_NOP21 HINT_NOP21 HINT_NOP21 HINT_NOP22 HINT_NOP22 HINT_NOP22 HINT_NOP23 HINT_NOP23 HINT_NOP23 HINT_NOP24 HINT_NOP24 HINT_NOP24 HINT_NOP25 HINT_NOP25 HINT_NOP25 HINT_NOP26 HINT_NOP26 HINT_NOP26 HINT_NOP27 HINT_NOP27 HINT_NOP27 HINT_NOP28 HINT_NOP28 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC 182 .

UNDOC P6.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC 183 .UNDOC P6.UNDOC X64.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.HINT_NOP28 HINT_NOP29 HINT_NOP29 HINT_NOP29 HINT_NOP30 HINT_NOP30 HINT_NOP30 HINT_NOP31 HINT_NOP31 HINT_NOP31 HINT_NOP32 HINT_NOP32 HINT_NOP32 HINT_NOP33 HINT_NOP33 HINT_NOP33 HINT_NOP34 HINT_NOP34 HINT_NOP34 HINT_NOP35 HINT_NOP35 HINT_NOP35 HINT_NOP36 HINT_NOP36 HINT_NOP36 HINT_NOP37 HINT_NOP37 HINT_NOP37 HINT_NOP38 HINT_NOP38 HINT_NOP38 HINT_NOP39 HINT_NOP39 HINT_NOP39 HINT_NOP40 HINT_NOP40 HINT_NOP40 HINT_NOP41 HINT_NOP41 HINT_NOP41 HINT_NOP42 HINT_NOP42 HINT_NOP42 HINT_NOP43 HINT_NOP43 HINT_NOP43 HINT_NOP44 HINT_NOP44 HINT_NOP44 HINT_NOP45 HINT_NOP45 HINT_NOP45 HINT_NOP46 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.

UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC 184 .UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.HINT_NOP46 HINT_NOP46 HINT_NOP47 HINT_NOP47 HINT_NOP47 HINT_NOP48 HINT_NOP48 HINT_NOP48 HINT_NOP49 HINT_NOP49 HINT_NOP49 HINT_NOP50 HINT_NOP50 HINT_NOP50 HINT_NOP51 HINT_NOP51 HINT_NOP51 HINT_NOP52 HINT_NOP52 HINT_NOP52 HINT_NOP53 HINT_NOP53 HINT_NOP53 HINT_NOP54 HINT_NOP54 HINT_NOP54 HINT_NOP55 HINT_NOP55 HINT_NOP55 HINT_NOP56 HINT_NOP56 HINT_NOP56 HINT_NOP57 HINT_NOP57 HINT_NOP57 HINT_NOP58 HINT_NOP58 HINT_NOP58 HINT_NOP59 HINT_NOP59 HINT_NOP59 HINT_NOP60 HINT_NOP60 HINT_NOP60 HINT_NOP61 HINT_NOP61 HINT_NOP61 HINT_NOP62 HINT_NOP62 HINT_NOP62 HINT_NOP63 HINT_NOP63 HINT_NOP63 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 rm16 rm32 rm64 P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC X64.UNDOC P6.UNDOC P6.UNDOC X64.UNDOC P6.

see section 4. • %pop can now take an argument. • Revert the early expansion behavior of %+ to pre−2.06 behavior: %+ is only expanded late. • Support for thread−local storage in ELF32 and ELF64.lang.4.11. • Fix assert failure on certain operations that involve strings with high−bit bytes. • Correct the arguments to the POPCNT instruction.2. Use %[.2 Version 2. • Fix section alignment in the Mach−O format.Appendix C: NASM Version History C. See section 4. see section 7. C. long time NASM developer as well as moderator of comp. these are variants of the bin output format which output Intel hex and Motorola S−records. See section 7. • Update AVX support to version 5 of the Intel specification.1.7. Intel hex or Motorola S−records. and is the production version of NASM since 2007.3. Crayne.1 Version 2.strtab section in the elf64 output format. • Support for structures with a non−zero base offset. include error and warning information in the list file.3. • Support for 64−bit Mach−O output. which can output binary.07 • NASM is now under the 2−clause BSD license. • rdf2ihx replaced with an enhanced rdf2bin.1.. • The Windows installer now puts the NASM directory first in the PATH of the "NASM Shell". See section 4.x86 and author of the book Serious Assembler. • Yet another Mach−O alignment fix. 185 .1. • Fix the handling of COMMON directives in the obj output format. • Support for indirect macro expansion (%[. See section 1.8. • The argument to %use is no longer macro−expanded. • Don’t delete the list file on errors.10.] if macro expansion is desired..06 • This release is dedicated to the memory of Charles A. C.2 and section 7.. See section 7. We miss you. Also. • New ith and srec output formats. • Fix the section type for the . COM.1. Chuck.]). • Fix the handling of accesses to context−local macros from higher levels in the context stack.asm.9. thereby allowing constructs like O16 FSAVE to work correctly. respectively.1 NASM 2 Series The NASM 2 series support x86−64.1. • Treat WAIT as a prefix rather than as an instruction. • Fix crash on %ifmacro without an argument..

• Fix bug where ALIGN would issue a full alignment datum instead of zero bytes.7) involving floating−point numbers. • Massive overhaul of the ELF64 backend for spec compliance.05. • Fix error where NASM would generate a spurious warning on valid optimizations of immediate values. See section 2. • Fix RIP−relative offsets when the instruction carries an immediate. • −w−user can be used to suppress the output of %warning directives. • New %use macro directive to support standard macro directives. • Fix offsets in list files. 186 . • Fix nested %else clauses. See section 2.98 legacy behavior. • New %unmacro directive to undeclare a multi−line macro.5 Version 2. See section 7. See section 4.05.comment section.24. • Fix %ifn and %elifn.1.1. See section 3. • The PINSR series of instructions have been corrected and rationalized. C.4 Version 2.03) spec. • Fix arguments to a number of the CVT SSE instructions.04 • Sanitize macro handing in the %error directive. C.3.• Correctly handle preprocessor token concatenation (see section 4. • %error directives are now deferred to the final assembly phase.9. • Fix the Geode PFRCPV and PFRSQRTV instruction. • Fix the SSE 4. • Fix %include inside multi−line macros or loops. • Builtin macro __PASS__ which expands to the current assembly pass. C. replaced with the new XOP/FMA4/CVT16 (rev 3.6.5. • The ELF backends no longer automatically generate a .9. See section 4.11.3.2 CRC32 instruction.10.3 Version 2. • Excess default parameters to %macro now issues a warning by default.1. See section 4. • __utf16__ and __utf32__ operators to generate UTF−16 and UTF−32 strings.4. • Add additional "well−known" ELF sections with default attributes. • New %fatal directive to immediately terminate assembly.05 • Fix redundant REX.3.22. which was broken in NASM 2.1.4. • Correct the handling of nested %reps.01 • Fix the −w/−W option parsing.2. • New %strcat directive to join quoted strings together. • Make the behaviour of −O0 match NASM 0. See section 4.1.W prefix on JMP reg64. • Removed AMD SSE5. • New %warning directive to issue user−controlled warnings.

1.. • Fix optimizations of signed bytes. • Fix checking for critical expressions when the optimizer is enabled. AVX and VTX instructions. %idefine keyword $%? can be used to make a keyword "disappear".• Fix bug in case−insensitive matching when compiled on platforms that don’t use the configure script..01 • Fix buffer overflow in the listing module. It also runs even when disabled. • Support for x87 packed BCD constants. IMAGEREL for Win64 (SEH).7.. • dy. • Numerous bug fixes. INVVPID and MOVBE instructions. INCBIN reimplemented as a macro. • Fix the 256−bit FMA instructions.. omitting the context identifier results in an anonymous context. • Intel INVEPT. • The −F option now implies −g.4.03 • Add support for Intel AVX. • Fix the operand size of VMREAD and VMWRITE.03. 187 . • Fix operation on bigendian machines. especially to the AES. • Add 256−bit AVX stores per the latest AVX spec. • The Postscript/PDF documentation has been reformatted.6 Version 2. −MQ. Of the official release binaries.). • SAFESEH support for Win32. • %? and %?? to refer to the name of a macro itself.W prefix on indirect jumps in 64−bit mode.‘ strings. In particular. • VIA XCRYPT instructions can now be written either with or without REP. −MP.1. but doesn’t optimize. apparently different versions of the VIA spec wrote them differently. This allows most forward references to be resolved properly. • The optimizer now always runs until it converges. including YMM registers. • Fix unnecessary REX. C. that only affected the OS/2 binary. C. resy and yword for 32−byte operands. • New options for dependency generation: −MD. • %push no longer needs a context identifier. • Fix some SSE5 instructions. • Fix buffer overflow in the preprocessor. • Correct the LTR and SLDT instructions in 64−bit mode. • New preprocessor directives %pathsearch and %depend. CLMUL and FMA instructions. See section 3. −MT. • Add missing 64−bit MOVNTI instruction. • Support the DWARF debugging format for ELF targets. • Add AVX versions of the AES instructions (VAES.7 Version 2. • Fix the handling of hexadecimal escape codes in ‘. −MF.

using backquotes (‘. • New type of character/string constants.1. • Fix handling of truncated strings with DO.1. • Fix debugging info when using −f elf (backwards compatibility alias for −f elf32). • New compile date and time standard macros. • Fix forward references used in EQU statements. as well as (hopefully) SSE operands with oword. • Fix segfaults due to missing include files. • Man pages for rdoff tools (from the Debian project. • ELF: Experimental support for DWARF debugging information. • %ifnum now returns true for negative numbers.) • Fix the PREFETCH instructions. • Fix segfaults due to memory overwrites when floating−point constants were used. which support C−style escape sequences. • Fix the documentation. • Autogenerated instruction list added to the documentation.02 • Additional fixes for MMX operands with explicit qword.9 Version 2.‘).1. • Fix corrupt output when the optimizer runs out of passes.. • ELF: Fix segfault when generating stabs. C.) • ELF: handle large numbers of sections.00 due to 64−bit changes. • New %ifempty test for empty expansion.. 188 . • Fix OpenWatcom Makefiles for DOS and OS/2. • %defstr and %idefstr to stringize macro definitions before creation. • %substr can now be used to get other than one−character substrings. • Add support for the XSAVE instruction group. • Fix issue with some warnings getting emitted way too many times. and no symbols have been defined.00 • Added c99 data−type compliance.8 Version 2.10 Version 2. C.01 • Fix the handling of MMX registers with explicit qword tags on memory (broken in 2. C. • Add autogenerated instruction list back into the documentation. • Makefile for Netware/gcc.• %include now resolves macros in a sane manner. • New %iftoken test for a single token.

98. • Added a large number of additional instructions. octal and hexadecimal floating−point. • Added Infinity and NaN floating point support.24.39 • fix buffer overflow • fix outas86’s . • Renamed the elf output format to elf32 for clarity. • Added 8−.24.in. respectively. C. See section 2.bss handling • "make spotless" no longer deletes config. • Added setting OSABI value in ELF header directive. SSE4. • Added ELF Symbol Visibility support. • Add −w+all and −w−all to enable or disable all suppressible warnings. • Correct the generation of floating−point constants. • Significant performance improvements. SSE5 support. See section 2.• Added general x86−64 support. • Enhanced Send Errors to a File option. • Added Logical Negation Operator. 16− and 128−bit floating−point formats. • Added elf64 and macho (MacOS X) output formats. • Allow underscores in numbers. • Enhanced Stack Relative Preprocessor Directives. 189 .98 Series The 0. • Added floating−point option control.2 NASM 0. • Add −w+error to treat warnings as errors. • Enhanced ELF Debug Formats. • Added Generate Makefile Dependencies option.1. SSE4.1.1 Version 0. • Added __BITS__ standard macro.1. See section 2. • Added SSSE3. • Added Unlimited Optimization Passes option.98 series was the production versions of NASM from 1999 to 2007. C. • Added oword. • Added win64 (x86−64 COFF) output format. • Added %IFN and %ELIFN support. • −w+warning and −w−warning can now be written as –Wwarning and –Wno−warning. • Added binary.2.2. • Added Numeric constants in dq directive. do and reso pseudo operands.1.h.24.

• Cyrix XSTORE instruction.36 • Update rdoff – librarian/archiver – common rec – docs! • Fix signed/unsigned problems. movhps/movlps reg.• %(el)if(n)idn insensitivity to string quotes difference (#809300).5 Version 0. • Fix output/outbin. • Fix the ELF output format.2.98. • 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. • Fix JMP FAR label and CALL FAR label.2 Version 0.4 Version 0. • −O2 and −O3 are no longer aliases for −O10 and −O15.pl to be able to generate completely pathless dependencies. • Fix the SMSW and SLDT instructions.) • Fix the STR instruction. • Make −U switch work. • (nasm. e. C.g.bc3 workaround for compiler bug.98. and modify mkdep. If you mean the latter. • Make sure that all of the formats which support debugging output actually will suppress debugging output when −g not specified.3 Version 0.reg bugs in insns. please say so! :) C. • Fix the use of relative offsets with explicit prefixes. • Remove backslash(). • Add new multisection support – map files – fix align bug • Fix sysexit. patch from Martin Wawro.) 190 . C. but not explicit paths. as required by OpenWatcom wmake (it supports path searches.c to allow origin > 80000000h.98.dat • Q or O suffixes indicate octal • Support Prescott new instructions (PNI).2. which was broken under certain circumstances due to the addition of stabs support. • Added stabs debugging for the ELF output format. a32 loop foo.2.c)__OUTPUT_FORMAT__ changed to string value instead of symbol.35 • Fix build failure on 16−bit DOS (Makefile.98.38 • Add Makefile for 16−bit DOS binaries under OpenWatcom. C.37 • Paths given in −I switch searched for incbin–ed as well as %include–ed files.2.

• Complete rewrite of the PostScript/PDF documentation generator.) C. enabled by "CPU IA64". 191 . • Correctly generate an error for things like "SEG eax". where "label" points into a relocatable segment.2. as appropriate). operand−size confusions. • Undo a braindead change which broke %elif directives. • Issue an error on things like "jmp far eax". • More documentation updates. • Add support for unimplemented (but theoretically available) registers such as tr0 and cr5.ZZ. • Recognize . C. • Fix configure.6 Version 0.YY.33 • New __NASM_PATCHLEVEL__ and __NASM_VERSION_ID__ standard macros to round out the version−query macros. • The MS Visual C++ Makefile was updated and corrected. • Generate dependencies for all Makefiles automatically. 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.rodata as a standard section name in ELF.32 • Fix NASM crashing when %macro directives were left unterminated.) • Fix the handling of "ABSOLUTE label".98. • Makefile updates. • Add the JMPE instruction.pl now understands X. • New keyword "strict" to disable the optimization of specific operands.2.• Fix dependencies and compiler warnings.5x.0.98. C. equivalent to X.) • Minor changes for code legibility.YY. • Fix some obsolete Perl4−isms in Perl scripts. • Drop use of tmpnam() in rdoff (security fix.YY. • Correct compilation on newer gcc/glibc platforms. • Lots of documentation updates. • Add –Ov option to get verbose information about optimizations.7 Version 0. Some work still remains in this area. • Fix OBJ output format with lots of externs.ZZplWW as a version number. • Fix the handing of size overrides with JMP instructions (instructions such as "jmp dword foo". version.8 Version 0.34 • Correct additional address−size vs.WW.YYplWW or X.WW (or X.98.2. • Add –X option to specify error reporting format (use –Xvc to integrate with Microsoft Visual Studio.in to work with autoconf 2. • Add "const" in a number of places.

• Added –v option description to nasm man.25alt C.11 Version 0. • I waited a long time to rename zoutieee.28 to not confuse poor little apt−get. Moved files to more reasonable places.c to (original) outieee.2. C. C.) C. • Added INSTALL file with installation instructions.c • moved all output modules to output/ subdirectory.98. • Make the normal ". • Added ’make strip’ target to strip debug info from nasm & ndisasm.12 Version 0. incorporating all information in CHANGES and TODO.13 Version 0.28 • Fastcooked this for Debian’s Woody release: Frank applied the INCBIN bug patch to 0. C.2. • 16−bit support for ELF output format (GNU extension. • Fixes for 16−bit OBJ format output.25 • Line continuation character \.30 • Changed doc files a lot: completely removed old READMExx and Wishlist files.14 Version 0.pl script to misc/ directory.98. • New %ifmacro directive to test for multiline macros.98. C.98.98.98.25alt and called it 0.25alt • Prettified the source tree. • Added findleak. • Docs inadvertantly reverted – "dos packaging". • Attempted to fix doc. • Derive all references to the version number from the version file. • Changed the NASM environment variable to NASMENV./configure && make" work with Cygwin. 192 .98. but useful. • Documentation updates. • Lots of Makefile updates and bug fixes.2.2.10 Version 0.98.• Fix a couple of "make cleaner" misses.26 • Reorganised files even better from 0. • New standard macros __NASM_SUBMINOR__ and __NASM_VER__ macros.2. • Added dist makefile target to produce source distributions.98.2.9 Version 0.31 • Correctly build in a separate object directory again.

2.98..13 • There was no 0.15 Version 0.rdata" to "−f win32".24 • Documentation – Ndisasm doc added to Nasm.19 Version 0. Lu’s patch back out. C.98. Lu’s "bogus elf" patch. C.98. C.c (%$$ bug?). C.16 • Fix whitespace before "[section .2.98.2. (Red Hat problem?) C.22 • Update rdoff2 – attempt to remove v1.17 Version 0.2.28 Version 0. C.98.12 • Update optimization (new function of "−O1") • Changes to test/bintest.21 Version 0..24p1 • FIXME: Someone.16 Version 0.98. C.doc.2. C.2.98. C.98.13 C.98.2.23 • Attempted to remove rdoff version1 • Lino Mastrodomenico’s patches to preproc. J.25 Version 0. • Fix fixes to memory leaks.2.98.21 • Optimization fixes.20 Version 0.17 • H. 193 .15 • Rdoff changes (?).98.2.14 • Fix memory leaks.23 Version 0.98." bug.27 Version 0. C. document this please.18 • Added ".2. J.2.C.98.2.24 Version 0.18 Version 0.11 • Optimization changes.19 • H.29 Version 0.98.20 • Optimization fixes.98.26 Version 0.98. C.2.asm (?).2.22 Version 0.2. C. C.

but forward branches are assembled with code guaranteed to reach.31 Version 0. –O2 multi−pass optimization. • Changed GLOBAL_TEMP_BASE in outelf. if needed 194 .dat (?).2. other insns.98. except that back− ward JMPs are short. • More forgiving with the PUSH instruction.98.98bf C.10 C. –O1 strict two−pass assembly.• Ndisasm fixed. –O3 like –O2. • Unterminated string error reported. • Fixes to SSE2. etc. may produce larger code than –O0. • Add "−v" as an alias to the "−r" switch.98. and signed byte values with no explicit size specification will be assembled as a single byte. JMP and Jcc are handled more like 0.2.c from 6 to 15. • Update install. • Changed definition of the optimization flag: –O0 strict two−pass assembly.98 requires a size to be specified always.09b will imply the size from the current BITS setting (16 or 32).07 release to 98.09 • Add multiple sections support to "−f bin".98.2. overriding size specification. 0.98.08 • Add "%strlen" and "%substr" macro operators • Fixed broken c16.98. but will produce successful assembly more often if branch offset sizes are not specified. C. also will minimize signed immed− iate bytes. since backward branches in range of short offsets are recognized. 0.30 Version 0.09b as of 28−Oct−2001 • More closely compatible with 0.98 when –O0 is implied or specified.sh (?). • Enable uppercase "I" and "P" switches. • Fixed bugs as per 0.32 Version 0. • Remove "#ifdef" from Tasm compatibility options. Not strictly identical. if possible. minimize branch offsets.98.10 • There was no 0. ex".33 Version 0. • Remove redundant size−overrides on "mov ds.mac. • Case insinsitive "seg" and "wrt".2. • Improve "invalid effective address" messages.09b with John Coffman patches released 28−Oct−2001 Changes from 0.98. but more passes taken. C. • Allocate tokens in blocks.

c.98.98p1 • GAS−like palign (Panos Minos) • FIXME: Someone. (upper case letter O). "−O0" reverts the assembler to no extra optimization passes. "−O1" allows up to 5 extra passes.34 Version 0.. 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. C. ADD.37 Version 0.06f" C. without the need to code a specific size (short or near) for the branch.C.98.h".06f released 01/18/01 • – Add "metalbrain"s jecxz bug fix in insns.imm. perhaps. AND.06e released 01/09/01 • Removed the "outforms.imm’/’IMUL reg. XOR: when used as ’ADD reg16.imm’ or ’ADD reg32. Offsets on forward references will preferentially use the short form. then the 386 form of Jcc will be used instead.h. Here it is. –prefix command line switches.07" 01/28/01 • Cosmetic modifications to nasm. and "−O2"(default).39 Version 0.98. MODIFIED C. If compiling for a 386 or higher CPU. OR.2. 195 .src to match – version "0. AUTHORS.2. nasm. version "0. in cases where a short offset is out of bounds. allows up to 10 extra optimization passes.06e" 01/09/01 • fbk – finally added the fix for the "multiple %includes bug".98bf (bug−fixed) • Fixed – elf and aoutb bug – shared libraries – multiple "%include" bug in "−f obj" – jcxz.2. 08/07/00 • James Seter – –postfix. • Added multi−pass JMP and Jcc offset optimization.03 with John Coffman’s changes released 27−Jul−2000 • Added signed byte optimizations for the 0x81/0x83 class of instructions: ADC. • Nelson Rush resigns from the group.98.’ No size specification is needed.2.2.2. version "0.98.’ Also optimization of signed byte form of ’PUSH imm’ and ’IMUL reg.imm.38 Version 0. Added instructions for ’Jcc label’ to use the form ’Jnotcc $+3/JMP label’. • Yuri Zaporogets – rdoff utility changes.dat – alter nasmdoc. fill this in with details C..36 Version 0. CMP..35 Version 0.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. SUB. jecxz bug – unrecognized option bug in ndisasm C..98.reg. • Brian Raiter / fbk – "elfso bug" fix – applied to aoutb format as well – testing might be desirable.98. [list –] directives – ineptly implemented. SBB. should be re−written or removed. Big thanks to Nelson for his leadership and enthusiasm in getting these changes incorporated into Nasm! • fbk – [list +].h" file – it appears to be someone’s old backup of "outform. This feature is controlled by a new command−line switch: "O".

10). the "use16" and "use32" forms of the "bits 16/32" directive.98 sources. 386.c: Changes islocal() macro to support TASM style @@local labels. 686.2.rr. The 37 is a prime. • Integrated a block of changes from Andrew Zabolotny <bit@eltech. All instructions will be selected only if they apply to the selected cpu or lower. They work almost the same way as %define and %idefine but expand the definition immediately. PPro. 186.98. 486. Since additional label space is allocated dynamically.40 Version 0. so "xdefine" can be deciphered as "expand−and−define". Thus you can do things like this: %assign ofs %macro 0 arg 1 %xdefine %1 dword [esp+ofs] %assign ofs ofs+4 %endmacro 196 . This is nothing new. 286.• Added a new directive: ’cpu XXX’.ru>: • A new keyword %xdefine and its case−insensitive counterpart %ixdefine. • labels. • parser. P2. (minor) • Changed label allocation from 320/32 (10000 labels @ 200K+) to 32/37 (1000 labels). macros. %stacksize to directives table • Added support for TASM style directives without a leading % symbol. • Added to ’standard. (minor) C. pentium.mac’. makes running under DOS much easier.03 for historical reasons: 0.c: Added new directives. All are case insensitive. • preproc. 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. just conforms to a lot of other assemblers.98. The "x" suffix stands for "eXpand"." ––John Coffman <johninsd@san. and when compiled without TASM_COMPAT defined we get the exact same binary as the unmodified 0. • Added islocalchar() macro to support TASM style @@local labels. %arg. 586.10 rather than the NASM style mov DWORD [eax]. I call this version 0.c: Added macros to ignore TASM directives before first include • nasm.01. this should have no effect on large programs with lots of labels.mac. • standard. %local. • All changes can be compiled in and out using the TASM_COMPAT macros.c: Added support for TASM style memory references (ie: mov [DWORD eax]. Something like a cross between %define and %assign.com>.dat’.98.98−0. believed to be better for hashing.h: Added extern declaration for tasm_compatible_mode • nasm. P3 or Katmai. where XXX is any of: 8086. not on the invocation.03 "Integrated patchfile 0.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).02 was trashed.98. Corrected a couple of bugs in cpu−dependence in ’insns.

%ixdefine. For example. Now you can do things like: %define hello(x) Hello. so there are no quirks as before when using %$name arguments to macros. After my "fix" it will "correctly" expand into goodbye as expected. %ifctx goes through "false" branch. however current behaviour is more logical (and allows more advanced macro usage :−).%xdefine.%idefine. Now they are converted into . 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.. Besides. • Removed "user error: " prefix with %error directive: it just clobbers the output and has absolutely no functionality.name form when detokenizing.%macro. x! %define %$name andy %error "hello(%$name)" Same happened with %include directive.%iassign. 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). in macros etc. "incorrect" etc because this is rather a feature not a bug. If there is no active context. %assign. this allows to write macros that does not differ from built−in functions in any way.%define. • Added expansion of string that is output by %error directive. Note that I use quotes around words "correct". a good example are extended "proc" macros included in this archive. This also allows for lots of goodies.%undef 197 . Same change was applied to: %push.• Changed the place where the expansion of %$name macros are expanded. • Added a check for "cstk" in %if*ctx and %elif*ctx directives – this allows to use %ifctx without excessive warnings.@ctxnum. • 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.%imacro. For example: %macro %endm abc %$here %$here abc 1 %define %1 hello Now last line will be expanded into "hello" as expected. • Now all directives that expect an identifier will try to expand and concatenate everything without whitespaces in between before usage.

This removes annoying repeated errors on first and second passes from preprocessor. when enabled NASM warns when a macro self−references itself. However. even macro−parameter references %1 or local labels %$zz or macro−local labels %%zz − no warning will be emitted. 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). • Now if preprocessor is in a non−emitting state.• A new directive [WARNING {+|−}warning−id] have been added. • Added a "error" routine to preprocessor which always will set ERR_PASS1 bit in severity_code. it will take precedence over outer definition. the following piece: %push outer %define %$a [esp] %push %$a %pop %pop will expand correctly the fourth line to [esp]. • Added the %+ operator in single−line macros for concatenating two identifiers. Example: %if 1 mov %else put anything you want between these two brackets.ecx will produce a warning. • A new warning type: macro−selfref. but %ifdef won’t look in outer contexts. if we’ll define another %$a inside the "inner" context. inner eax. After this expansion is performed again so it becomes "_otherunc". for example the following source: [WARNING macro−selfref] %macro %rep push 1−* %0 push %1 %rotate 1 %endrep %endmacro push eax.ebx 198 . It works only if the assembly phase is enabled (i. By default this warning is disabled. %endif • Context−local variables on expansion as a last resort are looked up in outer contexts. this modification has been applied only to expand_smacro and not to smacro_define: as a consequence expansion looks in outer contexts. third line will become "_myfunc". it doesn’t work with nasm –e).e. no warning or error will be emitted. For example.ebx. Usage example: %define _myfunc _otherfunc %define cextern(x) _ %+ x cextern (myfunc) After first expansion.

• Updated License file per OK from Simon and Julian. but the Pentium III behaviour matches NASM. The origline wasn’t freed before exiting on success. The encoding differs from what the Intel manuals document. C.) • Verified that the NASM implementation of the PEXTRW and PMOVMSKB instructions is correct. C. • Fixed memory leak in %undef. which was removed when changing the diagnostic output to stdout.98p3 have been produced by H. • Invoke insns. reported by Pedro Gimeno.98p9 • Update documentation (although the instruction set reference will have to wait. • Change src/rdsrc. • The documentation comment delimiter is • Allow EQU definitions to refer to external labels.2. • Split doc files that can be built by anyone with a Perl interpreter off into a separate archive.pl once for each output script. Peter Anvin <hpa@zytor.com>. in the following case: #define SOMETHING SOMETHING C. Example: %define %$arg1 [esp+4] test eax. I don’t want to hold up the 0.98 All changes since NASM 0.43 Version 0. for example. • Fix Makefile dependency problems.spec file for building RPM (RedHat Package Manager) packages on Linux or Unix systems.2. Of course it could be worked around by using explicitely %$$arg1 but this is ugly IMHO.eax if nz mov eax. required for install−info to work. not the Intel manuals. minor massaging to make it compile in my environment. • Improve the Unix configure−based makefiles to make package creation easier. • Re−enable support for RDOFF v1. • Updated the RDOFF distribution to version 2 from Jules. reported by Pedro Gimeno. 199 .2.pl to include sectioning information in info output. so %$arg1 is not valid anymore inside "if". • Fixed trap in preprocessor when line expanded to empty set of tokens.This behaviour is needed because we don’t want nested contexts to act on already defined local macros. • Fix handling of implicit sizes in PSHUFW and PINSRW. This happens.%$arg1 endif In this example the "if" mmacro enters into the "if" context.98 release for it.42 Version 0. making Makefile. • Included an RPM . reported by Stefan Hoffmeister.41 Version 0.98p8 • Fix for "DB" when NASM is running on a bigendian machine.in legal for "make –j". • Resurrect the –s option.

98p7 • Fixed opcodes with a third byte−sized immediate argument to not complain if given "byte" on the immediate. • Fix for bug reported by Mark Junger: "call dword 0x12345678" should work and may add an OSP (affected CALL. so I can’t work on them right now. 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. Jcc). This allows Makefile options to be shared between cc and nasm.2.98p3. it still doesn’t include documentation for the various new instructions. so drop the p3. 200 .) • %undef preprocessor directive. • Various minor bugfixes (reported by): – Dangling %s in preproc.7 • (Hopefully) fixed the canned Makefiles to include the outrdf2 and zoutieee modules. –U.c (Martin Junker) • THERE ARE KNOWN BUGS IN SSE AND THE OTHER KATMAI INSTRUCTIONS. • Renamed changes.x notation.44 Version 0.os2) for Borland under OS/2.98 release. I am on a trip and didn’t bring the Katmai instruction reference.5 which had memory operands. Skipped p4 and p5 to avoid confusion with John Fine’s J4 and J5 releases. C. but add an –E option to redirect them elsewhere (the DOS shell cannot redirect stderr. that undefines a single−line macro.) • –M option to generate Makefile dependencies (based on code from Alex Verstak. however. –i and –p to be specified as –D. • Allow %undef to remove single−line macros with arguments. and the address−size prefix was missing from the instruction pattern. and –u option.6 • Fixed a bunch of instructions that were added in 0. –I and –P for compatibility with most C compilers and preprocessors. for example.98p6 • Took officially over coordination of the 0.2. • Went through the list of Katmai instructions and hopefully fixed the (rather few) mistakes in it.asm to changed.47 Version 0. • OS/2 Makefile (Mkfiles/Makefile.98p3. • Recognize "idt" or "centaur" for the –p option to ndisasm. from Chuck Crayne. • Allow –d. • Update the documentation. This matches the behaviour of #undef in the C preprocessor.asm. C.• "Dress rehearsal" release! C. • Minor cleanups.45 Version 0. • Fix for environments when "stderr" isn’t a compile−time constant. • Updated the License file per agreement with Simon and Jules to include a GPL distribution clause.2.46 Version 0. C. JMP.2. –u. • Changed error messages back to stderr where they belong.98p3. • (Hopefully) fixed a number of disassembler bugs related to ambiguous instructions (disambiguated by –p) and SSE instructions with REP.

98−J5 on my 0. John’s based 0. • DOS DJGPP+"Opus Make" Makefile from John S. "spotless" is union. see http://www. Cyrix opcodes also used in SSE.2.pl (introduced by me) which would cause conditional instructions to have an extra "cc" in disassembly.C.2. Fine.2.98p3. C. this merges the changes.3 • Patch from Conan Brink to allow nesting of %rep directives. 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.[ebx+0x20] • Added a bunch of Cyrix−specific instructions. Fine.98p3 changes).g.net/cz/johnfine/ • Changed previous "spotless" Makefile target (appropriate for distribution) to "distclean". • changes.98−J5 release. • If we’re going to allow INT01 as an alias for INT1/ICEBP (one of Jules 0.98p3.g.[ebx+0x10] 00000005 670F514320 paddsiw mm0. • Removed BASIC programs from distribution. Fine’s 0. e. C.3 release. and added "cleaner" target which is same as "clean" except deletes files generated by Perl scripts.5 • Merged in changes from John S.pl so that the order doesn’t matter.bin 00000000 670F514310 paddsiw mm0. I can’t test it. • Fix the "PRIV" flag on a bunch of instructions.51 Version 0.48 Version 0.[ebx+0x10] 00000005 670F514320 sqrtps xmm0.) 201 . Change insns.asm to include the latest changes.2 • Merged in John S. • Tried to clean up the <CR>s that had snuck in from a DOS/Windows environment into my Unix environment. • Updated changes.50 Version 0.csoft.dat wasn’t sorted properly.2.asm changes from John S. C. • Added AMD−only SYSCALL and SYSRET instructions.98p3. "jnz" disassembled as "jccnz".98−J4 prerelease. • Expanded the instructions flag field to a long so we can fit more flags. and add new Katmai MMX instructions. Fine’s changes from his 0. For example: ndisasm −p cyrix aliased. • Fix bug in insns.49 Version 0. • Make SSE actually work. Get a Perl interpreter instead (see below. • We would silently generate broken tools if insns. mark SSE (KNI) and AMD or Katmai−specific instructions as such. but this was the best I could do.4 • Made at least an attempt to modify all the additional Makefiles (in the Mkfiles directory).98p3. and try to make sure than DOS/Windows users get them back. then we should allow INT03 as an alias for INT3 as well. • Added a –p (preferred vendor) option to ndisasm so that it can distinguish e.bin 00000000 670F514310 sqrtps xmm0.98p3.[ebx+0x20] ndisasm −p intel aliased.

2.org/ports/index. Contribution due to Fox Cutter. • Fixed a problem with group specification in PUBDEFs in OBJ.2" rather than "p3−hpa2" because of John’s contributions. new layout help screen • fixed limit checking bug.gz to create a fully buildable version for Unix systems (Makefile.pl to create the instruction tables in nasm. • ELF had a hard limit on the number of sections which caused segfaults when transgressed. • Added ability for ndisasm to read from stdin by using ‘−’ as the filename. FXSAVE.h and names. SYSEXIT.55 Version 0.52 Version 0. 0.98 Prerelease 3. so that a new instruction can be added by adding it *only* to insns. updated Wishlist. UD1.2. reg’ bug. 202 . Get yourself a Perl interpreter for your platform of choice at http://www.) • Changed insns. Now MAX_SYMBOL is derived from insns. • ndisasm wasn’t outputting the TO keyword. so these changes were made "blind". FXRSTOR. fix a bunch of compiler warnings in that file. • Fixed a stale−pointer bug in the handling of the NASM environment variable.c). C. • 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. thus creating trouble later when the %else or %endif was encountered.c to do with truncating section names longer than 8 characters. • Improved ease of adding new output formats. UD2 (the latter two are two opcodes that Intel guarantee will never be used.cpan. and a couple of rdoff related bugs.98p3−hpa • Merged nasm098p3.53 Version 0.bas is already out of date.98 pre−release 3 • added response file support. • Fixed error cascade on bogus expression in %if – an error in evaluation was causing the entire %if to be discarded.• Calling this "pre−release 3.html. Thanks to Thomas McWilliams.98 pre−release 2 C.2. improved command line handling. insns.2. Fixed.in updates. etc. • Actually link in the IEEE output format (zoutieee.tar.97.zip with nasm−0. but LOADALL286 and LOADALL386 are 10 characters long. the other one just as "Undefined Opcode" –– calling it UD1 seemed to make sense. referencing beyond end of string.dat. • 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 note on the BASIC programs included: forget them.98 pre−release 1 • Fixed a bug whereby STRUC didn’t work at all in RDF.c.dat. ’OUT byte nn. • Added the following new instructions: SYSENTER. C. Note I don’t know what IEEE output is supposed to look like.) • MAX_SYMBOL was defined to be 9. 0.98 pre−release 2 • fixed bug in outcoff.54 Version 0. C. one of them is documented as UD2 in Intel documentation. • 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.

of which only the first is taken into account. • Fixed floating point constant problems (patch by Pedro Gimeno) • Fixed the return value of insn_size() not being checked for –1. *blush again* • Fixed seg−faults and bogus error messages caused by mismatching %rep and %endrep within multi−line macro definitions. • Fixed the problem with EQUs pointing to an external symbol – this now generates an error message.3. specifically objtest.0. • Fixed the GLOBAL EQU bug in ELF.doc back in to the distribution archives – it was missing in 0.96. ndisasm now does not rely on feof(). • Fixed failure to update all pointers on realloc() within extended− operand code in parser. • Added internal.97 released December 1997 • This was entirely a bug−fix release to 0. when the second had been invoked with a label defined before it.0. • Fixed stupid mistake in OBJ which caused ‘MOV EAX. C.0.<constant>’ to fail. rather than after.txt’ as a guideline for how to format code for contributors. which was causing 286−specific code to be generated needlessly on code of the form ‘shr word [forwardref].asm. didn’t expand the inner macro.98. some small problems in OBJ. • Stopped nested %reps causing a panic – they now cause a slightly more friendly error message instead.1 Version 0..• Forward reference tracking was instruction−granular not operand− granular.96 to be unable to assemble its own test files.’ • Fixed a subtle preprocessor bug whereby invoking one multi−line macro on the first line of the expansion of another.1’. • Incorporated John Fine’s command line parsing changes • Incorporated David Lindauer’s OMF debug support • Made changes for LCC 4. Caused by an error in the ‘MOV EAX. Thanks to Jim Hague for sending a patch. Was causing wrong behaviour and seg faults on lines such as ‘dd 0. eax + ebx’ bug. which seems to have got cursed. • Reformatted a lot of the source code to be more readable. Included ’coding.<segment>’ support.96 *blush* • Fixed bug causing 0.0. • ndisasm hung at EOF when compiled with lcc on Linux because lcc on Linux somehow breaks feof(). C. • Allowed multiple size prefixes to an operand. 203 . • Incorporated John Fine’s changes. Released developers release 3. • A heading in the documentation was missing due to a markup error in the indexing. • All messages now appear on stdout.0.0 support (__NASM_CDecl__. • Fixed the ’mov eax..0. and a reworking of label handling to define labels before their line is assembled.0.9 Series Revisions before 0. including fixes of a large number of preprocessor bugs.c.. indicating an error. Silly me. Fixed. as sending them to stderr serves no useful purpose other than to make redirection difficult. • Incorporated 3Dnow! instructions. removed register size specification warning when sizes agree).3 NASM 0.

3. • Separated DOS archives into main−program and documentation to reduce download size. TEST mem. • Added PIC support in ELF: use of WRT to obtain the four extra relocation types needed. • Fixed minor instruction table problems: FUCOM and FUCOMP didn’t have two−operand forms. whereby strange types of symbol (EQUs. • Fixed some buffer overrun problems with large OBJ output files.2 Version 0. • Removed the fixed−size temporary storage in the evaluator. • Fixed a problem with the local−label mechanism. • Implemented common−variable alignment. plus far−common element size specification.out’.• Fixed a problem with buffer overrun in OBJ. auto−defined OBJ segment base symbols) interfered with the ‘previous global label’ value and screwed up local labels. • Fixed a bug involving segfaults on disassembly of MMX instructions. it needs to be tested thoroughly. after discovering that ‘obj’ _also_ shouldn’t have a link pass separator in a module containing a non−trivial MODEND. by changing the meaning of one of the operand−type flags in nasm. Fixed name pollution under Digital UNIX: one of its header files defined R_SP. NDISASM didn’t recognise the longer register forms of PUSH and POP (eg FF F3 for PUSH BX). • Implemented NEAR and FAR keywords for common variables. in ELF. • 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. • Made preprocess−only mode actually listen to the %line markers as it prints them. so that the –a and –l options in conjunction would produce a useless listing file. ‘os2’ is no longer a valid object format name: use ‘obj’. and global−symbol type and size declarations. which broke the enum in nasm. Very very long expressions (like ‘mov ax. • Added a feature whereby EXTERNs and COMMONs in OBJ can be given a default WRT specification (either a segment or a group). Thanks to DJ Delorie for the bug report and fix. COMMON and EXTERN directives.1+1+1+1+. which was causing corruption at ends of long PUBDEF records. • Fixed a bug whereby the stub preprocessor didn’t communicate with the listing file generator.h. then ‘nasm sourcefile –o outputfile’ still gave the warning even though the ‘−o’ was honoured.imm32 was flagged as undocumented. in OBJ..foo | bar foo equ 1 bar equ 2 • Added the ALIGN and ALIGNB standard macros. the 32−bit forms of CMOV had 16−bit operand size prefixes. • Merged ‘os2’ object file format back into ‘obj’. 204 . so that it can report errors more sanely. This may cause other apparently unrelated MMX problems..’ for two hundred 1s or so) should now no longer crash NASM. if ‘nasm sourcefile’ would cause a filename collision warning and put output into ‘nasm. C. Flat segments are now declared using the FLAT attribute.96 released November 1997 • Fixed a bug whereby. ‘AAD imm’ and ‘AAM imm’ are no longer flagged as undocumented because the Intel Architecture reference documents them. • Added the ability for output file formats to define their own extensions to the GLOBAL.h.

in OBJ format. • Added the ‘*’ option for the maximum parameter count on multi−line macros. REPZ etc) to be alone on a line (without a following instruction). to deal with ‘MOV EAX. and FSTSW to bring it into line with the otherwise accepted standard.<segment>’ type references: OBJ doesn’t directly support dword−size segment base fixups.asm to demonstrate the use of this. FSTCW. was a deliberate feature based on a misunderstanding. FENI.BYTE 1 (the 286−and−upwards version whose constant happens to be 1). also added test/binexe. 205 . FINIT. • Added preprocess−time expression evaluation: the %assign (and %iassign) directive and the bare %if (and %elif) conditional. • Added some more preprocessor %if constructs: %ifidn / %ifidni (exact textual identity). • Added the __FILE__ and __LINE__ standard macros. • Changed NASM’s idiosyncratic handling of FCLEX. FDISI. DS. • Added the %0 token whereby a variadic multi−line macro can tell how many parameters it’s been given in a specific invocation. • Added the IMPORT and EXPORT directives in OBJ format.• Transformed the Unix NASM archive into an auto−configuring package. Thanks to Yann Guidon for contributing the EXE header code. though it was a deliberate feature. • Added the ability to specify sections’ alignment requirements in Win32 object files and pure binary files. allowing multi−line macro parameters to be cycled. Apologies for the inconvenience. The warning can be disabled. FSAVE.out format. • 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 NetBSD/FreeBSD/OpenBSD’s variant of a. • Added the ability. and the subsequent definitions are just ignored. allowing them to take arbitrarily many parameters. GLOBAL and COMMON to take more than one argument. LOCK. ^^ and ||. a word−size fixup can be generated instead and it will work. and %ifid / %ifnum / %ifstr (token type testing). but as long as the low two bytes of the constant term are zero. • Added %rotate. • Improved the flexibility of ABSOLUTE: you can now give it an expression rather than being restricted to a constant. • Added the ability to distinguish SHL AX. • Added the ability for the user−level forms of EXTERN.EXE files by hacking up an EXE header using DB and DW. The previous behaviour. • Added the ability for a variable to be declared as EXTERN multiple times. FSTENV. and it can take relocatable arguments as well.1 (the 8086 version) from SHL AX. • Added a sanity check for number constants being greater than 0xFFFFFFFF. to deal with Windows DLLs. complete with PIC shared library features. for use only in %if constructs: the standard relationals = < > <= >= <> (and C−like synonyms == and !=) plus low−precedence logical operators &&. GLOBAL and COMMON are valid identifiers. • Added misc/exebin. • Improved sanity checks on whether the arguments to EXTERN. • We now allow instruction prefixes (CS. • Added a preprocessor repeat construct: %rep / %exitrep / %endrep.mac to allow direct generation of . Added relational operators to the evaluator.

and other similar changes.3.c’ and ‘insnsd. and attempted to define global symbols without first explicitly declaring the target segment. rather than putting the 32−bit ones in FIXUPP32 (new−format) records. • Updates to Fox Cutter’s Borland C makefile. 206 . • Added the ‘−s’ command line option to redirect all messages which would go to stderr (errors. Donated by Mark Junker. • Fixed a bug in OBJ which caused all fixups to be output in 16−bit (old−format) FIXUPP records. Makefile.3 Version 0. • Positivity sanity check in TIMES argument changed from a warning to an error following a further complaint. since they were obsolete anyway.c’ and convert ‘insns.bas’ and ‘insns. • Removed [INC] and [INCLUDE] support for good. • Added an include file search path: the ‘−i’ command line option.c’.c which was causing exceptions in cleanup_labels() on some systems. • Added makefiles (for NASM and the RDF tools) to build Win32 console apps under Symantec C++. • Changed the acceptable limits on byte and word operands to allow things like ‘~10111001b’ to work. This is important since [ESI+EBP] and [EBP+ESI] have different default base segment registers. • Fixed a bug relating to 32−bit PC−relative fixups in OBJ. • Changed the diassembled forms of the conditional instructions so that JB is now emitted as JC. • Added the ‘−w’ command line option to selectively suppress some classes of assembly warning messages. Now it does.doc.bas’. • Added. • Added ‘@’ to the list of valid characters to begin an identifier with. notably the addition of the ‘Common Problems’ section in nasm. • Added ‘macros.95 released July 1997 • Fixed yet another ELF bug. • Fixed inadequate error checking on the commas separating the arguments to ‘db’. • 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. tentatively. help text) to stdout instead. • Removed a spurious second fclose() on the output file.• ndisasm forgot to check whether the input file had been successfully opened. C. • Added a hinting mechanism to allow [EAX+EBX] and [EBX+EAX] to be assembled differently.dat’ to ‘insnsa. • Added the ‘−p’ pre−include and ‘−d’ pre−define command−line options.bc2. • Documentary changes. QBasic versions of the Perl scripts that convert ‘standard. • Added support for the PharLap OMF extension for 4096−byte segment alignment. • Fixed a bug in perm_copy() in labels. Doh! • Added the Cyrix extensions to the MMX instruction set.mac’ to ‘macros. ‘dw’ etc. Suggested list by Ulrich Doewich. OS/2 object file support (as a minor variant on OBJ). Also thanks to Mark Junker. • Fixed a major problem in the preprocessor which caused seg−faults if macro definitions contained blank lines or comment−only lines. • Fixed a crippling bug in the handling of macros with operand counts defined with a ‘+’ modifier. This one manifested if the user relied on the default segment.

in the absence of any explicit segment definition. • Errors in pass two now cause the program to return a non−zero error code.vc for this purpose. so that macros like ‘extrn’ as given in the documentation can be implemented. • Stopped FBLD and FBSTP from _requiring_ the TWORD keyword.92. which were causing ‘ld’ to continue to seg−fault in a lot of non−trivial cases. Previously they complained unless no keyword at all was present. this one occurring in code of the form rol ax. and also may be greater than 64K (which previously didn’t work on 16−bit systems). Thanks to Thobias Jones for the information.4 Version 0.3. • From this version forward. • Some forms of FDIV/FDIVR and FSUB/FSUBR were still inverted: a vestige of a bug that I thought had been fixed in 0. IBTS. • Added the __NASM_MAJOR__ and __NASM_MINOR__ standard defines. XBTS and LOADALL286. Win32 console−mode binaries will be included in the DOS distribution in addition to the 16−bit binaries. if anyone bothers to provide it. donated by Dominik Behr. 207 . which was too restrictive in that you couldn’t do ‘mov ax. • Added undocumented instructions SMI. which is the only option for BCD loads/stores in any case. C. Also reorganised CMPXCHG instruction into early−486 and Pentium forms. and misc/pmw.c to prevent compiler warnings. • Fixed a problem with OBJ format whereby. • Added the NASM environment variable. • Ensured FLDCW. • Fixed the implementation of WRT. hopefully for good this time.94 released April 1997 • Major item: added the macro processor. • Added the INCBIN pseudo−opcode. • Fixed the single−line macro cycle detection.. • Fixed two more stupid bugs in ELF. • Another minor phase error (insofar as a phase error can _ever_ be minor) fixed. • Added Watcom C makefiles. This was fixed.. at the request of Fox Cutter. which didn’t work at all on macros with no parameters (caused an infinite loop). • Added an alternative memory−reference syntax in which prefixing an operand with ‘&’ is equivalent to enclosing it in square brackets. • Added ‘return 0.’ to test/objlink. Added Makefile. FSTCW and FSTSW can cope with the WORD keyword.bat.[di+abc wrt dgroup]’ because (di+abc) wasn’t a relocatable reference.• Fixed a silly little preprocessor bug whereby starting a line with a ‘%!’ environment−variable reference caused an ‘unknown directive’ error. Also changed the behaviour of single−line macro cycle detection to work like cpp. which they didn’t before. non−global symbols declared in the implicit default segment generated spurious EXTDEF records in the output.forward_reference forward_reference equ 1 • The number supplied to TIMES is now sanity−checked for positivity. • Added the long−awaited listing file support: the ‘−l’ command line option. • Fixed a seg−fault in the label manager.

6 Version 0.• Due to the advent of the preprocessor. notably documentation of the fact that Borland Win32 compilers use ‘obj’ rather than ‘win32’ object format. • Included a new Borland C makefile. donated by Fox Cutter <lmb@comtch.c. • Documentary changes. Makefile.3.3. • Fixed a bug causing segfaults in large RDF files. the [INCLUDE] and [INC] directives have become obsolete. when an offset contained a forward reference and so 4 bytes were allocated for the offset in pass one. • Updates to RDOFF subdirectory. • Compiled the DOS binaries with a sensible amount of stack.7 Version 0.com>. • OBJ format now strips initial periods from segment and group definitions. causing instruction size mismatch between passes and hence incorrect address calculations. • Support for RDF added.3.iea. Was causing ‘ld’ to seg−fault under Linux. and changes to outrdf. Fixed. C. • Revised for Borland C: some variable names changed. • Fixed the COMENT record in OBJ files.92 released January 1997 • The FDIVP/FDIVRP and FSUBP/FSUBRP pairs had been inverted: this was fixed. • Support for DBG debugging format added. They are still supported in this version. • Support for 32−bit extensions to Microsoft OBJ format added. *blush* • Had problems with EA instruction sizes changing between passes. 208 . • Fixed a bug in disassembling far calls and jumps in NDISASM.93 released January 1997 This release went out in a great hurry after semi−crippling bugs were found in 0. but won’t be in the next. by pass two the symbol had been defined and happened to be a small absolute value.5 Version 0.91 released November 1996 • Loads of bug fixes. • Added support for user−defined sections in COFF and ELF files.bc2. C. which was formatted incorrectly. C.symtab was hard−coded as 7. • Really did fix the stack overflows this time. to prevent stack overflows on any arithmetic expression containing parentheses. even when this didn’t fit with the real section table). which caused incorrect object records to be output when absolute labels were made global. makefile added. This also affected the LCC driver. • Stupid bug in the revised ELF section generation fixed (associated string−table section for . • Fixed a bug in handling of files that do not terminate in a newline. • Fixed a bug in OBJ format. with a warning. so only 1 byte got allocated. • Fixed a bug regarding 32−bit effective addresses of the form [other_register+ESP]. in order to avoid complications with the local label syntax.92. • LCC support revised to actually work.

Other changes from previous version (0. • Range checking on short jumps implemented.• JMP/CALL NEAR/FAR notation added. First support for object file output. • Memory handling improved to bypass 64K barrier under DOS. C. • $ prefix to force treatment of reserved words as identifiers added. 209 . ~ and c{?} are now valid characters in labels. • Default−size mechanism for object formats added. @.90 released October 1996 First release version. • −e and −k options in NDISASM added. • Compile−time configurability added.8 Version 0. • MMX instruction support added.3. • Negative floating point constant support added. • ‘a16’. ‘o16’. • #. ‘a32’ and ‘o32’ prefixes added.3x) too numerous to document.

versus 32−bit mode 64−bit displacement 64−bit immediate 34 50 33. mixed−size address−size prefixes algebra ALIGN smart ALIGNB alignment in bin sections in elf sections in obj sections in win32 sections of elf common variables ALIGNMODE __ALIGNMODE__ ALINK alink. 43 39 39 39 39 33 50 33 44 33 34 33 34 36. 88 33 59 54 33. 75 33 109 26 29 64. 43 33 33 50 33 50 50 50 50 50 50 33 27 33 50 33 50 34 45 47 66 113 112 −a option A16 a16 A32 a32 A64 a64 a86 ABS ABSOLUTE addition addressing. 29. 75 65 64 73 84 75 78 86 65 65 90 90 23 84 65 14 65 24 87 87 87 87. 72. 105 56 97. 87 66 21 40 25 63 16 210 . 85 33 26.Index ! operator. 119 26 110 26 110 26 110 14.sourceforge. 104 14. 24. 25 29 68.lang. 65.asm altreg ambiguity a. unary != operator $$ token $ Here token prefix % operator %! %$ and %$$ prefixes %% operator %+ %? %?? %[ & operator && operator * operator + modifier + operator binary unary − operator binary unary ..@ symbol prefix / operator // operator < operator << operator <= operator <> operator = operator == operator > operator >= operator >> operator ? MASM syntax ^ operator ^^ operator | operator || operator ~ operator %0 parameter count %+1 and %−1 syntax 16−bit mode.net all alloc alternate register names alt.out BSD version Linux version aout aoutb %arg arg as86 assembler directives assembly−time options %assign ASSUME AT Autoconf 21.

104 __DATE__ 61 __DATE_NUM__ 61 DB 27. 100 c32. 102 C symbol names 93 c16. 88 data structure 97. 35. 88 bugs 116 bugtracker 116 BYTE 115 C calling convention 95. 55 context−local labels 54 context−local single−line macros 54 counting macro parameters 45 CPU 70 CPUID 31 creating contexts 54 critical expression 27. 20 DOS archive DOS source archive 15 211 .programmer 93 concatenating macro parameters 46 concatenating strings 41 condition codes as macro parameters 47 conditional assembly 48 conditional jumps 115 conditional−return macro 47 configure 16 constants 29 context stack 53. 42.autoexec. 37.asm. 72 __BITS__ 61 bitwise AND 33 bitwise OR 33 bitwise XOR 33 block IFs 55 boot loader 72 boot sector 115 Borland Pascal 98 Win32 compilers 74 braces after % sign 47 around macro parameters 42 BSD 105 . 31 character strings 30 circular references 37 CLASS 75 %clear 59 coff 84 colon 26 .comment 84 COMMON 69. 37 defining sections 67 %defstr 41 %depend 53 design goals 24 DevPac 27. 102 djlink 90 DLL symbols exporting 76 importing 76 DO 27. 31 debug information 19 debug information format 19 declaring structures 62 DEFAULT 67 default 86 default macro parameters 44 default name 72 default−WRT mechanism 77 %define 20. 88 _DATA 95 data 86.lang.data 84.bat 15 auto−sync 119 −b 118 bin 18.COM 72. 74 elf extensions to 86 obj extensions to 77 Common Object File Format 84 common variables 69 alignment in elf 86 element size 77 comp. 15 comp.msdos. 38.mac 104 CALL FAR 34 case sensitivity 24.bss 84.os. 87. 50. 72 multisection 73 binary 29 binary files 27 bit shift 33 BITS 66. 92 command−line 17. 68 −D option 20 −d option 20 .mac 97. 72 commas in macro parameters 44 . 31 dbg 89 DD 27. 40.x86 14. 31 DOS 15. 76 changing sections 67 character constant 27. 35 disabling listing expansion 47 division 33 DJGPP 84. 87. 40.

31 22 71 23 23 73 66 95. 100 58 60 75 102 72 70 71 31 31 31 31 31 31 31 31 71 22 31. 49.mac exec Executable and Linkable Format EXE_end EXE_stack %exitrep EXPORT export exporting symbols expressions extension EXTERN obj extensions to rdf extensions to extracting substrings −F option −f option far call far common variables far pointer FARCODE %fatal __FILE__ FLAT flat memory model flat−form binary FLOAT __FLOAT__ __float128h__ __float128l__ __float16__ __float32__ __float64__ __float8__ __float80e__ __float80m__ __FLOAT_DAZ__ float−denorm floating−point constants packed BCD constants floating−point float−overflow __FLOAT_ROUND__ float−toolong float−underflow follows= format−specific directives frame pointer FreeBSD FreeLink 92 91 91 84 84 91 91 52 76 88 69 21. 120 26. 105 90 212 . 72 25 77 34 98. 33 17. 28 27. 31 27 27. in common variables ELF shared libraries 16−bit code and elf. 102 87. 28 58 23 20 19 30 64 48 74. 31 21 21. 50 49 49 51 51 50 50 49 51 51 51 51 51 51 48 97. 28 77 84 85 87 87 84 84 48. 90 EXE2BIN EXE_begin exebin. 104 52 62. debug formats and elf32 elf64 %elif %elifctx %elifdef %elifempty %elifid %elifidn %elifidni %elifmacro %elifn %elifnctx %elifndef %elifnempty %elifnid %elifnidn %elifnidni %elifnmacro %elifnnum %elifnstr %elifntoken %elifnum %elifstr %eliftoken %else endproc %endrep ENDSTRUC environment EQU %error error error messages error reporting format escape sequences EVEN exact matches . 99. 31 25. 31 78 27.EXE 27. 70 33 25. 68 23 27.drectve DT DUP DW DWORD DY −E option −e option effective addresses element size. 72 69 77 88 41 19 18.DQ . 27. 26. 50 49 49 51 51 50 50 49 48.

50 49 49 51 51 50 50 49 %ifnnum %ifnstr %ifntoken %ifnum %ifstr %iftoken %imacro IMPORT import library importing symbols INCBIN %include include search path including other files inefficient code infinite loop __Infinity__ infinity informational section INSTALL installing instances of structures instruction list intel hex Intel number formats internal ISTRUC iterating over macro parameters ith %ixdefine Jcc NEAR JMP DWORD jumps.gotpc GOTPC relocations .. 88 95.gotoff GOTOFF relocations . 52 20 52 115 33 32 32 78 16 15 63 121 73 32 86 63 45 73 38 115 109 109 120 18 36 84 87 84 88 14 59 60 90 87 87 84 18 31 57 35 50 213 .gottpoff graphics greedy macro parameters GROUP groups −h hexadecimal hidden hybrid syntaxes −I option −i option %iassign %idefine %idefstr IEND %if %ifctx %ifdef %ifempty %ifid %ifidn %ifidni %ifmacro %ifn %ifnctx %ifndef %ifnempty %ifnid %ifnidn %ifnidni %ifnmacro 90 86..simtel. 105 85 106 85 106 86 27 44 75 34 118 29 86 24 20 20.out as86 ELF listing file little−endian %local local labels logical AND 51 51 51 50 50 51 42 76 76 69 27. 49 49.. 55 48 51 50 50 50 49 48. 102 99 19 14 14 69 86 86 88 105 85 22 85 106 85.net function functions C calling convention Pascal calling convention −g option gas gcc GLOBAL aoutb extensions to elf extensions to rdf extensions to global offset table _GLOBAL_OFFSET_TABLE_ gnu−elf−extensions . 119 40 37 41 63 48.ftp.lbss ld86 . 31 20.got GOT relocations GOT . mixed−size −k −l option label prefix ..ldata LIBRARY license %line __LINE__ linker. free Linux a.

exe near call near common variables NetBSD new releases noalloc nobits noexec . 28 18 18 74 32 87 91.out ___NASM_PATCHLEVEL__ __NASM_SNAPSHOT__ __NASM_SUBMINOR__ __NASM_VER__ __NASM_VERSION_ID__ nasm−XXX−dos. 88 29 214 .gz nasm−XXX−win32. 94 27 24. 42 21 72 multiplication multipush macro multisection __NaN__ NaN NASM version nasm version history nasm version id nasm version string nasm.1 ndisasm.tar. 97. 104 93 109 109 88 33 73 19 19 72 93 19 22.1 __NASMDEFSEG nasm−devel NASMENV nasm. 84 84 47 25 84 22 27. 74 18 25.zip nasm−XXX. 118 26 110 26 111 26 90 74 86.nolist ‘nowait’ nowrite number−overflow numeric constants −O option −o option O16 o16 O32 o32 O64 .logical negation logical OR logical XOR . object file format Mach−O macho macho32 macho64 MacOS X %macro macro indirection macro library macro processor macro−defaults macro−local labels macro−params macros macro−selfref make makefile dependencies makefiles man pages map files MASM MASM −MD option memory models memory operand memory references −MF option −MG option Microsoft OMF minifloat Minix misc subdirectory mixed−language program mixed−size addressing mixed−size instruction MMX registers ModR/M byte MODULE modulo operators motorola s−records −MP option −MQ option MS−DOS MS−DOS device drivers −MT option multi−line macros multipass optimization multiple section names 34 50 50 84 18 84 84 84 84 84 84 42 39 20 37 22 43 22 28 22 16 18 15. 105 15 84 73.OBJ obj object octal 33 46 73 32 32 59 185 60 60 16 74 15 23 15 18 59 59 18 59 60 59 60 60 15 16 15 15 118 16 15 25 77 87. 29 21 17.zip ndisasm ndisasm.lrodata −M option Mach. 16 16 73 14 24.exe nasm −hf __NASM_MAJOR__ __NASM_MINOR__ nasm. 28.zip nasm−XXX.

33.rodata 84 %rotate 45 rotating macro parameters 45 −s option 20. 26 74. 51 %repl 55 reporting bugs 116 RESB 25. 107. 68 SECTION 67 elf extensions to 84 win32 extensions to 78 215 . 119 searching for include files 52 __SECT__ 67.plt PLT relocations plt relocations %pop position−independent code −−postfix precedence pre−defining macros preferred −−prefix pre−including files preprocess−only mode preprocessor 89 18 24 74 44 34 87. 51 repeating 28. 74 pure binary 72 %push 54 __QNaN__ 32 quick start 24 QWORD 27 −r 118 rdf 87 rdoff subdirectory 16. 105 26 26 72 109 33 72. 87. 108 processor mode 66 progbits 73. 104 procedure linkage table 85. 107. 93. 105 23 33 20. PIC−specific 85 removing contexts 54 renaming contexts 55 %rep 28. 37 preprocessor expressions 21 preprocessor loops 51 preprocessor variables 40 primitive directives 66 PRIVATE 74 proc 88. 87. 90 program origin 72 protected 86 pseudo−instructions 27 PUBLIC 69. jumps output file format output formats __OUTPUT_FORMAT__ overlapping segments OVERLAY overloading multi−line macros single−line macros −P option −p option paradox PASCAL Pascal calling convention __PASS__ passes. 97. 38 34 23 20 21 21. 28. 53 35 15 20 75 85.. 84 program entry point 77. 67 relational operators 50 Relocatable Dynamic Object File Format 87 relocations.OF_DBG OF_DEFAULT OFFSET OMF omitted parameters one’s complement OpenBSD operands operand−size prefixes operating system writing operators ORG orphan−labels OS/2 osabi other preprocessor directives out of range. 115 22. assembly PATH %pathsearch period Perl perverse PharLap PIC . 88 redirecting errors 20 REL 29. 105 85 85. 75 84 59 115 18 72 61 34 75 43 38 20 20. 53 35 100 99 62 15 20. 108 108 54 85. 87. 92. 27 RESD 27 RESO 27 RESQ 27 REST 27 RESW 27 RESY 27 .

start 77. 87. 118 unary operators 34 %undef 21. 35. 88 _TEXT 95 thread local storage 86 __TIME__ 61 __TIME_NUM__ 61 TIMES 27. 105 shared library 86 shift command 45 SIB byte signed division 33 signed modulo 33 single−line macros 37 size. 22 tasm 24.tdata 84 test subdirectory 90 testing arbitrary numeric expressions 49 context stack 49 exact text identity 50 multi−line macro existence 49 single−line macro existence 48 token types 50 . 90 start= 73 stderr 20 stdout 20 %strcat 41 STRICT 34 string constant 27 string constants 31 string length 41 string manipulation in macros 41 strings 30 %strlen 41 STRUC 62. 88 .section alignment in bin 73 in elf 84 in obj 75 in win32 78 section. 26 segments 34 groups of 75 separator character 23 shared libraries 87. in C symbols 93 Unicode 30.. 31 uninitialized 27 uninitialized storage 25 216 . of symbols 86 smartalign 65 __SNaN__ 32 Solaris x86 84 −soname 108 sound 27 source code 15 source−listing file 18 square brackets 24. specifying 86 symbols exporting from DLLs 76 importing from DLLs 76 synchronisation 119 . specifying 86 symbol types. 86 . 28 srec 73 STACK 74 stack relative preprocessor directives 56 %stacksize 57 standard macro packages 65 standard macros 59 standardized section names 67.. 84. 68.text 84. Borland Pascal 100 segment override 25. 27 type. 115. 116 TLINK 92 tls 84.tbss 84 TBYTE 25 . bin extensions to 72 SEG 34. of symbols 86 −U option 21 −u option 21.. 97.sym 85 symbol sizes. 93 −t 22 TASM 14. 40 undefining macros 21 underscore.SYS 72.tlsie 86 trailing colon 26 TWORD 25. 87. 104 stub preprocessor 21 %substr 41 subtraction 33 suppressible warning 22 suppressing preprocessing 21 switching between sections 67 . 74 SEGMENT 67 elf extensions to 74 segment address 34 segment alignment in bin 73 in obj 75 segment names. 28. 78. 74 .

com www. 86. 76 %use 53.Unix 16 SCO 84 source archive 16 System V 84 UnixWare 84 %unmacro 48 unrolled loops 28 unsigned division 33 unsigned modulo 33 UPPERCASE 24.gotoff WRT .oulu. 112 Win64 74..pcorner..org www.fi %xdefine −y option −Z option 106 106 108 107 15 90 90 19 90 38 23 20 217 . 75 USE32 67..cpan.got 106 WRT .. 75 user 23 user−defined errors 58 user−level assembler directives 59 user−level directives 66 __UTC_DATE__ 61 __UTC_DATE_NUM__ 61 __UTC_TIME__ 61 __UTC_TIME_NUM__ 61 UTF−16 31 UTF−32 31 UTF−8 30 __utf16__ 31 __utf32__ 31 −v option 23 VAL 90 valid characters 26 variable types 24 version 23 version number of NASM 59 vfollows= 73 Visual C++ 78 vstart= 73 −W option 22 −w option 22 %warning 58 warnings 22 [warning *warning−name] 23 [warning +warning−name] 23 [warning −warning−name] 23 website 15 win64 80.gotpc WRT .delorie.com −X option x2ftp. 65 __USE_*__ 62 USE16 67. 87 WRT .. 74.plt WRT .sym WWW page www. 85. 102 Windows 90 Windows 95 Windows NT write 84 writing operating systems 109 WRT 34. 78.

Sign up to vote on this title
UsefulNot useful