x64 Assembly Language Step-by-Step, 4th Edition

Book description

The long-awaited x64 edition of the bestselling introduction to Intel assembly language

In the newly revised fourth edition of x64 Assembly Language Step-by-Step: Programming with Linux, author Jeff Duntemann delivers an extensively rewritten introduction to assembly language with a strong focus on 64-bit long-mode Linux assembler. The book offers a lighthearted, robust, and accessible approach to a challenging technical discipline, giving you a step-by-step path to learning assembly code that’s engaging and easy to read.

x64 Assembly Language Step-by-Step makes quick work of programmable computing basics, the concepts of binary and hexadecimal number systems, the Intel x86/x64 computer architecture, and the process of Linux software development to dive deep into the x64 instruction set, memory addressing, procedures, macros, and interface to the C-language code libraries on which Linux is built.

You’ll also find:

  • A set of free and open-source development and debugging tools you can download and put to use immediately
  • Numerous examples woven throughout the book to illustrate the practical implementation of the ideas discussed within
  • Practical tips on software design, coding, testing, and debugging

A one-stop resource for aspiring and practicing Intel assembly programmers, the latest edition of this celebrated text provides readers with an authoritative tutorial approach to x64 technology that’s ideal for self-paced instruction.

Table of contents

  1. Cover
  2. Table of Contents
  3. Title Page
  4. Introduction
  5. CHAPTER 1: It's All in the Plan
    1. Another Pleasant Valley Saturday
    2. Had This Been the Real Thing …
    3. Assembly Language Programming As a Square Dance
    4. Assembly Language Programming As a Board Game
  6. CHAPTER 2: Alien Bases
    1. The Return of the New Math Monster
    2. Octal: How the Grinch Stole Eight and Nine
    3. Hexadecimal: Solving the Digit Shortage
    4. From Hex to Decimal and from Decimal to Hex
    5. Practice. Practice! PRACTICE!
    6. Arithmetic in Hex
    7. Binary
    8. Hexadecimal as Shorthand for Binary
    9. Prepare to Compute
  7. CHAPTER 3: Lifting the Hood
    1. RAXie, We Hardly Knew Ye
    2. Switches, Transistors, and Memory
    3. The Shop Supervisor and the Assembly Line
    4. The Box That Follows a Plan
    5. What vs. How: Architecture and Microarchitecture
    6. Enter the Plant Manager
  8. CHAPTER 4: Location, Location, Location
    1. The Joy of Memory Models
    2. The Nature of Segments
    3. Segment Registers
    4. The Four Major Assembly Programming Models
    5. 64-Bit Long Mode
  9. CHAPTER 5: The Right to Assemble
    1. The Nine and Sixty Ways to Code
    2. Files and What's Inside Them
    3. Text In, Code Out
    4. The Assembly Language Development Process
    5. Linking the Object Code File
    6. Taking a Trip Down Assembly Lane
  10. CHAPTER 6: A Place to Stand, with Access to Tools
    1. Integrated Development Environments
    2. Introducing SASM
    3. Linux and Terminals
    4. Using Linux Make
    5. Debugging with SASM
  11. CHAPTER 7: Following Your Instructions
    1. Build Yourself a Sandbox
    2. Instructions and Their Operands
    3. Source and Destination Operands
    4. Rally Round the Flags, Boys!
    5. Signed and Unsigned Values
    6. Implicit Operands and MUL
    7. Reading and Using an Assembly Language Reference
    8. NEG Negate (Two's Complement; i.e., Multiply by −1)
  12. CHAPTER 8: Our Object All Sublime
    1. The Bones of an Assembly Language Program
    2. Last In, First Out via the Stack
    3. Using Linux Kernel Services Through Syscall
    4. Designing a Nontrivial Program
    5. Going Further
  13. CHAPTER 9: Bits, Flags, Branches, and Tables
    1. Bits Is Bits (and Bytes Is Bits)
    2. Shifting Bits
    3. Bit-Bashing in Action
    4. Flags, Tests, and Branches
    5. X64 Long Mode Memory Addressing in Detail
    6. Character Table Translation
    7. Tables Instead of Calculations
  14. CHAPTER 10: Dividing and Conquering
    1. Boxes within Boxes
    2. Calling and Returning
    3. Local Labels and the Lengths of Jumps
    4. Building External Procedure Libraries
    5. The Art of Crafting Procedures
    6. Simple Cursor Control in the Linux Console
    7. Creating and Using Macros
  15. CHAPTER 11: Strings and Things
    1. The Notion of an Assembly Language String
    2. REP STOSB, the Software Machine Gun
    3. The Semiautomatic Weapon: STOSB Without REP
    4. MOVSB: Fast Block Copies
    5. Storing Data to Discontinuous Strings
    6. Command-Line Arguments, String Searches, and the Linux Stack
    7. The Stack, Its Structure, and How to Use It
  16. CHAPTER 12: Heading Out to C
    1. What's GNU?
    2. Linking to the Standard C Library
    3. Formatted Text Output with printf()
    4. Data In with fgets() and scanf()
    5. Be a Linux Time Lord
    6. Understanding AT&T Instruction Mnemonics
    7. Generating Random Numbers
    8. How C Sees Command-Line Arguments
    9. Simple File I/O
  17. Conclusion: Not the End, But Only the Beginning
    1. Where to Now?
    2. The Art of 64-bit Assembly by Randall Hyde (No Starch Press, 2022)
    3. Modern x86 Assembly Language Programming by David Kusswurm (Apress, 2018)
    4. Stepping off Square One
  18. APPENDIX A: The Return of the Insight Debugger
    1. Insight's Shortcomings
    2. Opening a Program Under Insight
    3. Setting Command-Line Arguments with Insight
    4. Running and Stepping a Program
    5. The Memory Window
    6. Showing the Stack in Insight's Memory View
    7. Examining the Stack with Insight's Memory View
    8. Learn gdb!
  19. APPENDIX B: Partial x64 Instruction Reference
    1. What's Been Removed from x64
    2. Flag Results
    3. Size Specifiers
    4. Instruction Index
    5. ADC: Arithmetic Addition with Carry
    6. ADD: Arithmetic Addition
    7. AND: Logical AND
    8. BT: Bit Test
    9. CALL: Call Procedure
    10. CLC: Clear Carry Flag (CF)
    11. CLD: Clear Direction Flag (DF)
    12. CMP: Arithmetic Comparison
    13. DEC: Decrement Operand
    14. DIV: Unsigned Integer Division
    15. INC: Increment Operand
    16. J??: Jump If Condition Is Met
    17. JECXZ: Jump if ECX=0
    18. JRCXZ: Jump If RCX=0
    19. JMP: Unconditional Jump
    20. LEA: Load Effective Address
    21. LOOP: Loop Until CX/ECX/RCX=0
    22. LOOPNZ/LOOPNE: Loop Until CX/ECX/RCX=0 and ZF=0
    23. LOOPZ/LOOPE: Loop Until CX/ECX/RCX=0 and ZF=1
    24. MOV: Copy Right Operand into Left Operand
    25. MOVS: Move String
    26. MOVSX: Copy with Sign Extension
    27. MUL: Unsigned Integer Multiplication
    28. NEG: Negate (Two's Complement; i.e., Multiply by −1)
    29. NOP: No Operation
    30. NOT: Logical NOT (One's Complement)
    31. OR: Logical OR
    32. POP: Copy Top of Stack into Operand
    33. POPF/D/Q: Copy Top of Stack into Flags Register
    34. PUSH: Push Operand onto Top of Stack
    35. PUSHF/D/Q: Push Flags Onto the Stack
    36. RET: Return from Procedure
    37. ROL/ROR: Rotate Left/Rotate Right
    38. SBB: Arithmetic Subtraction with Borrow
    39. SHL/SHR: Shift Left/Shift Right
    40. STC: Set Carry Flag (CF)
    41. STD: Set Direction Flag (DF)
    42. STOS/B/W/D/Q: Store String
    43. SUB: Arithmetic Subtraction
    44. SYSCALL: Fast System Call into Linux
    45. XCHG: Exchange Operands
    46. XLAT: Translate Byte Via Table
    47. XOR: Exclusive OR
  20. APPENDIX C: Character Set Charts
  21. Index
  22. Copyright
  23. Dedication
  24. About the Author
    1. About the Technical Editor
  25. Acknowledgments
  26. End User License Agreement

Product information

  • Title: x64 Assembly Language Step-by-Step, 4th Edition
  • Author(s): Jeff Duntemann
  • Release date: October 2023
  • Publisher(s): Wiley
  • ISBN: 9781394155248