Programming · Ebook
Hex Decoding into Assembly Language: Disassembly and Instruction Encoding
by Shriira Press
A comprehensive, self-contained guide to the reverse of assembly — taking raw hexadecimal machine code and decoding it back into human-readable assembly instructions. This is disassembly, and it rests on understanding instruction encoding: how a CPU's instructions are represented as bytes, how the bytes split into opcode and operand fields, and how a decoder walks a byte stream turning 48 01 D8 into add rax, rbx. This book teaches that skill across architectures — the byte-level formats of x86/x86-64, ARM, RISC-V, MIPS, and more — blending intuition (what decoding is and why it's hard), concepts (encoding formats and the decode algorithm), and runnable practice (decoding by hand and writing a disassembler). It includes a multi-architecture encoding catalog (Appendices C–H) and the actual ISA manuals (in manuals/) that are the ground truth for every encoding.
Contents
- 1Preface
- 2Chapter 1 — What Is Hex Decoding?
- 3Chapter 2 — From Hex to Instructions: The Decoding Problem
- 4Chapter 3 — Instruction Encoding Fundamentals
- 5Chapter 4 — The x86 Instruction Format
- 6Chapter 5 — Decoding x86-64 by Hand
- 7Chapter 6 — x86 Addressing: ModR/M and SIB Decoding
- 8Chapter 7 — Decoding ARM (AArch64)
- 9Chapter 8 — Decoding RISC-V
- 10Chapter 9 — Decoding MIPS and Fixed-Width ISAs
- 11Chapter 10 — Building a Disassembler
- 12Chapter 11 — Tools of the Trade
- 13Chapter 12 — Challenges: Variable Length, Code vs. Data, and Obfuscation
- 14Chapter 13 — Hex Decoding in Practice and the Profession
- 15Appendix A — Glossary and Quick Reference
- 16Appendix B — Further Reading and the ISA Manuals
- 17Appendix C — x86 / x86-64 Encoding Catalog
- 18Appendix D — ARM Encoding Catalog (AArch64 & AArch32)
- 19Appendix E — RISC-V Encoding Catalog
- 20Appendix F — MIPS Encoding Catalog
- 21Appendix G — 6502 Encoding Catalog
- 22Appendix H — Other Architectures: Z80, AVR, PowerPC, SPARC
