🔧Assembly ( NASM )

Introduction

this section of the book is about the basics of assembly programming for Intel x86/64 architecture with NASM assembler. its not a full tutorial in assembly and i wont go into details about registers and Intel IA32 architecture.

you can check my x86-nasm repository for a lot of example codes in x86 NASM. the codes are well commented and you can understand them easily, i suggest you read this section of the book and practice with those codes to have a better understanding.

if your final goal is to become a reverse engineer/malware analyst or a vulnerability researcher/exploit developer, then you really don't need to know how to write ASM code, you just have to know how to read disassembly.

the difference between assembly and disassembly is that the first one is the actual code written in one of assemblers such as nasm, fasm, masm or gas but the second one is the result of reversing the assembly process and converting an executable file from the machine instruction generated by the compiler back to the highest level possible which is the assembly language.

generally when reading disassembly you usually face more surprises because you are dealing with what the compiler generated with a lot of code optimizations that makes it much harder to read and understand. for example IDA is a disassembler that takes a compiled binary executable and shows you the disassembly output.

the best way to understand assembly and be able to read disassembly is to write code in a higher level language like C or C++ ( use debugging options when compiling it like '-g' for gcc ) then disassemble it and try to understand the execution flow. you can also have your friend write some C code and compile it then you can disassemble it and try to write the same program in C from the disassembly.

Resources

some other resources:

Last updated