Assembly
Assembly Programming and Computer Architecture for Software Engineers
Install / Use
/learn @brianrhall/AssemblyREADME
Assembly Programming and Computer Architecture for Software Engineers (APCASE)
* Code Repository - some assembly required...git it? *
About
<img src = "./content/Edition2/Cover_Ed2.png" alt = "Cover" width="320" align="right" hspace="10" vspace="5" style="border: 1px solid black;">Welcome to the code repository for our book! APCASE is a very practical and comprehensive educational text for students, educators, and professionals seeking to learn about Assembly programming and computer architecture. But what makes our book helpful and unique?
- Based on a dominant architecture - x86 and x86_64 - and what you learn will be transferable to other architectures.
- All programming examples are provided for three common assemblers: GAS (Clang/LLVM), MASM, and NASM, which ensures both AT&T and Intel syntax. This allows for learning on any OS platform: Mac, Windows, and Linux.
- Context and examples provided in both 32-bit and 64-bit, both of which are useful for a programmer.
- Code-oriented and detailed overviews of function calls, floating-point operations (x87 through AVX), inline Assembly, intrinsics, and system calls, all in one book.
- Brief introduction and code examples for other modern architectures like ARM, AVR, RISC-V, and z/Architecture.
- The Appendices provide practical information and guide students in learning Assembly programming.
- Chapter Supplements provide a deeper dive on topics as necessary.
- Links to wikis, developer resources, and videos are provided to assist in further exploration of topics.
- Attention, Programming, and Learning notes are placed throughout the text to guide the reader in beneficial ways.
| Prospect Press | Print Book (313 pages) | eBook (comparison) | |----------------|-------|------------| | Price | $82.25 | $46.50 | | Sources | Redshelf.com | Redshelf.com, Vital Source | ISBN | 978-1-943153-82-4 | 978-1-943153-76-3 |
Is this book for you? Checkout the Preface, a free Chapter 3: Assembly and Syntax Fundamentals, and the free Appendices.
Chapter Roadmap

