Learning assembly language won’t make you a faster programmer. It won’t enable you to create portable, write-once, run-anywhere programs. So why learn it? The answer is that it will make you a better programmer.
Author John Schwartzman takes a fresh look at low-level programming and explores how to write programs using the BIOS and glibc. This laboratory-based book aids the writing of high-level structured programs by showing what the processor can and can’t do and how it does it.
You’ll take apart high-level structured C/C++ and show what the CPU is doing at every stage of the program. The book introduces programs and activities throughout the development process, providing sample code, makefiles, and shell scripts for each example program.
With the help of Assembly Language Reimagined you’ll become a more capable and versatile computer engineer.
What You will Learn
Explore a new perspective on the Intel x64 microprocessor for low-level programming
Understand what a processor is doing while a high-level structured computer language program is being run
Solve problems with the help of software.
See why assembly language programming is essential for every serious student of computer science
Who This Book Is For
Embedded Linux and Assembly developers, engineers and programmers, hobbyists from the Maker community, as well as college and graduate level students who have some prior knowledge of a structured high-level language like C or C++
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Assembly Language Reimagined: Programming the Intel X64 Microprocessor in Linux
## 【One-Line Pitch】
A hands-on, laboratory-style guide that teaches Intel x64 assembly on Linux by showing exactly what the CPU does when high-level C/C++ code runs, making you a more capable and versatile programmer. Ideal for embedded developers, engineers, hobbyists, and CS students who already know C or C++ and want to understand low-level programming from the ground up.
## 【Book Arc】
- **Opening (~0%–9%)**: Establishes why assembly matters—not for speed or portability, but for deeper understanding—and introduces core concepts like mnemonics, addressing modes, embedded programming constraints, and the CISC vs. RISC distinction.
- **Early (~9%–25%)**: Dives into BIOS services and Linux syscalls, walking through the SYS_WRITE example with register marshaling (rdi, rsi, rdx, rax), the `lea` instruction, and using the DDD debugger to observe register changes step-by-step.
- **Early (~25%–34%)**: Extends to the uname syscall, compares assembly output with equivalent C programs, and introduces Boolean logic gates, data types (byte, word, doubleword, quadword), and the C calling convention with callee-saved registers.
- **Middle (~34%–44%)**: Shifts from BIOS to glibc calls, explaining the linker's role, .bss sections, and shell script integration (os-distro.sh), then moves to command-line argument handling with argc/argv and printf's variadic argument mechanism.
- **Middle (~44%–47%+)**: Covers macros (like getSaveEnv) and passing arguments on the stack, including mixed C/assembly programs where assembly exports functions callable from C (e.g., printenv called from main).
## 【Key Takeaways】
- **Assembly is about understanding, not speed** (Opening): The book's core premise is that learning assembly makes you a better programmer by revealing what the processor can and can't do—not by making your code faster or more portable.
- **Mnemonics simplify machine language** (Opening): Assembly substitutes numeric op codes with readable names like MOV, ADD, and JMP, and addressing modes (immediate, register, memory) are determined by the arguments you supply.
- **Registers are the CPU's fast, named memory** (Early): The 64-bit registers like rdi (destination index) and rsi (source index) are special-purpose for strings, and marshaling arguments into the right registers before a syscall is the key to Linux kernel services.
- **The `lea` instruction loads addresses, not values** (Early): Unlike `mov`, `lea rsi, [msg]` computes and loads the memory address of msg into a register, with the assembler handling arithmetic like `listIndex + 8 * rcx` for you.
- **Syscalls use rax as the service selector** (Early): The `syscall` instruction always calls the same kernel entry point; the value in rax (e.g., SYS_WRITE=1, SYS_UNAME=63) tells Linux which service to perform, and arguments must be in the expected registers.
- **glibc is preferred over raw BIOS calls** (Middle): The gcc linker handles glibc startup/shutdown modules automatically, making it easier to call printf and other C library functions from assembly than to use low-level syscalls directly.
- **Data types have platform-specific meanings** (Early): Linux uses quadwords (64-bit) for long integers while Microsoft uses doublewords (32-bit), and all types except characters can be signed or unsigned with sign bits in the upper half.
- **Mixed C/assembly programming is practical** (Middle): Assembly functions can be declared in C (e.g., `int printenv(const char*)`) and called from main, with macros like getSaveEnv reducing repetitive code for environment variable lookups.
## 【Reading Tips】
- **Skim the preface and early chapters** (~0%–9%) for motivation and terminology, but don't get bogged down in CISC vs. RISC debates—the practical syscall examples starting at ~9% are where the real learning begins.
- **Deep-read the SYS_WRITE and uname examples** (~9%–34%): Follow along with the DDD debugger as the book suggests, stepping through instructions and watching registers change—this hands-on approach is essential for internalizing register marshaling.
- **Pay special attention to the C calling convention** (~34%): Understanding callee-saved registers and how printf's variadic arguments work (format string in rdi, additional args in rsi, etc.) is critical for later chapters on macros and stack passing.
- **Work through the Activities** at the end of each chapter (e.g., why `xor rax, rax` is used, creating a `zero` macro)—these reinforce the "why" behind each instruction and prepare you for the mixed C/assembly exercises.
- **Use the provided makefiles and shell scripts** as templates: The book includes complete build infrastructure (yasm, ld, gcc) and scripts like os-distro.sh, so replicate these setups to avoid environment issues and focus on the assembly logic.
## 【Coverage Limits】
This guide covers the book's progression from BIOS syscalls to glibc integration, command-line handling, and macros, based on excerpts through ~47% of the book. Later chapters on advanced topics (e.g., floating-point, SIMD, or advanced debugging) are not covered by the available excerpts.
##
Page 5
xiii Preface xv Chapter 1: Using BIOS Services 1 What Is the BIOS? 1 Getting Started 1 The Anatomy of a Makefile 5 Running the DDD Debugger 10 Activities 13...
d in the .data section (or .rodata section) of the program. The third and final argument is the number of characters that we want to write. In line 20, we mo...
do a 24 ChApTer 2 exTendIng BIOS ServICeS Activities 1. Draw the truth table for a three-input AND gate with inputs a, b, and c, and output x. 2. Draw the tr...
cursively as f(n) = { 1 if n <= 1, n * f(n – 1) if n > 1 } We’re now going to create the recursive function factorial both in c and in assembly language. The...
0 20! = 2432902008176640000 20! = 2,432,902,008,176,640,000 js@suse-tumbleweed-z4:~/Development/asm_x86_64/factorial$ ./a.out Enter a positive integer less t...
see that bubblesort is a rather poor-performing algorithm. Bubblesort takes the first element in a list of elements and compares it to every other element in...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Assembly Language Reimagined Programming the Intel X64 Microprocessor in Linux (John Schwartzman)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Assembly Language Reimagined Programming the Intel X64 Microprocessor in Linux (John Schwartzman)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment