A comprehensive guide to learning Assembly language from beginner to advanced level. This repository provides structured lessons, examples, and exercises to help you master low-level programming.
- About
- Prerequisites
- Getting Started
- Learning Path
- Course Structure
- Tools and Environment
- Resources
- Contributing
- License
This repository is designed to guide you through learning Assembly language from the ground up. Whether you're a complete beginner or looking to deepen your understanding of low-level programming, you'll find structured lessons that progressively build your skills.
Assembly language is the closest human-readable representation of machine code and provides invaluable insights into:
- How computers actually work at the hardware level
- Memory management and CPU operations
- Performance optimization
- Reverse engineering and security analysis
- Operating system internals
Before starting this course, you should have:
- Basic understanding of programming concepts (variables, loops, conditionals)
- Familiarity with number systems (binary, hexadecimal)
- A computer running Windows, Linux, or macOS
- Patience and curiosity to learn low-level concepts
- Clone this repository:
git clone https://github.com/sowngdp/assembly-learning.git
cd assembly-learning-
Set up your development environment (see Tools and Environment)
-
Start with Lesson 1 in the
lessons/directory -
Follow the lessons in order, completing exercises before moving forward
The course is divided into four main levels:
Foundation concepts and basic programming
Working with data structures and advanced instructions
System-level programming and optimization
Specialized topics and real-world applications
- What is Assembly language?
- CPU architecture basics (registers, memory, ALU)
- Assembly vs. high-level languages
- Setting up your environment
- Binary, hexadecimal, and octal systems
- Signed and unsigned integers
- Two's complement representation
- Converting between number systems
- Writing "Hello, World!" in Assembly
- Understanding the assembler and linker
- Program structure and syntax
- Comments and code organization
- General-purpose registers (EAX, EBX, ECX, EDX)
- Special-purpose registers (ESP, EBP, EIP)
- MOV instruction and data movement
- Basic arithmetic operations (ADD, SUB, INC, DEC)
- Status flags (Zero, Carry, Sign, Overflow)
- Comparison operations (CMP, TEST)
- Understanding how flags are set
- Basic conditional logic
- Unconditional jumps (JMP)
- Conditional jumps (JE, JNE, JG, JL, etc.)
- Creating simple if-else logic
- Loop basics with jumps
- Stack structure and operations
- PUSH and POP instructions
- Stack pointer (ESP) management
- Stack frames basics
- CALL and RET instructions
- Function prologue and epilogue
- Parameter passing conventions
- Local variables
- Immediate, register, and direct addressing
- Indirect and indexed addressing
- Base+offset addressing
- Effective address calculation
- Declaring and accessing arrays
- String operations (MOVS, CMPS, SCAS, STOS)
- Direction flag and REP prefix
- Implementing string functions
- AND, OR, XOR, NOT operations
- Shift operations (SHL, SHR, SAL, SAR)
- Rotate operations (ROL, ROR, RCL, RCR)
- Bit manipulation techniques
- MUL and IMUL instructions
- DIV and IDIV instructions
- Handling overflow
- Optimizing with shifts
- Nested function calls
- Preserving registers
- Stack alignment
- Variable argument functions
- cdecl, stdcall, fastcall
- Stack cleanup responsibilities
- Register preservation rules
- Interfacing with C/C++
- Defining and using macros
- Macro parameters
- Conditional assembly directives
- Code organization techniques
- Using debuggers (GDB, LLDB, WinDbg)
- Setting breakpoints
- Inspecting registers and memory
- Common debugging strategies
- FPU architecture and registers
- Floating-point instructions
- SSE/AVX instructions
- Precision and performance considerations
- MMX, SSE, and AVX extensions
- Parallel data processing
- Vector operations
- Performance optimization with SIMD
- Making system calls in Linux
- Making system calls in Windows
- System call numbers and conventions
- File I/O at the system level
- Virtual memory concepts
- Page tables and address translation
- Memory protection
- Allocating and freeing memory
- Interrupt handling
- Exception types and handling
- Interrupt descriptor table (IDT)
- Hardware vs. software interrupts
- Thread creation and management
- Atomic operations (LOCK prefix, XCHG, CMPXCHG)
- Spinlocks and mutexes
- Memory barriers and ordering
- CPU pipeline and instruction scheduling
- Cache optimization strategies
- Branch prediction optimization
- Profiling and benchmarking
- Understanding PIC requirements
- Global Offset Table (GOT)
- Procedure Linkage Table (PLT)
- Writing relocatable code
- Reading disassembled code
- Identifying common patterns
- Understanding compiler optimizations
- Tools and techniques
- Buffer overflows
- Stack canaries and protections
- Return-oriented programming (ROP)
- Security mitigations (ASLR, DEP, NX)
- BIOS and UEFI basics
- Real mode vs. protected mode
- Writing a simple bootloader
- Loading and executing code
- Process and thread implementation
- Context switching
- System call implementation
- Scheduler basics
- I/O port operations
- Memory-mapped I/O
- Interrupt handling in drivers
- Simple driver example
- GCC inline assembly syntax
- MSVC inline assembly syntax
- Constraints and clobbers
- Optimizing critical sections
- x86 vs. x64 differences
- ARM assembly basics
- Platform-specific considerations
- Portable assembly techniques
- Applying all learned concepts
- Building a complete application
- Code review and optimization
- Best practices and next steps
- NASM (Netwide Assembler) - Recommended for beginners
- MASM (Microsoft Macro Assembler) - For Windows development
- GAS (GNU Assembler) - For Linux/Unix systems
- FASM (Flat Assembler) - Lightweight and fast
- GDB (GNU Debugger) - Linux/Unix
- LLDB - macOS and modern systems
- WinDbg - Windows
- x64dbg - Windows, user-friendly interface
- Radare2 - Cross-platform reverse engineering
- Visual Studio - Full IDE with debugging support
- VS Code with Assembly extensions
- SASM - Simple crossplatform IDE for NASM, MASM, GAS
- Vim/Emacs with syntax highlighting
- VirtualBox - For safe experimentation
- VMware - Professional virtualization
- QEMU - For low-level development
sudo apt-get update
sudo apt-get install nasm gdb build-essentialbrew install nasm- Download NASM from: https://www.nasm.us/
- Install Visual Studio for MASM
- Use WSL (Windows Subsystem for Linux) for Linux-like environment
- "Programming from the Ground Up" by Jonathan Bartlett
- "Assembly Language Step-by-Step" by Jeff Duntemann
- "The Art of Assembly Language" by Randall Hyde
- "Professional Assembly Language" by Richard Blum
- Intelยฎ 64 and IA-32 Architectures Software Developer Manuals
- AMD Developer Guides
- NASM Documentation
- OSDev Wiki
- University lectures on computer architecture
- YouTube channels focused on low-level programming
- Assembly programming conference talks
- Crackmes.one - Reverse engineering challenges
- Microcorruption - Embedded security CTF
- pwnable.kr - Security wargames
Contributions are welcome! If you'd like to contribute to this learning repository:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-lesson) - Commit your changes (
git commit -m 'Add new lesson on topic') - Push to the branch (
git push origin feature/new-lesson) - Open a Pull Request
- Follow the existing lesson structure and format
- Include practical examples and exercises
- Test all code examples before submitting
- Add comments explaining complex concepts
- Update this README if adding new sections
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors who help improve this learning resource
- Inspired by the Assembly programming community
- Special thanks to educators making low-level programming accessible
- Issues: Please use the GitHub issue tracker for bugs or questions
- Discussions: Join our discussions for Q&A and community support
- Updates: Watch this repository for new lessons and improvements
Happy Learning! ๐
Remember: Assembly might seem challenging at first, but with practice and patience, you'll gain deep insights into how computers work. Take it one lesson at a time, experiment with the code, and don't hesitate to ask questions!