Thread: Learning Assembly

  1. #1
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483

    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?
    My Website
    010000110010101100101011
    Add Color To Your Code!

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> 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
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    More resources - a good reference for pretty much everything x86:
    http://courses.ece.uiuc.edu/ece390/b.../artofasm.html
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >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.
    My best code is written with the delete key.

  6. #6
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 03:51 PM
  2. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  3. Benefits of learning assembly language?
    By 747ken in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-02-2003, 07:16 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM