I’ve been looking for a good x86 assembly language book for some time. First, I picked up “Assembly Language Step-by-Step” by Jeff Duntemann (ISBN 0471578142) for cheap as a remainder. I wasn’t too impressed with that book, mostly because it was a little too short on details, the coverage was oriented towards 16-bit instructions and DOS and the writing style was a little too chatty for my tastes. It seems that because assembly language is riddled with machine details, authors feel the need to be chatty to get the reader past the details. Speaking for myself, I’d rather they just went into the details and left the chitchat for cocktail parties.
I’d also attempted to understand the x86 instruction set from the Intel documentation on the IA-32 architecture. Unfortunately, that document is a little too much into the details, presenting nothing but details and lacking any higher-level viewpoint. What I wanted in a book was a medium level in between the exhaustive detail of the Intel documentation and the cocktail banter of Duntemann. With that in mind, I received a review copy of “Professional Assembly Language” by Richard Blum courtesy of Wrox Press.
First off, the title of this book is wrong. It should be called “Beginning Linux Assembly Language“. I’m a self-confessed mass-market slut when it comes to my computing platform: I program for Microsoft Windows, not Linux. I don’t have anything against Linux (or its ancestor, Unix), but its not what I use to make a living and comparing relative sizes of markets, I’m not alone in that reality. Unfortunately this book chooses Linux as its platform and barely mentions that anywhere on the cover of the book. Its only mentioned once by inference in a note on the back cover promising that this book will teach you how to make Linux system calls from assembly language. Once you get into the book, its obvious, but when buying books online you don’t have the luxury of being able to browse through all the chapters. Many times, you consider yourself lucky if you can see a detailed enough picture of the back cover that you can read the text.
If it were just the occaisional detail about making a Linux system call, it wouldn’t be that bad. However, the Linux world uses gas (GNU assembler) as its assembler and the authors of gas decided to use AT&T syntax for their assembly language. This means that the syntax is backward from what you will find in all Windows and Intel documentation and environments. I counted no less than 4 occasions where the author warns the reader that the syntax displayed in his examples are backwards from what you will read in all the reference documentation for the IA-32 architecture. That the author felt compelled to repeatedly warn the reader should have been a good sign to the author that this was a poor approach. Even if you are programming for the Linux platform, you’re going to be referring to the Intel documentation and other example code out there on the net, the preponderance of which is for Windows and/or is shown in Intel instruction format. There are other minor differences in the instruction syntax, but the reversal of the source and destination arguments in the instruction formats causes no end of confusion and only serves to distract anyone who is not programming for Linux.
Then there’s the adjective “Professional” in the title. Wrox Press generally has two kinds of titles in their repetoire: “Beginning” titles that introduce you gently to a subject and “Professional” titles that get you down into the nitty gritty of the subject. This book was disappointing as a member of the “Professional” title group. In a professional title, I expect the book to cover a large enough example — perhaps refining it progressively through successive chapters — that I can get a sense of what its like to write a large chunk of assembly language. I expect a professional title to include significant details on advanced processor features such as MMX, SSE and SSE2 instruction set extensions. I expect a professional title to give examples of how to call methods on objects supplied from a C++ program and interact with the C/C++ runtime in an example more elaborate than just calling
So that’s two major strikes against this book, in my opinion. Had its title been as I suggest above, there would have been no disappointment — I simply wouldn’t have bought this book because I was interested in more advanced assembly language programming for the IA-32 architecture using Intel syntax. However, as I read through the book I also found other small problems. There’s the occasional typo in the text, and being an author myself I can forgive those. However, there are also small typos in the sample code and that’s an area where I’m less forgiving. Its important that sample code shown inline with the book text be fully functioning and correct. The publisher exhorts me to visit their web site for corrections and errata, which is fine for the prose portion of the book, but in my opinion the code samples should be held to a higher standard in a book on programming.
The SIMD instruction set extensions are covered by the last chapter in the book, but only briefly and not with sufficient examples to show the power of these SIMD extensions to the IA-32 architecture. The basic material in previous chapters appears to be accurately explained, although the order in which the instructions were presented also felt awkward to me. Several times the author shows instructions that have not yet been explained in order to make a more interesting example for the point under discussion at that moment. I feel it would have been better to give a brief summary of all the instruction opcodes before showing any examples of those instructions with a promise of an explanation later.
Overall, this book is just “ok”, and even then its only if you’re interested in writing assembly language programs on the Linux platform. It won’t be helpful to you if you’re writing a device driver and want to know how to manipulate common hardware peripherals directly. It won’t be very helpful to you if you’re interested in writing assembly language programs for Windows or using an assembler that supports the standard IA-32 instruction format. It also won’t be very helpful to you if you’re interested in advanced features like MMX, SSE or SSE2.