Live data from Hacker News

Where should I start learning Assembly?

news.ycombinator.com

11–20 of 54 posts

Re: Where should I start learning Assembly?

#11
If you already know C, you can start out by looking at the machine code generated by your compiler with "objdump -d" on Linux and "otool -tV" on Mac. Start experimenting by writing out C constructs like functions, loops, switch statements, etc., and just looking at what the generated code looks like.

Of course, to do that, you need to find the manual for your machine architecture. The x86 manuals are, for example, available here:

http://www.intel.com/content/www/us/en/processors/architectu...

You also then start to notice things like the operating system specific application binary interfaces (ABI):

http://www.x86-64.org/documentation/abi.pdf

and object file formats such as ELF that's used in Linux:

http://www.skyfree.org/linux/references/ELF_Format.pdf

or Mach-O used in Mac OS X:

https://developer.apple.com/library/mac/documentation/develo...

You can also do the same thing with the JVM and look at its JIT-generated machine code with the '-XX:+PrintCompilation' option:

http://stackoverflow.com/questions/13086690/understanding-th...

Re: Where should I start learning Assembly?

#15
post #8

Which assembly? x86, PowerPC, ARM, MIPS? Personally my favourites are 6502 ( http://skilldrick.github.io/easy6502/ ) and 68k ( http://www.easy68k.com/ ) tho' neither of these are realistically of any commercial use.

6502 is great for getting into assembly. It counts as tiny and I've done a great deal of things on the c64 including fixed point arithmetics, cellular automata and the like. Also a good place to start your "descent" into low-level code that article that was recently on here, http://www.chiark.greenend.org.uk/~sgtatham/cdescent/

Re: Where should I start learning Assembly?

#16
post #8

Which assembly? x86, PowerPC, ARM, MIPS? Personally my favourites are 6502 ( http://skilldrick.github.io/easy6502/ ) and 68k ( http://www.easy68k.com/ ) tho' neither of these are realistically of any commercial use.

An example of a practical modern 8-bit assembly language to learn would be for Atmel AVR microcontrollers. It's small enough to get your head around, and useful for DIY hardware projects.

Re: Where should I start learning Assembly?

#17
As an intermediate step, you could also study LLVM bitcode. It should give you a good idea of what assembly languages "feel" like without tying you to a particular architecture. It is easy enough to write smallish programs in the ASCII format and assemble them with llvm-as.

Re: Where should I start learning Assembly?

#19
Reverse engineering is quite a different skill set from assembly. Unless you are reverse engineering malware, whatever you are analyzing is unlikely to have been written in assembly or to be heavily obfuscated. Then it's more about knowing how certain high-level programming constructs (think virtual function calls in C++) will be translated into assembly by a compiler, what residual information there might be left in the binary or what all that noise is you are seeing (think C++ templates, destructors called for stack-allocated variables..).

For many reverse engineering projects, assembly might be a wholly uselss skill, since whatever you are looking at is actually MSIL or running on Python with its own embedded interpreter. Here assembly only serves you to quickly tell you would be wasting your time :)

Post reply on HN