You are on page 1of 2

o you have any interest in effectively using a debugger? Then yes.

Do you have a ny interest in writing reliable or efficient code? Then yes. Even if you never a ctually write assembler, once you learn assembler on one platform then all other assembly languages and all other programming languages are simply a matter of s yntax. Since you cant find a PDP11 around anymore I highly recommend the msp430 as a fi rst platform. Second perhaps by ARM, both because it has a good ISA and because everything not a desktop has an ARM in it. And because if you choose you can hav e a good, long, successful career by simply knowing ARM assembler... I recommend the best way to learn assembler is to write a disassembler. Take an assembler, and if possible a perfectly good disassembler, assemble simple adds a nd moves and such to a binary format (is probably going to be intel hex or sreco rd or elf, parsing of which is yet another good programming exercise)(of course are those really "binary" formats?). Dont write the disassembler with the intent ion to publish or sell, just for your own purposes, this will keep you focused o n the task at hand. By doing this you will be forced to learn every instruction and every nuance of every instruction and learn how to get the assembler to crea te every nuance of every instruction thereby making you more knowledgable than m ost assembly programmers for that platform. ARM in ARM mode (ARM7 aka armv4) is a very good place to start disassembling bec ause the instructions are all 32 bits on 32 bit boundaries. Fixed size and align ed instructions. If you start with say the x86 you will very quickly fail, varia ble size instructions are difficult at best to disassemble, you cant just start at the top and run through the binary in a linear fashion, you instead have to s imulate execution, start at the reset point and follow all of the possible execu tion paths, and even there you will fail. Disassembly on a variable sized instru ction set is a very advanced topic. (for learning purposes you can still write a disassembler and only write two or three instruction programs with no data stru ctures embedded in the instruction sequence). After writing one or two disassemblers, each nth disassembler and instruction se t should only take you an evening or two to learn. Go learn a few different arch itectures. Decide if you like risc over cisc and why. Realize that the x86 archi tecture is horrible at best, how could it have won? Next, write some simple C code, using yours or the compilers disassembler examin e how your high level programming style is implemented on the hardware. Realize that the number one performance improvement is your compiler not your style. Few of the many programmers that dont know assembly and have not done this exercise really understand that the same exact source code can execute at many different speeds from each brand of compiler and some brands of compilers produce much be tter code than others. So re-arranging your high level code and changing your pr ogramming style to make the compiler more likely to produce good code is one thi ng. Getting it to do it is another. You will learn all of these things with this exercise. If you want to be a successful software engineer, be able to choose the jobs you work on and not get stuck with cleaning up leftovers, you have to not only lear n assembler but learn how different compilers turn different high level language s into assembler for different platforms. You never have to be an assembly progr ammer to do this, you only have to understand the process and the results. Michael Abrash may have already been mentioned, find a copy of The Zen of Assemb ly language. It was reprinted in the black book perhaps, even at the time origin al copies were hard to find, I was lucky to have bought one not knowing it would be a rare gem. Even if you learn x86, or other assembler, finding out that you can increase performance by orders of magnitude by simply re-arranging the same

instructions or similar instructions is humbling. Actually all of his books and his magazine articles if still available are all gems.

You might also like