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.

9 Comments »

  1. I think it is a strange goal to ‘just’ learn assembly. Most people that end up writing assembly for a living usually come from a high-level language, have high performance requirements and hit a barrier or are compiler writers. Both groups usually have an idea of how a modern microprocessor functions, know some assembly as part of their routine job, or only need a small subset of assembly in general.

    Most books are for those people and won’t be good if you just want to learn assembly, because they weren’t written for that purpose.

    Also, I don’t see too much value in knowing assembly in and out. I hit a point where it becomes necessary from time to time, need to predict/compare performance, or want to optimize. I also make sure the auto-vectorizer is doing its job and write some vector instruction code manually. I don’t really need to know much assembly for that.

    Comment by phmr — April 5, 2013 @ 2:51 pm

    • I wanted to learn assembly because I have an interest in learning to write shellcode.

      Comment by allthatiswrong — January 5, 2014 @ 9:46 am

  2. Surprised not to see Introduction to 64 Bit Intel Assembly Language Programming for Linux: Second Edition http://www.amazon.co.uk/Introduction-Intel-Assembly-Language-Programming/dp/1478119209/ref=sr_1_1?ie=UTF8&qid=1384779495&sr=8-1&keywords=intel+assembly+linux+64

    Comment by Kenneth O'Brien (@ken_obrien) — November 18, 2013 @ 8:01 am

    • If that came up while searching, I probably rejected it as I wanted to make sure I knew 32 bit assembly first. Having to use a custom IDE doesn’t sound like a plus to me either.

      Comment by allthatiswrong — January 5, 2014 @ 9:46 am

  3. PC assembly, by Paul Carter, is “the book”… simple explanations, good examples… and is free!

    http://www.drpaulcarter.com/pcasm/

    Comment by Wesley Lopes de Oliveira — January 23, 2014 @ 10:56 am

  4. Another one… http://yurichev.com/writings/RE_for_beginners-en.pdf

    Comment by Dennis Yurichev — February 11, 2014 @ 12:53 am

  5. Great resources in the comments : https://news.ycombinator.com/item?id=7422703

    Comment by Adrian — March 20, 2014 @ 6:09 pm

  6. I really like it whenever people come together and
    share thoughts. Great blog, continue the good work!

    Comment by write a novel In 30 days contest — July 8, 2014 @ 1:47 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 74 other followers

%d bloggers like this: