Thread: Thinking of learning assembler, ARM?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485

    Thinking of learning assembler, ARM?

    Hi,

    I've been thinking of learning assembler I have looked at options like x86, older computer, 68000, z80 or ARM. Now I have seen that there are some new ARM based netbooks comming based on Nvidia Tegra chipset and Snapdragon. Could this be a good choice for this purpose? Thoughts.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    A long time ago:
    - processors were simpler, making it feasible to learn all about them.
    - processors were less powerful, making the necessity to program in asm to get the best.
    - compilers were less able to optimise the code, ditto getting the best.
    - processor design evolved slowly, making the return on your learning investment.

    Now, none of that is true.
    What with co-processors, pipelines, instruction reordering, branch prediction (and a whole bunch of other tweaks), it might take you a week just to write a few instructions in the most optimal manner. Then by the time you have learnt it, the processor is long out of date.

    Reading the generated code of your compiler is useful.

    Sure, if you're writing an OS, you need access to certain specific registers on the processor. Most of the time, you would write simple wrapper functions around the hardware specifics. You don't need to be an ASM wizard to manage that much.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Subsonics View Post
    Hi,

    I've been thinking of learning assembler I have looked at options like x86, older computer, 68000, z80 or ARM. Now I have seen that there are some new ARM based netbooks comming based on Nvidia Tegra chipset and Snapdragon. Could this be a good choice for this purpose? Thoughts.
    ARM is a pretty ubiquitous chip. But even in embedded environments, most code is compiled from a higher level language these days. If you want to learn an assembly language, it's a good choice because of its restricted instruction set. But in terms of being a marketable skill... Not sure.

    (I think you should go for it.)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Learning to program assembler is, in my opinion, never a bad thing. I haven't written ARM assembler, but I have debugged compiler generated code on ARM. It's not very different from other RISC assemblers - a 3-operand assembler syntax, 16 registers that are essentially orthogonal. Easy to write, easy to follow, I'd say.

    Once you know how to program in assembler, it shouldn't be very difficult to switch from one assembler form to another - after all, most things are pretty much the same.

    I have (professionally) written code in x86 (32- and 64-bit, including code for Virtual Machine monitoring in Xen), 29K, 68K.

    Non-professional programming also covered PDP-11, 6502, Z80 and 8031. In 8031, I didn't know ANY of it, when I wrote code to program EPROMs. A friend of mine built the hardware. I wrote the software. 8 hours from start to finish, we had the EPROM's programmed.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Thanks for your input on this.


    I realize that the practical use of assembly today might be limited, but my motivation for wanting to explore it is to get a more thorough understanding of what's going on at the processor level. I think that understanding might be useful even when programming in C. But mainly it's for the fun and challenge of doing it.

    So far the only experience I have is a basic hello world program and some inline assembler on x86, but very limited. I have had the feeling of wanting something simpler than x86 to start out with, as well as perhaps a more lightweight OS. I'm not sure what OS I can expect to install on these netbooks but I think linux and windows mobile was the options so far. But i guess that there should be a few OS'es for ARM that I could potentially use at least.

    Another option might be something even simpler like a pic such as AVR Butterfly or something.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Subsonics View Post
    a more lightweight OS.
    If you are interested in these kinds of things, consider installing a stripped down customized linux, ie, not a major disto install from disc or anything. This used to be a more popular activity ten years ago, when people commonly made their own rescue disks. I've made a bootable linux that fit on 2 3.5" floppy disks, which is like 3mb** (there was no GUI of course...)

    If mostly what you want to do is program in assembler (I'd like to too, kind of, for I think similar "curiosity" and comprehension type reasons), these two projects would go well together methinks because it is not as if you need more than a bare minimal system to do that. What a "bare minimal" linux system is will certainly shed some light on the nature of whatever major distro monstrosity* you are running right now.

    Google "Linux From Scratch". If it was me, this is when I'd want to start learning about FreeBSD, but that has nothing to do with anything...

    *just kidding, they're very nice
    ** the 3 disk version actually had networking and a text browser (lynx), so I could rummage on line docs in a rescue.
    Last edited by MK27; 06-15-2009 at 12:13 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > But mainly it's for the fun and challenge of doing it.
    Go for it, and enjoy
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Quote Originally Posted by MK27 View Post
    If you are interested in these kinds of things, consider installing a stripped down customized linux, ie, not a major disto install from disc or anything. This used to be a more popular activity ten years ago, when people commonly made their own rescue disks. I've made a bootable linux that fit on 2 3.5" floppy disks, which is like 3mb** (there was no GUI of course...)

    If mostly what you want to do is program in assembler (I'd like to too, kind of, for I think similar "curiosity" and comprehension type reasons), these two projects would go well together methinks because it is not as if you need more than a bare minimal system to do that. What a "bare minimal" linux system is will certainly shed some light on the nature of whatever major distro monstrosity* you are running right now.

    Google "Linux From Scratch". If it was me, this is when I'd want to start learning about FreeBSD, but that has nothing to do with anything...

    *just kidding, they're very nice
    ** the 3 disk version actually had networking and a text browser (lynx), so I could rummage on line docs in a rescue.
    Interesting, that is definitely something to consider. I'm currently reading a book on basic (more or less standard I guess) operating systems approaches and implementations, so it could be a worthwile exercise for more reasons I think. I have looked into FreeBSD as well and I think they have a distro for ARM, but it seems like it's not thoroughly tested, but it might be enough for a really small install though. Will check out Linux from scrach, thanks.

    Ok, I might have to change what I said, what it said on the FreeBSD site is that it's not offical and don't come in pre built packages but it's activly supported so it seems like it should fit for the purposes here.

    From the freeBSD site:

    "ARM is officially a Tier 2 architecture, as the FreeBSD project does not provide official releases or pre-built packages for this platform due to it primarily targeting the embedded arena. However, FreeBSD/ARM is being actively developed and maintained, is well supported, and provides an excellent framework for building ARM-based systems."
    Last edited by Subsonics; 06-15-2009 at 12:55 PM.

  9. #9
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    I would say learn ASM for sure. I could care less about actually understanding some x86 assembler language (although it is sometimes nice), but the most valuable things I learned came from learning what is going on within the machine and compiler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Learning to write Windows Apps
    By johnson_a in forum Windows Programming
    Replies: 8
    Last Post: 05-31-2004, 04:17 PM
  3. Thinking of Modding Xbox. Don't know about Linux
    By Stan100 in forum Linux Programming
    Replies: 4
    Last Post: 05-30-2004, 04:51 PM
  4. Fluid Thinking
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 11-20-2002, 03:29 PM
  5. MAINFRAME Assembler.
    By sean in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-05-2001, 05:32 PM