Часть III. NASM Syntax

The chapters in this part of the book document the NASM-compatible syntax accepted by the Yasm «nasm» parser and preprocessor.

Содержание

2. Язык NASM
2.1. Обзор ассемблерной строки NASM
2.2. Псевдо-инструкции
2.2.1. DB и ее друзья: Объявление инициализированных данных
2.2.2. RESB и ее друзья: Объявление неинициализированных данных
2.2.3. INCBIN: Включение внешних бинарных файлов
2.2.4. EQU: Определение констант
2.2.5. TIMES: Повторение инструкций или данных
2.3. Effective Addresses
2.3.1. 64-bit Displacements
2.3.2. RIP Relative Addressing
2.4. Immediate Operands
2.5. Constants
2.5.1. Numeric Constants
2.5.2. Character Constants
2.5.3. String Constants
2.5.4. Floating-Point Constants
2.6. Expressions
2.6.1. |: Bitwise OR Operator
2.6.2. ^: Bitwise XOR Operator
2.6.3. &: Bitwise AND Operator
2.6.4. << and >>: Bit Shift Operators
2.6.5. + and -: Addition and Subtraction Operators
2.6.6. *, /, //, % and %%: Multiplication and Division
2.6.7. Unary Operators: +, -, ~ and SEG
2.6.8. SEG and WRT
2.7. STRICT: Inhibiting Optimization
2.8. Critical Expressions
2.9. Local Labels
3. The NASM Preprocessor
3.1. Single-Line Macros
3.1.1. The Normal Way: %define
3.1.2. Enhancing %define: %xdefine
3.1.3. Concatenating Single Line Macro Tokens: %+
3.1.4. Undefining macros: %undef
3.1.5. Preprocessor Variables: %assign
3.2. String Handling in Macros
3.2.1. String Length: %strlen
3.2.2. Sub-strings: %substr
3.3. Multi-Line Macros
3.3.1. Overloading Multi-Line Macros
3.3.2. Macro-Local Labels
3.3.3. Greedy Macro Parameters
3.3.4. Default Macro Parameters
3.3.5. %0: Macro Parameter Counter
3.3.6. %rotate: Rotating Macro Parameters
3.3.7. Concatenating Macro Parameters
3.3.8. Condition Codes as Macro Parameters
3.3.9. Disabling Listing Expansion
3.4. Conditional Assembly
3.4.1. %ifdef: Testing Single-Line Macro Existence
3.4.2. %ifmacro: Testing Multi-Line Macro Existence
3.4.3. %ifctx: Testing the Context Stack
3.4.4. %if: Testing Arbitrary Numeric Expressions
3.4.5. %ifidn and %ifidni: Testing Exact Text Identity
3.4.6. %ifid, %ifnum, %ifstr: Testing Token Types
3.4.7. %error: Reporting User-Defined Errors
3.5. Preprocessor Loops
3.6. Including Other Files
3.7. The Context Stack
3.7.1. %push and %pop: Creating and Removing Contexts
3.7.2. Context-Local Labels
3.7.3. Context-Local Single-Line Macros
3.7.4. %repl: Renaming a Context
3.7.5. Example Use of the Context Stack: Block IFs
3.8. Standard Macros
3.8.1. __YASM_MAJOR__, etc: Yasm Version
3.8.2. __FILE__ and __LINE__: File Name and Line Number
3.8.3. __YASM_OBJFMT__ and __OUTPUT_FORMAT__: Output Object Format Keyword
3.8.4. STRUC and ENDSTRUC: Declaring Structure Data Types
3.8.5. ISTRUC, AT and IEND: Declaring Instances of Structures
3.8.6. ALIGN and ALIGNB: Data Alignment
4. NASM Assembler Directives
4.1. Specifying Target Processor Mode
4.1.1. BITS
4.1.2. USE16, USE32, and USE64
4.2. DEFAULT: Change the assembler defaults
4.3. Changing and Defining Sections
4.3.1. SECTION and SEGMENT
4.3.2. Standardized Section Names
4.3.3. The __SECT__ Macro
4.4. ABSOLUTE: Defining Absolute Labels
4.5. EXTERN: Importing Symbols
4.6. GLOBAL: Exporting Symbols
4.7. COMMON: Defining Common Data Areas
4.8. CPU: Defining CPU Dependencies