All that is wrong with the world…

March 4, 2013

A comparison of books for learning assembly language.

Filed under: Tech — Tags: , , , , , — allthatiswrong @ 2:31 am

I had wanted to learn assembly for a very long time, at least a year but was very slow getting into it. Part of that, I think, was because I imagined it to be a lot more difficult than it was. The second issue was finding a good guide. Random tutorials I encountered on the internet seemed to jump in without much of an explanation and I was quickly lost. It wasn’t until I realized how easy it was to download eBooks that I started taking my goal more seriously.

There were many different assembly textbooks out there; it was just a matter of choosing the right one. My requirements were simple: Intel syntax, Linux and Windows compatible, not assuming too much prerequisite knowledge and exercises with solutions as a way to test knowledge.

I thought I would quickly write this for people who are in a similar position to what I was in, hopefully narrowing down the choices. All the title reviewed here were the latest editions as at the date of this post.

James T. Strieb – Guide to assembly language: A concise introduction
This is the book I found to be the perfect guide. It was exactly what I was looking for. The book assumes a basic knowledge of programming and doesn’t go over architecture at all. Or if it does, it does so briefly and only when pertinent. The book assumes knowledge of things like libraries, arrays and functions, nothing to complex.

The book shows concepts in C with code examples and then shows how they would be implemented in assembly. It uses Intel syntax with the MASM assembler. There seems to be some of the more complicated stuff left out, although I think it is a great starting point, making it much easier to pick up one of the other assembly textbooks. The book gives solutions to about half the exercises, which is significantly better than the rest I couldn’t recommend this book enough for someone looking to learn assembly. I found it very approachable and was able to learn the language in a short amount of time.

The Art of Assembly Language – Randall Hyde

This was the first book I tried for learning assembly, as I had heard good things about the publisher and this book in particular. It was disappointing to say the least. The biggest gripe I have with this book is that it teaches “High Level Assembly”, essentially an entirely different language from assembly, built using assembly macros. It’s great maybe if you have no programming experience what so ever…although even then I don’t know why you would learn HLA instead of a real language.

I have a good knowledge of concepts like OO and arrays and functions, although I’m not much of a developer. Randall’s book assumed no prior knowledge, which I thought was fine as it would give me a chance to brush up on what I already knew. Learning HLA instead of assembly just became frustrating, and I soon looked for a replacement. It’s hard to recommend this book at all, as well written as it is, unless you are OK with learning a different language to help learn assembly.

Assembly Language for x86 Processors – Kip Irvine

This seemed like a book high on everyone’s list and for good reason. It covers a lot of architecture and then gets into the programming. I didn’t find it as approachable as some of the other books, in particular the one by Streib. I was somewhat put off that he uses his own library for input and output, although looking at it now it seems OK. I was probably just put off from the HLA stuff. He still teaches without his library eventually, so it’s a minor point.

I would not recommend this for a beginner, as he delves into things like the EQU directive and symbols in the introductory chapter! The main reason I didn’t go for this was that it seemed a little too complex, and that there were no solutions made available for the exercises unless you are an instructor. I find that quite frustrating. Now that I’ve finished with the Streib book, I may choose this to augment my existing knowledge.

Introduction to Assembly Language Programming: From 8086 to Pentium Processors – Sivarama P. Dandamudi

This book is over complicated and I don’t think suitable for a beginner. In fact I’m not really sure where it would find a niche, given there seem to be better books out there. The book devotes quite a lot to architecture, focusing on the Intel Pentium and going into RISC architectures with the MIPS processor as well. The book uses the Nasm assembler which is nice, as it is Intel syntax and cross platform.

There is a lot of info on debugging, interrupts and similar things which make it seem useful as a reference. Chapter 3 is devoted to explaining the Pentium Processor, with Chapter 4 starting to teach Assembly. If you just want to learn assembly and can go without deep explanations of processors mechanics, this probably isn’t the book for you. Also, no answers to exercises are provided.

Introduction to 80×86 Assembly Language and Computer Architecture – Richard C. Detmer

This book seems similar to Kip Irvine’s book in the sense that it covers a lot of architecture. There almost seems to be more about architecture than programming. As my goal was only to learn assembly and not architecture, I found this book too broad. When it gets into teaching assembly I thought it was too complex, introducing jmp in the same paragraph as add, for example.

It uses a special library for input and output similar to how Irvine does, but also seems to teach input and output sans library later on, which is fine. Staying consistent with the trend, solutions to exercises are not provided.

Programming from the Ground Up – John Bartlett

I think the main reason I didn’t use this book is because of the use of AT&T syntax. Intel is more popular and seems easier to pickup. It also uses Linux specific tool and since Windows is my everyday operating system, I didn’t want to reboot or use a VM just to learn assembly.

The book seems kind of odd to me…explaining basic architecture in the first 2 chapters but not getting deep into it. It starts off with some basic programs, but then gets into buffers and system calls very early on. This looks like a fine book if you were fine learning AT&T syntax in a Linux environment, and wanted a very gentle introduction to the concepts. There are no answers to exercises, which is frustrating.