Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
1Activity

Table Of Contents

Chapter 1: Introduction
1.1.1 Why Yet Another Assembler?
1.1.2 License Conditions
1.3.1 Installing NASM under MS−DOS or Windows
1.3.2 Installing NASM under Unix
Chapter 2: Running NASM
2.1 NASM Command−Line Syntax
2.1.1 The −o Option: Specifying the Output File Name
2.1.2 The −f Option: Specifying the Output File Format
2.1.3 The −l Option: Generating a Listing File
2.1.4 The −M Option: Generate Makefile Dependencies
2.1.5 The −MG Option: Generate Makefile Dependencies
2.1.6 The −MF Option: Set Makefile Dependency File
2.1.7 The −MD Option: Assemble and Generate Dependencies
2.1.24 The −w and −W Options: Enable or Disable Assembly Warnings
2.1.25 The −v Option: Display Version Info
2.1.26 The −y Option: Display Available Debug Info Formats
2.1.27 The −−prefix and −−postfix Options
2.1.28 The NASMENV Environment Variable
2.2 Quick Start for MASM Users
2.2.1 NASM Is Case−Sensitive
2.2.2 NASM Requires Square Brackets For Memory References
2.2.3 NASM Doesn’t Store Variable Types
2.2.4 NASM Doesn’t ASSUME
2.2.5 NASM Doesn’t Support Memory Models
2.2.6 Floating−Point Differences
2.2.7 Other Differences
Chapter 3: The NASM Language
3.1 Layout of a NASM Source Line
3.2 Pseudo−Instructions
3.2.1 DB and Friends: Declaring Initialized Data
3.2.2 RESB and Friends: Declaring Uninitialized Data
3.2.3 INCBIN: Including External Binary Files
3.2.4 EQU: Defining Constants
3.2.5 TIMES: Repeating Instructions or Data
3.3 Effective Addresses
3.4 Constants
3.4.1 Numeric Constants
3.4.2 Character Strings
3.4.3 Character Constants
3.4.4 String Constants
3.4.5 Unicode Strings
3.4.6 Floating−Point Constants
3.4.7 Packed BCD Constants
3.5 Expressions
3.5.1 |: Bitwise OR Operator
3.5.2 ^: Bitwise XOR Operator
3.5.3 &: Bitwise AND Operator
3.5.4 << and >>: Bit Shift Operators
3.5.5 + and −: Addition and Subtraction Operators
3.5.6 *, /, //, % and %%: Multiplication and Division
3.5.7 Unary Operators: +, −, ~, ! and SEG
3.6 SEG and WRT
3.7 STRICT: Inhibiting Optimization
3.8 Critical Expressions
3.9 Local Labels
Chapter 4: The NASM Preprocessor
4.1 Single−Line Macros
4.1.1 The Normal Way: %define
4.1.2 Resolving %define: %xdefine
4.1.3 Macro Indirection: %[...]
4.1.4 Concatenating Single Line Macro Tokens: %+
4.1.5 The Macro Name Itself: %? and %??
4.1.6 Undefining Single−Line Macros: %undef
4.1.7 Preprocessor Variables: %assign
4.1.8 Defining Strings: %defstr
4.1.9 Defining Tokens: %deftok
4.2 String Manipulation in Macros
4.2.1 Concatenating Strings: %strcat
4.2.2 String Length: %strlen
4.2.3 Extracting Substrings: %substr
4.3 Multi−Line Macros: %macro
4.3.1 Overloading Multi−Line Macros
4.3.2 Macro−Local Labels
4.3.3 Greedy Macro Parameters
4.3.4 Macro Parameters Range
4.3.5 Default Macro Parameters
4.3.6 %0: Macro Parameter Counter
4.3.7 %00: Label Preceeding Macro
4.3.8 %rotate: Rotating Macro Parameters
4.3.9 Concatenating Macro Parameters
4.3.10 Condition Codes as Macro Parameters
4.3.11 Disabling Listing Expansion
4.3.12 Undefining Multi−Line Macros: %unmacro
4.4 Conditional Assembly
4.4.1 %ifdef: Testing Single−Line Macro Existence
4.4.2 %ifmacro: Testing Multi−Line Macro Existence
4.4.3 %ifctx: Testing the Context Stack
4.4.4 %if: Testing Arbitrary Numeric Expressions
4.4.5 %ifidn and %ifidni: Testing Exact Text Identity
4.4.6 %ifid, %ifnum, %ifstr: Testing Token Types
4.4.7 %iftoken: Test for a Single Token
4.4.8 %ifempty: Test for Empty Expansion
4.4.9 %ifenv: Test If Environment Variable Exists
4.5 Preprocessor Loops: %rep
4.6 Source Files and Dependencies
4.6.1 %include: Including Other Files
4.6.2 %pathsearch: Search the Include Path
4.6.3 %depend: Add Dependent Files
4.6.4 %use: Include Standard Macro Package
4.7 The Context Stack
4.7.1 %push and %pop: Creating and Removing Contexts
4.7.2 Context−Local Labels
4.7.3 Context−Local Single−Line Macros
4.7.4 Context Fall−Through Lookup
4.7.5 %repl: Renaming a Context
4.7.6 Example Use of the Context Stack: Block IFs
4.8 Stack Relative Preprocessor Directives
4.8.1 %arg Directive
4.8.2 %stacksize Directive
4.8.3 %local Directive
4.9 Reporting User−Defined Errors: %error, %warning, %fatal
4.10 Other Preprocessor Directives
4.10.1 %line Directive
4.10.2 %!<env>: Read an environment variable
4.11 Standard Macros
4.11.1 NASM Version Macros
4.11.2 __NASM_VERSION_ID__: NASM Version ID
4.11.3 __NASM_VER__: NASM Version string
4.11.4 __FILE__ and __LINE__: File Name and Line Number
4.11.5 __BITS__: Current BITS Mode
4.11.6 __OUTPUT_FORMAT__: Current Output Format
4.11.7 Assembly Date and Time Macros
4.11.8 __USE_package__: Package Include Test
4.11.9 __PASS__: Assembly Pass
4.11.10 STRUC and ENDSTRUC: Declaring Structure Data Types
4.11.11 ISTRUC, AT and IEND: Declaring Instances of Structures
4.11.12 ALIGN and ALIGNB: Data Alignment
4.11.13 SECTALIGN: Section Alignment
Chapter 5: Standard Macro Packages
5.1 altreg: Alternate Register Names
5.2 smartalign: Smart ALIGN Macro
5.3 fp: Floating−point macros
Chapter 6: Assembler Directives
6.1 BITS: Specifying Target Processor Mode
6.1.1 USE16 & USE32: Aliases for BITS
6.2 DEFAULT: Change the assembler defaults
6.3 SECTION or SEGMENT: Changing and Defining Sections
6.3.1 The __SECT__ Macro
6.4 ABSOLUTE: Defining Absolute Labels
6.5 EXTERN: Importing Symbols from Other Modules
6.6 GLOBAL: Exporting Symbols to Other Modules
6.7 COMMON: Defining Common Data Areas
6.8 CPU: Defining CPU Dependencies
6.9 FLOAT: Handling of floating−point constants
Chapter 7: Output Formats
7.1 bin: Flat−Form Binary Output
7.1.1 ORG: Binary File Program Origin
7.1.2 bin Extensions to the SECTION Directive
7.1.3 Multisection Support for the bin Format
7.1.4 Map Files
7.2 ith: Intel Hex Output
7.3 srec: Motorola S−Records Output
7.4 obj: Microsoft OMF Object Files
7.4.1 obj Extensions to the SEGMENT Directive
7.4.2 GROUP: Defining Groups of Segments
7.4.3 UPPERCASE: Disabling Case Sensitivity in Output
7.4.4 IMPORT: Importing DLL Symbols
7.4.5 EXPORT: Exporting DLL Symbols
7.4.6 ..start: Defining the Program Entry Point
7.4.7 obj Extensions to the EXTERN Directive
7.4.8 obj Extensions to the COMMON Directive
7.5 win32: Microsoft Win32 Object Files
7.5.1 win32 Extensions to the SECTION Directive
7.5.2 win32: Safe Structured Exception Handling
7.6 win64: Microsoft Win64 Object Files
7.6.1 win64: Writing Position−Independent Code
7.6.2 win64: Structured Exception Handling
7.7 coff: Common Object File Format
7.8 macho32 and macho64: Mach Object File Format
7.9 elf32 and elf64: Executable and Linkable Format Object Files
7.9.1 ELF specific directive osabi
7.9.2 elf Extensions to the SECTION Directive
7.9.3 Position−Independent Code: elf Special Symbols and WRT
7.9.4 Thread Local Storage: elf Special Symbols and WRT
7.9.5 elf Extensions to the GLOBAL Directive
7.9.6 elf Extensions to the COMMON Directive
7.9.7 16−bit code and ELF
7.9.8 Debug formats and ELF
7.10 aout: Linux a.out Object Files
7.11 aoutb: NetBSD/FreeBSD/OpenBSD a.out Object Files
7.12 as86: Minix/Linux as86 Object Files
7.13 rdf: Relocatable Dynamic Object File Format
7.13.1 Requiring a Library: The LIBRARY Directive
7.13.2 Specifying a Module Name: The MODULE Directive
7.13.3 rdf Extensions to the GLOBAL Directive
7.13.4 rdf Extensions to the EXTERN Directive
7.14 dbg: Debugging Format
Chapter 8: Writing 16−bit Code (DOS, Windows 3/3.1)
8.1 Producing .EXE Files
8.1.1 Using the obj Format To Generate .EXE Files
8.1.2 Using the bin Format To Generate .EXE Files
8.2 Producing .COM Files
8.2.1 Using the bin Format To Generate .COM Files
8.2.2 Using the obj Format To Generate .COM Files
8.3 Producing .SYS Files
8.4 Interfacing to 16−bit C Programs
8.4.1 External Symbol Names
8.4.2 Memory Models
8.4.3 Function Definitions and Function Calls
8.4.4 Accessing Data Items
8.4.5 c16.mac: Helper Macros for the 16−bit C Interface
8.5 Interfacing to Borland Pascal Programs
8.5.1 The Pascal Calling Convention
8.5.2 Borland Pascal Segment Name Restrictions
8.5.3 Using c16.mac With Pascal Programs
Chapter 9: Writing 32−bit Code (Unix, Win32, DJGPP)
9.1 Interfacing to 32−bit C Programs
9.1.1 External Symbol Names
9.1.2 Function Definitions and Function Calls
9.1.3 Accessing Data Items
9.1.4 c32.mac: Helper Macros for the 32−bit C Interface
9.2 Writing NetBSD/FreeBSD/OpenBSD and Linux/ELF Shared Libraries
9.2.1 Obtaining the Address of the GOT
9.2.2 Finding Your Local Data Items
9.2.3 Finding External and Common Data Items
9.2.4 Exporting Symbols to the Library User
9.2.5 Calling Procedures Outside the Library
9.2.6 Generating the Library File
Chapter 10: Mixing 16 and 32 Bit Code
10.1 Mixed−Size Jumps
10.2 Addressing Between Different−Size Segments
10.3 Other Mixed−Size Instructions
Chapter 11: Writing 64−bit Code (Unix, Win64)
11.1 Register Names in 64−bit Mode
11.2 Immediates and Displacements in 64−bit Mode
11.3 Interfacing to 64−bit C Programs (Unix)
11.4 Interfacing to 64−bit C Programs (Win64)
A.3.2 Code Following Data: Synchronisation
A.3.3 Mixed Code and Data: Automatic (Intelligent) Synchronisation
B.1.2 Conventional instructions
B.1.3 Katmai Streaming SIMD instructions (SSE –– a.k.a. KNI, XMM, MMX2)
B.1.4 Introduced in Deschutes but necessary for SSE support
B.1.5 XSAVE group (AVX and extended state)
B.1.6 Generic memory operations
B.1.7 New MMX instructions introduced in Katmai
B.1.8 AMD Enhanced 3DNow! (Athlon) instructions
B.1.9 Willamette SSE2 Cacheability Instructions
B.1.10 Willamette MMX instructions (SSE2 SIMD Integer Instructions)
B.1.11 Willamette Streaming SIMD instructions (SSE2)
B.1.12 Prescott New Instructions (SSE3)
B.1.13 VMX Instructions
B.1.14 Extended Page Tables VMX instructions
B.1.15 Tejas New Instructions (SSSE3)
B.1.16 AMD SSE4A
B.1.17 New instructions in Barcelona
B.1.18 Penryn New Instructions (SSE4.1)
B.1.19 Nehalem New Instructions (SSE4.2)
B.1.20 Intel SMX
B.1.21 Geode (Cyrix) 3DNow! additions
B.1.22 Intel new instructions in ???
B.1.23 Intel AES instructions
B.1.24 Intel AVX AES instructions
B.1.25 Intel AVX instructions
B.1.26 Intel Carry−Less Multiplication instructions (CLMUL)
B.1.27 Intel AVX Carry−Less Multiplication instructions (CLMUL)
B.1.28 Intel Fused Multiply−Add instructions (FMA)
B.1.29 Intel post−32 nm processor instructions
B.1.30 VIA (Centaur) security instructions
B.1.31 AMD Lightweight Profiling (LWP) instructions
B.1.32 AMD XOP and FMA4 instructions (SSE5)
B.1.33 Systematic names for the hinting nop instructions
C.1.11 Version 2.07
C.1.12 Version 2.06
C.1.13 Version 2.05.01
C.1.14 Version 2.05
C.1.15 Version 2.04
C.1.16 Version 2.03.01
C.1.17 Version 2.03
C.1.18 Version 2.02
C.1.19 Version 2.01
C.1.20 Version 2.00
C.2 NASM 0.98 Series
C.2.1 Version 0.98.39
C.2.2 Version 0.98.38
C.2.3 Version 0.98.37
C.2.4 Version 0.98.36
C.2.5 Version 0.98.35
C.2.6 Version 0.98.34
C.2.7 Version 0.98.33
C.2.8 Version 0.98.32
C.2.9 Version 0.98.31
C.2.10 Version 0.98.30
C.2.11 Version 0.98.28
C.2.12 Version 0.98.26
C.2.13 Version 0.98.25alt
C.2.14 Version 0.98.25
C.2.15 Version 0.98.24p1
C.2.16 Version 0.98.24
C.2.17 Version 0.98.23
C.2.18 Version 0.98.22
C.2.19 Version 0.98.21
C.2.20 Version 0.98.20
C.2.21 Version 0.98.19
C.2.22 Version 0.98.18
C.2.23 Version 0.98.17
C.2.24 Version 0.98.16
C.2.25 Version 0.98.15
C.2.26 Version 0.98.14
C.2.27 Version 0.98.13
C.2.28 Version 0.98.12
C.2.29 Version 0.98.11
C.2.30 Version 0.98.10
C.2.31 Version 0.98.09
C.2.32 Version 0.98.08
C.2.33 Version 0.98.09b with John Coffman patches released 28−Oct−2001
C.2.34 Version 0.98.07 released 01/28/01
C.2.35 Version 0.98.06f released 01/18/01
C.2.36 Version 0.98.06e released 01/09/01
C.2.37 Version 0.98p1
C.2.38 Version 0.98bf (bug−fixed)
C.2.39 Version 0.98.03 with John Coffman’s changes released 27−Jul−2000
C.2.40 Version 0.98.03
C.2.41 Version 0.98
C.2.42 Version 0.98p9
C.2.43 Version 0.98p8
C.2.44 Version 0.98p7
C.2.45 Version 0.98p6
C.2.46 Version 0.98p3.7
C.2.47 Version 0.98p3.6
C.2.48 Version 0.98p3.5
C.2.49 Version 0.98p3.4
C.2.50 Version 0.98p3.3
C.2.51 Version 0.98p3.2
C.2.52 Version 0.98p3−hpa
C.2.53 Version 0.98 pre−release 3
C.2.54 Version 0.98 pre−release 2
C.2.55 Version 0.98 pre−release 1
C.3 NASM 0.9 Series
C.3.1 Version 0.97 released December 1997
C.3.2 Version 0.96 released November 1997
C.3.3 Version 0.95 released July 1997
C.3.4 Version 0.94 released April 1997
C.3.5 Version 0.93 released January 1997
C.3.6 Version 0.92 released January 1997
C.3.7 Version 0.91 released November 1996
C.3.8 Version 0.90 released October 1996
0 of .
Results for:
No results containing your search query
P. 1
nasmdoc

nasmdoc

Ratings: (0)|Views: 25 |Likes:
Published by nzscr

More info:

Published by: nzscr on Jul 01, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/01/2011

pdf

text

original

You're Reading a Free Preview
Pages 5 to 19 are not shown in this preview.
You're Reading a Free Preview
Pages 24 to 119 are not shown in this preview.
You're Reading a Free Preview
Page 124 is not shown in this preview.
You're Reading a Free Preview
Pages 129 to 184 are not shown in this preview.
You're Reading a Free Preview
Pages 189 to 220 are not shown in this preview.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->