<a name="appendices"></a>
Appendices
Appendices A, B, E, and I are available for free.
- Introduction to the Appendices
- Appendix A: Assembly Translation
- Appendix B: Environment Setup
- Appendix C: Disassembly
- Appendix D: Command-Line Debugging Assembly with GDB
- Appendix E: Linking Assembly and C++
- Appendix F: Functions and Stack
- Appendix G: Using CPUID
- Appendix H: ASCII and Decimal Arithmetic
- Appendix I: Intrinsics
Links
- Prospect Press (@ProspectPressVT): https://www.prospectpressvt.com/textbooks/Hall-assembly-programming-2-0
- Book Videos: https://lowlevelcoder.com
- Brian's Website: https://www.brianrhall.com
- Kevin's Website: https://www.kevinslonka.com
- Organized collection of all links in APCASE: Book_Links.md
Citing this Book
When citing code snippets or other content from the repository or book, please cite the original source:
BibTeX:
@Book{APCASE,
author = {Hall, B. R. and Slonka, K. J.},
title = {Assembly Programming and Computer Architecture for Software Engineers},
publisher = {Prospect Press},
year = 2020,
address = {Burlington, VT},
edition = 2,
isbn = {978-1-943153-32-9}
}
@Book{APCASE,
author = {Hall, B. R. and Slonka, K. J.},
title = {Assembly Programming and Computer Architecture for Software Engineers},
publisher = {Prospect Press},
year = 2018,
address = {Burlington, VT},
edition = 1,
isbn = {978-1-943153-32-9}
}
APA:
Hall, B. R. & Slonka, K. J. (2020). Assembly Programming and Computer Architecture for Software Engineers (2nd ed.). Burlington, VT: Prospect Press.
Hall, B. R. & Slonka, K. J. (2018). Assembly Programming and Computer Architecture for Software Engineers. Burlington, VT: Prospect Press.
FAQ
Important Notes
-
If you are using the most recent version of Windows 11, 23H2 - build 22631.4169 - or later (9/10/2024), then you must include the following line of code upon entry into
_mainin all x64 Windows programs. More is explained in the the FAQ page (and the book!). We will slowly add this line of code to the GitHub programs over time as people update, as it's not necessary for earlier versions of Windows.sub rsp, 28horsub rsp, 20h -
If you are using macOS High Sierra (10.3) and XCode 9 or later (very likely), you will discover that the i386 architecture is deprecated, and you must use x86_64. We have provided both 32-bit and 64-bit programs where possible but we recommend Edition 2 that has a 64-bit focus. The macOS 10.14 SDK and later do not support 32-bit applications. If you want to write 32-bit programs for i386 on macOS, Xcode 9.4 or earlier is required.
-
<span style="color: red;">Can I write x86_64 code on Apple Silicon??? (M1, M2, etc.)</span>
<span style="color: red;">YES!</span> Thanks to Rosetta. Just make sure Rosetta is installed and then in the Xcode project build settings set the Architecture to x86_64 and set arm64 to be Excluded. Emulators are cool things.
Book
- Why learn Assembly? Is it even used anymore?
- Why x86? Is it too complex for students?
- Why have code for multiple assemblers? Is it confusing?
- Why no custom software (e.g., libraries, macros, environments)?
- Is the GAS and Clang/LLVM code for macOS or Linux?
- What if a web link in the book is broken? / Is there a place with all active web links?
- What if students or instructors want to be able to perform console I/O before Chapter 6 and/or Chapter 10?
- Are there various syntax examples of the Edition 1, Chapter 6 detailed cdecl walkthough?
- Are there various syntax examples of the Edition 2, Chapter 6 detailed x64 walkthough?(Coming Soon!)
- Which provider should I choose for the eBook?
Teaching
- How do the authors pace a semester using the text? / Is there an example course outline?
- Chapter Highlights - What is most important, what do students typically struggle with, and what should students not forget for each chapter?
Programming
- Setting up shadow space on Windows x64
- How do I assemble and link on Linux?
- How do I assemble and link on macOS (Terminal)?
- Do I use the .globl or .global directive for main in GAS?
- How do I use GDB or LLDB for command-line debugging?
Edition 2.0 Errata
- Chapter 3, p. 45, Programming Note: <br>Incorrect: "The program would expect one piece of data from the user (weight in pounds) and would multiply pounds..." <br>Correct: "The program would expect one piece of data from the user (weight in pounds) and would divide pounds..."
- Chapter 3, p. 53, Program 3.2, GAS: Before
syscalland.end, the linemovl $1, %eaxneeds removed. This is correct in the repository. - Chapter 4, p. 62, Addition and Subtraction, GAS DECS example: <br><code>DECS M%rip)/%R </code> should be <code>DECS M%(rip)/%R </code>
- Chapter 6, p. 109, Implementations: A snipped of text from Chapter 12 was mistakenly placed in the final paragraph on page 109 during copy editing. The final two sentences should say: "We also compare cdecl, stdcall, and fastcall conventions in 32-bit. All code examples in this section were written in C++ using Xcode."
- Chapter 8, p. 139, Programming Note: Clarification that FSAVE/FNSAVE first saves the FPU state and then clears the registers.
Edition 1 Information
| Prospect Press | eBook (comparison) | Print Book (306 pages) | |----------------|-------|------------| | Price | $44 | $68 | | Sources | Redshelf.com, Vital Source | Amazon, Amazon Europe, Redshelf.com | | ISBN | 978-1-943153-31-2 | 978-1-943153-32-9 |
Edition 1 Samples
- Preface
- [Chapter 3: Assembly and Syntax Fundamentals](./content/Edition1/Assembly_Ed1_Ch3_GitHu
Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.8kCommit, push, and open a PR
