views:

1295

answers:

9

I have no prior knowledge of assembly programming, and would like to learn how to code x86 assembly on a Linux platform. However, I'm having a hard time finding a good resource to teach myself with.

The Art of Assembly book looks good, but it teaches HLA. I'm not interested in having to learn one way, then relearning it all over again. It also seems like RISC architectures have better resources for assembly, but unfortunately I do not have a RISC processor to learn with. Does anyone have any suggestions?

[Edit: this is sort of like http://stackoverflow.com/questions/4845/good-x86-assembly-book]

+1  A: 

Probably nothing much better than The Art of Assembly Language Programming and the other resources at that web site.

Charlie Martin
Alright, but what is the point of learning HLA if I can't use it?
And you can't use it why? Free download. In any case, the book goes through the regular instruction set, including how you code the structures the HLA macros then give you.
Charlie Martin
I started reading this book but found it hard going and found HLA got in the way. It was kind of like learning spanish by learning Portuguese. Is there any good books to teach using FASM?
Gary Willoughby
Can I practically use HLA to debug programs on x86 architectures?
@unknown - You can use any snippets of assembly knowledge you have to debug programs. But honestly, there are better ways to debug your code.
Chris Lutz
and @Gary - FASM is not the assembler I would use. I would go for NASM because it works on more architectures. Of course, I am biased, as I can't even use FASM here on OS X. Plus, FASM is new and relatively less documented than NASM. With NASM, you at least have the docs to learn from.
Chris Lutz
+4  A: 

I found Assembly language step-by-step to be a very good resource. It has a section in the back thats aimed at Linux assembly too.

fARcRY
+1 and the author is working on a new edition. He wrote recently, "I am now about 2/3 of the way through Chapter 9, of 13; and 113,000 words in, of about 175,000. It has to be done by June 30."See http://www.contrapositivediary.com/ for updates.
dwc
A: 

Try http://www.emu8086.com which is a windows-hosted 8086 emulator with an assembler and debugger. It comes with a tutorial.

anon
That would mean running windows. That's a big sacrifice to ask.
Charlie Martin
A: 

The Art of Assembly Language Programming

rtacconi
Did you read the question? Or the answers?
Michael Myers
A: 

I learned x86 assembler from a book about the 8086 (which I can't remember the name of at present... it was obviously quite old, and purple. if you're really interested I can dig it up when I get home). That will only teach you 16 bit stuff, for the more advanced 32 bit stuff I read some tutorials online. I've never done 64 bit. At least at first, the OS you're targeting probably won't matter, as you're too low-level... the BIOS is all you really care about. If you don't have access to a test system, an emulator is probably a good choice, as others have mentioned, but you can also build yourself an 8088 or 8086 without too much trouble from discrete parts. You can find tutorials and circuit diagrams online easily. It should cost less than $50 and it's a great learning experience -- you're essentially building a motherboard from scratch.

If you're not too attached to x86 assembly and want to learn RISC, I recommend the Microchip PIC microcontrollers. You can pick up a starter kit for less than $50 (the PICKit 1, which I have, even works under Linux). They have extensive documentation and plenty of third-party tutorials aimed at hobbyists.

rmeador
The starter kit sounds interesting. I may look into that. Thanks.
+3  A: 

See this answer for Linux related assembly resources. http://asm.sf.net has some material on architectures besides x86.

If you are interested in RISC architectures, you could run Linux on Qemu. Qemu emulates several RISC architectures like PowerPC, ARM and MIPS. You might be able to find a ready to use Qemu hard disk image here.

Another way to experiment with RISC architectures would be to use gdb's built-in simulator.

sigjuice
+1  A: 

There are really two parts to learning assembly-level programming: the basic concepts, and then specific architectures. If you haven't had any exposure to asm programming, I strongly suggest you get the basics down first with a simple, small architecture, even tho' it likely is not directly applicable to any real hardware. If many folks are pointing to a particular resource like "The Art of...", take another look at it, use it to learn what an architecture is, how to use the basic tools (asm, debugger, disasm, etc).

Once those are out of the way, then you can start looking into more advanced instruction sets. The x86 architecture and instruction set are pretty convoluted and there are many obscure ways to twist your brain - learn something simple before you tackle that.

Shannon Nelson
A: 

don't forget to grab a copy of Guide-Assembly-Language-Programming-in-Linux book.

avar
A: 

Even though many people I know at school hated this book, I will link it anyway:

http://www.amazon.com/Professional-Assembly-Language-Programmer/dp/0764579010

The main reason I used this book is because it uses x86 on Linux with the GNU assembler. That last point helped since I had to use that assembler in our school's lab, and if you aren't aware - the syntax is different from Intel syntax.

Also, I would just add that learning how high level languages are compiled into assembly language really helped me move along.

TURBOxSPOOL