Good book on x86 asm?

Intel17

Newcomer
Hello All!

Could somebody point me to a good book for learning x86 asm? Price is a non-issue as long as it covers the topic thoroughly!

Thanks!
 
There are plenty of resources available online, and I am not sure if there is any one resource that covers everything there is to know. Some resources to get started would be:It should be noted that the actual assemblers out there (MASM, TASM, NASM, as well as the inline assemblers of MSVC and GCC) differ quite a bit in the syntax they expect; in particular, you will find the 'Intel' syntax and the 'AT&T' syntax - it is useful to know both, although most people quickly grow to hate at least one of them.

Once you get a hang of the basics and get some code snippets up and running, it is time for the deep dive:
Don't have unrealistic expectations to assembly language, though. While it is in general still possible to beat C/C++ compilers on performance, doing so requires fairly deep knowledge of both the actual assembly language and the target processor. Also, it is in general not considered a good idea to use assembly language for non-performance-critical parts of your programs.

You can sometimes use knowledge of assembly optimization to 'help' C/C++ code performance; it is possible (but difficult!) to develop a 'feel' for what assembly code a C/C++ compiler will need to produce for a C/C++ code snippet and thus identify obvious problems that hinder the compiler from doing good optimizations. However, this is a quite advanced topic, far beyond what most programmers actually need to know to be productive.
 
You don't really need a book to learn asm, IMO.
You need an instruction set reference (like this), some tutorials explaining x86 peculiarities (real mode, protected mode, v86 mode, 'unreal' mode) and the runtime environment you're targetting (DOS, win32, Linux, etc). If you don't want to worry about runtime environments, you can start with writing external 32-bit asm routines for C (NASM Manual: Interfacing to 32-bit C Programs). I don't recommend writing inline asm routines, since some compilers use AT&T asm syntax, which is nothing but a bad joke for x86 asm, IMO. (If you really want to write some, MSVC's syntax is OK.)

Furthermore, if you're familiar with Pascal, TMT Pascal has very nice inline asm capabilities (Borland compilers have too, but they can't understand instructions above 286).
 
Thanks! Also, I want to learn assembly not really for the sake of writing lots of programs in it, but I just want to learn it because it seems extremely interesting to be able to program at a lower level. Oh, and I love learning new things as well! :)
 
I'm a fan of this, but that might be because I can walk into the either of the authors' offices and ask them any questions I might have.

Chapter 3, the assembly chapter, is 128 pages, and there is an addendum available online (okay, it's available to me, don't know if it's up on the book's site yet) on the changes in x86-64 assembly.
 
Just download the approprite processor reference docs from the Intel site, and write code.

You'll have to write a fair amount of assembler to get a feel for it. You'll find you tend to use a small subset of the instructions, until you spend a significant amount of time with a processor. When I'm going back to a processor, I find myself reading instruction set summaries over and over to familiarise myself with the tools available.

To me the most useful thing is knowing what a compiler is likely to produce, If I'm writing anything performance sensitive in C I'll often look at the assembler the compiler produced and "massage" the source C code to produce better assembler.
 
Back
Top