Assembly Language Step-by-Step: Programming with Linux®, Third Edition

Book description

The eagerly anticipated new edition of the bestselling introduction to x86 assembly language

The long-awaited third edition of this bestselling introduction to assembly language has been completely rewritten to focus on 32-bit protected-mode Linux and the free NASM assembler. Assembly is the fundamental language bridging human ideas and the pure silicon hearts of computers, and popular author Jeff Dunteman retains his distinctive lighthearted style as he presents a step-by-step approach to this difficult technical discipline.

He starts at the very beginning, explaining the basic ideas of programmable computing, the binary and hexadecimal number systems, the Intel x86 computer architecture, and the process of software development under Linux. From that foundation he systematically treats the x86 instruction set, memory addressing, procedures, macros, and interface to the C-language code libraries upon which Linux itself is built.

Serves as an ideal introduction to x86 computing concepts, as demonstrated by the only language directly understood by the CPU itself

Uses an approachable, conversational style that assumes no prior experience in programming of any kind

Presents x86 architecture and assembly concepts through a cumulative tutorial approach that is ideal for self-paced instruction

Focuses entirely on free, open-source software, including Ubuntu Linux, the NASM assembler, the Kate editor, and the Gdb/Insight debugger.

Includes an x86 instruction set reference for the most common machine instructions, specifically tailored for use by programming beginners

Woven into the presentation are plenty of assembly code examples, plus practical tips on software design, coding, testing, and debugging, all using free, open-source software that may be downloaded without charge from the Internet.

