-
Learning Assembly
I just wanted to ask a few questions, and get some real answers before I dive into assembly.
I've heard that there is different kinds of assembly? If so which one is best. And by best I mean, most widely used, easy to learn and is capable of programming for 32bit and 64bit processors.
How is the overall assembly learning curve? Is it hard, or not so hard.
What is assembly good for? I know that C++ has support to work with assembly, but just when and why would one use it?
What are some of assemblies advantages and disadvantages.
Also pointing me to some resources for learn assembly would be great. Maybe recommend books?
-
>> I've heard that there is different kinds of assembly? If so which one is best. And by best I mean, most widely used, easy to learn and is capable of programming for 32bit and 64bit processors.
assembly language is *basically* a one-to-one correspondance to the instruction set of a given processor. in that sense, each processor only has a single assembly format and for that reason you can't use code for one on another (which is why we have C, of course). moreover, use to there were just plain assemblers, but now days there are a lot more assemblers popping up that support higher-level constructs (similar to C, for instance) that have become quite popular such as MASM, GOASM (my personal favorite), and others - they might be a good start for the beginner.
>> What are some of assemblies advantages and disadvantages.
basic advantages:
- very fast, efficient code
- entire instruction set available
basic disadvantages:
- longer development time
- not portable
-
-
More resources - a good reference for pretty much everything x86:
http://courses.ece.uiuc.edu/ece390/b.../artofasm.html
-
>I've heard that there is different kinds of assembly?
There are different assemblers and different processors. The code you write will be subtly different between assemblers for one processor and can by wildly different between processors.
>And by best I mean, most widely used, easy to learn and is capable
>of programming for 32bit and 64bit processors.
What processor? Assuming the x86, MASM is probably the most widely used, but far form the easiest to learn. I think NASM is the easiest to learn, but there's a disturbing lack of resources available for it. Any decent assembler will be able to handle the base functionality of the processor, which means that if the processor is capable of 64 bit then the assembler will be to. It's all about the instructions. :)
>How is the overall assembly learning curve?
If you're used to high level languages then assembly might frustrate you at first, but it's not overly difficult.
>What is assembly good for?
Learn it and see. This is by far the silliest question anyone asks when learning a language. If you don't know what it's good for, why are you learning it? If you've decided to learn it, then what does it matter what it's good for? Once you get to the point where it's good for something for you, you'll have your answer and be the wiser for it.
>What are some of assemblies advantages and disadvantages.
Advantages are flexibility and power. Disadvantages are a complete lack of hand holding and sometimes unintuitive behavior.
>Also pointing me to some resources for learn assembly would be great.
A nice collection of stuff can be found at http://webster.cs.ucr.edu/. I wouldn't recommend HLA because it adds too much unnecessary complexity to assembly and you'll have more trouble seeing the beauty of the language, but that site is a nice portal for other assemblers. Also a good idea is to visit and try to participate in threads at comp.lang.asm.x86 and alt.lang.asm. But beware, there's a blood fued between the HLA group and the RosAsm group in alt.lang.asm.
-
For x86 I suggest fasm.
You also might want to learn z80 assembly, that's the processor the TI-83 calculators use.
Another advantage of knowing assembly that no one mentioned is the way it makes you think; after learning assembly I produced faster high-level code just because of my expanded understanding of the hardware and the wierd ways I thought about problems and solutions.
Also IBM, Toshiba, and Sony's cell which stamps other current processors:
http://www-128.ibm.com/developerwork...-cellstartsim/
http://cell.scei.co.jp/e_download.html