Table of contents

  1. Copyright
  2. About the Author
  3. Credits
  4. Acknowledgments
  5. Introduction: "Why Would You Want to Do That?"
    1. What You'll Need
    2. The Master Plan
    3. A Note on Capitalization Conventions
    4. Why Am I Here Again?
  6. 1. Another Pleasant Valley Saturday
    1. 1.1. It's All in the Plan
      1. 1.1.1. Steps and Tests
      2. 1.1.2. More Than Two Ways?
      3. 1.1.3. Computers Think Like Us
    2. 1.2. Had This Been the Real Thing...
    3. 1.3. Do Not Pass Go
      1. 1.3.1. The Game of Big Bux
      2. 1.3.2. Playing Big Bux
    4. 1.4. Assembly Language Programming As a Board Game
      1. 1.4.1. Code and Data
      2. 1.4.2. Addresses
      3. 1.4.3. Metaphor Check!
  7. 2. Alien Bases
    1. 2.1. The Return of the New Math Monster
    2. 2.2. Counting in Martian
      1. 2.2.1. Dissecting a Martian Number
      2. 2.2.2. The Essence of a Number Base
    3. 2.3. Octal: How the Grinch Stole Eight and Nine
      1. 2.3.1. Who Stole Eight and Nine?
    4. 2.4. Hexadecimal: Solving the Digit Shortage
    5. 2.5. From Hex to Decimal and from Decimal to Hex
      1. 2.5.1. From Hex to Decimal
      2. 2.5.2. From Decimal to Hex
      3. 2.5.3. Practice. Practice! PRACTICE!
    6. 2.6. Arithmetic in Hex
      1. 2.6.1. Columns and Carries
      2. 2.6.2. Subtraction and Borrows
      3. 2.6.3. Borrows across Multiple Columns
      4. 2.6.4. What's the Point?
    7. 2.7. Binary
      1. 2.7.1. Values in Binary
      2. 2.7.2. Why Binary?
    8. 2.8. Hexadecimal As Shorthand for Binary
      1. 2.8.1. Prepare to Compute
  8. 3. Lifting the Hood
    1. 3.1. RAXie, We Hardly Knew Ye...
      1. 3.1.1. Gus to the Rescue
    2. 3.2. Switches, Transistors, and Memory
      1. 3.2.1. One If by Land...
      2. 3.2.2. Transistor Switches
      3. 3.2.3. The Incredible Shrinking Bit
      4. 3.2.4. Random Access
      5. 3.2.5. Memory Access Time
      6. 3.2.6. Bytes, Words, Double Words, and Quad Words
      7. 3.2.7. Pretty Chips All in a Row
    3. 3.3. The Shop Foreman and the Assembly Line
      1. 3.3.1. Talking to Memory
      2. 3.3.2. Riding the Data Bus
      3. 3.3.3. The Foreman's Pockets
      4. 3.3.4. The Assembly Line
    4. 3.4. The Box That Follows a Plan
      1. 3.4.1. Fetch and Execute
      2. 3.4.2. The Foreman's Innards
      3. 3.4.3. Changing Course
    5. 3.5. What vs. How: Architecture and Microarchitecture
      1. 3.5.1. Evolving Architectures
      2. 3.5.2. The Secret Machinery in the Basement
    6. 3.6. Enter the Plant Manager
      1. 3.6.1. Operating Systems: The Corner Office
      2. 3.6.2. BIOS: Software, Just Not as Soft
      3. 3.6.3. Multitasking Magic
      4. 3.6.4. Promotion to Kernel
      5. 3.6.5. The Core Explosion
      6. 3.6.6. The Plan
  9. 4. Location, Location, Location
    1. 4.1. The Joy of Memory Models
      1. 4.1.1. 16 Bits'll Buy You 64K
      2. 4.1.2. The Nature of a Megabyte
      3. 4.1.3. Backward Compatibility and Virtual 86 Mode
      4. 4.1.4. 16-Bit Blinders
    2. 4.2. The Nature of Segments
      1. 4.2.1. A Horizon, Not a Place
      2. 4.2.2. Making 20-Bit Addresses out of 16-Bit Registers
    3. 4.3. 16-Bit and 32-Bit Registers
      1. 4.3.1. General-Purpose Registers
      2. 4.3.2. Register Halves
      3. 4.3.3. The Instruction Pointer
      4. 4.3.4. The Flags Register
    4. 4.4. The Three Major Assembly Programming Models
      1. 4.4.1. Real Mode Flat Model
      2. 4.4.2. Real Mode Segmented Model
      3. 4.4.3. Protected Mode Flat Model
    5. 4.5. What Protected Mode Won't Let Us Do Anymore
      1. 4.5.1. Memory-Mapped Video
      2. 4.5.2. Direct Access to Port Hardware
      3. 4.5.3. Direct Calls into the BIOS
    6. 4.6. Looking Ahead: 64-Bit "Long Mode"
      1. 4.6.1. 64-Bit Memory: What May Be Possible Someday vs. What We Can Do Now
  10. 5. The Right to Assemble
    1. 5.1. Files and What's Inside Them
      1. 5.1.1. Binary Files vs. Text Files
      2. 5.1.2. Looking at File Internals with the Bless Editor
      3. 5.1.3. Interpreting Raw Data
      4. 5.1.4. "Endianness"
    2. 5.2. Text In, Code Out
      1. 5.2.1. Assembly Language
      2. 5.2.2. Comments
      3. 5.2.3. Beware "Write-Only" Source Code!
      4. 5.2.4. Object Code and Linkers
      5. 5.2.5. Relocatability
    3. 5.3. The Assembly Language Development Process
      1. 5.3.1. The Discipline of Working Directories
      2. 5.3.2. Editing the Source Code File
      3. 5.3.3. Assembling the Source Code File
      4. 5.3.4. Assembler Errors
      5. 5.3.5. Back to the Editor
      6. 5.3.6. Assembler Warnings
      7. 5.3.7. Linking the Object Code File
      8. 5.3.8. Linker Errors
      9. 5.3.9. Testing the .EXE File
      10. 5.3.10. Errors versus Bugs
      11. 5.3.11. Are We There Yet?
      12. 5.3.12. Debuggers and Debugging
    4. 5.4. Taking a Trip Down Assembly Lane
      1. 5.4.1. Installing the Software
      2. 5.4.2. Step 1: Edit the Program in an Editor
      3. 5.4.3. Step 2: Assemble the Program with NASM
      4. 5.4.4. Step 3: Link the Program with LD
      5. 5.4.5. Step 4: Test the Executable File
      6. 5.4.6. Step 5: Watch It Run in the Debugger
      7. 5.4.7. Ready to Get Serious?
  11. 6. A Place to Stand, with Access to Tools
    1. 6.1. The Kate Editor
      1. 6.1.1. Installing Kate
      2. 6.1.2. Launching Kate
      3. 6.1.3. Configuration
      4. 6.1.4. Kate Sessions
        1. 6.1.4.1. Creating a New Session
        2. 6.1.4.2. Opening an Existing Session
        3. 6.1.4.3. Deleting or Renaming Sessions
      5. 6.1.5. Kate's File Management
        1. 6.1.5.1. Filesystem Browser Navigation
        2. 6.1.5.2. Adding a File to the Current Session
        3. 6.1.5.3. Dropping a File from the Current Session
        4. 6.1.5.4. Switching Between Session Files in the Editor
        5. 6.1.5.5. Creating a Brand-New File
        6. 6.1.5.6. Creating a Brand-New Folder on Disk
        7. 6.1.5.7. Deleting a File from Disk (Move File to Trash)
        8. 6.1.5.8. Reloading a File from Disk
        9. 6.1.5.9. Saving All Unsaved Changes in Session Files
        10. 6.1.5.10. Printing the File in the Editor Window
        11. 6.1.5.11. Exporting a File As HTML
      6. 6.1.6. Adding Items to the Toolbar
      7. 6.1.7. Kate's Editing Controls
        1. 6.1.7.1. Cursor Movement
        2. 6.1.7.2. Bookmarks
        3. 6.1.7.3. Selecting Text
        4. 6.1.7.4. Searching the Text
        5. 6.1.7.5. Using Search and Replace
      8. 6.1.8. Using Kate While Programming
        1. 6.1.8.1. Creating and Using Project Directories
        2. 6.1.8.2. Focus!
    2. 6.2. Linux and Terminals
      1. 6.2.1. The Linux Console
      2. 6.2.2. Character Encoding in Konsole
      3. 6.2.3. The Three Standard Unix Files
      4. 6.2.4. I/O Redirection
      5. 6.2.5. Simple Text Filters
      6. 6.2.6. Terminal Control with Escape Sequences
      7. 6.2.7. So Why Not GUI Apps?
    3. 6.3. Using Linux Make
      1. 6.3.1. Dependencies
      2. 6.3.2. When a File Is Up to Date
      3. 6.3.3. Chains of Dependencies
      4. 6.3.4. Invoking Make from Inside Kate
      5. 6.3.5. Using Touch to Force a Build
    4. 6.4. The Insight Debugger
      1. 6.4.1. Running Insight
      2. 6.4.2. Insight's Many Windows
      3. 6.4.3. A Quick Insight Run-Through
      4. 6.4.4. Pick Up Your Tools...
  12. 7. Following Your Instructions
    1. 7.1. Build Yourself a Sandbox
      1. 7.1.1. A Minimal NASM Program
    2. 7.2. Instructions and Their Operands
      1. 7.2.1. Source and Destination Operands
      2. 7.2.2. Immediate Data
      3. 7.2.3. Register Data
      4. 7.2.4. Memory Data
      5. 7.2.5. Confusing Data and Its Address
      6. 7.2.6. The Size of Memory Data
      7. 7.2.7. The Bad Old Days
    3. 7.3. Rally Round the Flags, Boys!
      1. 7.3.1. Flag Etiquette
      2. 7.3.2. Adding and Subtracting One with INC and DEC
      3. 7.3.3. Watching Flags from Insight
      4. 7.3.4. How Flags Change Program Execution
    4. 7.4. Signed and Unsigned Values
      1. 7.4.1. Two's Complement and NEG
      2. 7.4.2. Sign Extension and MOVSX
    5. 7.5. Implicit Operands and MUL
      1. 7.5.1. MUL and the Carry Flag
      2. 7.5.2. Unsigned Division with DIV
      3. 7.5.3. The x86 Slowpokes
    6. 7.6. Reading and Using an Assembly Language Reference
      1. 7.6.1. Memory Joggers for Complex Memories
      2. 7.6.2. An Assembly Language Reference for Beginners
      3. 7.6.3. Flags
    7. 7.7. NEG: Negate (Two's Complement; i.e., Multiply by −1)
      1. 7.7.1. Flags Affected
      2. 7.7.2. Legal Forms
      3. 7.7.3. Examples
      4. 7.7.4. Notes
      5. 7.7.5. Legal Forms
      6. 7.7.6. Operand Symbols
      7. 7.7.7. Examples
      8. 7.7.8. Notes
      9. 7.7.9. What's Not Here...
  13. 8. Our Object All Sublime
    1. 8.1. The Bones of an Assembly Language Program
      1. 8.1.1. The Initial Comment Block
      2. 8.1.2. The .data Section
      3. 8.1.3. The .bss Section
      4. 8.1.4. The .text Section
      5. 8.1.5. Labels
      6. 8.1.6. Variables for Initialized Data
      7. 8.1.7. String Variables
      8. 8.1.8. Deriving String Length with EQU and $
    2. 8.2. Last In, First Out via the Stack
      1. 8.2.1. Five Hundred Plates per Hour
      2. 8.2.2. Stacking Things Upside Down
      3. 8.2.3. Push-y Instructions
      4. 8.2.4. POP Goes the Opcode
      5. 8.2.5. Storage for the Short Term
    3. 8.3. Using Linux Kernel Services Through INT80
      1. 8.3.1. An Interrupt That Doesn't Interrupt Anything
      2. 8.3.2. Getting Home Again
      3. 8.3.3. Exiting a Program via INT 80h
      4. 8.3.4. Software Interrupts versus Hardware Interrupts
      5. 8.3.5. INT 80h and the Portability Fetish
    4. 8.4. Designing a Non-Trivial Program
      1. 8.4.1. Defining the Problem
      2. 8.4.2. Starting with Pseudo-code
      3. 8.4.3. Successive Refinement
      4. 8.4.4. Those Inevitable "Whoops!" Moments
      5. 8.4.5. Scanning a Buffer
      6. 8.4.6. "Off By One" Errors
      7. 8.4.7. Going Further
  14. 9. Bits, Flags, Branches, and Tables
    1. 9.1. Bits Is Bits (and Bytes Is Bits)
      1. 9.1.1. Bit Numbering
      2. 9.1.2. "It's the Logical Thing to Do, Jim..."
      3. 9.1.3. The AND Instruction
      4. 9.1.4. Masking Out Bits
      5. 9.1.5. The OR Instruction
      6. 9.1.6. The XOR Instruction
      7. 9.1.7. The NOT Instruction
      8. 9.1.8. Segment Registers Don't Respond to Logic!
    2. 9.2. Shifting Bits
      1. 9.2.1. Shift By What?
      2. 9.2.2. How Bit Shifting Works
      3. 9.2.3. Bumping Bits into the Carry Flag
      4. 9.2.4. The Rotate Instructions
      5. 9.2.5. Setting a Known Value into the Carry Flag
    3. 9.3. Bit-Bashing in Action
      1. 9.3.1. Splitting a Byte into Two Nybbles
      2. 9.3.2. Shifting the High Nybble into the Low Nybble
      3. 9.3.3. Using a Lookup Table
      4. 9.3.4. Multiplying by Shifting and Adding
    4. 9.4. Flags, Tests, and Branches
      1. 9.4.1. Unconditional Jumps
      2. 9.4.2. Conditional Jumps
      3. 9.4.3. Jumping on the Absence of a Condition
      4. 9.4.4. Flags
      5. 9.4.5. Comparisons with CMP
      6. 9.4.6. A Jungle of Jump Instructions
      7. 9.4.7. "Greater Than" Versus "Above"
      8. 9.4.8. Looking for 1-Bits with TEST
      9. 9.4.9. Looking for 0 Bits with BT
    5. 9.5. Protected Mode Memory Addressing in Detail
      1. 9.5.1. Effective Address Calculations
      2. 9.5.2. Displacements
      3. 9.5.3. Base + Displacement Addressing
      4. 9.5.4. Base + Index Addressing
      5. 9.5.5. Index × Scale + Displacement Addressing
      6. 9.5.6. Other Addressing Schemes
      7. 9.5.7. LEA: The Top-Secret Math Machine
      8. 9.5.8. The Burden of 16-Bit Registers
    6. 9.6. Character Table Translation
      1. 9.6.1. Translation Tables
      2. 9.6.2. Translating with MOV or XLAT
    7. 9.7. Tables Instead of Calculations
  15. 10. Dividing and Conquering
    1. 10.1. Boxes within Boxes
      1. 10.1.1. Procedures As Boxes for Code
    2. 10.2. Calling and Returning
      1. 10.2.1. Calls within Calls
      2. 10.2.2. The Dangers of Accidental Recursion
      3. 10.2.3. A Flag Etiquette Bug to Beware Of
      4. 10.2.4. Procedures and the Data They Need
      5. 10.2.5. Saving the Caller's Registers
      6. 10.2.6. Local Data
      7. 10.2.7. More Table Tricks
      8. 10.2.8. Placing Constant Data in Procedure Definitions
    3. 10.3. Local Labels and the Lengths of Jumps
      1. 10.3.1. "Forcing" Local Label Access
      2. 10.3.2. Short, Near, and Far Jumps
    4. 10.4. Building External Procedure Libraries
      1. 10.4.1. Global and External Declarations
      2. 10.4.2. The Mechanics of Globals and Externals
      3. 10.4.3. Linking Libraries into Your Programs
      4. 10.4.4. The Dangers of Too Many Procedures and Too Many Libraries
    5. 10.5. The Art of Crafting Procedures
      1. 10.5.1. Maintainability and Reuse
      2. 10.5.2. Deciding What Should Be a Procedure
      3. 10.5.3. Use Comment Headers!
    6. 10.6. Simple Cursor Control in the Linux Console
      1. 10.6.1. Console Control Cautions
    7. 10.7. Creating and Using Macros
      1. 10.7.1. The Mechanics of Macro Definition
      2. 10.7.2. Defining Macros with Parameters
      3. 10.7.3. The Mechanics of Invoking Macros
      4. 10.7.4. Local Labels Within Macros
      5. 10.7.5. Macro Libraries As Include Files
      6. 10.7.6. Macros versus Procedures: Pros and Cons
  16. 11. Strings and Things
    1. 11.1. The Notion of an Assembly Language String
      1. 11.1.1. Turning Your "String Sense" Inside-Out
      2. 11.1.2. Source Strings and Destination Strings
      3. 11.1.3. A Text Display Virtual Screen
    2. 11.2. REP STOSB, the Software Machine Gun
      1. 11.2.1. Machine-Gunning the Virtual Display
      2. 11.2.2. Executing the STOSB Instruction
      3. 11.2.3. STOSB and the Direction Flag (DF)
      4. 11.2.4. Defining Lines in the Display Buffer
      5. 11.2.5. Sending the Buffer to the Linux Console
    3. 11.3. The Semiautomatic Weapon: STOSB without REP
      1. 11.3.1. Who Decrements ECX?
      2. 11.3.2. The LOOP Instructions
      3. 11.3.3. Displaying a Ruler on the Screen
      4. 11.3.4. MUL Is Not IMUL
      5. 11.3.5. Adding ASCII Digits
      6. 11.3.6. Adjusting AAA's Adjustments
      7. 11.3.7. Ruler's Lessons
      8. 11.3.8. 16-bit and 32-bit Versions of STOS
    4. 11.4. MOVSB: Fast Block Copies
      1. 11.4.1. DF and Overlapping Block Moves
      2. 11.4.2. Single-Stepping REP String Instructions with Insight
    5. 11.5. Storing Data to Discontinuous Strings
      1. 11.5.1. Displaying an ASCII Table
      2. 11.5.2. Nested Instruction Loops
      3. 11.5.3. Jumping When ECX Goes to 0
      4. 11.5.4. Closing the Inner Loop
      5. 11.5.5. Closing the Outer Loop
      6. 11.5.6. Showchar Recap
    6. 11.6. Command-Line Arguments and Examining the Stack
      1. 11.6.1. Virtual Memory in Two Chunks
      2. 11.6.2. Anatomy of the Linux Stack
      3. 11.6.3. Why Stack Addresses Aren't Predictable
      4. 11.6.4. Setting Command-Line Arguments with Insight
      5. 11.6.5. Examining the Stack with Insight's Memory View
    7. 11.7. String Searches with SCASB
      1. 11.7.1. REPNE vs. REPE
      2. 11.7.2. Pop the Stack or Address It?
      3. 11.7.3. For Extra Credit...
  17. 12. Heading Out to C
    1. 12.1. What's GNU?
      1. 12.1.1. The Swiss Army Compiler
      2. 12.1.2. Building Code the GNU Way
      3. 12.1.3. How to Use gcc in Assembly Work
      4. 12.1.4. Why Not gas?
    2. 12.2. Linking to the Standard C Library
      1. 12.2.1. C Calling Conventions
      2. 12.2.2. A Framework to Build On
      3. 12.2.3. Saving and Restoring Registers
      4. 12.2.4. Setting Up a Stack Frame
      5. 12.2.5. Destroying a Stack Frame
      6. 12.2.6. Characters Out via puts()
    3. 12.3. Formatted Text Output with printf()
      1. 12.3.1. Passing Parameters to printf()
    4. 12.4. Data In with fgets() and scanf()
      1. 12.4.1. Using scanf() for Entry of Numeric Values
    5. 12.5. Be a Time Lord
      1. 12.5.1. The C Library's Time Machine
      2. 12.5.2. Fetching time_t Values from the System Clock
      3. 12.5.3. Converting a time_t Value to a Formatted String
      4. 12.5.4. Generating Separate Local Time Values
      5. 12.5.5. Making a Copy of glibc's tm Struct with MOVSD
    6. 12.6. Understanding AT&T Instruction Mnemonics
      1. 12.6.1. AT&T Mnemonic Conventions
      2. 12.6.2. Examining gas Source Files Created by gcc
      3. 12.6.3. AT&T Memory Reference Syntax
    7. 12.7. Generating Random Numbers
      1. 12.7.1. Seeding the Generator with srand()
      2. 12.7.2. Generating Pseudorandom Numbers
      3. 12.7.3. Some Bits Are More Random Than Others
      4. 12.7.4. Calls to Addresses in Registers
    8. 12.8. How C Sees Command-Line Arguments
    9. 12.9. Simple File I/O
      1. 12.9.1. Converting Strings into Numbers with sscanf()
      2. 12.9.2. Creating and Opening Files
      3. 12.9.3. Reading Text from Files with fgets()
      4. 12.9.4. Writing Text to Files with fprintf()
      5. 12.9.5. Notes on Gathering Your Procedures into Libraries
  18. Conclusion: Not the End, But Only the Beginning
    1. Where to Now?
    2. Stepping off Square One
  19. A. Partial x86 Instruction Set Reference
    1. A.1. Notes on the Instruction Set Reference
      1. A.1.1. Instruction Operands
      2. A.1.2. Flag Results
    2. A.2. AAA: Adjust AL after BCD Addition
      1. A.2.1. Flags Affected
      2. A.2.2. Legal Forms
      3. A.2.3. Examples
      4. A.2.4. Notes
    3. A.3. ADC: Arithmetic Addition with Carry
      1. A.3.1. Flags Affected
      2. A.3.2. Legal Forms
      3. A.3.3. Examples
      4. A.3.4. Notes
    4. A.4. ADD: Arithmetic Addition
      1. A.4.1. Flags Affected
      2. A.4.2. Legal Forms
      3. A.4.3. Examples
      4. A.4.4. Notes
    5. A.5. AND: Logical AND
      1. A.5.1. Flags Affected
      2. A.5.2. Legal Forms
      3. A.5.3. Examples
      4. A.5.4. Notes
    6. A.6. BT: Bit Test
      1. A.6.1. Flags Affected
      2. A.6.2. Legal Forms
      3. A.6.3. Examples
      4. A.6.4. Notes
    7. A.7. CALL: Call Procedure
      1. A.7.1. Flags Affected
      2. A.7.2. Legal Forms
      3. A.7.3. Examples
      4. A.7.4. Notes
    8. A.8. CLC: Clear Carry Flag (CF)
      1. A.8.1. Flags Affected
      2. A.8.2. Legal Forms
      3. A.8.3. Examples
      4. A.8.4. Notes
    9. A.9. CLD: Clear Direction Flag (DF)
      1. A.9.1. Flags Affected
      2. A.9.2. Legal Forms
      3. A.9.3. Examples
      4. A.9.4. Notes
    10. A.10. CMP: Arithmetic Comparison
      1. A.10.1. Flags Affected
      2. A.10.2. Legal Forms
      3. A.10.3. Examples
      4. A.10.4. Notes
    11. A.11. DEC: Decrement Operand
      1. A.11.1. Flags Affected
      2. A.11.2. Legal Forms
      3. A.11.3. Examples
      4. A.11.4. Notes
    12. A.12. DIV: Unsigned Integer Division
      1. A.12.1. Flags Affected
      2. A.12.2. Legal Forms
      3. A.12.3. Examples
      4. A.12.4. Notes
    13. A.13. INC: Increment Operand
      1. A.13.1. Flags Affected
      2. A.13.2. Legal Forms
      3. A.13.3. Examples
      4. A.13.4. Notes
    14. A.14. INT: Software Interrupt
      1. A.14.1. Flags Affected
      2. A.14.2. Legal Forms
      3. A.14.3. Examples
      4. A.14.4. Notes
    15. A.15. IRET: Return from Interrupt
      1. A.15.1. Flags Affected
      2. A.15.2. Legal Forms
      3. A.15.3. Examples
      4. A.15.4. Notes
    16. A.16. J?: Jump on Condition
      1. A.16.1. Flags Affected
      2. A.16.2. Examples
      3. A.16.3. Notes
    17. A.17. JCXZ: Jump If CX = 0
      1. A.17.1. Flags Affected
      2. A.17.2. Legal Forms
      3. A.17.3. Examples
      4. A.17.4. Notes
    18. A.18. JECXZ: Jump If ECX = 0
      1. A.18.1. Flags Affected
      2. A.18.2. Legal Forms
      3. A.18.3. Examples
      4. A.18.4. Notes
    19. A.19. JMP: Unconditional Jump
      1. A.19.1. Flags Affected
      2. A.19.2. Legal Forms
      3. A.19.3. Examples
      4. A.19.4. Notes
    20. A.20. LEA: Load Effective Address
      1. A.20.1. Flags Affected
      2. A.20.2. Legal Forms
      3. A.20.3. Examples
      4. A.20.4. Notes
    21. A.21. LOOP: Loop until CX/ECX = 0
      1. A.21.1. Flags Affected
      2. A.21.2. Legal Forms
      3. A.21.3. Examples
      4. A.21.4. Notes
    22. A.22. LOOPNZ/LOOPNE: Loop While CX/ECX > 0 and ZF = 0
      1. A.22.1. Flags Affected
      2. A.22.2. Legal Forms
      3. A.22.3. Examples
      4. A.22.4. Notes
    23. A.23. LOOPZ/LOOPE: Loop While CX/ECX > 0 and ZF = 1
      1. A.23.1. Flags Affected
      2. A.23.2. Legal Forms
      3. A.23.3. Examples
      4. A.23.4. Notes
    24. A.24. MOV: Move (Copy) Right Operand into Left Operand
      1. A.24.1. Flags Affected
      2. A.24.2. Legal Forms
      3. A.24.3. Examples
      4. A.24.4. Notes
    25. A.25. MOVS: Move String
      1. A.25.1. Flags Affected
      2. A.25.2. Legal Forms
      3. A.25.3. Examples
      4. A.25.4. Notes
    26. A.26. MOVSX: Move (Copy) with Sign Extension
      1. A.26.1. Flags Affected
      2. A.26.2. Legal Forms
      3. A.26.3. Examples
      4. A.26.4. Notes
    27. A.27. MUL: Unsigned Integer Multiplication
      1. A.27.1. Flags Affected
      2. A.27.2. Legal Forms
      3. A.27.3. Examples
      4. A.27.4. Notes
    28. A.28. NEG: Negate (Two's Complement; i.e., Multiply by −1)
      1. A.28.1. Flags Affected
      2. A.28.2. Legal Forms
      3. A.28.3. Examples
      4. A.28.4. Notes
    29. A.29. NOP: No Operation
      1. A.29.1. Flags Affected
      2. A.29.2. Legal Forms
      3. A.29.3. Examples
      4. A.29.4. Notes
    30. A.30. NOT: Logical NOT (One's Complement)
      1. A.30.1. Flags Affected
      2. A.30.2. Legal Forms
      3. A.30.3. Examples
      4. A.30.4. Notes
    31. A.31. OR: Logical OR
      1. A.31.1. Flags Affected
      2. A.31.2. Legal Forms
      3. A.31.3. Examples
      4. A.31.4. Notes
    32. A.32. POP: Pop Top of Stack into Operand
      1. A.32.1. Flags Affected
      2. A.32.2. Legal Forms
      3. A.32.3. Examples
      4. A.32.4. Notes
    33. A.33. POPA/POPAD: Pop All GP Registers
      1. A.33.1. Flags Affected
      2. A.33.2. Legal Forms
      3. A.33.3. Examples
      4. A.33.4. Notes
    34. A.34. POPF: Pop Top of Stack into 16-Bit Flags
      1. A.34.1. Flags Affected
      2. A.34.2. Legal Forms
      3. A.34.3. Examples
      4. A.34.4. Notes
    35. A.35. POPFD: Pop Top of Stack into EFlags
      1. A.35.1. Flags Affected
      2. A.35.2. Legal Forms
      3. A.35.3. Examples
      4. A.35.4. Notes
    36. A.36. PUSH: Push Operand onto Top of Stack
      1. A.36.1. Flags Affected
      2. A.36.2. Legal Forms
      3. A.36.3. Examples
      4. A.36.4. Notes
    37. A.37. PUSHA: Push All 16-Bit GP Registers
      1. A.37.1. Flags Affected
      2. A.37.2. Legal Forms
      3. A.37.3. Examples
      4. A.37.4. Notes
    38. A.38. PUSHAD: Push All 32-Bit GP Registers
      1. A.38.1. Flags Affected
      2. A.38.2. Legal Forms
      3. A.38.3. Examples
      4. A.38.4. Notes
    39. A.39. PUSHF: Push 16-Bit Flags onto Stack
      1. A.39.1. Flags Affected
      2. A.39.2. Legal Forms
      3. A.39.3. Examples
      4. A.39.4. Notes
    40. A.40. PUSHFD: Push 32-Bit EFlags onto Stack
      1. A.40.1. Flags Affected
      2. A.40.2. Legal Forms
      3. A.40.3. Examples
      4. A.40.4. Notes
    41. A.41. RET: Return from Procedure
      1. A.41.1. Flags Affected
      2. A.41.2. Legal Forms
      3. A.41.3. Examples
      4. A.41.4. Notes
    42. A.42. ROL: Rotate Left
      1. A.42.1. Flags Affected
      2. A.42.2. Legal Forms
      3. A.42.3. Examples
      4. A.42.4. Notes
    43. A.43. ROR: Rotate Right
      1. A.43.1. Flags Affected
      2. A.43.2. Legal Forms
      3. A.43.3. Examples
      4. A.43.4. Notes
    44. A.44. SBB: Arithmetic Subtraction with Borrow
      1. A.44.1. Flags Affected
      2. A.44.2. Legal Forms
      3. A.44.3. Examples
      4. A.44.4. Notes
    45. A.45. SHL: Shift Left
      1. A.45.1. Flags Affected
      2. A.45.2. Legal Forms
      3. A.45.3. Examples
      4. A.45.4. Notes
    46. A.46. SHR: Shift Right
      1. A.46.1. Flags Affected
      2. A.46.2. Legal Forms
      3. A.46.3. Examples
      4. A.46.4. Notes
    47. A.47. STC: Set Carry Flag (CF)
      1. A.47.1. Flags Affected
      2. A.47.2. Legal Forms
      3. A.47.3. Examples
      4. A.47.4. Notes
    48. A.48. STD: Set Direction Flag (DF)
      1. A.48.1. Flags Affected
      2. A.48.2. Legal Forms
      3. A.48.3. Examples
      4. A.48.4. Notes
    49. A.49. STOS: Store String
      1. A.49.1. Flags Affected
      2. A.49.2. Legal Forms
      3. A.49.3. Examples
      4. A.49.4. Notes
    50. A.50. SUB: Arithmetic Subtraction
      1. A.50.1. Flags Affected
      2. A.50.2. Legal Forms
      3. A.50.3. Examples
      4. A.50.4. Notes
    51. A.51. XCHG: Exchange Operands
      1. A.51.1. Flags Affected
      2. A.51.2. Legal Forms
      3. A.51.3. Examples
      4. A.51.4. Notes
    52. A.52. XLAT: Translate Byte via Table
      1. A.52.1. Flags Affected
      2. A.52.2. Legal Forms
      3. A.52.3. Examples
      4. A.52.4. Notes
    53. A.53. XOR: Exclusive Or
      1. A.53.1. Flags Affected
      2. A.53.2. Legal Forms
      3. A.53.3. Examples
      4. A.53.4. Notes
  20. B. Character Set Charts

Product information

  • Title: Assembly Language Step-by-Step: Programming with Linux®, Third Edition
  • Author(s):
  • Release date: October 2009
  • Publisher(s): Wiley
  • ISBN: 9780470497029