Slashdot Mirror


Is Assembly Programming Still Relevant, Today?

intelinsight asks: "Consider the following question given the current software development needs, and also the claims of the Assembly lovers for it being a language that gives one insights of the internal working of a computer. How relevant or useful is it to learn Assembly programming language in the current era? "

676 comments

  1. All's quiet by Longbow · · Score: 1

    ....... (sounds of crickets) ........

    1. Re:All's quiet by Tackhead · · Score: 5, Funny
      > ....... (sounds of crickets) ........

      Give me a moment. I've still gotta figure out the six nested timing loops I need to toggle the speaker cone in and out in such a way that it sounds like a cricket instead of a bird.

    2. Re:All's quiet by Qwertie · · Score: 5, Interesting

      Here are a few reasons you might need proficiency in assembly language:

      • You're writing software for a low-speed or low-memory chip for an embedded system (e.g. one of the PIC chips). Such chips are used either because they are cheap or because they need very little power. You can often program these chips in some variant of C, but if you need that last drop of performance, you use assembly.
      • You're writing a compiler. In this case you may not have to write assembly directly, but you'll have to understand it intimately in order to convert source code to machine language. (Replace "assembly" with "bytecode" or "IL", if making a Java or .NET compiler)
      • You are reverse-engineering closed-source software (another case where you must comprehend assembly)
      • You're designing or testing a computer chip, in which case you may have all sorts of tests cases written in assembly language.
      • You're maintaining an old "legacy" system that uses assembly.
      • You're writing an emulator for another computer, and you need high performance. In this case you may need to understand the assembly language of both the real and emulated machines, as I learned when I wrote a Super Nintendo emulator.
      • Those bastards make you study it in one of your college courses.
    3. Re:All's quiet by Anonymous Coward · · Score: 5, Insightful
      • Vertex Shader
      • Pixel Shader
    4. Re:All's quiet by lrichardson · · Score: 1

      Those bastards make you study it in one of your college courses.

      Not only that, they made me do Microcode! Every !@# gate on the system.

      Which explains why I'm quite happy playing with SQL & Essbase.

      More seriously, I don't think it helps anymore. Knowing how to program efficiently in Assembler doesn't help with coding efficiently in SQL. Knowing about optimizing indices, partitioning, minimizing joins, and database tuning in general doesn't rely on the same concepts at all.

      And, to be honest, most modern compilers spit out code that runs nigh-on as fast as optimal Assembler ... and, being honest again, a lot of Assembler I've seen professionally is less-than-optimal

    5. Re:All's quiet by LiquidCoooled · · Score: 5, Interesting

      Knowing about optimising registers, partitioning the stack, minimising movs, and assembly tuning in general doesn't rely on the same concepts at all.

      The GP is 100% correct in its uses and you are also correct that its current use is crap.

      We have abstracted ourselves far enough away and insulated ourselves so much that I think we are in danger of losing the point of fast computers.

      Anyone with visual studio can get a good example of this if you see how long the immediate window takes to calculate 1+1.
      It might be great and super and empowers the developer to do more, but something has been lost that I feel Visual Basic classic is fast in comparison.

      Finding a decent optimisation of the core .net framework would be a major benefit and you cannot do that without an implicit understanding of assembler.

      Every time this kind of discussion comes up I think of Mel.
      Assemblers are a dying breed but their services are more than needed even today.

      --
      liqbase :: faster than paper
    6. Re:All's quiet by Anonymous Coward · · Score: 0

      You forgot one - if you're writing certain parts of an OS.

    7. Re:All's quiet by mrbluze · · Score: 5, Funny

      Nothing to CX here, MOV along.

      --
      Do it yourself, because no one else will do it yourself. [beta blockade 10-17 Feb]
    8. Re:All's quiet by doti · · Score: 4, Insightful

      Those bastards make you study it in one of your college courses. That is justified by all your previous points.

      I see it this way: assembly is still used today, but only in a smaller niche. But that's not the only reason it's relevant. I think it's a good knowledge to have, even if you'll never use in practice, but it's concepts help you understand the whole. Much like Math, or basic Physics.
      --
      factor 966971: 966971
    9. Re:All's quiet by FMota91 · · Score: 1
      • Real-time Raytracing (a myth, yes, but a good one nonetheless)

      Unfortunately (or maybe not unfortunately), our Computer-Organization professor decided that he'd teach us IBM assembly. It's not terrible, but it's not terribly relevant either. Still, seeing that I know PC Assembly relatively well, I can learn the IBM ASM pretty easily. The same cannot be said of my colleagues. :/

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C1 bottles of beer on the wall. Take one down, pass it round... Oh, umm...
    10. Re:All's quiet by kyashan · · Score: 3, Insightful

      I think some assembly knowledge is important, at least to understand pointers.
      But, shaders are hardly written in assembly anymore, for all the good reasons.

      --
      "La presi e te la pagai (480.000 Lire)"
    11. Re:All's quiet by Austerity+Empowers · · Score: 4, Interesting

      You're writing software for a low-speed or low-memory chip for an embedded system (e.g. one of the PIC chips). Such chips are used either because they are cheap or because they need very little power. You can often program these chips in some variant of C, but if you need that last drop of performance, you use assembly.

      You're writing software for any chip, on any platform, that requires direct hardware level access, e.g. device drivers, boot code, or core-features. No machine, no matter how fast can be programmed exclusively in C. For example, in C you simply cannot a DCR on a PowerPC. You need a special instruction w/o a high-level language equivalent. You can't cast a pointer to a physical address, it is not mapped to physical memory. You also cannot enable, or disable instruction cache from any C function call. The list goes on. There are a number of places it is totally impossible to use a high level language to do things.

      There are a whole lot of these out there, in the consumer, enterprise, military, etc.

    12. Re:All's quiet by brunascle · · Score: 5, Funny
      you missed one:
      • You're writing malware to exploit a buffer overflow vulnerability
    13. Re:All's quiet by Anonymous Coward · · Score: 1, Interesting

      * Optimized code. MPEG4, MPEG4, etc. loops for mplayer etc. use hand-optimized assembly heavily. MP3 playback typically does too.

    14. Re:All's quiet by Anonymous Coward · · Score: 2, Funny

      I saw that Francisco - You're getting a special
      version of the Computer Org test tomorrow.
      One just for you.

      Your computer org professor.

    15. Re:All's quiet by Short+Circuit · · Score: 2, Interesting

      I've found myself in need of CPU burn-in software. Tools I've found apparently weren't designed for multi-core systems, and that's the kind of system I need to push.

      What I'd like to do is write a bunch of assembler routines that repeat different classes of instructions. One would run simple FPU operations several hundred times, another would run integer ops, another, logic ops, more would run mmx ops, sse ops, sse2 ops, sse3 ops, etc.

      The program would poll the CPU temperature every couple seconds, find the routine that causes the greatest amount of heat, and concentrate on it.

      The overall program would be a C/assembler hybrid. The burn routines would be in assembler, but the analysis and scheduling routines would be in C.

    16. Re:All's quiet by magixman · · Score: 1

      And another reason. A good buddy of mine commented some years back (well actually quite a few decades back) that he might get married but that "she would have know assembly language". He was actually quite sincere at the time.

    17. Re:All's quiet by Allocius+Reikei · · Score: 1

      Surprised no one thought of this one, since it's why we are all able to view this. You are writing an operating system kernel.

    18. Re:All's quiet by Qwertie · · Score: 2, Insightful

      You're writing software for any chip, on any platform, that requires direct hardware level access, e.g. device drivers, boot code, or core-features. No machine, no matter how fast can be programmed exclusively in C. For example, in C you simply cannot a DCR on a PowerPC. You need a special instruction w/o a high-level language equivalent.

      You're certainly right, but programming language extensions could get around these limitations. For instance, I think the PIC C compiler, which is not really standard C, has an extension that lets you write and install an interrupt service routine without any assembly. One could imagine such extensions for almost any hardware feature; it's just that compiler-writers rarely bother to offer such extensions.

    19. Re:All's quiet by FMota91 · · Score: 2, Funny

      You are too thoughtful sir. Thank you! Did I ever tell you how fabulous I think IBM assembly language is? You know, it has all those wonderful registers (yes, all 16 of them, if you count those 4 or 5 registers that you can't use). Ah well, I should know better than to post on Slashdot with my name about a subject on the eve of that test. If you answer this, don't just answer "Indeed". :) Oh, and I know you're going to show this to class tomorrow. Hi his class. :) Anyway, enough that's enough of me mongering around on /. for today. Time to work on Calculus. See you tomorrow. :)

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C1 bottles of beer on the wall. Take one down, pass it round... Oh, umm...
    20. Re:All's quiet by that+this+is+not+und · · Score: 2, Informative

      There's no 'PIC C Compiler' for the PIC10F200.

      It's basically a little grain of rice if you buy it in the surface mount package.

      A fairly powerful little grain of rice at that.

    21. Re:All's quiet by Anonymous Coward · · Score: 0

      (not the AC from above)
      Shaders aren't written in ASM anymore because of the same reason why we usually don't do ASM: it's a bitch to get the same results, and it's a lot more obfuscated. But it's EXTREMELY useful to know for the same reasons as well: so that we know what is going on with our code (Hell, it's because of that that I found it quite interesting and useful to study some of the microcode generated by ATi's Shader Analyzer) and what kind of performance implications it has. Doing exponents in HLSL might be one more line of code, but that doesn't mean it runs in one cycle. It could very well be that replacing that exp with a texture-LUT is much better, and that's something that knowing D3DASM (and/or ATi/NVASM) can help with.

    22. Re:All's quiet by rhythmx · · Score: 1
      • Computer Security
      • Shitty compilers
      As a Security Researcher, I read and write assembly all the time while analyzing vulnerabilities and writing/reading exploits. In some cases (relative jumps especially, 0xEB + ptr32) I even write raw machine code into memory.

      Also for the embedded world: there are a _lot_ of broken compilers for not-so-common architectures. If you're ever stuck using one of these, you can bet you'll end up stepping through disassembly in a debugger at some point. Be sure to submit bug reports when you do find problems, most of those compilers are produced by small shops and listen closely to feedback. It can even get you free development boards ;)
    23. Re:All's quiet by Anonymous Coward · · Score: 1, Funny

      JMP GOAT_CX

    24. Re:All's quiet by damium · · Score: 1

      The only part of the kernel that needs assembly is the parts that interact directly with hardware (small parts of driver code). Everything else can (and is) written in higher level languages.

    25. Re:All's quiet by Apathist · · Score: 1

      Not to mention what is probably the most common commercial usage of assembly language: Anti-Virus research.

    26. Re:All's quiet by UnknownSoldier · · Score: 2, Funny

      > Real-time Raytracing (a myth, yes, but a good one nonetheless)

      2005 called, they want their hardware back.

      --
      How can you understand Life if you don't even understand what happens after Death??

    27. Re:All's quiet by i+kan+reed · · Score: 1

      That's true now, but there are C-like languages cropping up for shaders these days.

    28. Re:All's quiet by UncleTogie · · Score: 1

      "Indeed"

      --
      Don't tell me to get a life. I'm a gamer; I have LOTS of lives!
    29. Re:All's quiet by Mekius_ · · Score: 2, Informative

      There's no 'PIC C Compiler' for the PIC10F200. Uhhh...yeah, I'm gonna have to go ahead and disagree with you on that one...http://ccsinfo.com/devices.php?page=devices
    30. Re:All's quiet by dmitriy · · Score: 1
      • GLSL
      • HLSL
      • Cg
    31. Re:All's quiet by Austerity+Empowers · · Score: 1

      Most people I know tend to prefer to use the GNU tool chain. Sometimes it's more of a hindrance not to use the mfg's compiler (Cypress PSOC for example), but usually they are not standard, quirky and expensive to boot... if you can use GNU, I personally would. Plus, working in a bigger company, you tend to do the same sorts of things for different platforms, and have a working set of high-level code you'd rather not debug all over again; just rewrite the HW specific stuff {boot vector, device manipulation code, MMU stuff, etc.}, but keep your c code, makefile magic, etc. That said, it's 90% of the job to do the low level stuff and schedules being what they are, you don't want to waste any time rewriting the high level stuff just because your compiler handles #define differently.

      ISRs are easy since they're fundamentally just a function pointer and sometimes a special return opcode. High-level languages get all but the return code, and it's common enough that they have extensions to cope with it. However most processors have instructions and operations that occur that do not have high-level language counterparts. High-level languages are algorithm oriented by definition. They don't understand the processor so much and use a subset of it's instruction set they need to do their work. Accessing that missing piece of the instruction set is where assembly is not just to geek-out, you just have no choice. Worse, quite often the exact order of instructions, the number of NOOPs etc, is so important you must put it in by hand. All that stuff high level languages and ultimately applications rely upon (virtual memory, HW abstraction APIs, etc.} requires assembly to manipulate the processor. No one should go through that if they're building a web app, for example, but that doesn't mean the modern world has thrown such things by the wayside, quite the opposite.

      My point is performance is not the only reason to use assembly, it's often not even a good one. Smarter people have debated that in flamewars for 20 years, it rages on. At some point or another assembly becomes the ONLY way to do certain things, you either do it explicitly in your code, or through other trickery. If you do not understand assembly language, and you do not understand processors and hardware, you cannot hope to do that work...precluding you from some very nicely paying firmware jobs and OS development jobs, which from my vantage point actually DOES have a shortage of labor. It seems to me, if you're a student trying to get a wide background in computing, and computing architecture, you still must learn assembly for one processor or another. Even if for nothing other than the understanding you gain of how processors work.

    32. Re:All's quiet by Vulcann · · Score: 1
      • Spinlocks
      Lets see you try implementing code for doing locking across processes on an SMP system. And any organisation/product worth its salt will have parallel application on an SMP system.

      You can try a Peterson's algorithm (pure code) but that wont scale well over 2 procs and its perf sux. The only way is to do an atomic test and set style spinlock and thats gonna need assembler.
    33. Re:All's quiet by Anonymous Coward · · Score: 0
      You forgot one:
      • You just received the first prototype board of a new embedded system, and it currently doesn't know how to do anything except get slightly warm. You need to get an operating system and IP stack running on it. Go.
    34. Re:All's quiet by wtarreau · · Score: 2, Insightful

      100% agree. There are a lot of missing features in C which require assembly nowadays :

      - bit rotations => have to be coded by ORing bit shifts and masks
      - bit counting (FFS/FLS) => have to be cleverly coded to avoid iterations
      - locking => you need the lock instructions/prefixes of CPUs
      - prefetching => idem
      - memory barriers => idem

      And the list is long. What do we do instead ? typically, bit operations are done by hand with 100 times slower operations and using jumps and loops while a single instruction almost always exists. Locking accesses is performed through calling functions from heavy and slow libraries such as pthreads.

      It always strikes me to see code doing such a thing :
              pthread_mutex_lock(&counter_lock);
              counter++;
              pthread_mutex_unlock(&counter_lock);

      While in assembly you would be able to do this on many platforms :

              LOCK INC counter

      Which is basically what is done in the mutex_lock (with added tests).

      We really need some C extensions to access the lower level, but unfortunately,
      the trend is the other way :-(

      Willy

    35. Re:All's quiet by soceror · · Score: 1

      well... if you are:

      BIOS engineer
      embedded system engineer

      you'd need to know asm pretty well...

    36. Re:All's quiet by kyashan · · Score: 2, Interesting

      Assembly for shaders isn't written in stone. Graphics hardware is moving so fast that the concept of a fixed assembly for them is limiting. It's limiting for the hardware makers, limiting for the software developers.
      One can always squeeze that cycle somewhere, but it doesn't make sense. The problem with shaders are different ones, like integrating them with CPU code and balancing between dynamic branching and code permutations (combinations of features in a shader are selected either with an IF or with a bunch of includes.. so to speak).

      Knowing assembly for shaders is definitely not worth it in my opinion. I highly doubt anyone uses it in the game industry.
      LUTs are very much used for common techniques such as PCF shadow mapping and what not in Cg and HLSL.

      --
      "La presi e te la pagai (480.000 Lire)"
    37. Re:All's quiet by Anonymous Coward · · Score: 0

      ...or compiler intrinsics, which won't mess with the compiler's optimizer, and actually work pretty well (unlike the current crop of MMX/SSEx intrinsics).

    38. Re:All's quiet by Anonymous Coward · · Score: 0
      • You intend to be a security expert and want a true understanding and grounding in exploitation techniques and the conditions that create them. (Sort of falls under reverse-engineering, but sort of doesn't.)
    39. Re:All's quiet by Anonymous Coward · · Score: 0

      There are times, no necessities, that require assembly. I believe Spinrite is written in assembly. I'd like to see Symantec or any other company have as useful a utility that fits on a floppy.

      Not only that, but I've gotten sick of the bloat. Assembly forces people to actually code. Due to this, they actually look to make it as short and efficient as possible, if only to lessen their own workload. If other programming languages worked like this, instead of the kitchen sink mentality we've ended up with, computers might actually be better devices. /remembers the Apple and programming in ML //assembly is the only "real" language ///everything else is an interpreter, but that's ok

    40. Re:All's quiet by ncc74656 · · Score: 2, Informative

      Give me a moment. I've still gotta figure out the six nested timing loops I need to toggle the speaker cone in and out in such a way that it sounds like a cricket instead of a bird.

      .. LDX #$40
      ]1 BIT $C030
      .. LDY #$18
      ]2 DEY
      .. BNE [2
      .. DEX
      .. BNE [1

      That'll give you one cricket-like chirp. Throw some more loops around it to make it repeat with the right cadence. :-)

      (Remove the dots...they're there only to get the columns to line up.)

      --
      20 January 2017: the End of an Error.
    41. Re:All's quiet by Anonymous Coward · · Score: 0

      1b) You're writen software for a high-speed chip and want to speed up the function it is calculating most of the time by using SIMD because you're already using 100% CPU.

    42. Re:All's quiet by aztracker1 · · Score: 3, Insightful

      Sorry, but that "multiplatform code" you speak of requires a lot of Assembly code under the covers. For the most part assembly is delegated to hardware integration, drivers, and performance tweaks. It is still vital to the industry... I will say that most developers have no need to learn it, but it is far from obsolete. C is still widely used for lower-level libraries and APIs, I wouldn't suggest it as a career path for most developers, but it's still pretty necessary.

      Personally, I like higher-level languages that abstract a lot of the inner workings such as C#/.Net, Python or Java. I like to concentrate on solving problems or making things work. However without those that *DO* write in assembly, nothing I write would *RUN* anywhere.

      --
      Michael J. Ryan - tracker1.info
    43. Re:All's quiet by Gordonjcp · · Score: 1

      It's not terrible, but it's not terribly relevant either

      It's probably quite well-chosen actually. If you learn something that's similar to, but not quite what you will use in practice, then you will learn the ideas behind assembly programming rather than taking a "cookbook" approach to it. Well, that's the idea, anyway.

      If you wanted to be a smartarse, just write your own IBM emulator in x86 assembler...

    44. Re:All's quiet by Anonymous Coward · · Score: 0

      Here are a few reasons you might need proficiency in assembly language:
      Here's one more:
      • because They don't want you to
    45. Re:All's quiet by Yaztromo · · Score: 1

      You're writing software for a low-speed or low-memory chip for an embedded system (e.g. one of the PIC chips). Such chips are used either because they are cheap or because they need very little power. You can often program these chips in some variant of C, but if you need that last drop of performance, you use assembly.

      As someone who has recently written an RTOS for such a system (which does include some hand-coded assembly operations), let me add this: debugging. The bulk of our RTOS is written in C, but sometimes the compiler can do some strange things, and the only way to figure out why is to debug the code at the assembly level. Case in point, contrary to the development system documentation, at the end of every C function call the compiler threw in two stack pops instead of just one. Our hand-rolled assembly for context switching was pushing one less element onto the stack (the expected, documented number), resulting in an eventual stack underflow. We couldn't debug this at the C level -- we had to debug it at the assembly level to figure out what is going on (fortunately we have on hand a good simulator environment which includes assembly view of the code that runs through the simulated debugger).

      For my part in the project, I didn't write any assembly. But I've had to debug the assembly instructions created by the C compiler on many, many occasions.

      Yaz.

    46. Re:All's quiet by Anonymous Coward · · Score: 0
      • You're writing an operating system
    47. Re:All's quiet by Flyboy+Connor · · Score: 1

      From experience: I had to make changes to a fairly complex program. The problem was: both the source code and the documentation were lost. The changes weren't that big, but man was I glad that I knew some assembly...

    48. Re:All's quiet by Aladrin · · Score: 1

      It's okay, there's another yet:

      • You're writing a trainer for an XBox game

      I (re)learned quite a bit doing that, and had quite a bit of fun, too. Code Caves FTW!

      --
      "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
    49. Re:All's quiet by Hal_Porter · · Score: 1

      * You want to differentiate yourself from the sea of application programmers

      Really, as assembler recedes into the past, the amount of programmers who can do it seems to be declining much faster than the amount of jobs. I'm hoping it will be like Cobol, or some other ancient language. Once it got to the 1990's, the few people that still did that could charge a fortune. Of course, you can't just do assembler, but my advice in embedded jobs is dive down to the low level stuff where there's less competition. Hopefully, when the trawlers of outsourcing and downsizing come along, you'll be able to watch from below, and eat any scraps that fall your way.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    50. Re:All's quiet by Hal_Porter · · Score: 2, Interesting

      If you use Win32, you can use InterlockedIncrement( &counter );

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    51. Re:All's quiet by Anonymous Coward · · Score: 0

      If you have to drop down to assembly language to access your processor's features then you should get a better compiler. More and more features are available either through library functions or through intrinsics (look like a function but evaluate to a low-level instruction).

    52. Re:All's quiet by ari_j · · Score: 1

      Two more:

      • You are an early adopter of a new CPU and are involved either in porting an OS or a compiler to it
      • You are debugging a compiler (even unintentionally; I had to learn PowerPC assembly language when I was porting Warzone 2100 to the Mac and came across a truly bizarre but, which turns out to be caused by a bug in gcc 4.0.1 as installed on Tiger)
      • (More importantly) You are debugging software to which you don't have the source code (either in researching a security vulnerability as noted by another commenter or, more generally, in tracking down the cause of an error or crash)

      Long story short, assembly language is still relevant to programmers and still ought to be required learning for at least a few credit-hours toward a CS degree. It's just like learning how to conjugate a verb in a class on conversational Spanish: it's a skill that you will not often use consciously, but will always have available when you need it and will often subconsciously apply, and it's a skill that underlies everything you do. If you don't want to learn how to conjugate Spanish verbs, don't take a course in Spanish and find something else that better suits your needs; if you don't want to learn how to program in assembly language, get a degree in Information Systems or Basketry instead of in Computer Science. It's not like any other CS required classes have much application to installing Windows or writing a user interface to a database in PHP, anyhow.

    53. Re:All's quiet by jbolden · · Score: 1

      Finding a decent optimisation of the core .net framework would be a major benefit and you cannot do that without an implicit understanding of assembler.

      You don't have access to assembler inside of .NET. .NET uses an intermediate language which runs on a virtual machine (similar to Java or Perl). .NET itself is becoming more abstract (see C--) as Microsoft wants another layer in there for automated parallelism.

    54. Re:All's quiet by Anonymous Coward · · Score: 0

      Shouldn't that be ECX these (post 1987) days?

    55. Re:All's quiet by Lacrymology · · Score: 1

      that's retarded.. if assembler was obsolete and no longer learned who the hell would write the f*ing compilers you use? -tard

    56. Re:All's quiet by tomhudson · · Score: 1

      "Java. I like to concentrate on solving problems or making things work"

      ... haven't tried to do much with the latest version of Eclipse, have you? s.l..o...w... to the point of unusability. Maybe they should have written it in assembler rather than self-hosting.

      I gave it a try last week, to work on some c code (downloaded the c/c++ extensions). I also figured I'd try jedit. I went back to vim.

    57. Re:All's quiet by TheNicestGuy · · Score: 1

      You are reverse-engineering closed-source software/quote. And as the analysis report on the Gozi Trojan that was posted yesterday pointed out, this applies to deconstructing new malware. Without the ability to comprehend the ASM in the debugger, the analysts would have had to be content with a "black-box" behavioral analysis rather than a dissection.
    58. Re:All's quiet by ggKimmieGal · · Score: 1

      Micro-controllers

    59. Re:All's quiet by Anonymous Coward · · Score: 0

      real operating systems don't have virii

    60. Re:All's quiet by FuzzyDaddy · · Score: 1
      You are reverse-engineering closed-source software (another case where you must comprehend assembly)

      Include in this all varieties of malware, and you have very compelling reason to learn assembly.

      --
      It's not wasting time, I'm educating myself.
    61. Re:All's quiet by sandman_eh · · Score: 1

      You missed an important one.

      If you writing boot code, or in the case of a PC BIOS code.

      You can probably get away with C for a bootloader, but for the cpu setup you often need to toggle them into 32 bit mode and set other stuff like turn the RAM on (with special asm instrctions) before you can do aynthing more complex.

      --
      Master of Peng Shui.Ancient oriental art of Penguin Arranging)
    62. Re:All's quiet by Rayor · · Score: 1

      You know, Eclipse isn't the only Java IDE. I myself prefer JCreator whenever I need to write something in Java. Yeah it doesn't have auto debugging, but I like handling that myself.

      --
      "Using linux is like a game, if you're able to make it run better than Windows, you're winning" - Unknown slashdotter.
    63. Re:All's quiet by Anonymous Coward · · Score: 1, Insightful
      You missed an important one and that's debugging.

      In my current job I spend the majority of my time looking at stress failures (either crash dumps or live remotes), some of which were on production servers running optimized builds. In order to effectively debug these kinds of failures you really need to understand the following:
      • Assembly language for the architecture you're working on. This doesn't necessarily mean that you need to be able to write an asm app from scratch but you do need to be comfortable with the instruction set.
      • The various calling conventions so you know how a stack frame is laid out. Especially helpful when the stack is corrupted so the debugger gives a bad call stack and you need to try to reconstruct the call stack manually (not always possible but you get lucky sometimes).
      • The memory models for the various CPUs (especially important for Itanium, if you're unfortunate enough to have to support this architecture ;)).
      • For C++ code, know how your compiler lays out class objects and how vtables work.
      • Depending on the type of app, some OS internals can also be helpful.


      Ok so I guess some of isn't directly related to assembly, but it is in the same spirit other people have pointed out which is to know how things work under the hood.
    64. Re:All's quiet by LiquidCoooled · · Score: 1

      You are correct that .net is abstract.

      Hence my suggestion of finding a decent optimisation to the core of .net and improving just about everything in one go.
      If a few cycles can be shaved from the core message dispatcher and object marshalling code then this will be amplified many many times increasing the whole speed of the system.

      --
      liqbase :: faster than paper
    65. Re:All's quiet by Allocius+Reikei · · Score: 1

      I understand that, I should of been more verbose.

    66. Re:All's quiet by An+ominous+Cow+art · · Score: 1
      Heh. Back in high school, a friend and I got our start by teaching ourselves 6502 machine language, mostly using the Apple ][ documentation. $C030 will always mean 'click the speaker' to me...
      Those were my less socially well-adapted days. I delighted in going into computer stores and doing this:

      ]CALL -151
      300:A5 4E 20 ED FD AE 30 C0 4C 00 03
      300G

      ... which prints a random character to the screen, then clicks the speaker, in a tight loop. The machine would just spew garbage to the screen while making an obnoxious buzzing noise. Ah, memories...
      Disclaimer: I may have gotten the LDA and LDX instructions wrong; it's been a long time... If I got it right, that's:

      LDA $4E
      JSR $FDED
      LDX $C030
      JMP $0300

    67. Re:All's quiet by bckrispi · · Score: 2, Funny

      ... haven't tried to do much with the latest version of Eclipse, have you? s.l..o...w... to the point of unusability.
      I use Eclipse 3.2 on an Intel dual T2400(1.8gHz), 2gb ram. It runs fine. Maybe it's just you? :P
      --
      Xenon, where's my money? -Borno
    68. Re:All's quiet by say · · Score: 1

      Actually, many compilers are written in C. When you think of it, you will find out that it's perfectly possible. Only the first compiler for a platform needs to be written in assembly.

      --
      Roses are #FF0000, violets are #0000FF, all my base are belong to you
    69. Re:All's quiet by Lacrymology · · Score: 1

      You still come down to it. And Java and it's cousins' bitcodes are not more nor less than VM assembly. And even if they are written in C, they have a lot of machine-code constants and whatnot. Ok, it's not assembly, it's even lower, and they are not writing the programs in it, but to do the decoding, they need to know how to write a flow control in assembly, when is it better to use a register than memory, and what are the probabilities of a certain piece of code being in the cache, to make a good compiler. That's all part of the "assembly language programming knowledge" the way I see it

    70. Re:All's quiet by Lacrymology · · Score: 1

      Plus, I'm a game programmer. Only about 1% to 5% of a high performance 3D game is written in assembly, but without that, you wouldn't be able to enjoy Doom3 or Stalker at a respectable framerate

    71. Re:All's quiet by cabazorro · · Score: 1

      "Those bastards make you study it in one of your college courses."

      During my sophomore year at CS dept at UT Austin(1996) they made us write the whole IP/TCP stack in assembly in a Mac Quadra.

      Boy I dreaded that class. I had to spend many days (and nights) at the labs in Welch Hall debugging the damn code to a point I did memorized most of the damn opcodes for the ppc. After that class each time I see a hex dump I quiver.

      After that class and years developing I came to realize that assembly language is to computer science what Anatomy is to Medicine.
      It was the "weed out" course.

      I would never take a job doing assembly.
      I got a 000000: 620a in that class.

      --
      - these are not the droids you are looking for -
    72. Re:All's quiet by FMota91 · · Score: 1

      Are you sure you're not in his class either? :P

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C1 bottles of beer on the wall. Take one down, pass it round... Oh, umm...
    73. Re:All's quiet by Anonymous Coward · · Score: 0
      or...
      • You're reverse-engineering a malware buffer overflow exploit to pinpoint [and fix] the vulnerability
    74. Re:All's quiet by Chaos+Incarnate · · Score: 1

      Only about 1% to 5% of a high performance 3D game is written in assembly, but without that, you wouldn't be able to enjoy Doom3 or Stalker at a respectable framerate

      But how much of that 1%-5% is written by the game developers, and how much is actually in the DirectX/OpenGL libraries?

      --
      Benford's Corollary to Clarke's Law: "Any technology distinguishable from magic is insufficiently advanced."
    75. Re:All's quiet by ZwJGR · · Score: 1

      Here are a few reasons you might need proficiency in assembly language:

              * You're writing software for a low-speed or low-memory chip for an embedded system (e.g. one of the PIC chips). Such chips are used either because they are cheap or because they need very little power. You can often program these chips in some variant of C, but if you need that last drop of performance, you use assembly.
              * You're writing a compiler. In this case you may not have to write assembly directly, but you'll have to understand it intimately in order to convert source code to machine language. (Replace "assembly" with "bytecode" or "IL", if making a Java or .NET compiler)
              * You are reverse-engineering closed-source software (another case where you must comprehend assembly)
              * You're designing or testing a computer chip, in which case you may have all sorts of tests cases written in assembly language.
              * You're maintaining an old "legacy" system that uses assembly.
              * You're writing an emulator for another computer, and you need high performance. In this case you may need to understand the assembly language of both the real and emulated machines, as I learned when I wrote a Super Nintendo emulator.
              * Those bastards make you study it in one of your college courses. Add to that: The need to debug any x86 binary compiled program, even if you have the source. No matter if you program is written in assembly, C or FORTRAN, if the binaries are x86 complied the debugger will list assembly instructions. If you don't understand them then debugging becomes infinitely more difficult.
      Additionally, if you write the program in assembly in the first place, then debugging it becomes so much easier, as you are not faced with wading through stacks and stack of bloat-code, as inserted by many high level languages. How many of you have disassembled a C program, and just instinctively known that you aren't going to enjoy poking through it, first seeing a horrendous and unneccesary stack maneouver, followed by multiple calls to superfluous library funtions (statically linked)?
      Knowing assembly is essential for good programming, not knowing the ins and outs of the chip you're supposedly coding for, is a recipe for inefficient code that doesn't make good use of the resources available. I've seen lots of such code.
      I personnaly code for TTDPatch, whilst some of the code is absolutely gracelesss and horrible, it is efficient and optimised, no bloat is permitted (because writting bloat in assembly is tedious and difficult, unlike C++ where bloat is the norm, and avoiding it requires years of experience, or just GCC).
      --
      There is no psychiatrist in the world like a puppy licking your face - Ben Williams
    76. Re:All's quiet by Mad+Ivan · · Score: 1
      Um - hate to argue, but I must disagree. In C you can cast a pointer to a physical address. Example:
       

      void * device_register = 0x1000032L;

        Of course, this only works for a kernel that is completely resident in physical memory, and is running in the most privileged mode of the processor. As a matter of fact, I used this exact technique when I wrote a device driver for an arcane video card with memory-mapped control registers for the Digital "v7m" flavor of Unix that ran on PDP-11's. (This was back in the early '80s.)
      --
      "You may be right, I may be crazy, But it just may be a lunatic you're looking for" - Billy Joel
    77. Re:All's quiet by Austerity+Empowers · · Score: 1

      Of course you can cast a pointer to a physical address, you cannot cast one to a PowerPC DCR, it has no physical address. The only way to access them are via special opcodes.

    78. Re:All's quiet by jbolden · · Score: 1

      Oh I'd agree you can make .Net itself more efficient using assembly. I just was just saying you can't make applications written in .NET more efficient.

    79. Re:All's quiet by slimey_limey · · Score: 1

      See, all that does is adds another layer of fuzz on top of the really simple operation. You shouldn't have to go through the dynamic linker to increment a variable!

    80. Re:All's quiet by Hal_Porter · · Score: 1

      What do you mean by 'going through the dymanic linker'? No offense, but that sounds like technobabble. Calls into a DLL just need an extra level of indirection - they are a CALL [func] rather than a CALL func, but there's no 'dynamic linker' involved.

      But from the page I quoted
      http://msdn2.microsoft.com/en-us/library/ms683614. aspx
      "This function is implemented as an inline function using a compiler intrinsic where possible. For more information, see the section on Compiler Intrinsics in the Visual Studio documentation."

      And it turns out the compiler does indeed knows how to turn this into a LOCK INC instruction
      http://msdn2.microsoft.com/en-us/library/2ddez55b( VS.71).aspx

      So even the normal call [func] rather than call func overhead you'd get from a DLL call doesn't apply in this case, it's ends up being as good as you could do with inline assembly.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    81. Re:All's quiet by slimey_limey · · Score: 1

      Oh, I thought that InterlockedIncrement would have to be linked in at runtime, thus invoking the dynamic linker at least once. I don't know much about Windows at a low level. Besides, I was just making a stupid joke!

    82. Re:All's quiet by Hal_Porter · · Score: 1

      Most DLL calls get linked at load time rather than runtime - the exe files has an import table full of function pointers - _imp_FunctionName, and the loader maps the DLL into process memory and fills in the addresses there. Since the API providing DLLs are used everywhere and are thus already in memory, this is a fairly cheap operation.

      You can linux elf style call time dynamic linking, either manually by LoadLibrary and GetProcAddress, or using the linker's delay load functionality.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    83. Re:All's quiet by ioshhdflwuegfh · · Score: 1

      There are a lot of missing features in C which require assembly nowadays :

      - bit rotations => have to be coded by ORing bit shifts and masks
      - bit counting (FFS/FLS) => have to be cleverly coded to avoid iterations Interestingly, FORTRAN 90 comes with ISHIFTC intrinsic function for bit rotations, but the bit counting is still not there as far as I know.
    84. Re:All's quiet by ioshhdflwuegfh · · Score: 1

      Actually, many compilers are written in C. When you think of it, you will find out that it's perfectly possible. Only the first compiler for a platform needs to be written in assembly. This is true only if you are talking about generic compilers, but, you know, nowadays most compilers must be optimizing compilers exactly in order to be competitive with assembler, and you can't write an optimizing compiler without understanding CPU architecture etc.
    85. Re:All's quiet by Lacrymology · · Score: 1

      1-5% of programmer-written code, I meant. Many times it is reused code, put into engines and whatnot, that's true. I would add all of the OpenGL and D3D libraries to that 1-5%

    86. Re:All's quiet by Anonymous Coward · · Score: 0

      Only the first compiler for a platform needs to be written in assembly

      Not even then... compilers usually evolve support for a given system target.

      Assemblers are in effect compilers which target some binary object format consisting mainly of machine instructions and binary representations of data, likely coupled with relocation information and other metadata with regard to the original components (subroutines/functions, global data structures, etc).

      One can write a compiler that targets a given assembler, or one can write a compiler that targets the same object binary format that assembler does.

      None of these needs to be written in assembly, nor run on the platform ultimately targeted (cf cross-compiling).

      It is pretty common to leverage existing toolchain components when developing new languages. Chicken-scheme, for example, targets gcc (feeding gcc C, C++ or Objective C as the output of the chicken compiler), which in turn uses one or more intermediate languages internally (depending on gcc version) and emitting output suitable for being fed into the GNU assembler, which in turn produces output suitable for being fed into the GNU linker, which finally produces an executable binary. A variety of language implementations use C (or specifically GCC) as an intermediate language.

      On the other hand, there are a variety of language implementations whose compilers target the GNU assembler language, and others which themselves generate output directly suitable for a system linker, and some which generate runnable executables with no outside help.

      Many of these languages first compilers and runtime support were written in C, or hand translated to C, as part of an evolutionary bootstrapping process. Usually the C gets removed in favour of components written in the source language itself, very soon after the compiler is capable of compiling those components. Sometimes this leads to Byzantine initial building processes, but often eventually converge on: make "tiny" version (language subset interpreter) from C source code; load step1 compiler and runtime in "tiny" version; compiler step2 compiler using that compiler; compiler library and full toolchain in step2 compiler.

      In some cases (CMUCL was notorious for this) the build process was missing bootstrapping components, so only a working full toolchain could build a distribution -- there was no way to do an ab initio installation purely from source on e.g. a completely standard UNIX-like system. On the other hand, one could install initial binaries and do rebuilds and upgrades without ever having a C compiler or assembler installed on the system. In the days before the first availabilty of gcc, this was a huge advantage, as vendor-supplied toolchains were expensive (and you usually didn't get source at all unless you were a school).

      GCC, and to some extent GAS, have made the bootstrapping process for new languages much easier, and has effectively eliminated the need to worry about different processor instruction set architectures and operating system object formats, delegating those problems to the GNU toolchain developers.

      GCC has consequently become a popular intermediate language target for other compilers, much like asm was in the 8086 MSDOS days.

      Generally, though, the output C code looks even less like what a human would write in C than the output of GCC looks like compared to what a human would write in assembly for that platform. This is not always a bad thing; some optimization techniques are extremely involved for C and derive from alien idioms (C functions generated by the Chicken compiler never return, for example). Likewise, gcc performs some optimizations that would be too involved or fragile to write by hand. Assembly writers, by comparison, use idioms which are terse and robust but require a level of intimacy with non-local information about the program or its expected runtime data flow that a compiler usually does no

    87. Re:All's quiet by Anonymous Coward · · Score: 0

      you can't write an optimizing compiler without understanding CPU architecture


      Sure you can, especially if your target is an intermediate lower-level language with a good optimizing compiler.

      Even with complete agnosticism about the target machine architecture, almost any human written language is amenable to some transformation in that same language to gain substantial efficiency. This is particularly true of higher order languages which allow for things like CPS coding or SSA coding but do not enforce it at the input source level (function/subroutine calls with implicit returns to caller and reuse of variables would be more comfortable for human programmers). Among the source-level transformation that are possible include rewriting every function to continuation-passing style (possibly into an ANF as well), rewriting all source into single static assignments (including constant folding and propagation), dead code and dead assignment elimination, strength reductions, redundancy eliminations, coalescing and motion on loop-invariant code, partial automatic common-case memoization (and CSE), memory footprint (essentially stack height or cons) reordering reductions, type-proven optimizaitons (using only integer or single precision floating point objects and functions, eliminating several runtime safety checks), function coalescing/lambda lifting/lambda removal, and several others.

      All of these can be done without knowing anything about the target. Many of them are designed with next-stage compilers in mind, since those compilers and the stages downstream from them are likely to be able to make architecture, platform, and machine-specific optimizations. Moreover, most languages that target another compiler make these sorts of source-level transformations prior to generating their output, mainly because they are virtually certain to be better at big-block (whole-function, whole-module, whole-program) DFA on their language input than downstream toolchain components will be.

      It is certainly true that you will want to have target-specific optimization performed as well precisely to aim for a favourable comparison of relatively language-portable algorithms between your high level language and competently hand-tuned assembly. However, target-agnostic / source-specific optimizations can gain huge advantages for ordinary code. Indeed, rewrite-and-simplify source transformation strategies seen in many functional languages can make it much easier for downstream compilation components to keep frequently used variables in registers (or close to them, in CPU cache). For example, if you transform through CPS with argument hoisting (turning variables into function arguments) and reducing your use of variables to a small working set (using spilling or rematerialization on those), you will tighten your memory working set substantially, which is useful in any target architecture with different memory access speeds (cache, demand paging VMs, ...).

      Finally, no amount of optimization by compiler toolchains will make up for poor choices of algorithms or data structures. Those tend to dominate performance problems, even in seemingly trivial programs.

  2. Yes. by bladx · · Score: 3, Insightful

    It's good to know how things work underneath the hood.

    1. Re:Yes. by fm6 · · Score: 2, Insightful

      Looking at assembly code tells you very little about how modern software systems work. Any more than sheet metal fabrication tells you how an airplane works. Ever hear the expression "can't see the forest for the trees?" With assembly language, you're focusing on the individual leaves!

    2. Re:Yes. by bladx · · Score: 1

      Actually it helped me understand more about what was going on from a programming perspective. From a building block perspective, I think it's still relevant. It's not that you yourself are going to be programming in assembly when you can have a compiler break down a higher language program into assembly automatically. But the point is, for myself at least, it gives a deeper/basic look into what goes in between software and hardware.

    3. Re:Yes. by A+nonymous+Coward · · Score: 5, Interesting

      I know far too many programmers who haven't a clue what is going on under the hood, so to speak, and have zero comprehension of what operations take longer than others. For instance, consider a C programmer I know who thinks strcat is a good routine to use.

      (For the ignorant, it takes two string pointers and copies the second one to the end of the first one; this requires zipping all the way from the start to the end of the first string to find where said end is. It then helpfully returns the pointer to the beginning of the first string, the very parameter you passed in. Never mind that the new end of the first string would be very handy for the next strcat to that same string.)

      This programmer is generally good at what he does, but the idea that strcat is woefully inefficient is not obvious to him. Even after explaining it to him, yes he will avoid it, but he does not really understand why. He, and far too many other programmers, measure their program's "speed" in lines of code. Sure, they know that a subroutine call has to count those subroutine lines of codes as well, but they simply have no concept of the fact that some operations take longer than others, that there are better ways of doing simple things.

      I think every beginning programmer should have to spend a semester on some funky old z80, for instance, all in assembler, debugging in machine language, before they can call themselves a good programmer. The idea is not to get them skilled in z80s, but to give them a basic idea of how computers work.

      It's the equivalent of learning to drive a stick shift car without understand why there are gears at all. If you are ignorant of the very basics of internal combustion engines and can't understand the dangers of lugging or redlining an engine and the importance of using the right RPM, you will never be a good driver. It matters not whether you ever drive a stick in real life, it's just a matter of knowing how to handle your equipment.

    4. Re:Yes. by SpaghettiCoder · · Score: 1

      I know far too many programmers who haven't a clue what is going on under the hood, so to speak, and have zero comprehension of what operations take longer than others. For instance, consider a C programmer I know who thinks strcat is a good routine to use.

      (For the ignorant, it takes two string pointers and copies the second one to the end of the first one; this requires zipping all the way from the start to the end of the first string to find where said end is. It then helpfully returns the pointer to the beginning of the first string, the very parameter you passed in. Never mind that the new end of the first string would be very handy for the next strcat to that same string.)

      This programmer is generally good at what he does, but the idea that strcat is woefully inefficient is not obvious to him. Even after explaining it to him, yes he will avoid it, but he does not really understand why. He, and far too many other programmers, measure their program's "speed" in lines of code. Sure, they know that a subroutine call has to count those subroutine lines of codes as well, but they simply have no concept of the fact that some operations take longer than others, that there are better ways of doing simple things.

      I think every beginning programmer should have to spend a semester on some funky old z80, for instance, all in assembler, debugging in machine language, before they can call themselves a good programmer. The idea is not to get them skilled in z80s, but to give them a basic idea of how computers work.

      It's the equivalent of learning to drive a stick shift car without understand why there are gears at all. If you are ignorant of the very basics of internal combustion engines and can't understand the dangers of lugging or redlining an engine and the importance of using the right RPM, you will never be a good driver. It matters not whether you ever drive a stick in real life, it's just a matter of knowing how to handle your equipment. Do you believe programmers should know big-O notation?
    5. Re:Yes. by Lehk228 · · Score: 4, Insightful

      i agree that everyone should have decent understanding of what's going on behind the curtain, though rather than focus on the what, i would prefer to see more experience with limited environments.

      as in your example, too many people code like the only platform is the multi-GHz PC.


      even a year doing tools in Graphing calculator basic will teach appreciation for not wasting cycles doing everything the lazy way, 'cause sure, you usiung strcat doesn't slow the system in a noticable way, but when half the processes running are using it, and using it in "hotspots" suddenly you need a new machine because it's just not fast enough.

      --
      Snowden and Manning are heroes.
    6. Re:Yes. by gpierce11 · · Score: 1

      Aren't you really talking about knowing and using efficient algorithms? Isn't this a separate issue from the question of whether it is useful to know how to program in a very, very low level language?

    7. Re:Yes. by hazem · · Score: 1, Funny

      If they knew about big-O, they would have girlfriends, and by definition, could not be programmers.

    8. Re:Yes. by BillyBlaze · · Score: 2, Insightful

      Could you design an airplane without a basic knowledge of sheet metal fabrication? I think not.

    9. Re:Yes. by toddhisattva · · Score: 1

      Any more than sheet metal fabrication tells you how an airplane works.
      We need aero engineers to understand annealing and metal fatigue.

      We need programmers to know assembly.

      D'ya think the Rutans skipped over that boring materials science stuff?
    10. Re:Yes. by bigtangringo · · Score: 1

      I'd disagree with you, to a point. Using your analogy:
      Do I need to know the very basics of an internal combustion engine to just drive the car to-and-from work? Not really, no. One can drive fine without knowing how a car works, in fact I suspect a significant number of drivers have no idea how their cars actually work.

      I also suspect that the same is true for the vast majority of programmers and programs, all programs being considered.

      The fact is, that computers today can run even the slowest of code fast enough.

      For many applications, however, knowing the intimate details of how it all works is vitally important; device drivers and operating systems for example.

      --
      Yes, I am a smart ass; it's better than the alternative.
    11. Re:Yes. by ObsessiveMathsFreak · · Score: 1, Flamebait

      Programmers shouldn't need to know about big-O notation(90% is just mathematical sophistry anyway). Programmers should simply be able to grok what algorithims are more or less efficient and in what circumstances, and mor or less why. Proving some rookies hack had was O(n!) is not a practical job requirement. You should just be able to look at his code, go "Uuuhhh!!!", and change it to something that's O(n^2), or O(nlog(n)) if you have time.

      At no point is it required that you know exactly what order your algorithim is. You should just have a good feel for how good its doing. Use code profilers, etc to help with this. But in the end, just like novel writers have to read lots of other books, programmers have to read lots of code so they know what's good and what's not almost instictivly. It's a skill that can be learned.

      --
      May the Maths Be with you!
    12. Re:Yes. by Anonymous Coward · · Score: 0

      Not because you don't like strcat/strncat doesn't mean that it isn't a useful function.

    13. Re:Yes. by MythoBeast · · Score: 1

      I couldn't agree more. When people compare the efficiency of C++ vs. Java they often concentrate on how long it takes to iterate through a 'for' loop or something silly like that. The real issue isn't how efficient it compiles down to an executable, but how the programmer tries to implement an algorithm. C++ programmers, being closer to the processor, are much more aware of how many cycles it's going to take for a specific chunk to run, whereas Java programmers are more likely to implement functionality using only partially applicable re-built components.

      --
      Wake up - the future is arriving faster than you think.
    14. Re:Yes. by 0111+1110 · · Score: 1

      You can't write efficient algorithms an a small scale using compiled languages. That's the whole point. Am I the only coder in the world who has been frustrated even in C with some function that does X,Y,Z, and A,B,C, when I just need it to do Y. Put that in an inner loop and you're sure as hell going to see a difference. While I don't know much about compilers, I do know that they don't understand your particular problem domain or why you may not need some particular error checking or god knows what that, while useful to 75% of pretty much everyone, is not useful to you in that particular program. Hence the use of inline assembly (or whatever kind of assembly). And if you think assembly is so low level, try coding in raw machine code sometime. Even assembly somewhat abstracts you from the hardware.

      --
      Quite an experience to live in fear, isn't it? That's what it is to be a slave.
    15. Re:Yes. by SpaghettiCoder · · Score: 0

      That makes me feel a bit better! So I don't need to study big-O for now.

    16. Re:Yes. by Anonymous Coward · · Score: 2, Insightful
      At no point is it required that you know exactly what order your algorithim is. You should just have a good feel for how good its doing. Use code profilers, etc to help with this.

      Wait a minute. You're going to go all the way through design, design review, and code it up, all based on a "good feeling". And THEN you're going to check it's efficiency with a profiler? You take "iterative" software design very literally, don't you.

    17. Re:Yes. by Dachannien · · Score: 5, Insightful

      I don't think that's a very apt analogy (though few analogies ever are apt). Driving a car to and from work is more akin to using Word (or OpenOffice) on your computer. You don't really need to understand the nuts and bolts of how either one works, but you do need to know what the controls do.

      Programming in a high-level language is more like doing basic maintenance on said car. You definitely need to know something about how the car works, and the more you know, the more work you can do on that car yourself. Programming in assembly is sort of like taking the engine out and repairing or modding it. You may never need or want to do that, but knowing how an engine works on a detailed level can help you diagnose and remedy things that don't actually require going to those lengths. Similarly, knowing how a microprocessor works can help you understand more about what you're doing when you program in a high-level language.

      It also gets you into a mindset where you're thinking about this sort of thing, which is why assembly should still be required teaching in an undergraduate computer science curriculum.

    18. Re:Yes. by smallpaul · · Score: 5, Insightful

      My philosophy is that you should know the layer beneath the layer you program on. Let's say you're working on Groovy code which is half-interpreted and half-compiled on a JVM which is written in C, perhaps using JIT or perhaps not, running on a CPU. Nothing that you can possibly known about how registers work or how jumps work will help you to understand the performance of your program several layers up -- especially given that your program will run on several different runtimes optimized in several different ways on several different CPUs.

      But if you're going to program in Groovy then you should know Java and perhaps JVM IL. If you're going to program in C then you should know assembly. If you're programming in assembly then you should know about how CPUs will reorder your instructions etc. If you're building a CPU, then you'd better know physics.

      I really don't think that if you're writing an app in Rails/Javascript/SQL you are going to achieve any performance or debugging benefits by understanding assembly language. It's just knee-jerk to say that every programmer, no matter what they do day-to-day should be knowledgeable about assembly. The same effort expended learning about the layer UNDER your development environment would have a much better payoff. E.g. a Javascript programmer reading the Firefox source code (or at least benchmarking FireFox and IE on important operations). With each level deeper you go, you achieve quickly diminishing returns.

    19. Re:Yes. by thecheatah · · Score: 5, Insightful

      Wow, the first programming language I learned was z80 assembly :-). I use to make games for the ti86.

      here is a side scroller i made written all in assembly (includes animated screen shot)

      http://www.ticalc.org/archives/files/fileinfo/232/ 23280.html

      The things I learned:
      1. 4mhz processor is REALLY fast!
      2. How the stack works.
      3. How absolute and relative jumps work.
      4. How to create "objects" and implement "methods"
      5. How the smallest variable, the register works.

      I have to say that after making games in assembly, I am actually disappointed in how well the current consoles handle them. I would expect them to be able to crazy things with the hardware they are given. That is also why I am interested in the ps3, it forces programmers to understand the underlying hardware.

    20. Re:Yes. by aj50 · · Score: 3, Insightful
      I think they should know about big-O notation, as in what it means and how it will affect the scaling of your algorithm but I don't think it's useful to have to prove it formally. It's useful to express what usually you should be able to see quite quickly in a way that other people understand. It allows you to say A is better than B because it's O(nlog(n)) rather than O(n^2) without trying to explain why a recursive algorithm can be quicker than one which just has two for loops.

      It's also handy for sanity checking when a quick calculation shows that your algorithm which works fine for n=10 will take something in the order of three years to complete for n=1000.

      --
      I wish to remain anomalous
    21. Re:Yes. by grasshoppa · · Score: 2, Interesting

      You are both right and wrong, in a sense. You are right that he should know what's going on under the hood. You are wrong in that he shouldn't use it. Program execution speed should ( almost always ) take a backseat to code readability. If the organization uses strcat, there is a very strong and valid argument why he should still be using it.

      --
      Mod me down with all of your hatred and your journey towards the dark side will be complete!
    22. Re:Yes. by Anonymous Coward · · Score: 0
      Said like someone who doesn't know it. ;-)


      If assembly language is a particularly difficult thing to get used to, I'd factor that in to the bigger more holistic picture. Every programmer worth his salt should have had at least some experience with assembly. Should he have written entire programs in it? I would hope not in this current time, at least not very many of them, but optimizing a routine or at least some course work in a typical CS or CE program should be there. It's pretty simple, it's actually really really simple, there isn't much syntax, there isn't that much to screw up. Not like writing C++ or OCaml. You do have to "do more" to make things happen but it's a worth while thing to have done at least once. Will you be a chip expert or "modern systems" after it? Hell no, that's not the point. You will most likely have a more concrete view of how most or even all systems do actually work though. As a true story, I actually found a bug in output from a compiler in the late 1990's, they still happen; might even happen more often now because there are more relevant instruction sets (ia32, ie32e/amd64, powerpc and all the extensions, sse, sse2, 3dnow) and AMD and Intel are much more willing to add to their instruction sets the last few years than they were 10 years ago. It wasn't unit tests that convinced us or the compiler vendor of the defect...


      The other fact of this matter is that modern compilers can typically out perform all but the best assembly coders. You're not going to have to do it in that many jobs that often, it's still good to know. Generally, beware whenever someone questions the importance of knowledge. I've never known someone to be hurt by knowing too much but I've meet plenty of people that have hurt themselves, company and people around them by deciding something arbitrarily wasn't worth knowing.

    23. Re:Yes. by vux984 · · Score: 2, Informative

      I know far too many programmers who haven't a clue what is going on under the hood, so to speak, and have zero comprehension of what operations take longer than others. For instance, consider a C programmer I know who thinks strcat is a good routine to use.

      Just have your friend write a strcat() himself using C, and he'll learn where/why its inefficient. (Or he won't and he's just dense.) Either way knowledge of assembler or lack thereof isn't the issue.

      It's the equivalent of learning to drive a stick shift car without understand why there are gears at all. If you are ignorant of the very basics of internal combustion engines and can't understand the dangers of lugging or redlining an engine and the importance of using the right RPM, you will never be a good driver. It matters not whether you ever drive a stick in real life, it's just a matter of knowing how to handle your equipment.

      You don't need to understand the dangers of lugging or redlining in terms of the mechanics of what is happening its enough to know that either leads to 'big engine problems' and to avoid them. That the mechanics involve engine strain, overheating, misfiring, etc is superfluous.

      Its easy to feel lugging with just a bit of experience and even a complete neophyte knows what redlining looks & sounds like. From there on, its enough to know to avoid both.

    24. Re:Yes. by 644bd346996 · · Score: 1

      You need to understand quite a bit about internal combustion just to drive a stick shift on a highway without blowing the engine or the clutch. You just can't go 65mph in first gear in a Civic and expect to get to work.

      That's why most people get automatic transmissions. They can't be bothered to understand the concepts of "rpm" and "torque". And very few cars can handle a commute all in first gear.

      To get back to computers, yes, most apps written in an interpreted language or just written badly will still be fast enough. But the libraries and operating systems have to be quite fast, otherwise the lags will add up to an unresponsive system. People notce the difference between 150ms and 500ms. In many cases, 150ms is acceptably close to instant, but a 500ms pause is so slow that it is distracting. A responsive gui makes any product seem much more professional.

      Go look at the recent changes to Cairo, from 1.2 to 1.4. It is astounding how many operations can be sped up by a factor of ten or a hundred just by spending a few extra days or weeks improving a few routines. You can't accomplish that much in so short a time span without knowing a lot about what is going on under the hood. Optimizing code through iteratively profiling and changing code with trial and error will not produce the kind of quality that Cairo has achieved.

    25. Re:Yes. by damiam · · Score: 1
      Well, there's no reason not to. :-) The basic ideas aren't too hard to learn. A google search will get you a few decent introductions. Probably the best way to start is to consider common sorting algorithms (bubble sort, selection sort, insertion sort, merge sort, quick sort, radix sort) and how many operations they take to sort a dataset. If you don't know how those algorithms work, look them up; it's good stuff to know as well as interesting in its own right.

      If you're just programming to make buttons appear on windows, then no actual thought is really necessary, but the ideas behind big-O notation come into play any time you're actually trying program something new and original, and many times even when you're not.

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    26. Re:Yes. by ivan256 · · Score: 2, Insightful

      I hate to tell you but pretty much every "modern" system has components that are written in assembly. Some of us still know how to write low-level software, and that's a good thing, because otherwise all of your fancy "modern" languages wouldn't have a system to run on.

    27. Re:Yes. by Nrlll9 · · Score: 1

      stop turniing his readable code into your unreadable code. he should use strcat() end of discussion.

    28. Re:Yes. by ekstrom · · Score: 2, Informative

      An example: A few days ago I had to explain to a very competent desktop programmer, who was doing the unfamiliar job of writing test C code to be ported to an MSP430 embedded processor, that taking an integer modulo 1440 was a bad idea. The MSP430 has no divide instruction, so the modulo had to compile to a division subroutine made of subtractions, tests, and shifts. In this case there was a way to code the overall task that evaded the need for the modulo. When doing embedded C on a processor of that size (still a lot bigger than a PIC) I ALWAYS look at the compiler output when I am writing anything where I care about either size or speed of execution.

    29. Re:Yes. by SpaghettiCoder · · Score: 1

      Thank you but I consider those sorting algorithms to be the basics of programming and I wouldn't dare call myself SpaghettiCODER if I didn't even know how they worked let alone implement them.

    30. Re:Yes. by fitten · · Score: 1

      Programmers aren't simply 'drivers' of 'cars'. Programmers are more analogous to mechanics in your scenario (fixing bugs, for example, in code is like fixing a bug in an engine). Users are simply 'drivers'. Sure, users don't need to know how to program at all, but a mechanic had better know how a car works.

    31. Re:Yes. by damiam · · Score: 1, Insightful

      Well, on Slashdot you never know. :-) If you know those algorithms, you know most of what you need to know about big-O notation. Why does selection sort require n^2 comparisons to sort n items? Why does merge sort only require n*log2(n) comparisons? If you can answer those questions, then you can say that selection sort is O(n^2) and merge sort is O(n*log2(n)). You don't need to know the formal mathematical definition of O() as long as you have a working knowledge of what it means and how it's generally used.

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    32. Re:Yes. by deadlinegrunt · · Score: 1

      This would be the one time I did not have mod points just waiting to expire.

      --
      BSD is designed. Linux is grown. C++ libs
    33. Re:Yes. by Anonymous Coward · · Score: 0

      Looking at assembly code tells you very little about how modern software systems work. Any more than sheet metal fabrication tells you how an airplane works. Ever hear the expression "can't see the forest for the trees?" With assembly language, you're focusing on the individual leaves!

      WOW! Have you got things backwards! Understanding assm helps you understand the underlying machine, so you can write better "modern software". A good programmer should have a proper understanding of the underlying machine, like wise an engineer designing a plane better know a thing or two about sheet metal fabrication!

      Unfortunatly not enough "modern" programmers understand this, and take your attitude about things. With air plane designers it's easier to weed out the morons who don't know what they are doing, their planes either don't fly or fall out of the sky. How ever the culture of software design has been overrun with "modern" programmers who don't care about little details such as execution time and memory foot print, and end users cannot easily tell which program is not truely ready for flight. And it doesn't help that Micro$oft has trained so many people to just accept software crashes as a way of life, through their appallingly low quality software. So now we have programmers who don't understand simple concepts that are key to good performance, like not putting static calculations inside a loop (such as x = y + 1, where y doesn't change until after the loop completes). It's this same group of people who coin useless phrases like "web 2.0".

      But no, by all means, let's follow your advice and see how things turn out! See how long we can get by with out any one in the computer industry learning assm, and therefore not having people to write compilers for those oh so powerful high level languages that let the masses remain ignorant of what their code is really doing... that should turn out swell...

    34. Re:Yes. by philipgar · · Score: 1
      If you're building a CPU, then you'd better know physics.


      What are you talking about there? Building a CPU may require some knowledge of physics at some level, but again, just like software you have many different levels of abstraction. You have the very high level block diagram designed by the architects, the HDL modules for the high level diagrams that are written by hardware designers for simulation. You have the VLSI guys designing the transistor diagrams below that, and then sizing appropriately etc. Below that you have the process people who determine the parameters the VLSI guys can use. The details go deeper, but that's not really relevant. Of course some knowledge of transistors is useful for the architect is useful, and some knowledge of VLSI etc. But they don't need to know the details of it. Also, I don't really know where physics enters into the equation.

      For ASM, it really isn't that relevant for high performance x86 CPUs. The instructions used don't represent what is done by the cpu etc. Some knowledge of the CPU you're writing for can be useful, and a general knowledge of what operations are "easy" on the target platform are important. But for many desktop apps, performance isn't that important. Unless someone is doing high performance code (for a game or something) or designing for an embedded system, knowing the assembly just isn't that relevant. Even there, know the platform, capabilities of the chip, but as for actually working with ASM, it's just kind of annoying, and doesn't have a huge advantage if you're not doing something very specialized such as SIMD programming.

      Phil
    35. Re:Yes. by Sigma+7 · · Score: 2, Insightful

      The fact is, that computers today can run even the slowest of code fast enough.


      No, they can't.

      In the current Standings for Al Zimmerman's programming contest, you see a lot of entries that have many submissions, but aren't even close to the optimal result. Even on the smallest scale, the slowest of code would go through all 20 trillion possible cominbations - the next smallest is an order of magnitude larger, and anything larger is within don't-even-bother territory.

      And yet, there's a person who has effectivly maxed-out their score, with a significant lead in the third category compared to the many other submissions. While he has at least one non-top submission, it's not something obtainable just by throwing as much computer power as possible.
    36. Re:Yes. by kruhft · · Score: 1

      I think every beginning programmer should have to spend a semester on some funky old z80, for instance, all in assembler, debugging in machine language, before they can call themselves a good programmer. The idea is not to get them skilled in z80s, but to give them a basic idea of how computers work.


      Or better yet, get one of the many freely available Gameboy emulators out there and the programming docs and write a game. I did that and it got me a job where I wrote 2 games for the Gameboy and Gameboy Color. There's nothing like writing a 16.8 fixed point 3d collision detection system in 8 bit assembly...
    37. Re:Yes. by that+this+is+not+und · · Score: 2, Interesting

      I learned programming at a 'professional' level by being thrown at a task and challanged to get it done. It was a stand alone medical device using a Hitachi 4-bit embedded controller. You learn fast that your code starts at the reset vector and you have to set up and intialize ANY resources your design will be using. A few years in at that job, the company brought online an older experience software engineer, but one who came from 'application' level programming. He knew a lot about what he was doing, but he was horribly reckless about initiating timers, critical configuration registers, etc., because he came from a world where that was all done for you by the operating system.

      Right now I just wish Microchip would do a better job of documenting the resources in their little PIC chips. It's tedious on each new model I decide to code to have to dig deep into all the arcana of the datasheet to figure out which registers to poke something in to to get the chip up and running what I need. They're certainly better, though, than some of the Japanese vendors, whose English manuals are bad translations of the Japanese originals.

      The first word on the first line of the table of contents on one manual I remember having to rely on was misspelled:

      "Beneral Introduction"

      It didn't inspire confidence in the rest of the manual.

    38. Re:Yes. by DrJokepu · · Score: 1

      Sometimes you can even gain performance benefits with SQL if you know a little bit about the low-level stuff. For example if your database server is running on a 32 bit platform, you should consider using INTEGER (the 32 bit one) instead of BIGINT (the 64 bit one), because a 32 bit CPU handles them much faster, you don't use a DOUBLE as a PRIMARY KEY for obvious reasons, and so on.

    39. Re:Yes. by frietbsd · · Score: 0

      z80 assembly is the last programming language i learned. I made games for ti83+

      saying that you don't need knowledge about assembly language because the compiler does it for you is like saying that you dont need to know addition because your calculator can do it for you. That you have a tool to do it faster is nice, but understanding what is going on is better.

      It makes you think much more structured. You have to know where you want to go 5 lines ahead. However, in practice the difference with other languages is small, because most of the actual work is done in calls to the OS or libraries.

      And you dont need to understand assembly to make a good emulator. Just have to be able to copy everything from the assembly reference manual.

    40. Re:Yes. by Khaed · · Score: 1

      You just can't go 65mph in first gear in a Civic and expect to get to work.

      You obviously don't watch other drivers often...

    41. Re:Yes. by HardCorePawn · · Score: 1

      That's why most people get automatic transmissions. They can't be bothered to understand the concepts of "rpm" and "torque". And very few cars can handle a commute all in first gear.
      You obviously dont live in a major metropolitan area and/or drive to work in said area... I barely get my car out of 1st gear on a 'good' day.

      hence why i take the train... but i digress, is this question something akin to asking 'is it still important for (insert profession here) to learn about (insert something old-fashioned relating to profession), now that we have (insert shiny new replacement)?' eg. Is it important for pilots to learn about navigation using charts/dead reckoning, now that we have GPS? To be honest, up until I used that pilot analogy, I was leaning towards no... but I think, like most things, this is one of those 'no right answer' situations. For some things I would say that, Yes, it is important... for others, not so much.
    42. Re:Yes. by Braino420 · · Score: 1

      You were doing absolutely splendid... until the car analogy.

      I'll never understand it honestly. Do you people assume the /. crowd knows more about cars?

      --
      They call me the wookie man, I guess that's what I am
    43. Re:Yes. by lordmatthias215 · · Score: 2, Interesting

      I agree that console programmers probably aren't pushing their hardware as hard as possible- unlike PC programmers, they have the luxury of having the same equipment in every unit, so they really don't have an excuse not to learn the system's assembly at least enough to squeeze a few extra cycles out.

      Out of curiosity (i'm not trying to troll here), what about the PS3 makes programmers understand the hardware better than they need to understand the 360 or Wii hardware? I know they have the Cell Processor, but IIRC they're just writing to Sony-provided APIs that thread the processes automatically.

      I'd actually expect programmers would have to know the Wii hardware much more inimately in order to not only obtain more finesse with gesture-based controls, but also squeeze the Wii for all it's worth to produce graphics that can garner people's attention once the 360 and PS3 start pumping out even more advanced graphics. In fact I think that if programmers don't invest the time needed to learn the Wii completely (even though it's very similar to the gamecube in architecture), the system may not be able to hold its momentum for too long. Of course Nintendo may have had this in mind, and will introduce another gen before the normal 5-year cycle is over.

    44. Re:Yes. by Tsagadai · · Score: 1

      Well in biology you generally go alot lower than leaves to learn how trees work. Also once you know how one plant or animal works at a cellular level you can generally work out how most releted plants or animals work. If you don't look under the metaphysical compiled bonnet and call yourself a programmer may I suggest sticking with .NET.

    45. Re:Yes. by smallpaul · · Score: 1

      Okay, but there are more straightforward ways to learn about the difference between a 32-bit number and a 64-bit one than using assembly. For example you could learn C, which is the language your database is implemented in. In fact, databases have such a complicated abstraction that you'd better learn a lot more about how their paging and indexing works etc. than how the C code that implements them is rendered into assembly language.

    46. Re:Yes. by Anonymous Coward · · Score: 0

      Not that I recommend it, but moving invariants out of loops is something most compilers do for you.

    47. Re:Yes. by Anonymous Coward · · Score: 1, Insightful

      Even after explaining it to him, yes he will avoid it, but he does not really understand why.

      I am not a C programmer; I learned a bit of C, a little more C++ and a small bit of assembly either on my own or during various courses at school. I understood your explanation fine. Why do you think somebody who is otherwise good at C would not understand if explained to them in precisely that way?

      but they simply have no concept of the fact that some operations take longer than others

      I don't buy this at all. I know it's a fairly lame example, I doubt you'll find any programmer who couldn't tell you that "x = x + 1; x = x + 1; x = x + 1;" is going to be a quicker than "while(x < 100000) x++;" even though the latter is less lines of code. I also find it hard to believe that they wouldn't be able to abstract that concept more to understand that two ways of doing things don't always work equally fast. Heck, hasn't just about EVERY programmer at the very least had a basic introduction to sorts? Even if they never profiled them in any way, I bet every programmer at least knows that there are multiple algorithms available that would give the same result with the same input. The logical reason for that is that one is faster than the other, either generically or in some special use case.

      If you want to argue that they won't know which is which, okay. I'm not sure learning a lower-level language is going to help with that though.

      If you are ignorant of the very basics of internal combustion engines and can't understand the dangers of lugging or redlining an engine and the importance of using the right RPM, you will never be a good driver.

      I assume you don't mean "a good driver" in the sense that most people mean it; rather, as some sort of measurement of technical ability. This is why I don't really follow this "you have to learn it or you're the suxxors!" argument.

      The things that people keep mentioning in this thread that assembly teaches--registers, stack, heap, queue, blah blah blah--can definitely be taught in abstraction, and probably much simpler than throwing an assembly manual at them and telling them to go to town. In fact, I would be surprised if most assembly lessons/classes don't begin with those very same abstracted explanations, before or alongside the throwing them in the pool approach.

      Maybe it helps them learn better, maybe it's more in depth, etc etc. Maybe it's just a really nice way to teach all of these sorts of things at exactly the same time. These are things you can argue, and probably relatively successfully. I just don't think you can really argue that it's not possible to understand the concepts if they are abstracted a little bit. Especially when you're talking about programmers who are writing in languages that are more abstracted from the concepts.

      Besides which, I don't really hear anybody argue that a well-written assembly program isn't going to be faster--perhaps substantially faster--than a well-written, for example, Java program. But isn't the whole point of C, C++, C#, Java, the majority (or all) of scripting languages, etc ad naseum to get you AWAY from the assembly to varying degrees? The argument being largely that the speed increase you would get simply isn't worth the extra development time, especially on near-modern systems?

      If you're coding in some niche markets, where speed is absolutely vital or direct, precision control is vital, assembly may be important. (Of course if you're writing the very lowest level things it is necessary.) Other than that, I think much more abstract concepts of efficiency, especially compared with some nice practical examples of performance testing, will do the trick. I'm not saying people shouldn't strive for efficiency, just that there are probably easier, shorter, more applicable ways of getting there.

    48. Re:Yes. by xero314 · · Score: 1

      Let's say you're working on Groovy code which is half-interpreted and half-compiled on a JVM which is written in C, perhaps using JIT or perhaps not, running on a CPU. Nothing that you can possibly known about how registers work or how jumps work will help you to understand the performance of your program several layers up This is incorrect. Spending most of my time dealing with "Java Programmers" (as opposed to software engineers) I can tell you that a little understanding of the hardware, machine code, and by extension assembly, the VM runs on goes a long way towards optimizations. True that the current generation of JVMs and Compilers do a significant amount of optimization, it is never perfect and never will be (All this coming from someone that has argued that odd architectures do not need to be more difficult to program since it can abstracted away). One fine example is a rare known fact that the first 4 references in a method are potentially faster to access than any others. From an well versed java developer this is because the bit code has optimizations for these references through aload_0 thru aload_3 as opposed to aload X, just as one example of where this optimization takes place. But why is this optimization there, why is it only optimized that way on certain architectures and why is only 4 and not 8 or 16 or any other arbitrary number. This is because of the initial target architecture of the Java language, which, after the overhead of the JVM had 4 registers available for storing the address of the object being referenced. So rather than the multiple operations necessary to get the address for an object using aload x, the system could pull the address from a register using aload_0-3. Explain that to most java developers (along with the basics of machine code and registers and so on) they all of a sudden start writing faster, more precise code. Yes it is possible to teach someone these things without understanding the underlying layers but it doesn't stick like it does when you do know what the heck is going on inside the machine.

      What is even worse is that languages such as java, as good as it may be for handle complex concepts, have not improved the performance of software or even the maintainability (I let you figure out the whys to that one.). The code I had written to run on a 2 mhz machine how ever many years ago (and I'm not old as developers go), would run faster on the current processors, yet the current programs are often slower to do the act same thing on todays machines. There is one thing high level languages have over machine code, or it's close cousin, assembly, and that is it allows VC to keep getting pumped into vaporware because we can keep it looking like progress is being made.

      Then again I was perfectly happy programing before I knew what NAND gates are used in processing a lookup ahead carry adder, but now that I do understand these things I can fathom how I got by without it.
    49. Re:Yes. by Anonymous Coward · · Score: 1, Insightful

      saying that you don't need knowledge about assembly language because the compiler does it for you is like saying that you dont need to know addition because your calculator can do it for you. That you have a tool to do it faster is nice, but understanding what is going on is better.

      Some might say that it's more like saying you don't need to know how to use an astrolabe because GPS can do it for you.

      That analogy is just as apt.

    50. Re:Yes. by x2A · · Score: 1

      "You need to understand quite a bit about internal combustion just to drive a stick shift on a highway without blowing the engine or the clutch. You just can't go 65mph in first gear in a Civic and expect to get to work"

      You need to understand about gears is that?

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    51. Re:Yes. by Anonymous Coward · · Score: 0

      How strcat works and why it is inefficient can be explained solely in terms of the C language. C is already close enough to assembly for that. What C hides from you is the actual register manipulations and such, and I don't see much insight to be gained from studying that (unless you are writing a compiler back-end, which most of us should leave to the experts)

    52. Re:Yes. by Anonymous Coward · · Score: 0

      Pointless inefficiency is indeed something we should avoid, but the "inefficiency" that comes from run-time memory safety checks, garbage collection, higher-level languages, greedy allocators etc. are all sensible tradeoffs that we have decided to make, and I think that we should make such tradeoffs far more often, actually. I'll take correctness over efficiency any day. Yes, people have made web browsers run on the Commodore 64, but coding in that style just doesn't scale very well - what Brooks says on writing a program vs. writing a program in a system matters here.

      But there is still something to be said against pointless inefficiency. If you're writing in C, and strcating strings in a loop, you get the worst of both worlds.

    53. Re:Yes. by belmolis · · Score: 1

      It's true that in many contexts strcat is not very efficient, but the GNU extension stpcpy addresses this problem. Indeed, the example in the manual entry is of using stpcpy to implement a more efficient strcat(). Moreover, there is absolutely no need to use assembly language either to understand this or to write it. Indeed, I wrote my own version of stpcpy (actually, the wide character version wcpcpy) in just a minute recently for portability to non-GNU environments, in C.

      I agree that some knowledge of assembly language is useful for understanding what is going on at the lowest levels, but this is not an example of the utility of knowledge of assembly language.

    54. Re:Yes. by belmolis · · Score: 1

      Actually, wcpcpy is a GNU extension but stpcpy is not. stpcpy is not in the ANSI or POSIX standards, but originated somewhere other than GNU.

    55. Re:Yes. by mgiuca · · Score: 1

      I agree with your sentiment. But I don't think it's a very good example.

      The problem you outlined can be seen if you just try to write out strcat in C itself. You don't need assembly knowledge to see what it's doing, and why it's bad if you misuse it. (I don't think strcat itself is necessarily bad, though obviously if you're catting lots of things together it's best not to use it, as you pointed out).

      Secondly, a knowledge of algorithms is more important to see why it's bad; I wouldn't have thought it's too necessary to know the assembly underneath.

      I don't think there really is a specific example of when it is good to know asm. It just is. Whenever you code in C, it's a good feeling to be able to imagine what asm the compiler is going to spit out. It does make you a better programmer. I don't believe it's "premature optimisation" to be coding with that in mind - it's just eternal vigilance.

      Asm is less relevant in a way - since what I just described is for coding in C, and other native languages. If you're writing code in C#, Python or Haskell, it isn't really possible to imagine the assembly coming out. But in another way, it's more relevant - because who is writing the JIT compilers and so on? The assembly coders!

      The biggest danger is that we get so focussed on the "higher abstractions" that everyone knows how to program in C# and Python, but nobody knows how the assembly code works - and suddenly people who actually know how to write compilers and bytecode interpreters get in short supply!

    56. Re:Yes. by shadanan · · Score: 2, Funny

      And if you're in physics, you should know math, and if you're in math, you should know Greek. :-)

    57. Re:Yes. by msormune · · Score: 1

      But what if the strcat routine implementation is super optimized for a specific architecture? In addition, sometimes it really is required your code is as short as possible. Further more, the more you "optimize" your code, the more bugs you are also likely to introduce into the code. And besides, you z80 programming requirement does NOT give any implication of how the computer actually works. Machine code is just another programming language and is interpreted by the CPU.

    58. Re:Yes. by SpaghettiCoder · · Score: 1

      That's super. I have a very old programming book (on Pascal LOL - don't worry I don't use Pascal) explaining the sorting algorithms in very simple terms, by way of explaining how they are implemented within the programming language itself. It doesn't use any mathematical notation to explain why one is more efficient than the other, but it's very clear.

    59. Re:Yes. by blahplusplus · · Score: 1

      "...even a year doing tools in Graphing calculator basic will teach appreciation for not wasting cycles doing everything the lazy way, 'cause sure, you usiung strcat doesn't slow the system in a noticable way, but when half the processes running are using it, and using it in "hotspots" suddenly you need a new machine because it's just not fast enough."

      This is exactly why some knowledge of assembly and the basics is important, small performance enhancements on functions that will be replicated and used many times in the same processes and also in multiple programs saves a lot of performance. It's the same as reducing just a bit the amount of electricity one uses by simply turning off a light, but you add up all those little choices across a growing population and you start seeing enormous efficiency gains from that one adjustment to the efficiency of commonly used functions.

    60. Re:Yes. by slapout · · Score: 1

      Your mention of strcat reminded me of this Joel on Software article:

      Back to Basics:
      http://www.joelonsoftware.com/articles/fog00000003 19.html

      --
      Coder's Stone: The programming language quick ref for iPad
    61. Re:Yes. by Anonymous Coward · · Score: 2, Insightful

      You might want to consult the Wright brothers on that one.

    62. Re:Yes. by mdwh2 · · Score: 1

      Does this apply to other things?

      Should a 3D programmer be able to write a software renderer (as someone who's done this in the past, I'd like to think it can provide some better understanding - but at the same time I accept that someone who's only programmed for 3D hardware can have an understanding of what's going on, just because I've spent hours trying to write code to rasterise polygons doesn't make any difference).

      Should a GUI programmer have hand-coded his own GUI library?

      Assembly can be useful, but there are a great many useful-but-not-essential things in the field of computing.

    63. Re:Yes. by Anonymous Coward · · Score: 0

      I completely agree about the benefits of knowing a lower level language. I would add that in additon everyone who programs should know C, or something equivalent. There are a couple of different phylosophies i've heard about how you teach programing to people, some have you learn a very high level language first (lisp, basic, etc.) to learn concepts about programming and slowly move you to a lower level language to improve your understanding of what is involved.

      Personally I think that's silly since students are always complaining how hard things are and they never gain an appreciation for languages. My first programming language was assembly for the 8086 and when I learned C++ later I thought it was the next best thing to sliced bread, then learning perl i couldn't believe how easy it was to write code in a few lines that would be 100s on lines of assembly.

      Knowing a variety of laguages across different levels of complexity gives you a better understanding for what can be best acomplished using what language. There are certain things I can do in a PIC using assembly that I've run into walls trying to do in C, and things in Flash that would take me months to code in C.

      I don't think every programmer 'needs to know' assembly, but I think everyone who is a serious coder should have been exposed to it for at least a term, and everyone should be familiar with C.

    64. Re:Yes. by _iris · · Score: 1

      This may be the best post I've ever read on Slashdot. I wish I could mod this up!

    65. Re:Yes. by Anonymous Coward · · Score: 1, Insightful

      Nice work. Ashame most current day programmer's could never write something like that even in a high level language.

    66. Re:Yes. by ravenlock · · Score: 2, Insightful

      Make it work.
      Make it right.
      Make it fast.

      Or,

      The rules of optimization:
      Rule 1: Don't do it.
      Rule 2 (only for experts): Don't do it (yet).

    67. Re:Yes. by Agent0013 · · Score: 1

      Yeah, but I bet the guy who invented the GPS system needs to know how to use an astrolabe to do a similar calculation for reading the GPS signals and figuring your location.

      --

      -- ssoorrrryy,, dduupplleexx sswwiittcchh oonn.. -Quote found on actual fortune cookie.
    68. Re:Yes. by fm6 · · Score: 1

      If you want to "look under the bonnet" (I love Brit English: "bonnet" is much more lively than our dreary "hood"), than you should study computer architecture, algorithmics, optimization, digital logic... The fact that you see the compiler as the main boundary between the virtual and actual computer tells me that you don't understand the inner stuff as well as you think you do.

      People have this weird notion that machine language is the "real" computer. In fact, it's just one layer of abstraction, with many layers above and below. Why not insist that everybody learn how to microcode, or design circuits?

      In fact, an obsession with machine/assembly language often leads to really bad programming practices. It tempts programmers to overoptimize their code, at the expense of maintainability and reliability. It promotes thinking in a low-level procedural model using bit-level data manipulation, wheras modern programming is dependent on high level abstractions, standardized code libraries, data encapsulation, and often uses non-procedural idioms.

      When you write a program, you pick a software model that works well for the problem you're trying to solve. Then you find a good implementation of that model and use it. That implementation, or "platform", usually consists of a compiler, some libraries, and nowadays often includes a virtual machine. (Despite your sneering at .NET, a virtual machine happens to be a powerful tool for creating efficient, reliable software. The fact that the Microsoft implementation of that idea suffers from their usual bad planning, feature bloat and bad QA is beside the point.) If the platform is any good, you can concentrate on solving the problems you're supposed to be solving, and leave the low-level stuff to your platform, which will probably do a better job of handling the low level stuff than you could anyway.

      That said: yes, a well rounded computer nerd (something not all programmers need to be) should certainly study assembly language — along with a lot of other stuff. But they shouldn't promote assembly language to any exalted role as the "real" computer language.

    69. Re:Yes. by jZnat · · Score: 1

      Assembler is just a pseudo-english version of the opcodes anyhow. Instead of using numbers for specific registers and other arithmetic needed to generate the proper op code for certain instructions (e.g. on x86, to calculate what number to use so that MOVL knows whether to use a certain register, a certain word in memory, etc.), it is only slightly simplified so that you can remember 3-8 (CMP8XCHG comes to mind :P) letter "words" instead of arbitrary numbers. It's very possible to write a program using just the opcodes, but why do that when the assembler will just convert it for you?

      --
      'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
    70. Re:Yes. by Anonymous Coward · · Score: 1, Insightful

      There appears to be a very big misunderstanding of the scope of projects and design in your post (not your code; not that I looked).

      It is naive to compare Assembly coding on a Ti86 to Assembly programming on an x86 processor, or a PowerPC processor. yes, the basics are the same, but there is still a lot more going on and necessary to understand than you seem to be acknowledging (albeit, probably unintentionally).

      On the scale of a modern game, it takes 50+ people working simultaneously to release the game within 2-4 years (of course not all of them are programmers), and that's in higher level languages, plus some Assembly for the verious graphic's shaders. When you begin to make games on this scale, it's not always just the fact that they didn't make the game in Assembly that brings out the occasional slow down (just to be clear, there are hand optimized Assembly parts, and a lot of developers will write their code in a high level language, then optimize the resulting Assembly). In most cases, it has nothing to do with the fact that they did not do parts in Assembly, but simply has to do with everything that's going on is simply too much to handle especially with graphics, which ironically probably have the most Assembly hand-made in them across the code base.

      If you want to code games in Assembly, then more power to you, but good luck trying to do it in a multithreading environment while trying to get something usable that is worthwhile on a deadline.

    71. Re:Yes. by djSpinMonkey · · Score: 1
      But if you're going to program in Groovy then you should know Java and perhaps JVM IL. If you're going to program in C then you should know assembly. If you're programming in assembly then you should know about how CPUs will reorder your instructions etc. If you're building a CPU, then you'd better know physics.

      And if you're going to do physics, then you should know... theology?

    72. Re:Yes. by 644bd346996 · · Score: 1

      Gears matter, yes. But most people had a bike as a kid. However, a car, unlike a bike, can have certain parts melt or bend out of shape or shatter when you redline it on the interstate for miles. The actual gear ratios don't matter much. It is the engine speed you need to be careful of.

    73. Re:Yes. by 644bd346996 · · Score: 1

      I live in an area where most commuters drive in from an adjacent county. As to the analogy, standard transmissions are no longer "standard" and automatic transmissions are pretty much universally availible. So in that sense, they are pretty much obsolete. Similarly, when programming, there is hardly ever any justification for not using the standard library's math routines. The problems come when you start to put together complex procedures with relatively low level operators. When you are doing that, it is easy to end up with a few extra calls that actually slow down your code by an order of magnitude. One of the other posters provided a good example of when not to use strcat.

    74. Re:Yes. by fm6 · · Score: 1
      Well, I've read your post carefully, and I still don't understand why strcat is evil. Yes, there are faster ways to concatenate strings. So what? A good programmer doesn't obsess about saving cycles on every little line of code. That's a waste of time — human time, which is more valuable to CPU time. A good programmer makes a program reliable and maintainable first, and only then worries about paring down the extra cycles. And then only if necessary. Which is only the case inside some loops, mostly very tight ones.

      If you hadn't been wasting so much time obsessing over pointers, you'd have heard Tony Hoare's famous quote: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil".

      Sure, you want to know how a computer works inside. But frankly, I don't think studying assembler is a very good way to do it.

      Incidentally, I aced my assembly language final (I won't say for which system, because then you'd know how old and senile I am) because it consisted of writing a simple bit-extraction program — and my program was more efficient than the official "right" answer. And that was the very last assembler program I ever wrote.

      And I never learned to drive a stick.

    75. Re:Yes. by smallpaul · · Score: 1

      One fine example is a rare known fact that the first 4 references in a method are potentially faster to access than any others.

      If a Java programmer who worked for me told me that they had reordered methods in a class in order to take advantage of a transient implementation detail of a specific JVM on a specific CPU, I would be sorely tempted to fire them.

    76. Re:Yes. by xero314 · · Score: 1

      Since you obviously have no clue what I was talking about I assume you are either a manager, and should be letting your programmers do their job, or you don't belong in a position to fire people.

      I didn't say anything about reordering methods at all. What I was talking about was making your most frequently used references (or primitives for that matter) in a method be the first four (between method parameters and local references) and if at all possible making there be only 4 in total (including the 'this' reference for instance methods and constructors). This is part of the Java Byte Code and is clearly defined in the specification, if you want to read that. Any java developer worth paying knows byte code, wether they have ever actually written direct byte code or not. All load and store operations in byte code, the most common operations, have 5 different versions. There are 4 that have no arguments (i.e. aload_0 thru aload_3) and one that takes a single argument(i.e. aload x). The byte code specifications states that the first 4 versions will perform as well or better than the final one. On every implementation I have used the first 4 were significantly higher performing. This is because on most platforms those first 4 can be optimized to look at specific registers or register parts, while the last one must load from an in memory array, which at best requires multiple machine code operations against physical memory and at worst has to deal with the over head of virtual memory. Not to mention the fact that the byte code itself is more compact and can be parsed in half the time using the first 4 variants.

      Needless to say that you have actually proven my point that understanding the underlying system is very important to actually understanding what effect you are having when writing code. The fact that you "would be sorely tempted to fire" a developer that was writing optimal code shows that you don't understand the effects that pessimal code has on your entire system. But then it's possible that Peter Haggar and I don't know what we are talking about, but I doubt it.

    77. Re:Yes. by x2A · · Score: 1

      Unlike muscles which don't have any limits, and won't pull or tear or anything???

      Knowing to keep your revs low isn't really understanding of the internal combustion engine, knowing why you should is. You don't need to know the reasons why to be able to drive, just the what.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    78. Re:Yes. by ioshhdflwuegfh · · Score: 1

      In the current Standings for Al Zimmerman's programming contest, you see a lot of entries that have many submissions, but aren't even close to the optimal result. Do you mean "the current best result" instead of "the optimal result"? Are optimal results known at all for these problems?

      And yet, there's a person who has effectivly maxed-out their score, with a significant lead in the third category compared to the many other submissions. While he has at least one non-top submission, it's not something obtainable just by throwing as much computer power as possible. This also might depend on the available computer power: if two contestants have algorithms A and B, and A is say 5 times faster in improving results than B, but B has 6 times more computing power, either because of the used hardware or software optimizations (that might even include assembler), B would win. Of course, with programming of heuristic searches, having a good high-level programming language for algorithm development combined with the coding of the current best algorithm in the low-level language seems to be the winning strategy.
    79. Re:Yes. by ioshhdflwuegfh · · Score: 1

      Moreover, there is absolutely no need to use assembly language either to understand this or to write it. Indeed, I wrote my own version of stpcpy (actually, the wide character version wcpcpy) in just a minute recently for portability to non-GNU environments, in C. Maybe nowadays there is no absolute need for assembler, but even in your example, if a program is to use strcpy a lot, assembler implementation might be beneficial to gain an extra speed. Portability is a great thing, but there just might be that one architecture for which assembler implementation is preferred to the compiler's. This is especially true for small routines doing low-level tasks.
    80. Re:Yes. by ioshhdflwuegfh · · Score: 1

      Sure, you want to know how a computer works inside. But frankly, I don't think studying assembler is a very good way to do it. Sure, you would like to program your computer from the outside, but using which programming language exactly?

      If you hadn't been wasting so much time obsessing over pointers, you'd have heard Tony Hoare's famous quote: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil". Is using C then a premature optimization?
    81. Re:Yes. by fm6 · · Score: 1

      Sure, you would like to program your computer from the outside, but using which programming language exactly? Qualify your question, please. What kind of program am I writing? What's the target platform? Are there memory constraints? Bandwidth issues? Realtime performance issues? What industry standards does it have to adhere to? Is localization an issue?

      Is using C then a premature optimization? Were you born stupid, or did you have to study?
    82. Re:Yes. by ioshhdflwuegfh · · Score: 1

      ...just prematurely optimized...

    83. Re:Yes. by fm6 · · Score: 1

      Like most netidiots, you place an excessive value on getting in the last word. You should bear in mind that in order to get in the last word, you have to actually say something.

    84. Re:Yes. by ioshhdflwuegfh · · Score: 1

      Like most netidiots, you place an excessive value on getting in the last word. You should bear in mind that in order to get in the last word, you have to actually say something. Would not saying something be the reason to have a dialog rather than "to get in the last word"? But then, this question aside, and, to be in accord as much as possible with what you wrote, the last word is yours. I promise I won't reply to your reply unless, of course, you say something.
    85. Re:Yes. by Anonymous Coward · · Score: 0

      [strcat is] woefully inefficient

      This is a property of having to find terminating NULLs, as the string "type" in C has no structure beyond that.

      What algorithm would you use, given that you have only a pair of pointers to start with?

      I would be interested in your code, which is more efficient than strcat, algorithmically.

      (Note, not necessarily safer, just more efficient and no less accurate).

      The problem, concisely, is: write a function taking two pointers to C strings as arguments. C strings are arbitrary collections of chars ending in '\0'. Concatenate the two strings, such that the first string's end ('\0') and the necessary memory locations after that are overwritten by the contents of the second string, and the resulting concatenated string is terminated with '\0'.

      Return what you like, use whatever searching/copying mechanisms you want, as long as you fit the requirement.

      consider a C programmer I know who thinks strcat is a good routine to use.

      (For the ignorant, it takes two string pointers and copies the second one to the end of the first one; this requires zipping all the way from the start to the end of the first string to find where said end is. It then helpfully returns the pointer to the beginning of the first string, the very parameter you passed in.

      Er... it copies the second pointer to the end of the first one?

      So memory looks like F....S.... and then FS...s.... where F and S are the pointers, and s is where S was before, and the dots are undisturbed memory?

      Your explanation confuses me!

      Hah, no, I know that p = strcat(s1, s2); finds the NULL terminating s1 (call that "n"), and then loops checking if the char pointed to by its second argument contains NULL. If it does not, it copies the char pointed to by its second argument to the char pointed to by n, increments both, and goes back to the start of the loop. otherwise, a terminating null is written to the char pointed to by s1, and returns. On some systems, before the return, it must do work to return the original first argument as the result. On others, the calling convention puts the first argument into a specific register, and expects the return result in the same register, and s1 is never mutated. In some environments, strcat uses bulk memory copy instructions, rather than individual charwise copies. In others, this is done on-chip through instruction fusing.

      strcat has some annoying failure modes: if s1 or s2 is not NULL-terminated, if s1 points to unwritable memory, if there is insufficient space after the s1's terminating NULL to store s2 without overwriting another object. this can be especially annoying if alloca() and automatic array types grow the stack downwards, and is a common vector for stack smashing attacks (a well-crafted s2 string would overwrite the return address pushed onto the stack in some C runtime/calling conventions). strcat has a portability problem in that it also can't be relied upon to deal with overlapping copies in a predictable fashion.

      bcopy/memmove are slightly safer (both cope with overlapping copies and take a length argument), but probably not much faster, than strcpy (or strncpy, which is more directly comparable).

      Never mind that the new end of the first string would be very handy for the next strcat to that same string

      The "string" pseudotype in C is bogus and dangerous. They are ordered blocks of chars ending in '\0'.

      strcat does not relocate the first string, nor does it modifiy it in any way short of destroying the terminating NULL.

      This is normal for C.

      Your "new" string end from any of the concatenation routines in the standard libraries will be the the old string end plus the length of the concatenated string.

      Or, if you want, you can DIY:

      #include <stdio.h>
      #include <s

    86. Re:Yes. by Anonymous Coward · · Score: 0

      strcat and relatives take the start of a string, and you would just reuse s1 for appending more data
      ... at the cost of having to find the end of the string from the beginning again, which can be expensive when large strings are involved and the operation is done frequently.

      On the other hand, this is so atypical that writing one's own string concatenator would be an attractive optimization at the algorithmic level.

      Returning the initial argument makes this sort of thing easy to code:

      strcat(strcat(strcat(strcat(strcat(buffer, "a"), "b"), "c"), "d"), "...");
      but we are scanning the whole buffer from the start each time, looking for '\0'.

      You are right that the problem is the C string, and that there are a variety of ways a better data structure could help dramatically with this kind of data flow.

      However, the library maintainer or the compiler can help here too, by memoizing the '\0' search, or consolidating the strcats if you are willing to use a compiler builtin rather than a library function.

      Memoization in the library is straightforward: cache the most recently seen pointer (or pointers) and the ends of them. On each call to the memoized strcat, compare it with the already seen ones, and look for the '\0' in the right place.

      This can mess you up if you truncate the string (by inserting an earlier '\0'), however, so doing this in the compiler is safer (even in strcat terms...).
  3. Isn't it the root of all programming languages?? by madhatter256 · · Score: 4, Insightful

    Isn't knowledge of assembly language for microprocessors required to create a higher level programming language?

    --
    Previewing comments are for sissies!
  4. You should not learn it.. by QuantumG · · Score: 5, Insightful

    Please remain ignorant of all lowlevel details of your deployment and development platforms.
    Please continue to treat both computers and the tools you use to program as magic black boxes.
    That way old dogs like me will still have a job.

    --
    How we know is more important than what we know.
    1. Re:You should not learn it.. by LionKimbro · · Score: 3, Insightful

      Yes; Understand too, how the gates work, all the details of how the chips work, (the myriad chips your program may run on,) and have a good understanding of quantum mechanics, as well. Understand all the business supply chains, as well.

      Anything else, is just-- pshaw... Black boxing it.

    2. Re:You should not learn it.. by MenTaLguY · · Score: 5, Insightful

      Um, I know you were being facetious, but that's not a bad idea at all, actually. A comprehensive knowledge of those fields isn't normally worth it for most things, but basic literacy in all the areas you mention is actually very helpful at times.

      --

      DNA just wants to be free...
    3. Re:You should not learn it.. by Anonymous Coward · · Score: 0

      How is someone going to learn assembly? I can't imagine having to learn it without getting the use the equivalent of DEBUG which AFAIK doesn't exist for a 32 bit protected mode environment. GDB is nothing compared to DEBUG for assembly :/

      I suppose someone can run vmware with drdos or something but why force someone to learn segments and rules that applied to registers that don't matter anymore?

    4. Re:You should not learn it.. by Bozdune · · Score: 2, Interesting

      How is someone going to learn assembly?

      Well, when I was a wee lad taking 6.251 from Donovan & Madnick at MIT, they threw an IBM Assembler H manual at us and wished us good luck on the first programming task (in two weeks).

      So suck it up and RTFM. Although, to be fair, the Assembler H manual is probably one of the finest computer manuals ever written, so it wasn't as bad as it sounds.

    5. Re:You should not learn it.. by Duhavid · · Score: 1

      You know...

      There *are* other assembly languages than x86.

      For instance, I learned assembly on a PDP-11, no
      segmentation, none of the stupidities about registers
      that the x86 burdens one with....

      --
      emt 377 emt 4
    6. Re:You should not learn it.. by gripen40k · · Score: 2, Informative

      I'd have to agree with you there, and electrical engineers have to know everything from the ground up; microelectronics, digital logic, computer architecture, assembly, and finally programming languages. All of them have their uses, and when building even basic control circuits you have to use pieces of them.

      For example, if I were to build some kind of light controller, I could use... microelectronics knowledge to use a BJT that drives a LED via a microcontroller. The microcontroller uses its analog to digital converter to test some voltage that in turn controls the output to the BJT. I can use some logic circuits to have serial input from a computer to control/program the microcontroller. The computer is programmed in C++, the microcontroller in assembly (or C if you have the neat-o compilers).

      Even if pure software people may not have to use it, and therefore think it's irrelevant, assembly is still a big part of the picture when it comes to the nitty gritty parts of electronics design. I've used the C compilers for the PIC microcontroller and they are nice and all, but don't do anything efficient at all, don't support any power saving states, and generally needlessly use up memory. They are great to use to do preliminary design, then you can go in and do some bit hacking if you want your controller to run as fast and as cheaply as possible.

      --
      Har?
    7. Re:You should not learn it.. by NormalVisual · · Score: 3, Insightful

      680x0 assembly was similar in that respect - the register set was very orthogonal, and the chip in general was a blast to code for. Oh, and no segmentation either. ;-)

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
    8. Re:You should not learn it.. by Duhavid · · Score: 1

      The little bit of Sparc assembler I did in compiler construction
      ( ah, my favorite ( no, that is not sarcasm ) ( the course ) )
      seemed pretty straight forward as well. The little I learned
      about 680x0 assembler made me wish I had a chance to get to know
      it better.

      --
      emt 377 emt 4
    9. Re:You should not learn it.. by Nazlfrag · · Score: 1
      Assembly programming in an x86 PM environment isn't straightforward, but can be done. Under Windows/DOS I just used to use Watcom C to create a DOS4GW 32 bit protected mode DOS executable, and call the assembler from a C stub. Not sure how I'd do it nowadays, but most languages should support linking at least on the object level. In Unix it is trivial.

      Protected mode assembly programming on x86 isn't half bad. Linear addressing almost made sanity of the PC's memory map. Reminded me of the simplicity and elegance of 68k code. Any register could be a memory pointer, there were some nice addressing modes and most SVGA cards could me mapped linearly. Of course, it's been a while since I bothered, the performance difference from compiled high level code on a Pentium II and above is negligible, and simply not worth the time. Anything older or slower, it can be a significant boon.

      If you want to be a professional in any computer field, the nuts and bolts understanding it gives you is second to none. It's mostly needed in the security field, microcontroller programming, OS and hardware design and game industries.

      You haven't experienced programming until you've coded in hex.

    10. Re:You should not learn it.. by that+this+is+not+und · · Score: 1

      Do they still train EEs?

      All the new 'pups' I see coming along these days seem to just be CAD Workstation operators. And a lot of them have a degree title with some weird variation, like 'Electronic Engineering Technolgy.'

      In the world I grew up in, there were:

      Electrical Engineers
      Mechanical Engineers
      Chemical Engineers

      And liberal arts wannabes.

      What happened?

    11. Re:You should not learn it.. by that+this+is+not+und · · Score: 1

      Don't forget good old 6800 Assembly Language.

      At the time I was being dragged through that in class, I was a Z-80 zealot so I always had some sharp comment: "6821? Why are we memorizing the status register on THAT old relic?!?"

      HINZVC

    12. Re:You should not learn it.. by gripen40k · · Score: 1

      Ha, EE techs go to college for two years, whereas E-Eng's goto university for 4 years. there's usually a big difference in the things you have to learn and the quality of the education. At least that's how it works in Canada...

      --
      Har?
    13. Re:You should not learn it.. by UnknownSoldier · · Score: 1

      > How is someone going to learn assembly?

      AppleWin

      --
      Somedays you wish the CP/M inventor would of used an Apple. (Stupid 8.3 compared to 32 chars)

    14. Re:You should not learn it.. by Braino420 · · Score: 1

      Orrrrr.... you can be a 2nd rate developer who only does this "for a living".

      I'm currently a CS student, and I have had to go through a few classes that cover the topics you mention (except the business supply chains, of course). Although it was painful, and I was bitter at first, I feel I have a much better understanding of what happens in those "black boxes". Besides that, I wouldn't have any self-respect if I, as a CS student, didn't have a basic understanding of the low-level workings of a computer. Now is this essential for all people doing software development? Hell no. In some cases? Definitely. If someone happens to get a computer-related degree without at least _understanding_ these concepts, I believe their university has done them quite a disservice.

      As for the actual question: ummm, of course it's still relevant. It's not like all of the assembly language stuff is all over and no one has to ever worry about it again. That, and as MANY others have mentioned, it can help when working with lower level languages (you know, the ones without a VM). But hell, if you just want to do some high-level development, as the person seems to be pushing for, just jump right in, you'll end up doing what you want to do anyway. It just sounds like me sometimes, getting aggravated over my Comp Arch class (or any class I'm feeling aggravated in): "Oh this is sooo stupid, when will I ever use this"

      --
      They call me the wookie man, I guess that's what I am
    15. Re:You should not learn it.. by nernie · · Score: 1

      "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way."

      -Kurt Vonnegut, Cat's Cradle

    16. Re:You should not learn it.. by etzel · · Score: 1


      start:
          mov ah,08 ; If you must know how things work,
          int 21h ; by all means go ahead and learn it.
          CMP al,27 ; Is it relevant today? depends on
        JNZ not_escape ; what your target job is.
      is_escape: ; I learned it while in college 20
          mov ah,02 ; years ago. Since then, I've used it
          mov dl,"E" ; ZERO times. Then again, I do not
          int 21h ; develop drivers or deal with buffer
          mov dl,"S" ; overflows but design warehouses and
          int 21h ; business systems.
          mov dl,"C" ; In case you are wondering, the code
          int 21h ; to the left will read in a key and
      not_escape: ; tell the user if he pressed escape
          mov ah,4ch ; (ASCII code 27). Funny thing is that
          mov al,00 ; everything going through your screen
          int 21h ; now eventually ends up in something like this...

      --
      "It is the mark of an educated mind to be able to entertain a thought without accepting it."
    17. Re:You should not learn it.. by LionKimbro · · Score: 1

      Yes; Your response is quite fair.

      What I mean to say is: Black boxes are a fact of life. We simply cannot, as individuals, know everything.

      You can be a perfectly good programmer, and not know what's in a great many black boxes.

      You can be a perfectly good scientist, and now know what's in a great many black boxes.

    18. Re:You should not learn it.. by yo303 · · Score: 1

      There has never been a sweeter assembly language than 680X0. I still believe that the entire instruction set can be derived directly from Maxwell's equations. yo.

    19. Re:You should not learn it.. by Anonymous Coward · · Score: 0

      Speaking as someone on an Electronic & Software Engineering course, I'd say we're very much alive, no thanks to snide old-timer "things were better in MY day" commentators such as yourself.
      Admittedly we don't do AS MUCH assembly (it's mainly C, compiled using KEIL), we do however still cover a lot of basic microprocessor theory, programming and implementation. It's all practicals too, so we get to put the hardware together and our code along with it. It gives so much more freedom to be able to code direct to the hardware that you've set up to your own preferences. Plus you learn a lot about how powerful microprocessors really are, and how to work with their limitations to achieve real results.

      As for the question itself, do learn it. I can't see doing my course any other way. The computer science guys seem to be stuck doing database theory and programming in Java. For me, learning assembly and C (as a basic part of microprocessor hardware and programming) has genuinely opened up horizons for me. I never even CONSIDERED things like hardware hacking before, but now I can't stop looking at toy electronics and household appliances, and thinking about how they can be souped up. A stepper motor here, a PIC there... muahahahaha...

    20. Re:You should not learn it.. by drinkypoo · · Score: 1

      There's an absolute ton of books on the subject. I personally ended up taking a class on x86 asm, which I heartily recommend because it's probably the most lame-ass architecture you'll ever see and everything else will be easier after fucking with that. Plus, you can get all kinds of emulators, free DOS, and free MASM, so you can run it and learn on any platform you like. I haven't use my assembler skills since the class much, although I did do a tiny bit of monkeying with AVR assembler. The mnemonics change, but the concepts always stay the same. Sometimes you have less instructions, but that's what macro assemblers and labels are for - you can recreate them if you need them :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    21. Re:You should not learn it.. by drolli · · Score: 2, Insightful

      > Yes; Understand too, how the gates work, all the details of how the chips work, (the myriad chips your program may run on,) and have

      If you understand what the gate does, there is no semantical level to break it down any more. Howver, be aware that it consumes Energy.

      > a good understanding of quantum mechanics, as well.

      That is not so important.

      > Understand all the business supply chains, as well.

      Yipp, this indeed is important. Understanding why sometimes a technologically favourable solution is not the best makes you a good engineer. (E.g.: Instead of asking "Could we not transport four video streams more over our ethernet if we use an adapted divx coding with increased buffer size?", it may be better to ask: We need a camera, well tested, avaialble in thousands, weatherproof, from an reliable supplier with a standard protocol, because handling a problem in the firmware of a device which is distributed in hundreds over this large industrial facility will consume time and money.)

      > Anything else, is just-- pshaw... Black boxing it.

      Yepp. More than one Comapany died in such a way.

    22. Re:You should not learn it.. by smithmc · · Score: 1

        Yes; Your response is quite fair.

      What I mean to say is: Black boxes are a fact of life. We simply cannot, as individuals, know everything.

      You can be a perfectly good programmer, and not know what's in a great many black boxes.

      You can be a perfectly good scientist, and now know what's in a great many black boxes.


      That's no excuse for not learning everything you possibly can about those "black boxes", and about as many of them as possible. If you don't, the other guy who did will be eating your lunch.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
    23. Re:You should not learn it.. by LionKimbro · · Score: 1

      What are you doing, giving free school lessons on Slashdot?

      Somebody's eating your lunch, man! Right now!

      Shouldn't you be, ... I don't know; Memorizing your latest architecture's assembly set, and optimizing your data structures and memory utilization to meet the on-chip cache space your clients are most likely to have?

      Right now, somebody's eating your lunch!

      No excuses! Out! Right now!

    24. Re:You should not learn it.. by drolli · · Score: 1

      Actually i got a lesson in that yesterday.

      in an simple electronics design of mine a certain circuit (SN74128) appears. This cercuit does nothing special, just an NOR gate. Actually I do not use the NOR gate as a NOR gate, i am only interested in the handy 50Ohm driver in the output to convert a logic signal to a 50Ohm line. Sound pretty standard, eh?

      That was a mistake. I assume that this ceruit is available easily and everywhere, just because the supplier i previously had nearly everything. When buying my part locally i figure out that only one of the four local shops has this component, even if they all have the complete 74Series of circuits.

      I though about it, and the more i thought about it i figured out that this chip is not standard at all:
      1) Amateurs usually don't drive logic signals over 50 Ohm lines
      2) Professional electronic engineers would probably use another driver of use anyway an higher integrated component

      So I got my lesson, that probaly physicists (i am one), semi-professional in EE, who just want to build a simple circuit driving an Coaxial cable to the timing input of a device a few meters away are indeed nearly the only users of this circuit.....

      It is an irony of fate that this episode happend to me just after writing the last message.

      A generalized vie of it would be not to rely in an design which is non-mainstream on the availability of something which doe not get a significant market share from what you are doing.

    25. Re:You should not learn it.. by Muad'Dave · · Score: 1
      How is someone going to learn assembly?

      Use Microchip's IDE, which has a built-in debugger and stimulus editor. Once it runs in the debugger, burn it to a chip and watch it run. Since their processors have built-in I/O devices, you can get a lot done with little or no additional circuitry.

      --
      Tiller's Rule: Never use a word in written form that you've only heard and never read. You will end up looking foolish.
    26. Re:You should not learn it.. by Anonymous Coward · · Score: 0

      Note that "understand" doesn't necessarily mean "be an expert at". You have to know that it's there, the concepts that drive it, and generally not be scared of it. Rattling off MIPS mnemonics is not usually useful - but having some idea as to how, say, pipelining works will at least point you to where you need to look to solve some frankenbug or another.

      Also, you've just summed up nicely the difference between an Engineer and a code monkey: perspective. A code monkey writes code. An Engineer designs and builds with a knowledge of what they're doing, why, and why it's important, and can thus go for the best solution possible under the circumstances.

  5. Assembly _programming_? by ResidntGeek · · Score: 1

    Learning assembly programming is not terribly useful. Learning assembly language, however, is very useful. Reverse-engineering and debugging both make use of disassembly, and especially in vulnerability analysis, exploit writing, compiler writing, and similar fields, knowledge of assembly language is often critical. Assembly programming is only useful for optimizing short bits of functions, and it's my understanding that it doesn't help much or often.

    --
    ResidntGeek
    1. Re:Assembly _programming_? by dgatwood · · Score: 4, Insightful

      That's a pretty fine line there. If you can understand asm well enough to debug such issues, I would argue that you also probably know enough to write it, or at least very nearly so.

      I would say that you need to know how to program in assembly language, though it doesn't really matter much which ISA you use---MIPS, x86, PPC, ARM, whatever. What matters is the ability to understand what's really happening at a low level so that you don't do stupid things in high level code that cause your machine to have a seizure.

      For example, once you understand that your CPU only has a limited number of registers, you'll understand why (on some CPU architectures) it is a good idea to limit the number of function arguments so that they can be passed via registers, and that you should put the arguments that you are most likely to use at the beginning of your prototype so that they have the best chance of already being in a register.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    2. Re:Assembly _programming_? by ResidntGeek · · Score: 1

      I've found that there tends to be quite a bit of difference between disassembled code and written assembly. Assemblers provide lots of features like labels and subroutine names that aren't found in disassembled code. Not only that, but you usually only have to be able to read disassembled code, which is generally easier than writing it.

      I like that example at the end, by the way. Very neatly sums up the good things about understanding low-level function.

      --
      ResidntGeek
    3. Re:Assembly _programming_? by T.E.D. · · Score: 1

      For example, once you understand that your CPU only has a limited number of registers, you'll understand why (on some CPU architectures) it is a good idea to limit the number of function arguments so that they can be passed via registers
      ...and once you understand compilers, you'll understand that your compiler passes them all on the stack save the return value, so it matters only in readability what order you put them in. However, it matters a great deal whether you are passing large structures around by reference rather than by copy, or if you are passing a large number of parameters. However a truly smart compiler (eg: Most Ada compilers) will take care of that for you too. You'll also understand that none of this matters if your compiler manages to inline the routine.
    4. Re:Assembly _programming_? by Anonymous Coward · · Score: 0

      Please don't promote the belief that microprocessor architectures are simply a measure of word length and the number of registers.

  6. easy as 1 2 3 by zeromusmog · · Score: 4, Funny

    Nobody has to learn assembly language anymore to create piddly things like compilers or program ultra-small devices or anything like that. You can do all of those things with Ruby on Rails now.

    1. Re:easy as 1 2 3 by ResidntGeek · · Score: 1

      You laugh, but there are microcontrollers programmed in BASIC now. Sounds nice on the surface, lets kids get into programming and home users more easily create electronic devices, right? Unfortunately, the intro to electrical engineering course at Duke University trains kids in their use. The future of electrical engineering in America is people who program microcontrollers in BASIC. Isn't that a nice thought?

      --
      ResidntGeek
    2. Re:easy as 1 2 3 by Anonymous Coward · · Score: 0

      uhh wrong. those of use doing kernel programming still need assembly. sure your web gui junk doesn't need it, but those of us who work on the OS running your junklet can't ignore it.

    3. Re:easy as 1 2 3 by TheDreadSlashdotterD · · Score: 1

      The future of electrical engineering in America is people who program microcontrollers in BASIC. Isn't that a nice thought?

      I know what you want the reader to say, but could you just quit begging the question and say no?
      --
      I have nothing to say.
    4. Re:easy as 1 2 3 by armer · · Score: 1

      I actually prefer visual fortran (http://www.programmersparadise.ca/PPI_CA/Product. aspx?sku=D20%200156) for all my small projects...

    5. Re:easy as 1 2 3 by Anonymous Coward · · Score: 0

      That's sad. On the other hand, what they call "microcontroller" now, is used to be called/equivalent to microcomputer's CPU 20 years ago, which had basic interpreter, so...

    6. Re:easy as 1 2 3 by nitrocloud · · Score: 2, Insightful

      Like Duke knows anything of electrical engineering. It only takes a State student to tell you that (or a Carolina student, but they can go to hell).

      Curriculum here started with learning about what a gate was, how it was made from transistors (which were magic black boxes then), from gates we learned adders and other MSI devices, and eventually got to an abstraction of a microcomputer. Assembly then was a Godsend and now using that same assembly language, we've implemented C.

      Point is, reference a school for electrical engineering, make a better choice than masking Duke to the country. I mean, look here at State, Ga Tech, Va Tech, MIT, Stanford, Princeton, USC, etc.

      --
      Karma: Good, or bust!
    7. Re:easy as 1 2 3 by FlyByPC · · Score: 3, Interesting

      Not all of us. I'm majoring in EET/ComET at ODU (they didn't offer the pure EE via distance-learning) -- and we're required to learn PIC assembly at least.

      Granted, PICs are much MUCH simpler than anything running a modern OS -- but learning assembler, even on a simple device like a PIC, does teach a lot about how hardware and software integrate. Also, it's kind of cool to know that (for example) exactly 1,000,000 clock cycles after the program starts up, it will be calling *this* instruction, which moves the value in the accumulator to *that* register.

      I can't be the only one out there who finds this extremely refreshing after taking a course in Java (and learning about font objects, GridBagLayouts, and other things so far removed from "real" programming that they might as well call it a Fine Arts course), can I?

      Anyway, I wasn't really looking forward to learning Assembler -- until I got started and saw how powerful, elegant, and just plain beautiful it really is.

      PICs are cool toys -- 5MIPS ain't much compared to the latest and greatest Intel and AMD have to offer -- but when you consider that they'll run for days (weeks? months?) on a CR2032 cell, and cost under a buck apiece, they're very impressive. (Freescale MCUs, too -- although I don't yet know those quite as well.)

      --
      Paleotechnologist and connoisseur of pretty shiny things.
    8. Re:easy as 1 2 3 by Anonymous Coward · · Score: 0

      Holy crap, did you just use the phrase "begging the question" correctly? I'm not entirely sure. I don't think I've ever seen it done on Slashdot.

      Nonetheless, congratulations.

    9. Re:easy as 1 2 3 by afidel · · Score: 2, Informative

      RIT, they have a fab on campus =)

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    10. Re:easy as 1 2 3 by hjf · · Score: 1

      I prefer Old Fortran for my robots.

    11. Re:easy as 1 2 3 by SnprBoB86 · · Score: 1

      I know you were joking, but I checked the replies to you because I was almost certain that someone would say "You forgot to mention the URL:" (followed by a link to some sf.net project where you really can write a cross-arch C++ compiler with Ruby on Rails...)

      --
      http://brandonbloom.name
    12. Re:easy as 1 2 3 by zeromusmog · · Score: 1

      If someone made that, I'd so use it.

      But naw, instead I just got someone who took me seriously :)

    13. Re:easy as 1 2 3 by ResidntGeek · · Score: 1

      I can't be the only one out there who finds this extremely refreshing after taking a course in Java (and learning about font objects, GridBagLayouts, and other things so far removed from "real" programming that they might as well call it a Fine Arts course), can I?
      You're not the only one, but when I look at the people around me, it seems you're one of a few. Most people (here, at least) study for tests and do homework as quickly as they can so they can get back to drinking beer, and words couldn't easily describe how much they don't care about things like that. They'd all be happy learning about GridBagLayouts, abstract classes, JavaBeans, and other assorted crap. I hope to God the rest of the world cares more about the inner workings of computers (or hell, anything intellectual), but my hopes are not high.
      --
      ResidntGeek
    14. Re:easy as 1 2 3 by ResidntGeek · · Score: 1

      Did he? If he used it correctly (in the sense of petitio principii) then I'm afraid I don't understand his post. Where did I present a premise which supposed a conclusion based on it? If I'd presented the answer to the question as a conclusion of a logical progression, you might be able to argue it was begging the question, but it would be pretty weak.

      --
      ResidntGeek
    15. Re:easy as 1 2 3 by Inda · · Score: 1

      I use VBA (Visual Basic Assembly). So easy, it's child's play.

      What? I'm no idio...

      --
      This post contains benzene, nitrosamines, formaldehyde and hydrogen cyanide.
  7. Depends on what you want or need to do ... by taniwha · · Score: 1
    Making an accounting system why would you care?

    On the other hand I find myself needing to break into assembly once or twice a month - but I do embedded systems of one type or another

    1. Re:Depends on what you want or need to do ... by Bit_Squeezer · · Score: 1

      I agree. I write in assembly all the time. But it is for small embedded processors.

  8. For most programmers, no. by CosmeticLobotamy · · Score: 5, Insightful

    For good programmers, yes.

    1. Re:For most programmers, no. by leerpm · · Score: 1

      And believe it or not, there are major banks out there that still run mission critical software written in assembly.

    2. Re:For most programmers, no. by konstant · · Score: 1

      Even for good programmers, it's not always clear cut. Sometimes you see slices of assembly in otherwise wholly C-based systems that are elegant and an order of magnitude more efficient than C, but drastically harder to maintain when the original author "moves on". Occasionally the local performance gain is swamped by the global performance profile, too.

      --
      -konstant
      Yes! We are all individuals! I'm not!
    3. Re:For most programmers, no. by Bogtha · · Score: 5, Insightful

      I don't think that's the case. It really depends on what you want to do. Typical desktop applications don't need any assembly language, nor in-depth knowledge of how the CPU works. In fact, it's probably a bad thing to worry about things like this — premature optimisation being the root of all evil and all that. You don't want to put a lot of work into making your application 1% faster and then realise you've ruined your portability.

      In fact, these days, there's a case for even doing away with languages like C for a lot of desktop applications. With the speed of today's computers, if you can write your application quicker in a scripting language, it's a worthwhile trade-off for many organisations.

      Sure, if you want to work with operating systems or things like games where performance is critical, then knowing assembly will make you a better developer even if you don't end up using it. But most of the software industry is working at a level far higher than that, and if you are at that level and making your decisions based on what instructions the CPU is getting, then you're probably doing a worse job than somebody who is entirely ignorant of assembly.

      --
      Bogtha Bogtha Bogtha
    4. Re:For most programmers, no. by Pootie+Tang · · Score: 1

      premature optimisation being the root of all evil and all that

      I have heard some people say that kind of thing before. I'm not sure where this comes from. Have you ever put in a lot of work to make your application 1% faster and then realized you ruined your portability? I haven't. Nor has anyone I know. Not what I would characterize as a major concern.

      But most of the software industry is working at a level far higher than that, and if you are at that level and making your decisions based on what instructions the CPU is getting, then you're probably doing a worse job than somebody who is entirely ignorant of assembly.

      This sounds familiar too. Knowing assembly doesn't mean you have to try to code based on the fastest possible CPU execution. Do you think people who are fluent in French are impaired in their ability to speak English on the assumption that they must somehow be thinking about French?

      I can't say I think assembly knowledge is useful for the web programming I do. But I don't think it's hurting me either. It's not something I think about.

      I will say that I have had problems because I didn't know enough about the details of things I was building on top of. And I've seen other people have the same kind of problems. I can't say I've ever seen a case where a programmer's ignorance of something, assembly or otherwise, was a strength allowing them better deal with higher levels of abstraction.

    5. Re:For most programmers, no. by Bogtha · · Score: 1

      premature optimisation being the root of all evil and all that

      I have heard some people say that kind of thing before. I'm not sure where this comes from.

      Donald Knuth said it. And yes, a counter-productive focus on efficiency has always been prevalent in the software industry, even if you haven't personally seen it.

      Knowing assembly doesn't mean you have to try to code based on the fastest possible CPU execution.

      Of course not. But you can't have it both ways: either you are worrying about what the CPU is doing — a pointless endeavour that distracts you from your real work — or you aren't worrying about what the CPU is doing, in which case knowledge of assembly isn't helping.

      I can't say I think assembly knowledge is useful for the web programming I do. But I don't think it's hurting me either. It's not something I think about.

      So my statement "making your decisions based on what instructions the CPU is getting" doesn't apply to you then.

      I can't say I've ever seen a case where a programmer's ignorance of something, assembly or otherwise, was a strength

      Not a strength, just not a liability.

      --
      Bogtha Bogtha Bogtha
    6. Re:For most programmers, no. by dmitriy · · Score: 1

      Knowing assembly is useful for optimizations, but it is critical for tracing bugs -- especially bugs in your tools. How many GCC bugs have you discovered lately?

    7. Re:For most programmers, no. by violent.ed · · Score: 1
      YES if it comes to having to deal with low level instructions when it comes to real-time computing it is good to know. I personally beleive that the latest generation, 5 yrs and younger, will be studying such things as AJAX's grandchildren, that when it comes to actually creating a NEW system, if they do not have plug & play, if they dont have a clue how the hardware actually talks to the processor, then they just wont know wtf to do.

      Sure, if you want to work with operating systems or things like games where performance is critical, then knowing assembly will make you a better developer even if you don't end up using it.

      So that explains why Vista home Premium runs like crap on a 1.6GHz core 2 duo. (Intel Core 2 Duo Processor T5200, 1 GB RAM, 160 GB Hard Drive, Vista Premium, Intel Graphics Media Accelerator 950)

      Flame Retardant Notice: Current Lead PC Tech at my local CCity, MSCE, CCNA, A+, no i dont know assembly, or even Fortran, but c'mon! (specs taken from Toshiba Satellite A135-S4467, which i work with daily) I like Toshiba A Lot, but 1GB of ram and decent specs for a consumer grade PC and its STILL SLOW!?!?! Give me XP with good antispyware any day, not like im going to see a linux installation come across my desk from the hands of the type of people that buy a emachine instead of building their own.

      --
      - You're not paranoid, they really are after you.
    8. Re:For most programmers, no. by dr_d_19 · · Score: 1

      Exactly... just the same as in:

      Is knowing how to make concrete important for architects today?
      "For most architects, no. For good architects, yes"

      Or stating that only artists who know how to mix their own paint are good artists.

      It is true however that the new generation of developers focus more on high level languages and rapid development.

    9. Re:For most programmers, no. by Anonymous Coward · · Score: 0

      How can you invoke His name without mentioning that his seminal work uses assembly as the programming language?

  9. Look at FFMpeg by Dwedit · · Score: 1

    Yes. Even today, the popular libavcodec library (often seen in Codec-Packs) still has plenty of ASM code poured into it to make it faster.

    ASM code is also especially important if you are programming for a more limited platform, such as a GBA or Nintendo DS. ASM code can often be four times the speed of C code.

    1. Re:Look at FFMpeg by corvair2k1 · · Score: 1

      What you mention is spot on, but there's a specific reason that it's faster to do this. With the various multimedia ISA extensions, which are typically instructions designed to work with small vectors of 3-4 elements, nice speedups can be obtained... However, this functionality is not exposed in high-level programming languages, and it's usually not going to be generated by a compiler, either.

      Also, look at linear algebra libraries. They also use these short-vector instructions deep within the kernels. The percentage of assembly language is very small, but those kernels are executed a lot, so the speedup over ignoring these instructions is significant.

    2. Re:Look at FFMpeg by Calyth · · Score: 1

      Well, gcc does provide instrinsics that allows assembly functions to be accessed almost as if functions.
      One must realize that although gcc does generate decent code, it still (to my knowledge, does not do any automatic vectorization.
      FFMpeg probably contains assembly for this reason.

      I think it is folly to totally ignore assembly. Assembly language is still needed for any disassembly, and there may be cute optimization that other programmer may overlook if they were not subjected to bit-mangling before.

    3. Re:Look at FFMpeg by NormalVisual · · Score: 1

      Knowing assembly is also helpful when you happen upon a compiler bug. I've had a couple of occasions where I've found bugs in MSVC-generated code that were causing problems in perfectly good C++ that I'd never have found otherwise.

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
  10. Why bother? Just ... by Bin_jammin · · Score: 3, Funny

    Hire someone else to code in assembly.

  11. Yes by Anonymous Coward · · Score: 0

    Yes, it is.

    1. Re:Yes by jonatha · · Score: 1
      there are many people who would like to hire you. Including the group I work in.

      So when do I start?

      --
      The SCO lawsuit makes me wish my company were in Utah. We need a new building.
    2. Re:Yes by armer · · Score: 1

      10-15 years!!! But I need to eat now!!! Actually we are still using assembly in the really small PICs, cause we are too cheap to by the c compiler for it...

    3. Re:Yes by Anonymous Coward · · Score: 0

      Assembly is covered heavily in most (all, I assume) computer engineering degrees.

    4. Re:Yes by Anonymous Coward · · Score: 0

      most companies hire EE's or CE's for firmware and asm development, not CS majors.

      ASM will be at the core of any good CE program for a long time to come. Kinda hard to avoid it when you have to define the opcode in VHDL or Verilog.

    5. Re:Yes by Twylite · · Score: 1

      Do you write drivers?

      Yes. Never had to use assembler.

      Or do you need highly optimized algorithms?

      Yes. Never had to use assembler. C compilers do a much better job of optimisation.

      What about really low level firmware stuff?

      Yes. Had to use an asm { ... } block in C once or twice -- that doesn't exactly constitute knowing how to program in assembler.

      There are very few good reasons to use asm these days. And I'm saying that as someone who has written a lot of asm code in the past (mostly 8086 and 80386).

      CS students certainly shouldn't be learning asm. That's now the realm of EE students and practitioners.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    6. Re:Yes by Anonymous Coward · · Score: 0

      I'm going to take a wild guess and say that you work for MS... Am I right?

    7. Re:Yes by GreyWolf3000 · · Score: 1

      This is true. Knowing a bit of ARM assembly teaches me that this: count = max_value; while(count--) { /* Do stuff */ } is generally better than this: for(count = 0; count max_value; count++) { /* Do stuff */ } (but it only really matters in tight, frequent loops). Also, you learn to avoid multiplying and dividing on certain architectures without multiply or divide instructions--or you try and use powers of two as much as possible (since you can mult/divide a power of two by bitshifting). This is just one example of many.

      --
      Slashdot: Where people pretend to be twice as smart as they really are by behaving like children.
  12. security by Anonymous Coward · · Score: 0

    Reverse engineering malware.

  13. Yes by Erich · · Score: 5, Informative
    If you're good.

    If you know DSP, are adept with fixed point arithmetic, know a bunch of fun tricks, can schedule well... there are many people who would like to hire you. Including the group I work in.

    Simply, compilers cannot produce code of the same quality that great hand coders can produce code, especially for complex embedded devices like DSPs. But it's not enough to know how to write assembly, you need to know all the tricks the compiler knows, all the tricks you can play with the algorithm, and all the ways in which you can tinker with the code to fit it nicely into the architecture.

    Those things are still highly valueable; people need to get really optimized code for their media players. If you can squeeze 20% out of your MP3 decoder, you can get 20% lower energy usage on your programmable logic.

    --

    -- Erich

    Slashdot reader since 1997

  14. Absolutely by Anonymous Coward · · Score: 0

    Sometimes you just need to look at what the fuck the compiler did to your poor code. Or debug libraries to which you don't have the sources. Or do embedded. Or something.

  15. Honestly... by CyberBill · · Score: 2, Insightful

    You really only need to know how to program assembly if you want to be a good programmer. If you want to be a crappy one, learn Java or C#, pretend pointers are magical, and be happy with your life. (I'm not saying those are bad languages, I'm just saying they're opposite from assembly)

    Also, a lot of embedded work is still done in assembly because with a lot of low-level industrial work having very precise clock-counts on everything is very important.

    --
    -Bill
    1. Re:Honestly... by ralphdaugherty · · Score: 1

      I spent the 80's as an 8086 programmer. To throw in an obervation, the same code can be written in other languages with pointers doing exactly the same thing. It's more that of people learning what can be done with bit manipulation and pointers, for example, rather than the actual assembly syntax.

            The other point is, it's not about "learning" assembler, it's about doing something substantive enough to use the equivalent. Then we're talking learning.

        rd

    2. Re:Honestly... by Lehk228 · · Score: 2, Informative

      what the fuck is it with pointers that is so difficult?

      i'm a novice coder and people constantly bitch about how hard pointers are, so when i read what they actually are(this was quite a few years ago) I went back a few times thinking i must have missed something "....surely there is more to it than that...." i thought to myself.

      --
      Snowden and Manning are heroes.
    3. Re:Honestly... by GWBasic · · Score: 1

      I took assembly in college. I think that it's important that programming students are exposed to the differences between the stack and heap; and that they understand registers. It's really not vital that all programmers are expert assembly coders; I was one of the best in my class, yet I haven't looked back since.

      You really only need to know how to program assembly if you want to be a good programmer. If you want to be a crappy one, learn Java or C#, pretend pointers are magical, and be happy with your life. (I'm not saying those are bad languages, I'm just saying they're opposite from assembly)

      Java and C# really aren't the opposite of assembly. They're just abstractions, as they end up getting compiled to assembly for a virtual machine. Languages like LISP and Prolog are more likely to be considered the opposite of assembly. Likewise, any interpreted language is the opposite of assembly.

    4. Re:Honestly... by Anonymous Coward · · Score: 0

      The concept of a pointer is simple, it is the practice that can make life Hell.

      Most of the bugs I've encountered are due to someone fucking up either pointers or memory management.

    5. Re:Honestly... by Anonymous Coward · · Score: 0

      You obviously know nothing about programming telling C programmers with little or no knowledge of assembly they don't know anything about pointers and might as well program in interpreted language. Assembler may help in certain areas, but someone who knows how to write and design good C can kick the pants of someone optimising chunks in assembler.

    6. Re:Honestly... by Alioth · · Score: 1

      Most people find pointers difficult because their minds have been poisoned by BASIC (Visual or otherwise). For such people, pointers are a gigantic conceptual leap.

      Pointers are very simple if you're used to assembly language. After all, what is "ld a,(hl)" [0] other than using a pointer? You've just been calling it indirection rather than a pointer, but it's the same concept - you just dereferenced a pointer. BASIC programmers are never exposed to anything like that, and may reach a reasonable level of competence before even knowing such a thing is possible - they think they know all the abstract stuff about programming (loops, conditions etc.) and then are faced with pointers - something that simply doesn't exist in what they've been doing for the past ten years. Tell them that you can have pointers to pointers and their watch their heads explode. They will be thinking in BASIC and translating into C - but the trouble is there's no way to trivially think in BASIC and translate to a C pointer. It's not until they start thinking in C rather than BASIC that the light usually turns on.

      [0] if you're unfamiliar with Z80 asm - "load the accumulator with the contents of the memory address pointed to by the register pair HL".

    7. Re:Honestly... by Anonymous Coward · · Score: 0

      Pointers are easy, but when they go wrong and stomp on some unexpected bit of memory, the problem can be very hard to find with the effects often changing with just a simple recompile of the code.

      On PCs with protected memory it's not too bad. In embedded environments where memory may not be protected it can be very nasty indeed.

    8. Re:Honestly... by Anonymous Coward · · Score: 0

      You state that you "read" what they are, but didn't mention if you've tried using them extensively. Reading, and doing are quite different.

    9. Re:Honestly... by Lehk228 · · Score: 1

      i use them occasionally, most of the time when i am coding something, it is to process some text or something that i don't end up using pointers (except reference parameters) for

      --
      Snowden and Manning are heroes.
    10. Re:Honestly... by KnowledgeKeeper · · Score: 0

      what the fuck is it with pointers that is so difficult?

      Demands IQ greater than average :)

      --
      It is always better to be a first grade version of yourself than a second grade version of someone else.
  16. In soviet russia... by Anonymous Coward · · Score: 0

    Assembly program you!

    1. Re:In soviet russia... by FlyByPC · · Score: 0, Flamebait

      Oh, what the hell. I haven't been modded flamebait in a while...

      In Christian America, the Assembly programs *you*!

      --
      Paleotechnologist and connoisseur of pretty shiny things.
  17. University Teaching High Level Languages by orta · · Score: 0

    With the rise of C# and Java being the languages of choice, and having maybe a 2-3 lectures on what assembly language is, it's likely that the new generations of programmers just don't care. I often get called 'crazy' for daring to code in C.

    --
    my band is more brutal techno punk than yours
  18. Always have a place by Anonymous Coward · · Score: 0

    As long as you can write something that is more efficient in assembly than in a higher language it will never go away. Obviously it's not the right choice for most things, but it will still have its use.

  19. I say learn it. by Anonymous Coward · · Score: 0

    You'll have a bit of a better understanding of what's under the hood. Even if you're programming for a lowly 8bit embedded processor. Or you could remain ignorant and say it's no longer relevant.

  20. more important.... by penguinbroker · · Score: 1

    the last decade or so has also seen a minimal amount of change to the architectures that intel and amd (most common processors) support. BUT... as parallel computers become more omnipresent, the need for strong assembly language skills should increase as developers try to squeeze out all the power they can from these new wave of computers.

  21. speed... YES!! by Anonymous Coward · · Score: 0

    if you need the speed (ie in universities where all they are doing is sim's) then yes using assembler is extreamly relevant!
    sometimes all you need is the CPU as a universal state machine as opossed to a platform that an OS resides in

    would you rather your code run at main CPU-speed or based around the kernels tick? NOTE the linux kernel with a tick at 100Khz is next to useless in running anything but the kernel (apparent CPU speed to apps ~ 10% of actual CPU speed). why run w.r.t a tick when you can run at main clock speed

    1. Re:speed... YES!! by Anonymous Coward · · Score: 0

      I agree that sometimes you don't need an OS. But to say that the apparent CPU speed to apps under linux is 10% actual CPU speed? How did you determine that?

    2. Re:speed... YES!! by jonnyc · · Score: 1

      while I can't say that it's necessarily 10%, most microprocessors, microcontrollers and FPGA applications run at a much higher frequency internally than what is available to any application outside the chip.

  22. Very relavent by Forrest+Kyle · · Score: 5, Insightful

    Well, given that the world runs on embedded systems, and will probably become more reliant on even greater numbers of even more complex embedded systems, I'd say assembler will be around for quite a while. However, in terms of game programming or something, it's probably not amazingly useful any more. It is my understanding that most of the API calls to advanced graphics libraries are about as optimized as they are going to get. Clearly you don't need it to write a medical billing application.

    I would not encourage universities to start pumping out CS graduates who have never seen assembly laguage, and don't expect it to phased out of the average Electrical Engineering curriculum any time soon.

    Frankly, I don't think it's a very good question. It's sort of like saying, "Given that we now have calculators and computer algebra systems that will do the math for us, is it really worth it to waste students' time learning the nuts and bolts of mathematics?" It has been my (limited) experience in software engineering that knowing how something works on a deeper level will almost always be an asset, and at the worst have no effect at all.

    1. Re:Very relavent by TheRealMindChild · · Score: 1

      "Assembly", not "Assembler"

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    2. Re:Very relavent by Anonymous Coward · · Score: 0

      You just had to add your $0.02 didn't you? Did it ever occur to you that its not the actual words used, but the meaning behind them that really matters? Obviously you didn't have any difficulty understanding what the author meant, since you were able to "correct" him/her on a very pedantic level, so nothing is wrong. Your comment didn't add any value to the discussion, its just wasting disk, bandwidth, and my time.

      I may have singled you out, but this is only because I am attempting to make a very general observation about some of the comments that appear on /. If understanding is not impeded by the author's choice of words, then there is no sense in maligning their use of language. This is simply because the author's objective was accomplished: an idea was communicated. After all, that is the very purpose of language.

      And no, I'm not new here.

    3. Re:Very relavent by TheRealMindChild · · Score: 1

      Let us take for example the sentence "Who learned you ta spoke?". Completely atrocious. But you knew what they were saying, right? So what's the problem? I think it is pretty evident.

      Would you feel comfortable if a C/C++ programmer said "I found the command 'atan2' that does what I need."? I hope to god not. What about a Unix admin that told you "I cleaned up all of they system folders of unneeded junk"? Just as bad as someone saying "I program in Assembler"

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    4. Re:Very relavent by Xner · · Score: 2, Funny

      Even the page you link to acknowledges the terms have been used interchangeably.

      --
      Pathman, Free (as in GPL) 3D Pac Man
    5. Re:Very relavent by Anonymous Coward · · Score: 0

      Let us take for example the sentence "Who learned you ta spoke?". Completely atrocious. But you knew what they were saying, right? So what's the problem? I think it is pretty evident.

      Your example is irrelevant in the sense that it lacks clarity; I had to read it twice in order to grasp the meaning. I am not condoning that sort of language. Rather, what I am arguing for is being charitable. Interchanging "assembler" and "assembly" does not reduce clarity in most contexts.

      I agree that using "command" is improper when "function" or "method" is what is intended, since it could easily be interpreted as referring to a UNIX command. However, if someone used the word "folders" to refer to "directories" I doubt there would be any confusion.

      Ultimately, I think it should be the context that determines what standard of discourse is appropriate. A forum is hardly the place to be nitpicking. Anyway, that is only my opinion and you are free to ignore it.

  23. nowadays? only for transistor hackers by Anonymous Coward · · Score: 0

    For the most part, it's no longer necessary to know Assembly Language unless you work with actual transistors of the chip, or are dealing with code you know will not be optimized properly by your compiler (and need every speedup you can get). I'm taking a Microsoft stand for this unfortunately here...

    Most people don't care how well the compiled binary ends up and expects the CPU to make up for software inefficiencies (sad sad world this has become). "correct by design" not "optimized by design" is more important. Many high level language compilers tend to generate code sequence that's better than what you can do by hand anyway. However, if you suspect or know not, and this tends only occur if you need every optimization you can get, then likely it's not necessary to optimize this way and assembly isn't necessary.

  24. Glad I did by linuxwrangler · · Score: 5, Interesting

    I'm glad I took assembly. I've never "used" it in the traditional sense of writing an application other than in school, but understanding how things work "under the covers" (whether at the CPU, hard-disk or network level) has provided valuable guidance in day-to-day design and troubleshooting.

    I've worked with people with very focused high-level programming skills and found that while they could write mostly decent code, their code was also most likely to fail in production since they were completely mentally removed from concepts like disk-seek times or bandwidth constraints. Programmers with a deeper understanding of what actually happened when their code ran tended to make wiser programming choices.

    --

    ~~~~~~~
    "You are not remembered for doing what is expected of you." - Atul Chitnis
  25. Yes, in some ways by Deathanatos · · Score: 1

    For creating regular applications, probably not.

    But assembly still finds its uses in niche places. Things that need to run as fast as possible get optimized by conversion to assembly along with further tweaking (and then bragged about). OS specific code, bootloaders, or even drivers, might have to be written in assembly (or involve assembly).

    My old TI-83+ can, AFAIK, only be programmed in assembly or TI-BASIC (which is slower than dirt). Assembly is blazingly fast by comparision, and is the only choice for more complex applications.

    Embedded devices might find more use for assembly as well. I worked on a robot/robotics team for the past few weeks. The first thing that the robot executed was written in assembly. (It setup stack registers, did a few other things that I never quite figure out, and kicked control over to a C function.) OS startup, essentially.

    Granted, assembly is being more and more rare, but it still has a place in today's programming.

    1. Re:Yes, in some ways by 2short · · Score: 1

      I know assembly. It's fun in a geeky way, and it may be useful for embedded systems. I don't do embedded systems and will defer to those with more expertise in that area.

      But for modern PC hardware, for significantly sized code that needs to run as fast as possible, hand-tweaked assembly isn't the way to go. I've seen very smart people brag about the handful of clock cycles they saved by hand tweaking the assembly. And I've seen (apparently) smarter people save thousands of cycles by ripping out the hard-coded assembly so that a good compiler can do its job. Some knowledge of assembly may be useful in understanding what the compiler does, and how to take advantage of that, but don't write it yourself!

  26. Unless your compiler emits C by tepples · · Score: 2, Interesting

    Isn't knowledge of assembly language for microprocessors required to create a higher level programming language? In theory, you could just make your higher-level programming language's compiler emit C or C-- and then let the maintainers of GCC and other mid-level language compilers do the dirty work for you.
    1. Re:Unless your compiler emits C by Surt · · Score: 2, Informative

      A lot of languages these days are emitting java .class (binary) and letting the VM do the work.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    2. Re:Unless your compiler emits C by jc42 · · Score: 1

      So who's to implement the VM for the next generation of CPUs? Or will we find that new CPUs can't be developed, because there's nobody left to write the lowest level VM interpreters?

      Of course, if the AI people could just get their act together, we could handle the job over to the machines. But like 30 years ago, that's 5 to 10 years in the future.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  27. important? by Anonymous Coward · · Score: 0

    .begin
    Message db "fp$";
    mov dx,OFFSET Message
    mov ax,SEG Message
    mov ds,ax
    mov ah,9
    int 21h
    mov ax,4c00h
    int 21h

    END start

  28. Not quite dead... I'm getting better by softwaredoug · · Score: 5, Interesting

    One day won't there be little nanobots floating around with 512 bytes of memory and a 1 mhz processor that need to buzz around your body and eat up your precancerous cells? I imagine as things get smaller, the miniturization fronteir of computing nescesitates limitations in computing power and memory. This may necesitate a new generation of assembly programmers. Even today in the minituarization/embeddedness/realtimeyness world where many enjoy programming away in plain old C (like me) that knowing assembly is useful. First to look at the compiler's output and figure out what the hell its doing, second to just have a plain basic understanding (not necesarilly a detailed one) of what your C statements/operations/etc is probably turning into in assembly instructions.

    Another question, would assembly be more popular if it wasn't such a nightmare to write for Intel's x86 architecture? If we all had nice Motorolla PCs, would assembly be really cool?

    1. Re:Not quite dead... I'm getting better by Anonymous Coward · · Score: 0

      im in ur body, eeting ur precancerous cells!

  29. Let's make this an ad hoc poll!!!!! by BKX · · Score: 1

    Vote by replying with the following choice subjects:

    Yes, assembly rocks.
    No, assembly is stupid, old and out-dated.
    I married assembly, you insensitive clod.
    WIPO: (for example, I like to wipe asses with assembly.)

    1. Re:Let's make this an ad hoc poll!!!!! by Anonymous Coward · · Score: 0

      Shut up, you retarded piece of shit.

  30. Yes by Starji · · Score: 4, Insightful

    Do you write drivers? Or do you need highly optimized algorithms? What about really low level firmware stuff?

    In other words, yes, there are good reasons for knowing assembly. Whether or not you'll actually use it is another matter entirely. Just depends on what you're working on.

    Actually I wouldn't be surprised if in about 10-15 years assembly programmers are in higher demand since none of the CS schools these days ever teach assembly anymore.

  31. Definitely by SaidinUnleashed · · Score: 2, Interesting

    I just got a SDK-86 to start learning it!

    --
    Shiny. Let's be bad guys.
  32. Embedded Development by nzAnon · · Score: 1

    There is still a vast amount of Embedded development being done, and, for devices with extremely restricted resources, is best done with assembly code.

    See Microchip's 8-bit PIC micro range for examples.

  33. Of course it's relevant. by grub · · Score: 2, Insightful


    How do compilers know what to compile to? Magic? Imagine if all the assembly programmers died: who'd maintain & update compilers, embedded devices, many realtime instruments, etc. ?

    --
    Trolling is a art,
    1. Re:Of course it's relevant. by lkeagle · · Score: 1

      How many compilers do you need? There's not many chips out there these days that don't have some compiler support. I only need one smart guy to work on optimizing my C code into assembly. I don't have time to do that myself, and I'm willing to bet that the other 99% of C programmers will agree.

      If you're actually trying to get a product to market, you should be thinking about assembly as an optimization tool, and a last resort at that. Any category of software that allows you to spend your time fidgeting with assembly is definitely a niche domain. BTW, embedded programming and kernel level driver development is NOT an everyday task that all programmers need to be adept at. I think the embedded programmers and driver designers will agree.

      Also, whenever I read assembly for debugging purposes, I always tend to find that it was something I borked at a much higher level that was causing the problem. Perhaps assembler debugging could be alleviated by more verbose compiler warnings?

  34. Re:Isn't it the root of all programming languages? by KokorHekkus · · Score: 5, Insightful

    Isn't knowledge of assembly language for microprocessors required to create a higher level programming language?
    To create - yes. To use as a programmer - no. You can still be a good programmer if you know the cost (in terms of resources) for the operations you choose to make use of. A higher level language will most likely give you a wider range of ways to solve a problem within the given limitations. But only if you actually know the computational characteristics of the system (as a whole) that you are using. Simply put you need to realise which operations are expensive and which are cheap from a total perspective.
  35. How to get started? by WillDraven · · Score: 1

    Having read the replies so far, I've decided I'd like to get my hands dirty and start learning assembly. Can anybody reccomend any good books / websites / (cheap) courses to take / etc.?

    --
    This is my sig. There are many like it but this one is mine.
    1. Re:How to get started? by oaklybonn · · Score: 2, Interesting

      The best way is gcc --save-temps; write your c code and then understand what gets generated and how it differs depending on what you write in a language you're already familiar with.

      I spent 6 months recently working for a company that programmed mainly in C++ and visual basic (I'm a mac programmer, so I was a fish out of water there, which is ultimately why I left...) But the developers there didn't / couldn't / wouldn't understand assembler in any way shape or form. Without the high level debugger, they were lost. So when their app would crash, they'd be helpless to understand how.

      I was appalled. I've spent 20 years debugging crashes and even though I don't speak x86 fluently, I can at least find my way around it. How do people that aren't able to read assembler ever able to ship quality products?

      Of course, the best way to learn it is using an interactive assembler: go back in time to 1998 and use TMON Pro with MPW. With an 11 minute link time, you'll quickly learn that its easier to patch your bugs in assembler and continue execution, or write a little subroutine in "playmem" to do something, rather than terminate your app, make a small change, and relink.

      God I miss TMON.

    2. Re:How to get started? by p7 · · Score: 5, Informative

      Try the "Art of Assembly Language Programming" available free at this website http://webster.cs.ucr.edu/AoA/index.html it should get you started.

    3. Re:How to get started? by Anonymous Coward · · Score: 0

      Art of Assembly Language by Randall Hyde, it's a very thorough introduction. http://webster.cs.ucr.edu/AoA/index.html

      I read through the first 7 chapters of the 16-bit version just to get a feel for what sort of operations a CPU actually do when a program runs, it was very easy to read and understand. That was a while ago, I've not tried hard to advance to writing Win32 programs in assembly, because from what I could gather from brief scanning through Win32 ASM tutorials it is a right PITA to even get 'Hello World' to work in a window. There are example code to cut&paste in the tutes of course, but understanding *why* the code does what is quite involved, and without understanding there is no point doing anything in ASM.

    4. Re:How to get started? by Kymermosst · · Score: 1
      --
      "Alcohol, Tobacco, Firearms, and Explosives" should be a convenience store, not a government agency.
    5. Re:How to get started? by that+this+is+not+und · · Score: 1

      Good books?

      Start by reading the little user manual that comes with your wire-wrap gun.

    6. Re:How to get started? by jshriverWVU · · Score: 1

      "The Art of Assembly" and the Intel/AMD manuals which you can find online.

  36. Yes, but only for general knowledge by Anonymous Coward · · Score: 1, Interesting

    Learning assembly language is good because it gives you a better sense of processor architectures and what the compiler has to do. Think of it as similar to learning how to add and multiply by hand, even though you will probably use a calculator for most arithmetic in the future.

    Do not delude yourself into thinking assembly is the ultimate gateway to speed though. I would bet most of the people advocating assembly language programming to make your code go faster cannot write assembly better than today's optimizing compilers. Similarly, you probably won't be able to do better than the compiler either, with one major exception: Compilers do not generate effective SIMD code yet (gcc is slowly trying to add it, but it is pretty primitive). This is because popular programming languages do not express data-parallel algorithms in a way that makes it easy for compilers to spot them and generate the appropriate code. Many media libraries use assembly language primarily for this reason, and not because they are bad-ass programmers who can allocate registers better than gcc.

    1. Re:Yes, but only for general knowledge by letxa2000 · · Score: 1

      I would bet most of the people advocating assembly language programming to make your code go faster cannot write assembly better than today's optimizing compilers.

      This is generally true, but not as much as you may think. For even an optimizing compiler to optimize to better-than-you-can-write-assembly, your code must be written in a way that lets the optimizer do the best it can do. You can have some amazingly poorly written 'C' code that doesn't even consider what's going on in assembly language and it's entirely possible that while the optimizer will do a good job considering what you gave it, you'd actually produce better assembly language code if you wrote it yourself because you'd actually have to spend some time and consider what you're really doing and look at the best way to do it.

      For example, I work with 8-bit microcontrollers. It's very easy, in 'C', to throw in an int or a long when you really only need an unsigned char--"just for safe measure." But when you're coding it in assembly language, you really stop and think about what you need. And it makes a huge difference. The optimizer will never be able to read your mind and know that that long you defined will never have a value that exceeds 255. So it's very possible that a moderately good assembly language programmer can produce better code than an optimizer optimizing the code of an average HLL programmer. The char/int/long is an extreme example, but poorly designed algorithms don't become magically improved by an optimizer and, often, writing it in assembly language forces the developer to think things through.

      One of the worst things you can do is take a 'C' programmer that is used to writing for Linux or Windows and have him write 'C' code for a real embedded processor. It's not the same thing and it's precisely because they don't know (or care) what's going on in assembly language. They just treat it as a magical black box and code away in 'C' as if they were writing code for a PC. I've cleaned up the mess developers like that made.

      Of course, a lot of the same things can be achieved in 'C' if the developer thinks things through and writes good 'C' code. But what is "good" on one architecture can royally suck on another. The only way to know you're writing good 'C' code is to know the underlying assembly language.

    2. Re:Yes, but only for general knowledge by gnasher719 · · Score: 1

      '' Do not delude yourself into thinking assembly is the ultimate gateway to speed though. I would bet most of the people advocating assembly language programming to make your code go faster cannot write assembly better than today's optimizing compilers. Similarly, you probably won't be able to do better than the compiler either, with one major exception: Compilers do not generate effective SIMD code yet (gcc is slowly trying to add it, but it is pretty primitive). This is because popular programming languages do not express data-parallel algorithms in a way that makes it easy for compilers to spot them and generate the appropriate code. Many media libraries use assembly language primarily for this reason, and not because they are bad-ass programmers who can allocate registers better than gcc. ''

      I can write assembler code that is faster than equivalent C code. However, it is an awful lot of work. Writing assembler code is not an awful lot of work, but writing assembler code that is _faster_ than C is. Instead of using my time to write assembler code, I can use the same time to understand the underlying problem better and improve the algorithm, or understand the surrounding situation better and possibly avoid having to solve the problem altogether. This approach has two advantages: The result is portable, and it is not a dead-end: If my faster C code is still not fast enough, I can switch to assembler as the last resort. But I can also improve the algorithm further. Once you're at the assembler level, you're stuck.

      SIMD is quite easy to handle by most compilers by making the SIMD primitives available as C intrinsic functions. I have seen media code written for PowerPC; they had C versions of the code and handwritten Altivec assembler code that ran about twice as fast. By rewriting that assembler code in C with intrinsic functions, everything became so much clearer that optimizations could be lifted one level higher, making everything four times faster again.

  37. Why do you need to ask? by exp(pi*sqrt(163)) · · Score: 1
    If you don't plan to program in assembly language, but you'd like to learn what it's all about, just find one of the many introductions on the web and read it. There are no profound concepts to learn and nothing complicated to understand (unless you want to get into the details of virtual memory or exactly how multiple simultaneous interrupts are handled). You'll have it figured out in an afternoon. You won't be an expert, but it sounds like you've no need to be one. This is a short enough time that it's really not worth agonising over whether it's useful to learn. In a single day, if you have a few dollars to spare, you could even go from ground zero to programming your own embedded hardware with a project like this. So really, stop asking, and just get on with it.

    Now if you asked if it was worth learning Haskell, that would be a question worth thinking hard about because it'll demand a significant chunk of your time.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    1. Re:Why do you need to ask? by Anonymous Coward · · Score: 0

      Another Haskell fanboy...

    2. Re:Why do you need to ask? by Anonymous Coward · · Score: 0

      I suppose it depends how you learn it. My assembly labs in school used a 68000-system where we would assemble line by line into HEX. It's wonderful when you're on line 200, and realize you made your first mistake on line 4.

    3. Re:Why do you need to ask? by exp(pi*sqrt(163)) · · Score: 1

      You had it easy. In my day you'd have to retype not just the code but the hex loader itself every time there was a bug.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    4. Re:Why do you need to ask? by exp(pi*sqrt(163)) · · Score: 1

      Cool! Where?

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  38. Re:Isn't it the root of all programming languages? by Nasarius · · Score: 1

    Exactly. You don't need to be fluent in x86 assembly, but if you're completely ignorant of the inner workings of computer architecture, you're at a disadvantage to those who have been exposed to it and written, say, a bit of old MIPS assembly code.

    --
    LOAD "SIG",8,1
  39. YES! by Bluesman · · Score: 5, Informative

    If you never learn assembly language, it's a very strong possibility that:

    - You can't write a compiler
    - You can't debug C/C++ programs
    - You don't really know why buffer overflows are bad
    - You don't really understand memory management and what the heap and stack really are
    - You don't really know why threads are different than processes
    - You can't write a device driver
    - You don't know any computer architecture at any depth that matters
    - You won't ever understand garbage collection
    - You don't know how your CPU works
    - You won't think the movies with "hacking" in them are as funny as the rest of us do.

    If not being able to do those things doesn't bother you, by all means, don't learn assembly.

    The thing is, in order to be a really good programmer, you have to know how the machine works, all the way down. Once you do, you can pick up any language very easily, because you know what they're trying to do and how.

    Just learn it. It's really one of the simplest languages to learn. Realize it's not a programming language, but simply the actual machine code represented by mnemonics. So you'll have to learn an architecture. Intel 386 is a great place to start, and it couldn't be easier than on Linux. You have a flat, protected memory model, GNU "as" is likely already installed, and you make system calls using interrupt 0x80 after setting up the arguments.

    You should be printing stuff to the screen within minutes, and interfacing with C object files in hours. You can write the GTK "hello world" program in a combination of C and assembly fairly easily.

    Get to work.

    --
    If moderation could change anything, it would be illegal.
    1. Re:YES! by Brandybuck · · Score: 1

      You can write the GTK "hello world" program in a combination of C and assembly fairly easily.

      Although frankly, by the time you reach the GUI, you should have stepped up to a higher level language. As long as you're going to abstract the user interface graphically, you might as well be abstracting the code you write.

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:YES! by toddhisattva · · Score: 1

      Intel 386 is a great place to start
      It's a great place to start because it will feel so good when you stop!
    3. Re:YES! by Cyrano+de+Maniac · · Score: 5, Informative

      So you'll have to learn an architecture. Intel 386 is a great place to start...

      Choke. Cough. Laugh. Thanks a lot, now I have to clean soda off my keyboard.

      While the rest of your comment is pretty much spot on, this advice is, frankly, absurd. x86 has one of the most convoluted, non-orthogonal, legacy-laden instruction sets and list of constraints of any architecture, ever. Introducing someone to assembly programming via x86 is sure to warp their brain, and will certainly send the vast majority of people running away, never to revisit the idea. You might as well recommend Malbolge, Intercal, Brainf*ck, or Befunge to them -- it'll result in the same reaction.

      If you want to introduce yourself to assembly language programming, start with something sane and simple. To that end, you can't get much simpler than the Motorola 6800 family of processors. Then, step up to something with a richer instruction set, such as the Motorola 68000 family. After having a good grasp of those a person will have correctly oriented their brain to take on more complex but sane architectures, such as MIPS or Alpha. For a challenge after that point, I'd highly recommend IA64 (i.e. Itanium) -- which introduces some really complex ideas, but implements those ideas in a sane and consistent manner. It might be worth learning a DSP processor assembly language (such as the TI TMS320 series) before IA64, to get a handle on concerns regarding explicit parallelism.

      Only after learning a number of well-designed instruction sets and architectures such as those should you even consider exposing yourself to x86 and (most likely) the PC architecture. At that point you'll have built up enough intellectual rigor in your approach to assembly programming to survive in the Lovecraftian realm of programming for this architecture. If you're lucky, you'll realize just how truly terrible the instruction set and system architecture are, and avoid programming in x86 assembly whenever possible.

      Seriously, I'd even recommend IBM 360 mainframe assembly ahead of x86 for an initial learning experience. Please don't start with x86, it will rot your brain.

      Brent

      P.S. Yes. I have programmed and/or debugged programs in every assembly language mentioned above. x86 rates dead last.

      --
      Cyrano de Maniac
    4. Re:YES! by sofla · · Score: 1

      Nicely put. I cut my teeth on 6502 assembler back in the 80's, to the point where I figured out some of the illegal instructions by looking at the bit patterns between related opcodes (LDA vs LDX vs LDY is a good starting point). When I think of how much I learned hacking assembler on my trusty old C-64, with the Compute! Mapping the C-64 book at my side, and then I think of how much "knowledge" I frequently encounter when talking to Java programmers or (*ack*) "web developers" (LAMP, .ASP, etc.)... I shudder at the thought of someone who is so oblivous to the internals writing an application that I might need to use someday.

      And yeah, having deep knowlege definitely makes "hacking" movies hilarious on a whole new level.

      (Nothing against Java or LAMP, btw. I've done both. But they are just SO far removed from the hardware, its not even funny.)

    5. Re:YES! by Anonymous Coward · · Score: 0

      Fantastic comment. Thanks.

    6. Re:YES! by IkeTo · · Score: 1

      Hm... you seem to think assembly is more important than it really is.

      > You can't write a compiler

      More exactly, you can't write a complete compiler that compiles to assembly language (although you can write the parser and tokenizer). Nowadays few does that, more write a compiler to something else (e.g., to byte-code, to XSLT, etc), and lack of knowledge have little effect for those.

      > You can't debug C/C++ programs

      C/C++ compilers are good enough these days that I no longer think it is relevant. As long as you can use a good source debugger (gdb is enough), you should know everything in your virtual memory that is relevant to solving your problem. (And they don't normally show you assembly, either!)

      > You don't really know why buffer overflows are bad
      > You don't really understand memory management and what the heap and stack really are
      > You won't ever understand garbage collection

      I think this has to do with memory model, rather than assembly language. It is not difficult to abstract the memory model without touching assembly language at all, especially in language like C/C++ that you can cast a pointer to an integer and print that out in hex. On the other hand, yes, most likely you cannot "exploit" buffer overflow.

      > You don't really know why threads are different than processes

      I believe that even this is actually about memory model, although the "memory" here must now include cache memory and registers.

      > You can't write a device driver

      My belief is that if somebody tells you that he cannot write a device driver because he doesn't know assembly, he is just lying because he is lazy. Most of the device drivers in the Linux kernel has no line of code that is assembly.

      > You don't know any computer architecture at any depth that matters
      > You don't know how your CPU works
      > You won't think the movies with "hacking" in them are as funny as the rest of us do.

      These are mostly true, though. My belief is that you need to use assembly if you are doing one of the following activities:

          - Understanding, modifying or writing the code generator of a compiler that targets to machine code.
          - Understanding, modifying or writing a virus or other similar code that must be attached to such machine code.
          - Understanding, modifying or writing operating system routines or library routines that deals directly with registers, e.g., to do process creation, context switching or mutual exclusion.
          - Understanding, modifying or writing performance critical library routines that need to use special machine instructions (e.g., MMX).
          - Designing or implementing the instruction set of a CPU. (No, I don't think you really need to know assembly to implement a hardware device to be attached to a bus.)

      In other cases, you learn assembly mainly for two reasons: curiosity ("why the hell can human beings design machines from such silly transistors that are so reliable and efficient!"), and unwillingness to accept that something is out of your capability because you don't know assembly. Of course, programmers with these two traits are more likely to be good programmers, so if you are hiring you will choose one who know assembly language. =)

    7. Re:YES! by Courageous · · Score: 1


      - You can't write a compiler

      True.

      - You can't debug C/C++ programs

      Totally false.

      - You don't really know why buffer overflows are bad

      I'd say you "don't know, practically, how they go about being bad."

      - You don't really understand memory management and what the heap and stack really are

      Crock.

      - You don't really know why threads are different than processes

      Bull.

      - You can't write a device driver

      True.

      - You don't know any computer architecture at any depth that matters

      Crap.

      - You won't ever understand garbage collection

      Lie.

      - You don't know how your CPU works

      Hmmm. Maybe true.

      - You won't think the movies with "hacking" in them are as funny as the rest of us do.

      Well, at least you ended with "funny".

      C//

    8. Re:YES! by hisstory+student · · Score: 1

      Thanks. You took the words right out of my mouth. I was fine with what he said until he recommended starting with the X86 architecture. Good thing I wasn't taking a sip on my coffee at the time. It's relatively easy learning with the flat 6800 memory space, but X86 would turn them off rather quickly I'm sure.

      --
      Heard any good sigs lately?
    9. Re:YES! by BritneySP2 · · Score: 1, Insightful

      > Seriously

      Yeah, right, let me go and find myself an IBM/360 to get exposed to... "Seriously" - you are suggesting to ignore, what, 90% of computers in the world - hell, the one sitting on your desk.

      How can this be serious (or insightful).

    10. Re:YES! by Anonymous Coward · · Score: 0

      While my brain might have been warped and rotted before I learned x86 assembly, it wasn't that difficult. And it's very useful for reverse engineering current applications. The best way I found to learn assembly so far is to write a small c++ app in visual studio (don't use iostreams, use the c i/o routines), load it in IDA Pro, and load the debug symbols. OllyDbg is probably a good free alternative to IDA Pro.

    11. Re:YES! by Nethead · · Score: 1

      No, use an software emulator package. Unless you really want to know how the computer works, then get out your wirewrap kit and a logic probe.

      --
      -- I have a private email server in my basement.
    12. Re:YES! by gnasher719 · · Score: 1

      '' - You can't write a compiler ''

      That is untrue. For large parts of a C compiler, like gcc, you don't need any knowledge of assembler whatsoever. Only the backends need assembler language knowledge at all. However, they don't require knowledge of assembler language - they need knowledge of the processor instruction set, and that is something totally different. (gcc is an exception because its output is assembler language, but that is an abomination).

      "You don't really know why buffer overflows are bad"

      Make a post in comp.lang.c. Buffer overflows are just one case of "undefined behavior", and undefined behavior is bad. No need to know why.

      "You can't write a device driver ''

      The device drivers I've helped writing couldn't possibly have been written in assembler.

    13. Re:YES! by had3z · · Score: 1

      Your way of viewing this is a little bit off.
      If you don't know physics, you can't be a good driver, because how on earth would you understand how braking works? Or what gasoline consuming magic makes your care move.

      - You don't know how your CPU works - this is abslolutely stupid. Why would i need to know that? Ever crossed your mind that i might NOT NEED to understand this?

    14. Re:YES! by Kjella · · Score: 1

      My knowledge of assembler is roughly at this level: It's a 1:1 map to hardware calls on the processors, completely basic things like ADD, MUL, DIV, JMP etc. I couldn't code "Hello world" in assembler if my life depended on it. None the less:

      - You can't write a compiler
      TRUE
      - You can't debug C/C++ programs
      By groking assembler? No. Using anything from stack traces, debuggers or print "Got here"? Yes. If you have to dig through assembler, you're probably doing something wrong to begin with - FALSE
      - You don't really know why buffer overflows are bad
      Certainly crash and burn, probably arbitrary code execution? FALSE
      - You don't really understand memory management and what the heap and stack really are
      Not really, but the clue-by-four is to never allocate memory without releasing it. Works for me but I might miss some things - MAYBE
      - You don't really know why threads are different than processes
      Threads live in the application's memory space, processes in their own. Try interfacing with a buggy library and you'll figure out the difference very quickly without learning assembler - FALSE
      - You can't write a device driver
      TRUE
      - You don't know any computer architecture at any depth that matters
      FOR WHAT?
      - You won't ever understand garbage collection
      TRUE
      - You don't know how your CPU works
      Neither do you, because underneath is a bunch of microops and a RISC/CISC mix - TRUE YET FALSE
      - You won't think the movies with "hacking" in them are as funny as the rest of us do.
      Dude, you don't need to grok assembler to laugh at hacking Independence day using TCP/IP.

      --
      Live today, because you never know what tomorrow brings
    15. Re:YES! by Anonymous Coward · · Score: 0

      You are missing one practical CPU there: the ARM, used in most mobile phones and the most common handheld video games. Although that architecture has got a bit bigger over the years.

    16. Re:YES! by justthinkit · · Score: 1

      So you'll have to learn an architecture. Intel 386 is a great place to start...

      Choke. Cough. Laugh. Thanks a lot, now I have to clean soda off my keyboard.

      While the rest of your comment is pretty much spot on, this advice is, frankly, absurd. x86 has one of the most convoluted, non-orthogonal, legacy-laden instruction sets and list of constraints of any architecture, ever.

      This is exactly why you should start with the i386.

      I am extremely glad I started with DOS (and PC Write, Qedit and Word for DOS, for that matter). Windows apps are trivially easy to use with that as a foundation. Similarly, I consider myself lucky to have English as a first language -- anything but Russian seems almost boring by comparison. French, despite being forced down my Canadian throat, was more consistent and had a fraction of the vocabulary. And Spanish was a lark in comparison to French.

      Slashdotter parents, give your child(ren) the toughest language, the weakest editor and the pokiest computer -- I guaranty this will produce more benefit to them than paying their way through college. Slashdotter parents? Hello???

      --
      I come here for the love
    17. Re:YES! by Braxton_Bragg · · Score: 0

      Mod this guy up ! Good to see that some of the "old breed" survived and is still active in the ranks (GMAP veteran here, myself)

    18. Re:YES! by grumbel · · Score: 1

      ### If you want to introduce yourself to assembly language programming, start with something sane and simple. To that end, you can't get much simpler than the Motorola 68000 family of processors. ###

      This might be right, my question is, how does one get started? My desktop computer isn't a Motorola 68000, so how does one get a Motorola 68000? Shall one use a Amiga emulator? Is there some hardware to buy? Anything that can be done with qemu, Dosbox, Dosemu or similar emulation software? I know that assembler is important for some things and I would like to learn it one day, however every time I tried I ended up in the situation that there simply wasn't much interesting to do with it, since all the interesting things where either impossible (no more 0xA000 for graphic access, etc.) or a lot easier done with other languages. Its also hard to find a good tutorial, since most stuff applies to DOS or other systems.

      So how does one learn assembly today? Is going retro with Amiga and C64 emulation the only way or are there any practical applications left to get started? Last not least there is also the question of what to do with assembler skills if acquired? Say I would learn 68000 Assembler, would that knowledge be much useful when switching to x86? Or would I have to restart from scratch since all the Syscalls, Opcodes and Mnemonics are different?

    19. Re:YES! by Ihlosi · · Score: 2, Insightful
      So how does one learn assembly today?

      Many different ways.

      Using an emulator of a legacy machine would be one way. You could also use evaluation kits for various microcontrollers ('51, ARM, PIC, AVR, whatever suits you best). They have the added bonus that you're running on actual hardware. You could also try a processor simulator, which comes with many uC/DSP development kits.

      Say I would learn 68000 Assembler, would that knowledge be much useful when switching to x86?

      Yes, because you have already mastered the concepts behind assembly (registers, processor flags, pointers, etc). A different processor may have different rules, but the concepts stay the same. Some of the rules are the same on many architectures ("If the processor has a zero flag, then counting down in loops is preferable to counting up.", for example). Mnemonics and Opcodes are something you just look up in the documentation.

    20. Re:YES! by Anonymous Coward · · Score: 0

      I was blown away one time when I typed in 2 programs from a magazine into my Acorn Electron, which was also 6502 based, (also the BBC Micro and Electron had an assembler in the ROM so you could program in BASIC or Assembler!), Both programs merely filled the screen with random garbage, one was BASIC and one Assembler, the BASIC one literally took a good 20 - 30 seconds to complete the task, the Assembler version was nearly instantaneous. That really opened my (10 year old!) eyes quite a bit!

    21. Re:YES! by VanessaE · · Score: 1

      I'm an assembly programmer and I still don't know what a heap is, you insensitive clod!

    22. Re:YES! by CrankyOldBastard · · Score: 2, Informative

      Motorola has some nice development kits. They feature a 68xx or 68xxx processor, a small amount of ram ,a monitor rom, a hex keypad, a 7 seg LED display and an RS232 port. Not very expensive and you can put your fingers into everything.

  40. Do you want to be a *good* programmer? by LoveMe2Times · · Score: 1

    Does a web developer need to know HTTP? Does a network programmer need to know the details of TCP/IP? Does a Window's application programmer need to know the ins and outs of the WIN32 API, event handling, processes, threads, handles, GDI, DirectX and others? Does a Flash programmer need to know anything about the SWF file format?

    In general, does any programmer need to know low level details of the technologies they use given that they have high level libraries and abstractions to work with? The answer, IMHO: only if they want to be good at what they do. However, what you consider to be "low-level details" will vary depending on what you're doing. If you're doing J2EE, then low level details might include how different browsers handle cookies, the specifics of HTTP, how it interacts with proxies w.r.t. caching, various details of JavaScript, parameters to the VM that affect garbage collection, the internals of any frameworks you're using (like spring or hibernate), some of the details that the DBA worries about, etc. Assembly language might as well be silicon transistors. Even the details of TCP/IP are likely to be a little far afield for a web developer.

    For an application developer, high level and low level are likely a different beast. Different again for a game developer. Game developer probably needs to know assembly. Network programmer or (embedded) systems programmer, yeah. Application developer, I would recommend it, especially if you're working in C/C++ world.

    I want to point out a caveat here: I don't mean people should be experts in all this stuff. We have specialization for a reason. I'm talking about having a basic familiarity and comfort level working with them. It's a whole different beast debugging through some assembler vs writing 100,000 lines of it. Knowing how TCP/IP works and the general layout of the headers and packets is a different beast from writing your own TCP/IP stack. Etc.

  41. Cheap hardware means less assembler. by SirSid · · Score: 1

    1. Performance problems are solved with faster hardware.
    2. Software bloat problems are solved with more RAM or disk.
    3. Software developers are lazy and rely on points 1 and 2.

    When hardware was expensive we needed good assembler programmers to make the most of the hardware. Now we throw more hardware at the software issues.

    1. Re:Cheap hardware means less assembler. by FrankSchwab · · Score: 4, Interesting

      We're in the process of doing a SOC ASIC, with a 32 bit CPU, analog sensing hardware, USB and other communications ports, sophisticated low power wakeup mechanisms, and RSA/AES/SHA-256 hardware. It only contains 32KB of ROM and 12KB of RAM. We expect the part to require less than 10ma of current in full-scale operation (generating 1 MB/sec of encrypted sensor data). We expect the parts to sell for less than $3, including several bits of external hardware, into a highly competitive marketplace. If our parts cost $0.10 more than our competitors or take 10 ma more current, we're out of business. We expect to sell millions of parts per month.

      ROM and RAM comprise the largest space on the die. Die cost is about linearly proportional to area - doubling the size of the die doubles the cost. As a result, we don't have the luxury of embedding Linux, throwing a couple more MB of RAM at the problem, or increasing the clock speed. We certainly don't have the luxury of throwing this weeks latest, greatest academic language at the problem. 'C' and Assembly is the only way this product is going to survive.

      I think you can be a fine Web programmer without knowing assembly or 'C'; I think you'd be a better one after one assignment to a project like mine, where every design decision is made and every line of code is written with a thought to "how fast is this going to run, how much code does this generate?", rather than "how do I get this done fastest and easiest?". There are many situations where the "throw more hardware at it" approach is valid; there are also many situations where it isn't.

      --
      And the worms ate into his brain.
  42. I am typing in it right now by Anonymous Coward · · Score: 0

    We're writing an assembler program right now for a microcontroller. gcc just wouldn't cut it speed wise and it also wasn't using the registers of the uC sanely. So we wrote it in assembly. As for learning it, once you know C you can just pick it up as you need it.

  43. It depends on the economics of the situation by Anonymous Coward · · Score: 0

    If you are making only a few of something then engineering time is probably the major expense. In that case, anything that gets the job done quicker produces the cheapest result. You can afford to spend more on parts; a more powerful processor, more memory etc. In that case, trying to do the job in assembly almost never makes sense.

    On the other hand, if you're making a million of something, engineering is just about your smallest expense. It pays to optimize the design and reduce parts count and parts cost. An understanding of the hardware issues makes the difference between profit and loss. If you understand machine code and can program in assembly, you can do clever things that save big bucks.

  44. Very Helpfull I think by Stevecrox · · Score: 1

    I'm a computer engineering student in our second year (share the year with EE,E,COMMS,ROBOTICS) we had to program a 8031 (http://www.pjrc.com/tech/8051/board5/index.html) it taught me alot on how a Microprocessor and Microcontroller works, this year I've done a software programing module which was a breeze because I'd been forced to learn proper memory management had already delt with concurrency, interupts and other little tricks OS's do.

    Also this year we've been learning VHDL those of us who worked hard learning assembly last year have found it a breeze getting to play around in semi C and know how it works.

    Assembly makes you appreciate higher level languages, teaches you to learn about clock cycles (remember kids SJMP uses have the cycles of LJMP!) memory limitations (you learn alot with only 8 bytes of internal memory) and with things like the SDCC you can make a program in Assembly and test it, then learn C and test it on a board and once you know basic C the only hard thing about C++ is OO. Personnally I like assembly it can make tiny programs and can help you understand some of the seemingly abstract things about programming.

  45. Of course assembly language is relevant by mtaht · · Score: 1
    ... but only after you have a good grip on algorithms and on processor architecture. There are many tricks one can do in assembly that simply can't be done in a higher level language.

    Jumping directly into the center of a loop - Aggressively and effectively using registers - Developing compilers - Doing bit manipulation - using barely language supported features like "find first bit" or popcount - are all things that can often be best done in assembly. Big today is vector arithmetic.

    Grokking assembly helps is knowing what can be fast in your language, and what can't be. For example, in looking at some gcc generated X86_64 assembly code recently I found that floor and ceil were still function calls on that processor. As was lrint (even though SSE has a rounding mode).

    The two places where assembly is used a lot these days is in accelerating vectorized code, and in low level hardware bringup. If you are interested in developing code for a new processor or SOC, you aren't going to be writing in java at first, but painful, tedious assembly, poked directly into the processor via jtag.

    Lastly - in the general case, if you don't know how your hardware really works, you don't know how to program effectively for it.

    Sure, in today's day and age, you shouldn't set out to code an entire visicalc-alike in assembly - but profiling your code to find hot spots - and knowing when and to use assembly to fix them, IS important.

    Examples:

    Extensive oprofiling of ardour 2's core routines showed several that would benefit from being rewritten in assembly, or something much closer to assembly. Result? Ardour now scales 2-3x better under high workloads than it did before (and those core routines STILL dominate the runtime)

    Now, if the question is: "would being a competent assembly language programmer be a help in the job market?"

    Beats me. Isn't helping me out at all.

    IMHO everybody should learn some assembly for at least one processor at some point before exiting college, preferably in the first or second year.

  46. It is relevant... by gweihir · · Score: 1

    ... for the additional insights. It is also relevant if you plan to work on a small embedded platform were the size and speed gains may be huge. THe insight especially will allow you to understand advanced stuff. Granted, with the quality of most code produced today, obviously most programmers do not have the additionsl insights you can gain from using assembly language. But then, most programmers seem to even fail at basic algorithmics.

    It you take pride in your skills and want to refine them, lear one assembly diealect. I would advide MC68000, but that is not in wide use today. A close subsutitute is the input language the GNU assembler GAS uses. It basically maps the old MC68000 commandset to a 386 or higher CPU (as far as possible).

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:It is relevant... by NormalVisual · · Score: 1

      It you take pride in your skills and want to refine them, lear one assembly diealect. I would advide MC68000, but that is not in wide use today.

      For that, you could just download and use an Amiga emulator. The Amiga-specific includes and libraries are a bit more difficult to come by, but the documentation is usually pretty cheap on eBay and it's certainly a great toy to play with. :-D

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
  47. Assembly programming dead? Say it ain't so... by leed_25 · · Score: 1

    I spent the first 10 years of my career programming in assembler for various kinds of minicomputers and also for the PDP-10 (not really a mini). It was heavy sledding and I would do most of that work in C today (or possibly C++). That being said, I would not give up that early work in assembler for anything.

    It was fun and illuminating to be so close to the hardware --I have written numerous device drivers in assembler and even an RTOS of sorts-- but, all in all, I suppose that you are right, it is unlikely that I will ever do that again.

  48. Yes! by Anonymous Coward · · Score: 1, Interesting

    I was asked this question by the new head of the Computer Engineering Department at my college, RIT. They were thinking of removing this requirement from the coursework. My point then (and now) is that (as others have pointed out), it's important to understand the Assembly Language of the processor you're working on, so as to aid in debugging, etc. As was pointed out, very little assembly "programming" is done today, only those items that are close to the hardware (drivers, Kernel stuff, etc.) In the past, I've actually found compiler bugs when looking at software in assembly, finding out how it screwed up a procedure prologue. Granted, today, compilers are MUCH more mature (thank you Compiler Gurus!). However, debuggers and other diagnostic tools still need to know/understand the underlying architecture and hence knowing the "raw" assembly code is a very handy thing. One area, as pointed out, is DSP's, these are still heavily programmed in Assembly, as that's the best way to squeeze every possible MIP out of the device. Most DSP's can juggle multiple things at once. I spent time in the early 90's working with TI C25 DSP's. Some very handy things you can do, but limited in other ways, in terms of RAM space, etc. (it was the wrong CPU for the job, but that's what the PHB's wanted to use, as it was cheap).
    As an Embedded Systems Engineer with 25 years experience, Assembly language is important to what I do, even though I don't use it all the time. I still enjoy the ability to turn on the "disassembly" mode of the debugger and single step through the problem.

  49. One thing... by petrus4 · · Score: 2, Informative

    ...that learning assembly will teach you is that a libc is really a convenience, rather than a necessity. If you know what you're doing you can accomplish pretty much anything either via system calls directly to the kernel, or by writing your own asm functions for various things (print, etc) and then simply calling *them* via includes. If you end up writing your own asm includes for things you'll still get some bloat, but I can guarantee you that it will be an order of magnitude less than using glibc. There are times when that can be valuable...like if you're needing a system which will fit on a floppy or usb stick, or for an older system with less ram etc.

    I strongly recommend checking out asmutils if you want examples of asm programs that actually do something useful. Some of these (such as ls and the basic httpd) are less than 1k in size.

    You might also be interested in Menuet, which is an entire (small) OS including GUI written completely in either 32 or 64 bit asm.

    1. Re:One thing... by Valdrax · · Score: 1

      If you end up writing your own asm includes for things you'll still get some bloat, but I can guarantee you that it will be an order of magnitude less than using glibc.

      Who runs on a system where they're interested in the functionality of glibc but don't expect it to already be available in memory as a shared library?

      There are times when that can be valuable...like if you're needing a system which will fit on a floppy or usb stick, or for an older system with less ram etc.

      It's exceptionally rare that you'll need something on a floppy nowadays, and I have a pretty cheap 1 GB usb stick. I can fit a bloated GNOME or KDE-based distro install on that with very little effort. Older systems with less RAM usually have older software that was designed for them. Sure, it's neat to run a webserver on a C64, but what's the point other than to say you've done it?

      Assembly has its place, especially in embedded programming, but much of what you're describing is effort for the challenge of successfully doing something the hard way.

      --
      If it's for-profit but free, you're not the customer -- you're the product (e.g., the Slashdot Beta's "audience").
  50. Yes, but not for everybody... by astifter · · Score: 1

    Its good to know assembler because it teaches you how it works on a more basic level. Its good to be able to debug and optimise in assembler. (I do that on a weekly basis... but I don't actually write in assembler tough.)
    Its necessary if you work on microcontrollers. (Again, debugging and optimising.)
    (Optimization can also be done by looking at the assembler code a compiler generates, crying, then rewriting your C-code to generate better assebly code..)
    So yes, its quite useful. (And knowledge never hurts....)
    astifter

  51. learn it well enough to read by moocat2 · · Score: 2, Interesting

    While I have not written any assembly since college, I am really glad I know it. As an engineer who works in C/C++, sometimes it is really helpful in debugging to see what is happening at the assembly level.

    So, I would definitely recommend at least being acquainted enough with assembly so that you can semi understand a listing.

  52. Ownage by HTH+NE1 · · Score: 1

    I've said it before: the lowest code owns. Also true: he who codes the lowest owns.

    See Reflections on Trusting Trust. It should be required reading of every programmer.

    --
    Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
  53. depends on your career choice. by LOTHAR,+of+the+Hill · · Score: 1

    For java/db/web apps, not so important. It's absolutely crucial for OS, drivers, or development on micros.

  54. Relevant? by Anonymous Coward · · Score: 0

    Heck - we should be teaching it (albeit a little simplified) to 6 year olds, along with Latin, philosophy and QED. Get them understanding the fundamentals right from the word go - it's the only way we're going to evolve...

  55. Very important by SpaghettiCoder · · Score: 2, Interesting
    You need to have assembly language, to write routines to directly access the CPU (perhaps to make a fast routine to do a simple operation in your program that gets called many times), address specific memory and input/output of various hardware such as your screen, your ports, everything.

    There are limitations to what high-level languages can do. When I started out on the Amstrad CPC, I remember the computer booted up into a very inefficient non-standardised BASIC, which had many added commands which were really functions to allow access to the unique hardware of the CPC (sound and graphics). These were ridiculously slow, with the Z80 processor and 32K memory available for programs. If you wanted to make a simple animation for example (say, a little 2D sprite walking across the screen), you needed to do it in Z80 assembly language IF you wanted the computer to do ANYTHING else at the same time (e.g. scan for keyboard interrupt, play sound chip in background, or even just a second sprite).

    x86 assembly language isn't hard, but it's the only way you're going to be able to play control freak with your PC hardware. Many excellent Linux applications are done almost 100% in assembly language, including the excellent SNES emulator ZSNES (which makes much the same demands on Linux as the old 8-bit Amstrad, and keeps perfect time). If speed is really important then there's no other way. For some reason I think secret organizations like GCHQ would employ skilled assembly programmers so they can keep looking for ways to brute force public-key encrypted messages in the shortest possible time.

    In my opinion, a lot of people are able to use a few libraries in VC++ or similar to be able to make useful programs, and also new things like Python, Perl, etc. but that doesn't necessarily make them a "coder" just because they're able to use some built-in functions. To be a "coder" means you PREFER to use plain C, and know assembly language (even though assembly language is different for every platform - an assembly language programmer knows exactly what info he needs to find out re opcodes and registers and memory addressing and interrupts, to program his program with the same techniques).

  56. It's a pity about the Lisp Machines... by starseeker · · Score: 3, Interesting

    I have always wondered what would have happened if the idea of using Lisp as the assembly language of a machine had actually taken off. If I understand the Lisp machines correctly, they were actually "lisp on the metal". Given the flexibility and power of the lisp language it would have been very interesting to see what the evolution of the Lisp Machines would have been, had they proved viable in the long term.

    --
    "I object to doing things that computers can do." -- Olin Shivers, lispers.org
    1. Re:It's a pity about the Lisp Machines... by nuzak · · Score: 1

      > If I understand the Lisp machines correctly, they were actually "lisp on the metal".

      They were more like lisp accelerators. Current architectures and advances in interpreters would make today's PC hardware pretty competitive with lisp machines (though no doubt an evolution of lisp machines to today's standards would also be impressive). Their real strength (and to some extent their weakness) was in the pervasiveness of the lisp environment -- being able to inspect and modify everything in any running app, with a single toolchain, something only smalltalk really manages to reproduce. The wikipedia article on Lisp machines is quite good -- I suggest starting there.

      --
      Done with slashdot, done with nerds, getting a life.
  57. it's fundamental by wmeyer · · Score: 1

    Of course it's important to learn assembly language. Compiler writers need the capability to tweak code below the level of the compiled language, for one thing. But so do many others. It's easy to overlook the importance of assembly language when you're running a 3GHz 64 bit machine, but for those of us who sometimes have to work with real-time (microseconds, not milliseconds) and for those who must deal with what happens on adapter cards, not just on the PC, and even more, for those who may have to code for 8-bit machines in real-time with very small memory budgets, assembly continues to be important.

    C++ is not the universal solution.

    --
    --- Bill
  58. Yes, in some lines of work by Distan · · Score: 5, Informative

    First, I'll give the disclaimer that I am a hardware engineer, not a software engineer.

    My experience has been that when bringing up new hardware, when you don't yet have a stable bootloader, let alone a compiler or operating system, then being able to write in assembly is very valuable.

    More accurately I think I should say that being able to write in machine language is very valuable, as you might not even have a working assembler depending on what you are working on.

    Being able to peek and poke a few registers, hand code a loop or two, and maybe write some sequential values across a bus can go a long way in helping you get the hardware going. Hook a logic analyzer to the bus and you're golden.

    Even if you do have a whole infrastructure of compilers, device drivers, and operating systems available, none of that helps you when the first damn batch of prototypes (made of the first revision of the PCB, containing the first ever silicon of a new CPU, and the first ever silicon of the the new chipset) won't even boot, and you are trying to get to root-cause ASAP because you've got a whole army of testers ready to have at the hardware as soon as you get it running code.

    In short, if you are the guy designing the raw iron that the software is going to talk to, you better be able to step up and take control of the raw iron when the software can't.

    1. Re:Yes, in some lines of work by honkycat · · Score: 1

      As someone closer to the middle between hardware and software, I want to echo what you said. For embedded systems and hardware work, knowing assembly and how it relates to the hardware you're using is very important. Quite likely you'll never need to implement anything computationally significant in it, but for bootstrapping, there's nothing more helpful than being able to step through the real source -- not the C source, the cycle by cycle opcodes that it compiled into. Especially if you have a modern compiler that thinks it's smarter than you are, there's no better way to see what your code is *really* doing.

      It's also helpful when you have a brand new flavor of DSP on your board and even the manufacturer's own compiler gets things wrong... and then when it turns out there's a bug in the hardware, TOO. Not that that's happened to me... but it's a lot easier to get the engineers to take you seriously if you can tell them exactly what you're doing...

  59. depends what you're writing by Zork+the+Almighty · · Score: 1

    Whether or not you want to learn assembly depends on the kind of software that you want to write. If you are writing "interface" software, where a wide range of functionality from different sources is tied together to accomplish a goal, then assembly language is not really useful. Even if your software needs to be fast, you can probably use C. It is always much more important to optimize the data structures and algorithms used for a program, followed by the cache behavior.

    Where assembly language is useful is when you really need to get down to specific instructions. Maybe your C compiler is producing bad code for a critical section, or it can't make use of some optimization because it doesn't know about restrictions on the data. Another situation is when you want to use instructions which have no analogue in your preferred higher level language. For example, say you want to implement a lock-free data structure using compare-and-swap. You will probably have to code some of it in assembly for each platform.

    In all honestly, learning assembly should be no big deal. You don't have to be a guru, but it is always helpful to have basic knowledge and skills that you can build on later if you need to. CPU instruction sets aren't going away, and I found it added to my confidence to know that if need be, I could always go right down to the level of machine instructions to bash exactly what I want into the machine.

    --

    In Soviet America the banks rob you!
  60. Understanding Compiler Bugs by Anonymous Coward · · Score: 0

    Recently I have done some assembly level debugging to understand why some compiler or another is generating bad code. Of cource we were compiling at the highest possible optimization level which is always interesting. There two reasons for doing this, first is to generate a work around and second is so that we can report the bug.

  61. Re:Isn't it the root of all programming languages? by Anonymous Coward · · Score: 0

    I like to think about it as the root of a series of primes multiplied together, none of 'em can be removed easily!

  62. Course it's relevant by Anonymous Coward · · Score: 0
    I was just involved in the writing of a linux device driver for a device which was formerly supported only in Windows (XP, not even Vista) and one of the skills involved was decoding the firmware of the device to understand how the device talks to the computer. So yes, assembly skills remain relevant.

  63. Internal combustion engine alalogy by davidwr · · Score: 2, Insightful

    Knowing assembly language is like knowing how to an internal combustion engine works.

    For most drivers, it's a curiosity.
    For most auto mechanics, it's somewhat useful.
    For anyone doing engine repair, it's very important.

    If you are programming at a hight level like Java, .NET, or web-based programming, knowing assembly language won't help much.

    It's only when you are using a language like C where knowing how the chip works can actually help you write your code does it really matter.

    Anyone doing systems programming, real-time programming, or anyone who needs fine control over their program's execution should learn assembly.

    For non-programmers and very high level programmers, it's about as useful as studying Shakespeare or business law. It'll make you a more well-rounded person but it won't help your code run faster.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
    1. Re:Internal combustion engine alalogy by Tony · · Score: 1

      It'll make you a more well-rounded person but it won't help your code run faster.


      Yes. Very true.

      Understanding asm helps in understanding the computer, and how the computer works. Understanding how the computer works helps in understanding how code works. Understanding how code works helps you write better code. Not necessarily faster: but, in general, better.

      I think the same thing of LISP, though-- knowing LISP helps you understand a different way of thinking about code, which helps give insight into solving different problems.

      Basically, the more different types of languages you know, the better off you are. I think a good helping of FORTRAN, LISP, asm (at least one), C, Smalltalk, FORTH, and maybe Java would be a good start. I've never found C++ to be very helpful in understanding other languages. Perl is interesting, but. like C++, it's such a mess it's almost worthless as a tool for understanding. (Don't get me wrong-- I love Perl, use it all the time.) I might add Haskell to the list, if I ever get around to learning it.

      These aren't all languages I advocate for getting work done. They're tools for learning different ways of thinking about programming that I've found useful over the years. (These days I tend to stick with Perl, C, and Objective-C for regular work, though I occasionally have to use C#, which is Java dressed up for a casual night of prostitution.)
      --
      Microsoft is to software what Budweiser is to beer.
  64. I used assembly langauge just today by EMB+Numbers · · Score: 1

    I am benchmarking various signal processing function on a variety of CPUs including PPC970 (a.k.a Apple G5) and Intel Itanium 2. I have had to both examine and optimize assembly language for both processors and their SIMD units, Altivec and SSE2 respectively.

    There are some domains including signal processing and embedded system generally that require assembly langauge occasionally. Having said that, I write 100 times more C/C++ than assembly language.

  65. Assembly Language Absolutely Revelvant by Ichthus777 · · Score: 1

    Any good software engineer will learn assembler for at least one platform (one processor) to gain both a formal understanding of how a von Neumann processor functions as well as understanding the basics of low level programming. Most business (and other) application programmers will never have to actually program using assembler; however, assembler is often required for programming microprocessor chips in advanced embedded systems, and sometimes low level driver functions are best done in assembler. Assembler is still highly relevant; however, assembler is also not used by the masses of applications programmers.

    --
    Ichthus
  66. Libpng has some by Anonymous Coward · · Score: 0

    A few years ago someone from Intel contributed some assembler code to libpng, to handle some of the innermost hard decoding work using Intel's MMX instruction set. Later on one of the libpng maintainers converted the code to run on gcc compilers.

    Although, when it works, this does make the decoder run a lot faster, the code has been a maintenance nightmare. Not all platforms, such as 64-bit machines, are able to assemble the code correctly. Some don't produce compiler errors but produce bad code. The libpng group finally had to resort to distributing several special makefiles (makefile.linux, makefile.gcmmx, and makefile.nommx) to build with or without the assembler code, and to resort to special tricks in the configure script to decide whether to use it or not.

  67. no need for it, believe me. by Anonymous Coward · · Score: 0

    There is absolutely no need for it. If you know what a car is for, why should you know then what these funny long sticks beneath your bel-bul-thingy-down-your-how-do-you-call-that are for? Just trust me.

    cb

  68. YES FOR THE LOVE OF FUCKING GOD by stratjakt · · Score: 0, Redundant

    I've had it up to *HERE* (trust me im pointing really high up) with "IT EXPERTS" who don't have the foggiest fucking clue how a computer works.

    It's worth it, just for understanding in a general sense. It's worth it to understand the function of a microprocessor works right down to the latches and nand gates. It's worth it to know how the various IO buses operate, what their limitations are, etc.

    It's worth it just to know what a computer CAN do. It's worth it to know how much overhead there is every time that recursive subroutine calls itself.

    It's like asking if it's important for a car mechanic to know how an internal combustion engine works. He could probably change oil at jiffy lube without it. And break my fucking PCV valve and tape it back on with electrical tape. It just goes in like a cork I mean what the fuck, like I wouldnt notice, or think Ford installed it that way? Then they get lippy when you demand they replace a 2 dollar plastic doongle because they think its a major overhaul.

    What was the topic? Yeah, it's a good idea to have a fucking clue how what you work with functions.

    --
    I don't need no instructions to know how to rock!!!!
  69. Of course it is relevant by russotto · · Score: 1

    If you want to break DRM, you need assembler! Microsoft ain't gonna give you their source, yaknow!!!!

  70. Yes Not useful to you by Anonymous Coward · · Score: 0

    Compiler writers might find it useful. There understanding of ASM make sure your HLL executes
      quickly.
    Driver writers? I do not think they can use Java or Ruby.
    OS Writers? ASM in key places can make a big difference.
    Now on a User level PC program who cares. 64 bit integers, whatever. The smaller the system the more it maters. You would be suprised how many new 8 bit programers think they have an FPU or 16 and 32 bit instructions.

    ASM is not going anywhere until the CPU learns to read HLLs.

  71. oldskool by Anonymous Coward · · Score: 0

    try, Peter Norton's Assembly Language Book for the IBM PC,ISBN: 9780136621492
    I read it at my local uni when i was in highskool. brings back memories.

    B81300CD10B80100CD33B8004CCD21

    you can "program" that by using copy CON: 1.com
    and using alt-x to enter the ascii code equivalent to the hex

    used to do that at school, just to piss off the teachers

    w00t

    ps: try it, or just disassemble it in your head and tell me what it does. rofl

    pps: i used to show people and tell them that early windos really was close to dos cause after all the basic functions came from dos and the bios. heh

    1. Re:oldskool by Anonymous Coward · · Score: 1, Informative

      It sets the video mode to 0x13 (320x200, 8-bit color), shows the mouse pointer, and exits.

  72. Confessions of recovering 2600 game programmer by ClosedSource · · Score: 1

    "Jumping directly into the center of a loop"

    Not to mention jumping directly into the middle of an instruction. Oops. Did I say that out loud?

  73. My take on how to learn x86 ASM by MannyMax · · Score: 5, Informative
    I spent some time last summer doing exactly this, learning x86 assembly language. Granted, I tried to emphasize a specific area that may or may not be important to you (fast, high-accuracy scientific floating-point), and I already had a passable familiarity with assembly from C dumps, but that just meant I could skip large chunks of many of these references -- they're still good stuff. Some of my opinions on how to go about it:
    • Don't use Windows. Seriously. Don't. I'm a Windows geek at heart; I know Linux OK and can use it happily on a daily basis, but I'm really at home in Windows. I have been for 15 years. And it's the absolute worst way to learn ASM you can possibly come up with. The problem is that Windows is built on DOS, and in assembly that really shows. Not in the sense that it behaves like DOS -- it doesn't -- but all the interfaces were clearly designed in the DOS era, and few have been updated. Linux, in contrast, has the perfect environment for learning assembly: the system calls are easy to make, reasonably well documented (the documentation is actually pretty bad, but it's better than Windows' -- it exists.), and it's got all the things you'd expect of a modern OS, not all of which Windows always has (like a flat 32-bit address space for everything!). Even 64-bit Linux has no trouble running even pure 32-bit assembly programs once you get the linker flags right.
    • Don't use as (or gas, GNU as). If you must, stay the hell away from AT&T syntax, as's default, since no one but as ever uses it. Make sure you learn the standard Intel syntax (like MASM uses) or a very close approximation (NASM or FASM). as used to only accept AT&T syntax, but now it's got a command-line option to accept Intel syntax; honestly, I prefer NASM's slightly simplified, streamlined Intel syntax. They're very close to each other, close enough that once you know NASM syntax you can read Intel syntax no problem. FASM is similar to NASM, and another decent place to start.
    • Use NASM. It's free and open-source. It works. Its no-frills approach is perfect for assembly, and a real breath of fresh air compared to convoluted messes like AT&T syntax. The only downside to NASM is that it's 32-bit-only at the moment; this isn't too big a problem, because almost all existing tutorials teach 32-bit anyway (and all the migration guides for 64-bit ASM assume you know 32-bit). If you want to graduate to 32-bit later, there's FASM, which is free and close enough to NASM that you'll have no trouble.
    • Stay the HELL away from old 16-bit code in any form. It's ugly. It's obsolete. It's just not worth your time. Of course, using the 16-bit registers is fine when they're the appropriate tools for the job, but seriously, any tutorial that mentions segmentation? Just say no. You'll thank me for this later.
    • Don't put too much faith in the Art of Assembly books. In my opinion, they just aren't that good. They were first written in the 16-bit era, and it shows in far too many places. They're also very DOS/Windows-centric, even the Linux version (also not that good), and learning on Linux is much easier with a native Linux tutorial, like this one:
    • Get Paul Carter's NASM tutorial. It's nice and low-level, explaining all the basics from the ground up. It does assume you know C, and it does use libc for a lot of the dirty work, but you can always do it the way I prefer and build everything from the ground up with pure ASM and system calls. I figure that if you're going to use C, just write a C-program and call an assembly function or two. If you're going to write it all in ASM, write it all in ASM. There are lots of nice tutorials out there for doing either (calling ASM from C or pure Linux ASM); google "linux assembly tutorials".
    • Get the official manuals from Intel and AMD. They are the single best references out there. Yes, get both co
    1. Re:My take on how to learn x86 ASM by Anonymous Coward · · Score: 3, Informative

      Could you elaborate on your mention of Windows having DOS-style interfaces please? The Win32 API lives in kernel32.dll which acts as a shim, redirecting calls through to the native api (ntdll.dll if you're on an NT system). DOS interfaces? What the hell are you on about?!?!

      Windows doesn't have a flat memory model? Are you on crack, or are you running Windows 3.1?

      Madness.

    2. Re:My take on how to learn x86 ASM by WillDraven · · Score: 1

      Thanks for your reply. It's by far the most extensive and informative that I've received yet. And you need not worry about me using windows. I've been running pure linux for two years now. I perhaps should of mentioned that in my initial post as many of the replies have directed me towards windows-centric tutorials and resources.

      --
      This is my sig. There are many like it but this one is mine.
    3. Re:My take on how to learn x86 ASM by SpaghettiCoder · · Score: 1

      I disagree with your comment about the Art of Assembly Language Programming (Randall Hyde). That's an excellent book.

    4. Re:My take on how to learn x86 ASM by Anonymous Coward · · Score: 0

      The Art of Assembly is a good book to learn how things work and why they are that way, but if you are actually trying to learn how to write assembly code it falls pretty flat with todays computers. I still recommend that anyone who really wants to be a great programmer read the book, but more for the conceptual knowledge of how it works rather than actually learning the syntax since it is somewhat out of date. Not to mention the fact that the last thing you want to do is become dependent on a particular architecture/OS for the traditional "step by step" method of learning programming that a lot of people seem to do. If you are actually trying to get to the point where you want to write a program in assembly then I would study the documentation for that architecture/OS.

    5. Re:My take on how to learn x86 ASM by NoNickNameForMe · · Score: 3, Informative

      Stay the HELL away from old 16-bit code in any form. It's ugly. It's obsolete. It's just not worth your time. Of course, using the 16-bit registers is fine when they're the appropriate tools for the job, but seriously, any tutorial that mentions segmentation? Just say no. You'll thank me for this later.

      I teach Assembly Language Programming, and for that reason I refuse to teach it on x86 because most available books are using 16-bit (DOS/BIOS based) x86 code. Unfortunately learning 32-bit x86 is a much bigger jump (conceptually) for newbies, I'm not sure it can be done in one semester to students who never had Assembly exposure before.

      Ideally, I'd like to use ARM as the reference assembly language for teaching. It's reasonably clean, and has a sufficiently large code base (i.e., PDAs, embedded systems) to be worth the while to learn. I'd love to find out what books are availble for learning Assembly Language Programming on ARM though.

    6. Re:My take on how to learn x86 ASM by Anonymous Coward · · Score: 0

      Why don't use Windows? The Windows API is actually rather nice to use, and it's how I learnt assembly. You only need a few defines included in your program, and you can call pretty much any function as easily as in C, etc. Yes, raw Windows API is a little more complicated than, say, .NET Windows Forms, or the MFC, but really, if you don't know how to call a function in a system dll, and read the windows API documentation in a language-independant way, I'd question your ability to write a program in assembly on any platform...

    7. Re:My take on how to learn x86 ASM by o'reor · · Score: 1
      If you want to have a try at assembly programming, working on Menuet OS might be a good idea. It was designed for development in assembly language and makes an interesting environment to work with.

      Take a look at the "programming" section on this page.

      --
      In Soviet Russia, our new overlords are belong to all your base.
    8. Re:My take on how to learn x86 ASM by Anonymous Coward · · Score: 0

      Unfortunately one of the big reasons for using assembler is hardware interface, and the PC BIOS is still 16-bit (doh!) So, if you work on x86 PCs, you need to know 16-bit assembly code.

    9. Re:My take on how to learn x86 ASM by Unnamed+Chickenheart · · Score: 1

      I've been waiting a long time for this post.

      Thank you. :)

      --
      urd
  74. How relevant or useful is it to learn Assembly? by Anonymous Coward · · Score: 0

    If you need to ask, then I would not hire you.

  75. Compiler Bugs by Detritus · · Score: 1

    Even for applications programmers, it can be useful. On occasion you may run into compiler bugs. It's helpful to be able to compare the source code and the compiler output.

    --
    Mea navis aericumbens anguillis abundat
  76. Analogies in other disciplines? by Sockatume · · Score: 1

    I don't want to derail the comments so feel free to mark this down as "Off Topic" but the discussion here reminds me of moving out of university into the world of "real" chemistry, and the basic principle may apply in all fields. When everything's working fine, you don't need to remember the fundimental stuff and can treat it like a black box. However when things begin to behave strangely, you have to know what's inside the box or you're never going to be able to solve the problem. The obvious analogy is when your car breaks down

    If I'm interpreting a simulation of a compound, even if I'm only interested in the structure, I need to know the nuts and bolts of the numerical methods used to predict that structure, so that I can choose the right approach. Even if the correct approach is obvious, in-depth knowledge is needed to avoid mistaking simulation artefacts for actual information.

    Any examples from other fields?

    --
    No kidding!!! What do you say at this point?
    1. Re:Analogies in other disciplines? by Shados · · Score: 1

      Thats a pretty darn good analogy, actually :) The web world (while still programming) is such a prime example of that. Lately with all the frameworks, ruby on rail, asp.net, all the java stuff, AJAX toolkits, etc, one can do without knowing even the basic of HTML, Javascript and CSS... but all these tools are buggy, since they are built on top of buggy frameworks themselves (thanks Internet Explorer).

      So when things go weird, you see on the forums a bunch of clueless newbies asking what went wrong, when the problems are usualy found within 10 seconds by people who know how to do real HTML/CSS/JS.

      I know people will say "No one who doesn't know HTML should deal with web stuff!", and thats exactly my point. But its still a very good example, since its a very very recent one, and is probably fairly similar to how assembly programmers felt when the first batch of third generation languages compilers started popping up...

  77. The engines canna take it by dbIII · · Score: 1

    Unfortunately faster hardware still gets pushed to the limit and remember that a 1% improvement is nearly two hours time saving per week per node - not paticularly trivial when the job takes over a week to run on ten nodes (nearly twenty hours in which other stuff could be done if you could get that 1% improvement). With numerical data processing in a lot of fields you just do more with the data when you get better hardware.

  78. Be careful what you wish for by ClosedSource · · Score: 1

    I used to wish that there were more hardware resources available to get the job done in a reasonable time-frame. Now that I got my wish and hardware is so cheap and capable, my hard-won assembly language skills are mostly obsolete.

  79. Should have at least forgotten it by ballmerfud · · Score: 1
    This reminds me of the quote by Brander Matthews:

    "A gentleman need not know Latin, but he should at least have forgotten it."

    As this was said of the educated a century ago, the same might be said of assembly language for programmers today. There are benefits outside of direct application that prove worthy in other endeavors.

    --
    http://uncyclopedia.org/wiki/User:Steve_Ballmer
  80. Definately, at least the basics by Shados · · Score: 1

    People who read my previous posts on similar topics probably have seen im one of the vocal advocates for shifting toward a more "practical" education system when it comes to anything computer related, or at least splitting the more science part from the engineering part (splitting CS in two, more or less). But EVEN with these belief, I have to say, learning assembly is totally relevent.

    Even in modern languages like C#, when you start doing something complicated, you will need to use pointers, at least once in your life (yes, C# allows pointers. Look up the unsafe { } construct). Pointers are the abstraction of something as low level as it gets, and to fully comprehend how it works, you need to, at least once, have touched assembly. No need for an ENTIRE class about it. But at -least- one or two assignmed, a few lectures. People need to know what it is, how it works.

    Otherwise, the first time Visual Studio (or whatever) pops up with an exception in a native bit of code, and pops the disasemblyer, people just go "wtf?!" and think its an hopeless situation...

  81. Machine Code by Saint+Stephen · · Score: 1

    I had fun handwriting a little machine code (lower level than assembly) -- actually just writing the bytes of the program -- in Bochs.

    I think in 2 bytes I could do a terminal echo; in 13 bytes I could boot to real mode; and in 33 bytes I could boot to 32-bit protected mode. Coulda kept going.

    Why can't we build completely special purpose machines? Like DOS, with no protection whatesoever -- if I get it wrong, please just let the whole computer die. You could just have a fixed byte range i/o monster for your database server.

    1. Re:Machine Code by cyborg_zx · · Score: 1

      Why can't we build completely special purpose machines?

      1. We do - but one does not build special purpose for generic work.
      2. Abstraction is fundamental to manage complexity. Our machines are several orders more complicated than they started out with. If we were still doing everything with assembler we would have little hope in hell of getting much done with them.
  82. What about Microcontrollers by hoofie · · Score: 1

    If you want to play around with Microcontrollers [pic16 series for example] you MUST learn assembly. Ok, you can use a C compiler to do it [SDCC for example] but it can be a bit clunkier and you end up having to write some of the routines in assembly anyway. Microcontrollers are an easy and cheap way for anyone who wants to get their hands dirty with electronics.

    1. Re:What about Microcontrollers by Anonymous Coward · · Score: 0

      Pic Assembly language looks pretty ugly to me. I was looking at the H8 for my upcoming home microcontroller project. Its supposed to be similar to the PDP-11.

    2. Re:What about Microcontrollers by kbielefe · · Score: 1

      If you want to play around with Microcontrollers [pic16 series for example] you MUST learn assembly.

      Not necessarily. A huge number of "play around" projects in articles for people who are not computer engineers are written for the BASIC stamp. PICs are mostly for people who pretty much already know assembly or have a strong desire to learn.

      I suspect the main reason people on slashdot like assembly is that it helps us feel smug and elite. Come on, admit it. That and cracking keys for software that has the audacity to be non-free.

      --
      This space intentionally left blank.
    3. Re:What about Microcontrollers by hoofie · · Score: 1
      I agree with you partially, but when I say microcontrollers I mean the PIC16 etc series. I've used stamps myself and my next little project will probably use a PICAXE as I can't be arsed to code a large block of assembly. I'd dearly love to use C etc but often some of the functions still have to be done in assembly.

      I suspect the main reason people on slashdot like assembly is that it helps us feel smug and elite. Come on, admit it. That and cracking keys for software that has the audacity to be non-free. Perhaps some would, but not me, I'd rather avoid it like the plague [although it does give me a warm fuzzy glow to know I can still do it]. It does bother me though that many programmers don't want to touch it. Fine, but being able to go back to fundamentals, even in a simple way, benefits one's skills.
  83. MOD parent l337 by Anonymous Coward · · Score: 0

    noiche

  84. Re:6502 Programming by Megane · · Score: 1

    A program written in assembly language on a Commodore 64 is faster than an algorithmically identical program written in BASIC on a MIPS4000-based SGI machine.

    Which leads to the question: why is someone programming an SGI MIPS machine in BASIC? And interpreted BASIC at that?

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
  85. Assembly language... isn't that like..... by Anonymous Coward · · Score: 0

    ...typing a long string of 1's and 0's into a C64?

  86. Re:Isn't it the root of all programming languages? by jd · · Score: 2, Interesting
    No. You only have to generate code for another already-existing compiler. For example, this is how people use f2c. You can also write compilers that generate bytecode (some LISP compilers do this, as do many Java compilers).

    Now, if you were to ask "isn't knowledge of assembly language for a given microprocessor required to create a compiler capable of directly generating native code?" then the answer would be yes, because all the other possibilities have been excluded. Alternatively, if you asked "isn't quality knowledge of assembly language for a given microprocessor required to create a compiler that can generate code that is compact, efficient on resources and fast?" then the answer would also be yes.

    However, as most modern programs are anything but compact, efficient on resources or fast, that is a rather moot point. The best compiler in the world can't turn junk into quality, although a trashy compiler can certainly turn quality into junk.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  87. -1: Braindead by Austerity+Empowers · · Score: 1

    Are you nuts? How could any reasonably educated person answer "no"? How could a slashdot editor allow this to be posted?

    I do it every single day I go to work and it's not even my job. You cannot, now or ever, ignore that hardware exists beneath all those layers of abstraction, obfuscation and OS APIs or BSPs.

    C is great, I love it. I'd never write something in asm that I did not have to write, but it's not hard to find situations where it is absolutely essential. You simply cannot do some things in C that you can in assembly, especially as we go multi-core, especially as we use different architectures (like PowerPCs and their DCRs). Every time you send some screwball-over-http packet, somewhere down there, someone wrote a device driver that at a minimum blocks up your packet and refills transmit fifo's in response to ISRs, a lot of which cannot be done without precise control over hardware. And that's just computing hardware, you cannot forget the incredible number of embedded devices out there on which you can't even get a java interpreter to fit. Yes, processors are now fast enough that writing complex routines in assembly is not necessary but for many things, you MUST do it.

    Every game console, set top box, computer, car, guided missile...hell even some toasters has assembly in there somewhere. If anything the growth of embedded development has made assembly, and processor architecture more important than ever.

  88. *Hem hem* by Eli+Gottlieb · · Score: 1

    You forgot CoyboyNeal, you insensitive clod!

  89. For Micro$oft programmers NO by Ichthus777 · · Score: 1

    ... which is why their code is bloated, botched, broken, and generally vulnerable. IMO.

    --
    Ichthus
  90. Re:Isn't it the root of all programming languages? by Tatarize · · Score: 1

    That isn't the question. The problem is that via a few levels of encapsulation knowing a higher level programming language has nothing to do with the core code that runs on the processor.

    The only thing I've ever used Assembly for is to write up a virtual machine for a genetic algorithm I was running. And even that is on a pretty profoundly different level and I didn't write the assembly code, the evolving little code-bots did.

    --

    It is no longer uncommon to be uncommon.
  91. The real question is "What is Programming?" by netchipguy · · Score: 1

    Reading most of these posts gives you a pretty clear idea of where most Slashdot readers have spent a good portion of their time (doing assembly or 1-2 levels up from it). The problem is that "programming" today is done at many different levels. At any level it's naturally helpful to know a bit about the couple of levels beneath you. Trained in EECS, I once enjoyed thinking that I understood "all levels" of computing systems, something that was possible when C was a "high level" language. I had written Windows apps in C, written Z80 assembler, designed a MIPS CPU at the RTL level, built a 4-bit CPU out of gates, and done transistor layout for logic cells. Those times are gone. There are many more higher layers ("programming" in Flash? Excel?) that it's not just not possible to for some people to have a good enough grasp of assembly to be worthwhile. Then there's the fact that for some people "assembly code" is pretty high level. Assuming you mean those complex macro instructions that break down into N actual hardware operations (including loops)? Even those who say "I'm glad I learned assembly" usually don't understand how instructions are broken down and scheduled differently on different CPU implementations... how bugs may cause instructions to be emulated, or how the alignment of memory accesses can affect timing, or how your instructions interact with virtual memory, caching, exception contexts, etc. It's a complex multi-layered world out there. -netchipguy

    1. Re:The real question is "What is Programming?" by 3seas · · Score: 1

      Maybe the quantization is not quite what you might think, but at all levels there are constant (actions) that exist.
      http://threeseas.net/abstraction_physics.html

  92. Re:6502 Programming by Anonymous Coward · · Score: 0

    Eh? Have you tried turning the SGI machine on? Or was the BASIC implementation written by a moron? Hmm, maybe you overclocked your C64. Personally I think you're talking out of your arse.

  93. Depends on what you mean by a good programmer by sterno · · Score: 3, Insightful

    Frankly I think a good programmer is somebody who writes well documented and designed code. I don't think somebody's knowledge of the low level assembly programming necessarily helps with that. I'd rather somebody wrote somewhat inefficient code that I could read and, as needed, optimize, then have some spaghetti pile that nobody could understand but was lightning fast.

    --
    This sig has been temporarily disconnected or is no longer in service
    1. Re:Depends on what you mean by a good programmer by einhverfr · · Score: 1

      1) Design: Requires knowledge of good programming, maintenance, security
      2) Code: Requires knowledge of good programming practices
      3) Review: Requires contact with the user
      4) Optimize: Assembly may be helpful here.

      Worry about everything in its right time. :-)

      --

      LedgerSMB: Open source Accounting/ERP
    2. Re:Depends on what you mean by a good programmer by Nevyn · · Score: 1

      Sure ... because optimizing, like security, is at it's best when tacked on the end. How could I forget so quickly.

      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
    3. Re:Depends on what you mean by a good programmer by einhverfr · · Score: 1

      Not all optimization should be done at the back-end tacked on. But unlike security, I don;t think you should do too much up front either (at least not in version 1.0 of software).

      "premature optimization is the root of all evil" comes to mind. Usually this means identifying bottlenecks once the software is in use, unfortunately.

      --

      LedgerSMB: Open source Accounting/ERP
    4. Re:Depends on what you mean by a good programmer by CrankyOldBastard · · Score: 1
      Perhaps you're being sarcastic, but I'll bite anyway...

      There is nothing similar between optimisation and security. Early optimisation paints you into corners, and will reduce your flexilbility when requirements change (as happens in real software development). Make sure that the design is secure from the start, and then make the software work. Then start profiling and then optimising. This way you don't waste time pruning microseconds from code that's rarely run whilst missing the millisecond+ speedups from somewhere else, and you don't have to try to understand your tricky but blindingly fast code when you realise that the client didnt actually understand what he needed the software to do.

      A classic example I saw was code where over a week was spent setting up superfast locking primitives, saving lots of CPU cycles and allowing massive concurrency, when the software was actually bound by network latency talking to the database. This added about $2000 to the cost of development, but provided no real speedup for the application, whilst making any changes to the system much nastier as programmers had to jump through all these extra hoops to make sure they did things The Right Way.

  94. Yes Assembly language is still needed today and .. by 3seas · · Score: 1

    .. even more so tomorrow.

    But first there needs to be a change in the way we understand the creation and use of abstractions that lead to higher level languages.

    Take any computer language of a higher level of abstraction that assembly language and know that it can be reduced down to assembly language which is far more efficient in its use of clock cycles then higher level languages (which all have to eventually be reduced down to machine language or 1's and 0's)

    Now in knowing this, it's obvious that it really comes down to doing the translation down the abstraction ladder BEFORE a compile or assembly into machine language (binary).

    Todays methods are sloppy and generate more binary than is really needed to create most any program done in a higher level language. And the more binary also means the higher probability of human error.

    This all shows where Computer Science has failed, as the genuine science shoudl have been focused on such prior to binary generation, translation down the abstraction ladder in a manner that holds better output.

    However, as software takes the skill of abstraction creation and manipulation understanding to produce, it is also the one industry where the phrase "if you can't dazzel them with brilliance, baffel them with bullshit" really sums up what all the abstractions can be used for.

    All to often the sales hype makes all sorts of claims that in actual use are not what they were said to be.

    Its all about the use of abstractions.

    Its just to bad that Computer Science itself became polluted and distracted from honest science so much that the real research of dealing with Abstraction Physics and the abstraction ladder reduction for code output has in practicality been forgotten.

    But it took 300 years for the easier and much more empowering hundu-arabic decimal system overcame the highly inherently constrained roman numeral system of doing math.

    And just as computer technology couldn't even been imagined thru such limitations as the roman numeral system presented, so is there advances and technology and markets yet to be imagined with the current failure of Computer Science.

    Imagine the task of writing just the software for a holodeck? And since that is beyond the reach todays programming methods, certainly the physical interactive interface as depicted on star trek, is preceived as only ever being fictional.

  95. The long way by quantaman · · Score: 4, Funny

    I realize that assembly is very useful to know and can be useful in certain instances.

    But writing in assembly has always given me the same feeling as eating rice with a single chopstick.

    --
    I stole this Sig
    1. Re:The long way by Anonymous Coward · · Score: 4, Funny

      Hey, no deadlock.

  96. The C Conspiracy by jd · · Score: 3, Insightful
    There really isn't a language called C. It's just a bunch of assembler macros. :)

    Seriously, assembly is important for all the reasons you noted, but also for some others. If you know assembly, the chances are:

    • You know how to design the software, because you got sick of trying to debug in a disassembler
    • You know how to express the design cleanly - unclean assembly is longer, so takes more effort, and is murder to debug
    • You know how to add structure to the code, as it's easier to test and fix a small subroutine than a gigantic blob
    • You know how to avoid unnecessary structure, as exploding stacks is generally not a good idea
    • You know how to re-use code, as it is pure hell to repeatedly reinvent anything in assembly

    All software engineering, computer science and programming courses should start by requiring people to program a non-trivial application on an ARM processor, or something with an equally limited instruction set, in pure assembly. Why? Because then you get people who think, who program with care and forethought, who think of bloat not in terms of adding more RAM, but in terms of opportunities for bugs, glitches and gremlins. Sure, you'll get more dropouts. The computing world doesn't need more code monkeys, so it's no loss if they did. Who needs a society of half-baked, semi-literate coders?

    This is not elitism, because I'm not saying that anyone should be excluded from the profession. I don't think they should. What I do think is that society needs to make damn sure that the typical coder isn't the worst coder, which is what you get if people are trained to NOT think but to let the computer do the thinking for them. Windows may act like a HAL-9000 at times, but trust me, it isn't remotely capable of anything resembling thought. A bad design or a poor implementation will not be rectified by some magical intelligence in the machine, because there isn't any.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    1. Re:The C Conspiracy by leenks · · Score: 1

      While I can see your point, I don't think it really applies now. Times have changed and there are now thousands of times more programmers in the world because thousands more businesses need (or want) software to help them.

      I think that 99.9% of business software does not need any of the things you talked about - it just needs to be written in the first place, even if it is a nightmare to maintain. Lots of this code will be written, out of necessity and the shortage of "good" programmers, by people that have no idea about assembly language programming or the underlying computer hardware - but it really doesn't matter.

      And yes, the world needs a society of half-baked, semi-literate coders. They can come up with the VBA / MS Word Macros, the Excel spreadsheets and the websites that keep the world running, while the good ones can go and write the software that this stuff runs in/on.

  97. Weak abstractions by myopiate · · Score: 1

    Isn't there some law about this? Law of weak abstractions or something? From what I understand, basically all program languages don't do a good job of simplifying the way to make a computer do what you want it to do. There is always some little detail/trick below the surface that the language cannot deal with or deals with in a peculiar way. So... learning how the lower level stuff works will only improve your mastery of the higher level stuff. Assembly language is as close to the hardware is your going to get. You have to read hardware manuals to actually do any REAL work in assembly, otherwise you are just writing non portable code.

    Was it my my university professor, or Djikstra, or someone else who come up with this law?

    1. Re:Weak abstractions by nuzak · · Score: 1

      I believe the term you're looking for is "Leaky Abstractions", which is Joel Spolsky's term. And it's not intended for languages, but for incompletely-specified abstractions that end up exposing implementation details. Like most things Spolsky, he has a point, but take it with a shaker of salt.

      Exposing the implementation isn't even limited to programming. My TV has a pretty friendly interface, connectors that are easily accessible, and two component inputs. Which for some truly odd reason are labeled "YpBpR1" and "YpBpR2" (the capitalization may be off). I know only vaguely what these stand for, but daily I'm mystified why I should care. It's not like the "Tuner" input says "NTSC" or anything.

      --
      Done with slashdot, done with nerds, getting a life.
  98. It Was Very Valuable For Me by NeverVotedBush · · Score: 1

    I learned to do assembly programming a long time ago and it has been paying me back ever since. Knowing at least a little about what a program really does on the inside give you a huge advantage when it comes to debugging, trying to write tight code, and especially when working in the embedded world. Actually, in the embedded world, knowing electronics and how things like analog-to-digital converters work also pays off big time. Having insight into the guts of what is really going on can't be overstated as how valuable it is and the only way people will appreciate that is when they themselves see how valuable it is for them.

    That you can see from all the people posting that say the same thing.

  99. Steve Gibson seems to feel it's worthwhile by Kevoco · · Score: 2, Informative

    from http://www.grc.com/smgassembly.htm
    Huh? . . . Windows in Assembler?

    Am I sick? Perhaps. Am I a dinosaur destined for early extinction? Yeah, probably. But I truly love programming. It's what I do. It fulfills me and sustains me . . . and I'm never in a hurry to "just be done with it." I can't stand sloppiness in my work, so for me that means writing the smallest, tightest, fastest, most economical computer programs possible. And THAT means authoring Windows applications in Assembly Language.

    Though the rest of the world may argue that they're more "productive" (when measured by hard disk space consumed per second), I stand by the principle that: "Small Is Beautiful".

    1. Re:Steve Gibson seems to feel it's worthwhile by justthinkit · · Score: 1

      Nice to see someone else think of Steve Gibson and assembly. I think Spinrite is, pound for pound, some of the finest assembler ever written. That interface was downright cool, especially when DOS was what most of us were using. All in about 80KB.

      --
      I come here for the love
  100. Yes... by SETIGuy · · Score: 1

    Every programmer should know an assembly language. It's a good start, but it's not nearly enough.

    • They should also learn when not to use it.
    • If they are programming for a cached memory architecture, they should know that reordering memory accesses can be more important than using assembly.
    • If they use GCC should know how to use the full spectrum of inline assembler syntax. (i.e. let the compiler allocate the registers).
    • If they program for x86 and compatibles, they should understand why their optimal Pentium 4 code isn't optimal Pentium M code.
    • They need to know optimal programming isn't just about learning tricks. Some trick are good (i.e. Carmack's inverse square root). Some are pointless, dangerous, or both (most examples of recursion, XOR swap).
    • Learning PPC assembly isn't going to help them figure out PIC programming. Learning PIC programming might help them learn PPC assembly.
    • If it's that good an optimization, put it in the compiler. Everyone should learn to modify the code generation of their favorite open source compiler.
    • If it might kill someone, do it right even if that means its not optimized.

  101. Re:Isn't it the root of all programming languages? by JohnnyLocust · · Score: 1

    Isn't knowledge of assembly language for microprocessors required to create a higher level programming language?

    NOP ... Errr, I mean Nope!

  102. Relevancy by wm32gonz0 · · Score: 1

    Depends on what your doing...does speed matter? Are you attempting to inject a little carefully crafted code into the stack? I say there is definitely a reason to learn Assembly, I mean even if you are an accomplished C, C++, Delpi programmer...you can't really know where your art is going until you know where it's been. Take the time...it will pay great dividends when you find yourself needing to call a little bit of high speed assembly from inside your C, C++, Delphi program. I've also found it fun just to code some otherwise common methods in assembly knowing that my co-workers are not familiar with it...just to watch them scratch their heads...shame on me. If nothing else...you can at least add it to your resume. "Not all things are as they appear...especially the invisible things." Rock on Joanna.

  103. Yes and more by tknd · · Score: 1

    A good software engineer should understand assembly, how that gets translated into machine code, and how the processor uses the machine code. He should also understand the memory hierarchy, how basic cpu designs work (single cycle, multicycle, pipelined). He should also understand DMA, something about hard drives (layout of sectors, tracks, and cylinders). He should also understand something about compilers and how they can perform certain optimizations and how they get from high level code to machine code.

    This isn't out of necessity in designing hardware, but for if/when you take a job that deals with the hardware, you won't be lost. These areas typically include operating systems, drivers, firmware, and compilers. Even then, some places want even more from a software engineer because often you're dealing with a custom-made piece of hardware that probably doesn't have your standard screen output device and keyboard input device. Instead you start working with an emulator and then you go load the software on the actual hardware and have to use the hardware test tools to do your testing.

    Now if your goal is to be a "C++ Programmer" or a "Java Programmer" then maybe you don't need to know all of those things to be successful. But if your goal is to be a good software engineer then be prepared to never stop learning in both technical topics AND social topics (how you work with other people like programmers/customers to get the job done).

  104. Yes it is! by sudden.zero · · Score: 1

    Assembly was the first language that I learned. We used it to program 68HC11 Micro controllers. To this day I am glad that I learned Assembly first even though I use C++, Java and Python more than anything now.

  105. Re:Yes. -- No by dlmarti · · Score: 1

    No, it's essential to know how things work underneath the hood.

  106. Still relevant, but... by pinkfloydhomer · · Score: 5, Insightful

    Hmm. Assembly is still relevant and useful for certain tasks, of course.

    But two things come to mind:

    1: Handcoders can code better than good compilers?

    Yeah, in some cases after a lot of refining. But it is not as easy as it once was.

    Compilers have gotten much better and processors have gotten a lot more complex. It's not just "how many clock cycles does this instruction use?", you also have to take various forms of micro-parallelism (pipelining, branch prediction, etc.) and cache hierachy issues into account.

    2: It's good to know what goes on under the hood, sure.

    But in many, many software developer tasks, early optimization is the root of all evil.

    I would actually much rather recommend a top-down approach for most problems, abstracting away low-level details, rather than going bottom-up. The teaching approach of the great "Accelerated C++" comes to mind.

    A lot of developers that know a little or a lot about low-level programming write less than excellent code in other regards (algorithmic complexity, design, re-use, etc.) and they can't seem to stop focusing on performance throughout the process.

    For most problems, performance isn't critical, and even when it is, it might be better to look for algorithmic enhancements (lowering complexity) rather than do low-level fiddling. /David

    1. Re:Still relevant, but... by Vexorian · · Score: 1
      Repeat with me: "Performance is always critical."
      Now repeat this: "Optimization for practical programming is always about complexity."

      In other words, you can always write faster code in low level languages, but not every programmer actually can do that. Low level languages are only faster if used correctly, if you seriously have no idea or tend to hang yourself after some optimizations (which is the case for like 95%) stay with the languages that have compilers that do the optimization for you.

      But this does not mean assembler is irrelevant now, quite the opposite, with time asm programmers will get more and more scarce, however new platforms will keep getting created. People able to make JIT compilers for these platforms would always be necessary, thus the whole low level stuff is still necessary...

      On the other hand, it should never get out of the college collection of subjects. Knowing "how things work" is always necessary, you really shouldn't call yourself a Software Engineer if you didn't know how it works. And I would dare to say that learning assembler will make you better when dealing with the high level languages or at least make you appreciate how much the compilers do for you.

      Which btw, every computer science student should be able to make a compiler... Automata and grammar theory is already taught (at least I have been taught that...) you should really be able to make a compiler even if you maybe won't ever need it. Or to the least, understand how emulation in general works.

      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
    2. Re:Still relevant, but... by angus_rg · · Score: 1

      Good post.

      Basically, you need to evaluate what you want to do and why assembly is or is not relevant, and decide, is ease of understanding and reuse not as important as efficiency. I have a degree in Computer Science and work in Computer Security. I have found the Assembly/Operating Systems classes to be unbelievably useful in understanding exploit concepts and code, despite the fact that I rarely code in it. Could I still do my job without it? Certainly. Would I be as good at what I do? Probably. Does it make me a more efficient programmer? Yes. Will any one notice a difference with the latest billion core processor? Probably not. Is it easier to write a bug that goes unnoticed? Certainly. Does efficiency equal good programming? No.

      Certain things will always require assembly knowledge: Gaming and Graphics that require speed; reverse engineering malware and AV/ad ware detection software to detect malware, avoiding system library calls that may be corrupted to prevent detection, portions of operating system kernels, device drivers/firmware, and devices that have simple circuitry for specialized, time sensitive functions like a robot programmed to quickly get me a beer from the fridge so I dont miss what Im watching on TV.

      If you are writing a guidance program for a missile, a few less instructions could be the difference between life and death, where as if you are writing a heart monitor, readability and ease to debug problems may be more critical. The brain can live without blood for 4 6 minutes, a few less instructions will buy you nothing, and if it did, youd probably end up being a vegetable anyway. Maybe they should write that kind of stuff in Cobol to bring down health care costs.

      Assembly will not make you a better programmer, like being versed in Impressionism will not make you a better artist. Like programming, you are either good at painting, or you arent, unless it is non-objective, which always sucks.

    3. Re:Still relevant, but... by senatorpjt · · Score: 1

      where as if you are writing a heart monitor, readability and ease to debug problems may be more critical. The brain can live without blood for 4 6 minutes, a few less instructions will buy you nothing, and if it did, youd probably end up being a vegetable anyway. Maybe they should write that kind of stuff in Cobol to bring down health care costs.

      You still want the heart monitor to be reliable. It seems like the less layers of abstraction between the user interface and the hardware would help in this regard, just by minimizing the number of things that can go wrong.

    4. Re:Still relevant, but... by angus_rg · · Score: 1

      Would writing it in assembly make it more reliable, considering how much easier it is to make a mistake that goes unnoticed?

    5. Re:Still relevant, but... by senatorpjt · · Score: 1

      Well, for applications without a lot of complexity, yes. If you're writing code in assembly, it's all you have to worry about. Writing in a high level language, you have to worry about every intermediate tool in the chain that gets from high level language to machine code.

  107. Dumb question by briancnorton · · Score: 1
    Is assembler still relevant, of course.
    Do you need to know it if you want to be a proficient average programmer? No. (and there's nothing wrong with that)

    If we go back to the tried and tested car analogy whereby IT staff is Jiffy lube and programmers are the manufacturers, then the person writing assembler is the engineer in the lab optimizing how air combusts in the cylinder for optimal power. The factory doesn't know and doesn't care, it just needs the parts and an understanding of how they should go together.

    There's nothing wrong with a career writing web-apps using VB.net, but if you want to work at the system level, going beyond what comes in the visual studio box, you need things like assembler.

    --

    People who think they know everything really piss off those of us that actually do.

  108. debugging by aachrisg · · Score: 1

    As an old school assembly language programmer who now programs in c++, I don't understand how people debug the "hard" bugs without any assembly knowledge.

    1. Re:debugging by Anonymous Coward · · Score: 2, Insightful

      They stare at the code for a while, make wild guesses about how the problem could have happened, add a lot of couts, and hope for the best. Seriously.

    2. Re:debugging by JackMeyhoff · · Score: 1

      They stare at the code because they dont know the solution they are looking at and all its qurks that the original creator would know. This is why we all hate inheriting somebody elses code. This is because we are too full of ego, hack in workarounds and so on, because? Because we design it to be FAT software, we need to think smaller objects, smaller API's smaller smaller smaller! How often have you seen objects that are really 2 or 3 objects rolled into one? BLOAT. Abstraction is great when done right, you can unit test the objects properely, they do one thing and one thing WELL, not 3 or 4 things. If I find my self scrolling screen loads of code, I start to think its time to refactor.

      --
      http://www.rense.com/general79/wdx1.htm
    3. Re:debugging by GuyWithLag · · Score: 1

      Shotgun Debugging: http://catb.org/~esr/jargon/html/S/shotgun-debuggi ng.html . Sadly, I've seen it too often for comfort.

    4. Re:debugging by Bruce+Dawson · · Score: 1
      > I don't understand how people debug the "hard" bugs without any assembly knowledge.

      Absolutely. Any professional programmer should know how to *read* assembly language. Otherwise they may find it impossible to debug optimized code, code with no symbols, code-gen bugs, and all sorts of oddball issues. If you don't mind having to go to an expert whenever you hit a hard problem then by all means don't learn assembly language. I will happily be that expert for you, and I will make more money because of it. If you want to rise to the top of your profession and be productive, then learn how to read assembly language. Writing assembly language, on the other hand, is 99.99% obsolete. Still needed occasionally, but rarely worth it. Most developers will only make their programs worse (larger, less portable, harder to maintain, and *slower*) by writing them in assembly language.

    5. Re:debugging by BrokenHalo · · Score: 2, Funny

      They stare at the code for a while, make wild guesses...

      Sure. But that's only because "The C Programming Language [is] A language which combines the flexibility and power of assembly language with the readability of assembly language". ;-P

  109. Re:Well, no. by Eli+Gottlieb · · Score: 1

    The more efficient replacement is simply to keep an int or long int containing the length of the string (assuming fixed-size ANSI chars) and pass that around in a struct or something with the actual pointer to the start of str1. This is the way all languages with real string data-types actually handle the problem, and code that returns a beginning pointer and an int for jumping to the end without searching for it will simply run faster (all else equal, of course).

  110. Not for most of us by Anonymous Coward · · Score: 0

    For 99.9% of programming that happens, no, no it isn't.

  111. depends.... by crmartin · · Score: 1

    Do you want to be a real programmer when you grow up?

    Do you want to be able to see if your compiler has savaged you, in one of those rare cases where the compiler doesn't generate efficient code?

    Do you want to understand why your C program is throwing segfaults in your sprintf?

    Do you think you might like to do hard real-time stuff? Or firmware?

    Do you want to know what the computer is really doing, or are you satisfied to know it's just black magic?

    Do you want to understand why a SPARC or PPC might have advantages --- and disadvantages --- over an IBM 360 or an x86?

    Then yeah, you should learn assembler. At least one.

    1. Re:depends.... by nagora · · Score: 1
      in one of those rare cases where the compiler doesn't generate efficient code?

      Rare?! All compilers generate inefficient code almost all the time. However, with faster processors today "inefficient" is usually fast enough. A human who understands the problem can always at least match any compiler, and almost always beat it, but the development time is normally a bigger issue than the execution time.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  112. You're kidding, right? by Dr.+Mu · · Score: 1

    I have a friend who was in the Air Force. He said there was a saying among officers that went, "If you ain't a pilot, you ain't $#|+." Now, in programming, replace "pilot" with "assembly programmer".

  113. Programming in Assembly language is kind of like.. by DoctorPepper · · Score: 3, Insightful

    Communicating in Morse code. It's a pain in the ass to learn, but when you do, you find the rewards more than justify the effort spent.

    Also, it's good to remember that Assembly language is just one more tool in a programmer's tool box. I wouldn't write throw-away scripts in Assembly language, just like I wouldn't use C. I'd probably use Perl, Python or shell script, as necessary. When you need to hand-tune that algorithm to get that last little boost in performance, being able to drop down to Assembly language can save the day. Too bad it is a dying art.

    On another note, I agree with the other posters that said learning Assembly language allows you to learn the hardware better. 8086 Assembly language was my second language (after BASIC), and I used it for several years, until I started using Windows and found it was much easier to write a Windows program in C :-)

    --

    No matter where you go... there you are.
  114. Could the same be asked of Latin? by dubbayu_d_40 · · Score: 1

    Since understanding Latin gives one a better understanding of teh language they're actually using. Right?

    1. Re:Could the same be asked of Latin? by MLease · · Score: 1

      I'm not sure how you mean this, but I did take Latin in high school (all 4 years), and while I don't use it for anything now, I know that it has improved my understanding and knowledge of English significantly.

      -Mike

      --
      I'm sorry; I don't know what I was thinking!
  115. Obligatory by Anonymous Coward · · Score: 0

    He who hasn't hacked assembly langauge as a youth has no heart. He who does so as an adult has no brain.

    - J. Moore

  116. Re:Well, no. by TwobyTwo · · Score: 2, Insightful

    I think you're suggesting that for certain kinds of optimization it's as important to know about machine architecture and organization, I.e. things like cache associativity and size, relative speed of memory vs. registers vs. cache, etc., as it is to know or optimize the use of particular "assembler" (actually machine) language instructions. Good point. Still, if you want to know how many memory accesses either the presupplied strcat or your own alternative are going to issue, and which addresses they're going to hit, knowing machine language is a big help.

  117. As long as we still have OSes by OrangeTide · · Score: 1

    As long as we have OSes we will need at least a little bit of assembly. Some things are so architecture specific there is no portable way to do them in a higher level language. Like PowerPC style TLBs versus x86 page tables. Virtualization is very specific to each architecture, and Intel and AMD have different approaches to the problem. Also virtualization without special processor support as VMware does requires a major amount of architectural knowledge, and I have little down in my mind that the ladies and gentlemen at VMware spend a significant amount of time reading assembly.

    People who write compilers might want to know some assembly language too. I think that's a fair assumption.

    The fact that our dependence on compilers, more advanced operating systems, hypervisors and virtualization proves that assembly is not dead.

    --
    “Common sense is not so common.” — Voltaire
  118. It's fun by Pojodojo · · Score: 1

    I learned it for the comp sci program, however I would have to say that it is one of the most fun languages I have learned.

    There are so many things you can do with it, maybe not many truly useful things...

    I did find a practical use though, I used it to write a prime number program for the Altair 8080.

    --
    arrrg, (like a pirate)
  119. I have a more important question to ask by Anonymous Coward · · Score: 0

    In an era when we could conceivably get all the daily nutrients we need to live in a delicious canned protein shake, do we still need teeth?

  120. Yet another reason it is still relavant by certain+death · · Score: 0

    You can use it to hack DirecTV and Dish Network cards, just don't forget to close the memory hole when you are done :o)

    --
    "My immediate reaction is "WTF? What kind of moron doesn't make things 64-bit safe to begin with?" Linus
  121. More by DeadCatX2 · · Score: 2, Interesting
    • Designing a microprocessor. This is the worst, because you have to understand the entire architecture, what kinds of operands are possible, and you must manually enumerate opcodes and such. Essentially, creating your own assembly language.
    • You want to take advantage of processor-specific instructions which are not in a high level language (except as intrinsics). Things like CPUID, various SSE instructions, etc.
    --
    :(){ :|:& };:
  122. Firmware? by Anonymous Coward · · Score: 0

    Firmware.

    anyone who codes for micro procs better know ASM very well. Granted more and more devices have C compilers available but to get the kind of performance you need it is often required to at least code some key functions in asm. Then there are entire families that do not have decent C compilers (anything below microchips PIC18 series for instance). perhaps this is more important to EE and CE(myself) majors than CS majors, but the CS guys at my school really only ever looked at asm in one class anyway, though it did not have a very strong CS program.

    -xian

  123. Its funny that you use that example... by Anonymous Coward · · Score: 0

    For example, once you understand that your CPU only has a limited number of registers, you'll understand why (on some CPU architectures) it is a good idea to limit the number of function arguments so that they can be passed via registers, and that you should put the arguments that you are most likely to use at the beginning of your prototype so that they have the best chance of already being in a register.

    ...because if you're writing any performance sensitive but portable C/C++ code, the practise of reordering your arguments probably doesn't matter, assuming of course that you are using a compiler of reasonable caliber. This is because your performance sensitive code is probably in a single source file, or more specifically a compilation unit, and the optimizer has open season on your code. These optimizations may include inlining the ass out of your functions, turning expressions inside out, and reordering function arguments.

    Of course, you could be writing for some embedded platform with a second rate (if not outright buggy) toolchain. If thats the case your observations apply and... well... I feel sorry for you.

    1. Re:Its funny that you use that example... by dgatwood · · Score: 1

      Yes, compilers inline functions sometimes. However, for any case where this does not occur, your code will perform faster if the more frequently accessed arguments fit into registers. Period. No, you can't fix that in an optimizer because changing the parameter order because the parameter order is hard-coded into the ABI. Go read either the PowerPC or x86-64 System V ABI.

      Now if you REALLY want to reorder parameters, you might come up with some clever object format hints to tell your compiler that the order of a function's arguments is nonstandard, but if you do, you'd better understand that you will be creating code that can't safely be called from code compiled with any other compiler on the planet.... I'm not aware of any compilers that do this, and I've also done a good bit of searching and haven't found any evidence that suggests that anybody does this. Want to write it and patent it? Just be sure to list my name on the patent.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    2. Re:Its funny that you use that example... by Anonymous Coward · · Score: 0

      Yup thats true; I completely understand ABIs. Its just that in every situation where I've been writing performance sensitive code where parameter ordering can play a significant role, I've had the opportunity to inline. If you don't, then you're probably doing something wrong; worrying about argument ordering when you cannot inline seems like a runner worrying about their running shorts when they don't even have shoes.

      As for reordering parameters, you may wish to take a look at GCC's regparm attribute. It allows you to flag certain parameters as to be placed in registers.

  124. Learn as much as you can about what you do by Anonymous Coward · · Score: 0

    Learn as much as you can about what you do, in as many different ways.

    If you use .NET or Java on the job, you don't need assembly. But if you only learn how to do things the .NET/Java way, you are missing a lot of opportunities to make your code simpler, faster, more efficient, or just plain aesthetically pleasing.

    Learn the C way, learn the assembly way, learn the VBScript way, the C#, and Java, and maybe even some of those utilitarian things like Perl and Ruby.

    Also, if you know assembly, nearly all proprietary applications are open source. I did ASP coding, of course moved to ASP.NET. We had a request to change one application - no one wanted to take it on, but I did. Why didn't they want it?

    The job was to rewrite an extended stored procedure for MS SQL, which connected to some other appliction via a third party library. That means it was a compiled .dll (no source) which used an SDK for which the only documentation we had was another .dll. I disassembled the crap out of it, figured out how it communicated with the SDK, and managed to update the extended stored proc so that some idiot who knows only SQL could do his job.

    That's not within my normal scope, but I was able to do it and no one else could. We could have said, no way you just deal with it, but our team got out there as someone who just plain gets shit done. And, I have an understanding of how these systems work together.

    I'm rambling now. Learn as much as you can about what you do. you will save yourself time, your server energy, your company money, and most of all maybe Al Gore will finally have nothing to talk about if we reduce the amount of energy used by computing resources. Yep more rambling.

  125. Answer to "What's hard about pointers?"... by tlambert · · Score: 4, Insightful

    Answer to "What's hard about pointers?"...

    There are people who cannot grasp the difference between "a thing" and "a respresentation of a thing". In fact, there was an entire century where almost the entire school of French philosophers were unable to grasp that there was a difference.

    For pointers, it comes down to realizing that a pointer to memory is not the memory, it's a representation, and the real memory lives somewhere else: at the dereference of the pointer. And at that location it takes up real space. And so does the representation (but it's comparatively tiny).

    The ability to make this disctinction comes naturally when you've written assembly code of any complexity, since you've had to manage the memory yourself. But if you've never done that, or, worse, you've only ever programmed in languages which eschew pointers and try to pretend that their own internal implementations don't use them, even if they won't let you use them, well, then, you've got a conceptual problem. An that conceptual problem is going to be very hard for you to overcome.

    It also makes it very, very hard for someone to understand row-major vs. column major languages, or how you would link a program in one against a library in another, and be able to usefully communicate your data between the two. Or it makes it hard to understand the difference between "call by value" and "call by reference.

    If I'm interviewing someone, and it becomes clear that they need a "code interview" because some things don't add up between their banter and their resume, the first thing I whip out is a pointer problem.

    -- Terry

    1. Re:Answer to "What's hard about pointers?"... by 4D6963 · · Score: 2, Informative

      I hate to think of pointers as a "representation" of something. (Disclaimer : I'm a C and ARM ASM coder) When I learnt Pascal I thought that to call it a "representation" was utterly confusing. Just call it an address, because that's what a pointer is, it's as simple as that, it's an address, it's so simple.

      --
      You just got troll'd!
    2. Re:Answer to "What's hard about pointers?"... by ObsessiveMathsFreak · · Score: 1

      I like to think of it as a little more. A pointer, in reality, contains only one address in memory. But the pointer itself is designnated as pointing to a specific type of data. So when it points to the start address of a block of data, there's also additional things about that pointer that tell you how to find all the rest of the data type.

      It's like mass biscuit templates. D you know the ones that are segmented into different biscuit shapes. You roll the dough flat and press the template into it to cut out the different shaped sough pieces for cooking the biscuits. But obviously, by placing down the template to cut only one biscuit, you automatically determine all the rest of the biscuits.

      Pointers are like those biscuit templates. And memory is like the dough. The address is the location of just one biscuit, and once placed into the dough(memory) all the rest of the data pieces(biscuits) are determined. Think of the dough as containing raisins, etc, peppered all over the place, to represent non homogeneous data in memory.

      --
      May the Maths Be with you!
    3. Re:Answer to "What's hard about pointers?"... by dan+dan+the+dna+man · · Score: 1

      Really, that is *not* a helpful analogy ;)

      --
      I don't read your sig, why do you read mine?
    4. Re:Answer to "What's hard about pointers?"... by Gazzonyx · · Score: 1
      Not flamebait, although it will sound like it.

      So, I guess that's why java programmers have a layer of abstraction between them and the pointers. I've found that java is *mostly* pointers under the APIs, but they don't let you touch very much. Coming from a C/C++ background when I started java, I always wondered why they kept smacking my hands when I wanted to touch the memory... I guess this is the difference - true OOP is about tying together objects, not programming in the classical sense. Unless you're the implementor, but in that case, you're not really leveraging (buzz word!) the OOP API, rather, you're constructing it.

      I guess that's where the gap is. The people who don't understand the abstraction are content to just use the objects and tie them together. Whereas those implementing and designing (not in that order, obviously) 'get it' and take care of the pointer details.

      Don't get me wrong, I'm sure there are plenty of java programmers that could code around me, but I've wondered what it was about them that I've never much 'clicked' with them much. I 'click' with C/C++ programmers just fine, and I'm guessing that it has to do with like minds on some level where concepts are concerned.

      Just as a for instance, I've wondered why java is so rigid on its use of language to describe things. All definitions are set in stone and simply must be used in the correct context or you can lose a group of people. Like, I know the difference between a class and an object, but in more casual conversation I use them somewhat interchangably. I take it for granted that whomever I'm speaking with understands when I'm using class or object out of context, I'm speaking of an object. I might say 'X' is a class that I use for yadda yadda, while talking about it's instianted object XY. It seems now, while thinking about it, that there are programmers that work in the concrete but not at all in the abstract (no, I'm NOT talking about abstract classes!), while other can move from abstract to concrete seamlessly.

      It seems, to me at least, that ASM has elements of both. Registers are concrete, but they can hold memory addresses, and then they become abstract.

      ld [%l1],%l1

      Am I way off base here?

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

    5. Re:Answer to "What's hard about pointers?"... by 4D6963 · · Score: 1

      I agree, I hardly even understood it. Just call it an address and the index an offset to that address, no need for damn biscuit analogies.

      --
      You just got troll'd!
  126. Re:Well, no. by Nrlll9 · · Score: 1

    Mod parent up!

    lol at worrying about the efficient of strcat()

  127. Re:Isn't it the root of all programming languages? by 0111+1110 · · Score: 1

    A higher level language will most likely give you a wider range of ways to solve a problem within the given limitations.
    I may be completely lost here. If I am please help me out. It was my understanding that one advantage of assembly is that there are far more ways of solving a given problem. In a compiled language some assembly language programmer decided what functions should be included in the standard library and then what each function should do exactly. How much error checking. Do most people need to do this or that? Those sorts of things. In reality one function may actually be using hundreds or even thousands of lines of assembly. So in general, if you are going to rely on function or object libraries written by someone else, then it is either their way or the highway. I don't see how this is giving you a wider range, but maybe I am missing something here. By programming in (just to use one example) 'C' are you also assuming that you will be hand coding your own functions and then using the resulting 'high level' language? If that's the case then you will get no argument from me.
    --
    Quite an experience to live in fear, isn't it? That's what it is to be a slave.
  128. YES! by dark12222000 · · Score: 0

    ASM is useful in several applications. Most notably low level electronics and theres plenty of complex problems that do require it to be written at the machine level. Lets not even get into boot scripts or anything involving low level booting. You don't need to be an expert but you should have some basic understanding so as to be able to peruse ASM and understand what the hell is going on.

  129. Again? by boxxa · · Score: 1

    I think this falls under the typical "Which language is better?" argument. Its all based on the developer. Like it has been posted, if you are working on programming chips and kernel modules, then you its something very useful. I am a web and desktop developer. I mainly use Visual Basic for desktop because its ease and build times are very key to my application development. Me learning assmbly would be a waste of time, however my friend who writes kernel modules and programs flash chips for on board circuits is a BIG thing for him where knowing how to write a desktop program is minor.

    --
    Bryan
  130. Here's another by waimate · · Score: 1
    All good reasons, and here's another
    • You're writing some software which will run on modern, fast computers. The software does a bunch of stuff, frequently on very large volumes, and you want your software to go faster than your competitors. So you analyse the performance, and discover there's four places where three lines of code consume 75% of total execution time. By rewriting those 12 lines in assember, the rest of your half million lines goes twice as fast as it used to, and you sell more software than your competitor who wasn't prepared to go the extra mile.
    The nice thing about this reason is that as hardware gets faster, the reason remains.
    1. Re:Here's another by countach · · Score: 4, Insightful

      Maybe, except that not many assembly programmers can make faster code than a C compiler anyway. It's no use being a mediocre assembly programmer.

    2. Re:Here's another by Anonymous Coward · · Score: 4, Insightful

      To consistently beat a C compiler: Write your code in C with inline assembly if required, then compile through Assembler to get assembler source code. Next, hand tweak the assembler code and add C as comments. Pretty soon you will start to think like a compiler and your C code will get better too!

    3. Re:Here's another by blahplusplus · · Score: 1

      "Maybe, except that not many assembly programmers can make faster code than a C compiler anyway. It's no use being a mediocre assembly programmer."

      A mediocre assembly programmer can become better with practice. Also there is simply doing something for you to better understand the hardware you are dealing with. In my mind the more you understand the underlying hardware the better equipped you are as a programmer, even if you are a "mediocre" one, the knowledge and tool itself is still indispensable when you need it. The thing about assembly in my mind is that its foundational knowledge is indispensable when you need it, like any language assembly is a knowledge and tool that is to be used where its needed. That's why it exists, until the full automation of problem solving by artificial means (i.e. AI or what have you), assembly in my opinion is very useful, and I'm sure windows contains quite a bit of assembly where it's needed in terms of speeding up responsive times of different aspects of the GUI.

    4. Re:Here's another by mdwh2 · · Score: 1

      Can you cite an actual example where hand-written assembler would be faster than the code which any modern compiler would generate? I'm not saying that no such case, but I'm just curious, as there's this common myth that rewriting anything in assember makes it faster.

      I was amused by a recent post I saw on a forum where someone asked how to write something in assember, "to make it go faster". Someone suggested he take a look at the dissambled code generated by the compiler, and paste that into his code...

    5. Re:Here's another by senatorpjt · · Score: 1

      mod parent up.

      I hadn't really thought about it in this way, but really, that's the most important reason to learn assembly language. Even if you never actually "use" it, or you learn it for an architecture that you end up not working on (doesn't Knuth have some sort of artificial assembly language).

      Knowing how assembly works helps you think of how code should be written in higher-level languages. Not just how to write a program that does what you want it to, but how to write it in the most intelligible way for the computer, not just you.

    6. Re:Here's another by waimate · · Score: 1

      Sure - happens to me several times a year. I don't want to get into actual code examples, but in outline the first step is to profile your program so you understand where the bottlenecks are. Then profile those bottlenecks in detail. I use VTune. Frequently it comes down to a couple of tight loops somewhere. Then, using your long experience of coding assembler and your in-depth understanding of the performance characteristics of Intel CPUs, recode the loop making maximimal use of registers, careful choice of instructions which use fewest cycles, interveaving instructions to get maximum number of execution units operating in parallel, etc.

      A human *always* has a better understanding of the big-picture issues and available trade-offs than a computer does. Compilers are good at generating RISC code, because there are few other ways to generate. Intel CPUs are CISC, and the opportunities for radical re-expression are multitude.

      Sure, it's not true that rewriting *anything* in assembler will make it go faster. And IMO there is no value in capturing the assembler output from your compiler and starting with that, because quite frankly if you have to do that and can't start from scratch(ish), then you're unlikely to be able to concieve or execute the sort of re-expression that will yield dividends.

      Compilers frequently generate code that sh/w/ould make you weep. Usually it doesn't matter. But let's say you're processing 10TB of text, then for those bits where you are doing something for every character processed, there will inevitably be fragments of code which are expensive to run, and for which other options exist, and where replacing 3 lines of code with 30 lines of assembler might drop your total runtime by 10 or 20%.

  131. What is the difficulty to learn cmp C++ Data Struc by mojo0716 · · Score: 0

    What I would like to know is how hard it is to learn and comprehend Intel x86 Assembly language compared to C++ Data Structures? I have to take a couple Assembly language classes soon and I will be taking Calc and Calc2 at the same time! I am taking C++ Data Structures now and damn it is fairly difficult. thanks

    --
    http://www.fuckedupcountry.com
  132. Embedded Systems by segafreak · · Score: 1

    Interestingly we convered this topic in a lecture I was in about 2 weeks ago, for the Operating Systems course I sit as part of my degree in Software Engineering. The idea of "ubiquitous computing" is pretty much upon us, as more and more devices are containing embedded CPUs. You're gonna need people that know assembler for this as has been mentioned in numerous other posts above. I got taught a bit of assembler in 2nd year, and I hated it. Electronics students get taught a lot more assembly as part of their degree (especially Electronic and Software Engineering students).

    --
    "Everlasting peace will come to Earth when the last man kills the last but one." - Adolf Hitler
  133. Learn forth instead by johansalk · · Score: 1

    As low level as you need it, yet as high level as you make it.

  134. I took Assembly in college by Conspiracy_Of_Doves · · Score: 1

    And I have never used it since.

    Even so, I'm glad I learned it. I value knowing what the computer is doing 'under the hood'.

  135. Some applications require assembly by MobyDisk · · Score: 1
    There are some cases where you must know assembly language to even perform the task:
    • Writing a compiler
    • Writing shader code for a video card
    • Writing audio-processing code for a DSP chip
    • Writing vectorized code for a video game, physics simulation, etc. (SSE2/MMX/etc.)
    • Hacking CSS, AACS, etc.
    • Writing a driver, BIOS, or operating system
    • Writing an emulator
    • Designing a microprocessor
  136. All you need to know is: by Anonymous Coward · · Score: 0

    All you need to know is:

    0:000>eb eip 90;g

    and you are good to go.

  137. yes by smash · · Score: 1
    If you are in any way interested in performance, it would be worth learning for at least one platform (80x86) - if for no other reason than to get a feel for how your algorithms can be implemented on the hardware you're using, and how new CPU developments can be taken advantage of, etc.

    I'm not saying you need to code entire applications in it, but knowledge of it will perhaps give you a bit of an edge.

    --
    I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
  138. reading, or writing? by Chris+Snook · · Score: 1

    These days, most people don't write assembly after college, but reading assembly is still a critical skill. You need to understand how the computer works at a low level if you're going to do OS, compiler, performance, or security work; or expertly debug anything written in a compiled language. The assembly I wrote in school was an important experience to prepare me for the assembly I now read on a weekly basis.

    --
    There's no failure quite as dissatisfying as a complete and total solution to the wrong problem.
  139. Is Assembly programming dead? by z0ltanz0ltan · · Score: 1

    In my most humble opinion, I think, at least for the vast majority of programmers/students, learning Assembly programming is still an essential component of the whole learning experience. Maybe we may not actually use any of it anytime, but the paradigm of Assembly programming is such that I believe it makes us better programmers, especially regarding program size, quality and efficiency. This is a valid argument because there aren't any resources to waste in this domain unlike the severely unschooled and spoilt programmers that abound today who wouldn't think twice about writing a sloppy piece of code which just "works" but could eat up an indecent amount of memory and disk space, not to mention processor cycles. Like Eric S. Raymond mentions in one of his essays, a language is worth learning only if it teaches us to think in a different manner. Lisp is one such language. Assembly programming is one even better as an example. And I think the best way to make students learn and appreciate programming is to start them off with Assembly programming in a "practical" way immediately through hands-on projects and continuing with the theoretical aspects of it in due course of time and not the other way around! I still remember the dry sessions on the architecture, command formats - including every possible permutation of the subcomponents and wondering why this is all so fussy and wasn't it supposed to be fun? Only when I got my own x86 simulator on my PC and started writing programs did I realise that I was right and it was a hell load of fun! That is the way to learn. First unlearn whatever you have been taught in school and then re-educate yourself. Believe me, this is way more fun than anything you could ever imagine! - Timmy Jose.

    --
    The Will is in the Person
  140. Re:6502 Programming by that+this+is+not+und · · Score: 1

    Because MS-DOS on Bochs on NetBSD on a MIPS box seemed like a cool idea at the time??

  141. Can we get Mike Rowe to do an episode? by NotQuiteReal · · Score: 1
    "Assembly language programming - it's a dirty job, but someone has to do it"

    If we can get Mike Rowe to do an episode of Dirty Jobs on it, then it is "relevant", otherwise, no. I've done my share of keeping the pipelines full and worrying about getting to what's in cache before it's flushed, but not for a while. Frankly most programmers don't care, and they don't "need" to.

    Alas, sentiments aside, pragmatically, perhaps it really is a specialty field. Especially when the number of programmers who need to know assembly is expressed as a percentage of programmers.

    If I went to my GP and he happened to have knowledge of an obscure disease because of a hobby of his, it would be great, but if he said, "I dunno, here is the name of a specialist" you would take it in stride.

    Knowledge builds on on prior learnings. Computer science is getting old enough so that useful work can be done without every artisan and engineer in the field needs to dissect their own cadavers to know how to do something useful.

    --
    This issue is a bit more complicated than you think.
  142. Re:Well, no. by Profane+MuthaFucka · · Score: 1

    I keep an array of all the possible values of the string, except the one that is the actual length of the string is missing. To find out how long the string is, you've got to determine the value missing from the array.

    Can you make a program slower than that? What is the slowest provable program? Imagine a contest where for a specified algorithm the challenge is to come up with not the fastest, but the provably slowest implementation. It's harder than it looks.

    --
    Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
  143. Is hand tweaks still worthwhile? by HoboMonkey · · Score: 1

    I understand why compiler writers, driver writers, and folks working on non-PC architectures can use assembly. I also agree that it is healthy for PC programmers to learn assembly to get an idea of what goes on under the hood. But how feasible is it for most programmers to determine how their assembly will actually execute on today's superscalar, out-of-order execute, pipelined architectures, with all the hardware based optimizations? How often can you still "beat the compiler". I ask because I've often wanted to spend some time on learning assembly, but as I learn more about the current architectures this question keeps nagging me.

    1. Re:Is hand tweaks still worthwhile? by ClosedSource · · Score: 1

      "How often can you still "beat the compiler"."

      Probably not very often on today's general purpose processors, but of course the hardware is "rigged" in favor of compilers. The price that is paid is that these processors aren't suitable for hard real-time programming because their timing isn't deterministic. If you use a PC for a hard real-time system (no matter what OS you use, if any) you have to push the hard RT stuff to hardware.

  144. Why not? by KC1P · · Score: 1
    These kinds of arguments always take for granted the idea that programming in assembly is somehow unpleasant. Sure, if you aren't an assembly programmer.

    If you know how to do it well, assembly language programming is just plain fun and that's all there is to it. I do almost all of my programming in assembly (my company's main product is a 200K-line assembly program), officially for speed/size but honestly I'd still use it even if it were slower and fatter. I don't need compilers "protecting" me from architecture details that I never minded in the first place, and I really hate it when HLLs obscure the inner workings to the point that someone like me who's been programming for 28 years honestly can't figure out what's actually happening. With assembly I always know what the computer is doing, because it's exactly what I told the computer to do (never mind whether I was wrong). A lot of programmers really are micromanaging control freaks and assembly is nirvana for people like us.

    Seriously, the way to get good results from a computer is to learn how to program the computer. These days people would prefer to learn to program some abstraction, and then stuff enough bloatware under the hood to make it appear that that's what the computer is. Great fun if you don't care about the results (Unix) and/or if you're just trying to congratulate yourself for your cleverness (Comp Sci majors), but to get real work done efficiently you have to be able to think like the machine. The really great programmers are the ones who already thought like the machine full-time anyway.

    Portability -- good point, in 1980. Retarded now. Boo hoo, my IA32 code runs on only 90% of the world's computers, I sure painted myself into a corner on that one.

    Anyway, what ever happened to plain old curiousity? I learned FORTH *because* it's weird and useless. I never expected to be doing everything in FORTH, I haven't used it at all in years. I've forgotten APL but it was fun having my mind bent at the time I learned it. I can't imagine how it would help my life but that's not the point. It's good for your noggin to look at programming from as many different points of view as possible.

  145. Yes, learn it in context. by nadador · · Score: 5, Insightful

    As a marketable skill, assembly won't get you anywhere. There are a handful of places were knowing a specific assembly language is a prerequisite (boot loaders, deeply embedded applications, etc.) but these are just a fraction of the overall job-space for software engineers. Most software engineers never mess with assembly; they are, in fact, afraid of it and think that it's evil.

    Given all of that, assembly language *is* the hardware/software boundary. It's where all of the fancy abstractions from CS dissertations meet reality. Understanding computer architecture is a huge asset as a software engineer, and to properly understand how software and hardware interact, you have to learn at least one assembly language. There is no alternative. For most people, it is an unpleasant experience, but the payoff is enormous. The learning process that you undergo while learning assembly will change the way that you see your software and will help you understand why your code is so slow and how to make it fast by design.

    I have one last point. When you tell a potential employer about the low-level stuff that you know or work that you've done, your assembly skills are a proxy for understanding how hardware works (at least to interviewers with half a brain). If their software needs to run fast, they'll be happy that you understand the deep magic of hardware.

    (Incidentally, I think that the fraction of software jobs that require an understanding of hardware and knowledge of assembly languages, linker internals, etc., are the only fun ones and the only ones worth having. So I learned MIPS, ARM, PowerPC, and TMS320C6 assembly, and they have all served me very well because I don't have to refactor C# for a living.)

    --

    Outside of a dog, a book is a man's best friend. Inside a dog, its too dark to read.
    1. Re:Yes, learn it in context. by Arao+Filho · · Score: 1

      Of course assembly is still relevant and important, some examples of a real life: Microchip has a microcontroller series, pic12, who had code memory about 1kB, Motorola and others either, these low-end devices are become more used in devices such as car peripherals, household-electric and other. And for a high efficiency of the code ,the only possible choice is Assembly, another example is where the realtime at extreme make sense. The need of assembly is the context, depends on many factors, and these are only some examples. Assembly disadvantages compared with another languages like C are relevant, like code portability, but only the project will help to do this choice. And learn Assembly is still really necessary, including the need of make compilers to another languages. This is my opinion, is about embedded systems, but there a lot of more applications of the assembly, and I repeat, assembly is still relevant today!

    2. Re:Yes, learn it in context. by adisakp · · Score: 1

      As a marketable skill, assembly won't get you anywhere.

      Unless you want to be a video game programmer and get to touch low level hardware on PS3, 360, PS2, XBOX, Gamecube, Wii, etc. That's my job at Midway Games and it requires lots of asm knowledge. From being able to debug "beta" compilers that are in constant flux to disassembling chain-mode DMA packets, you have to get to know the machine. Maybe not all the gameplay programmers know assembler but all the senior systems programmers certainly do.

    3. Re:Yes, learn it in context. by vallef · · Score: 1

      Aboslutely, good programmers must understand the stack.

  146. Re:Well, no. by BillyBlaze · · Score: 1

    Actually, it's pretty trivial to prove there is no slowest algorithm. Given any algorithm, you could run it on an emulator that would make it slower. (I wonder how may recursions of that it takes to get a 1 Hz CPU?)

  147. finguring out strange errors by multicsfan · · Score: 1

    There is one very good reason for knowing assembly or at least looking under the hood of whatever environment yo program in. The hardware/assembly language or whatever is the next level or more down makes restrictions on what the next layer up can do. Sometimes the restrictions can be wrong so you can have a mysterious error caused by an error at a lower level. Understanding the lower level(s) can help figure out the error.

    Fortran VI example:

    main routine code: .....
    i=3
    call foobar(1,2)
    j=2*i
    print i, j ....

    subroutiune foobar(l,m) ....
    m=l ....
    return

    program outputs: 3 3

    knowing what goes on in the compiler will tell you what happened ;)
    NOTE: this may not be true ofevery fortran compiler.

  148. Re:Isn't it the root of all programming languages? by macshit · · Score: 1

    You don't need to be fluent in x86 assembly, but if you're completely ignorant of the inner workings of computer architecture, you're at a disadvantage to those who have been exposed to it and written, say, a bit of old MIPS assembly code.

    Indeed. There's a Knuth quote I like:
    People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- Donald Knuth

    --
    We live, as we dream -- alone....
  149. performance math libraries and atomic operations by ufnoise · · Score: 1

    high performance math libraries are often written for specific CPU's using a combination of Assembly and FORTRAN (intel MKL, AMD ACML).

    The gnu implementation of the C++ string class update reference counts using atomic assembly instructions instead of mutexes (lock add).

  150. Re:All's quiet- Assembly still relevent by Douglas+Goodall · · Score: 2, Informative

    As a guy who kept programming in assembler for many years after C was around, I would point out that BIOS code is often written in assembler becauses it is so low level and it gets used a lot, or at least it used to. Now days the operating systems take over most of the hardware after the system comes up, but in the original IBM PC, the BIOS provided the interace layer to all the hardware.

  151. Dare I say, "Hell yes, it's relevant." by Zekasu · · Score: 1

    Assembly is STILL entirely relevant to programming today. Consider your programs that patch your fancy games; "Patchers" (At the very least) have their roots in assembly. Understanding how a machien works at a basic level, and understanding how to design code in such a way that it can be expanded upon and use a more efficient way of being run is still under the land of assembly.

    You can do many things in C, but you can do EVERYTHING in assembly. Granted C is still (at a very simplistic level) a compilation of human readable macros that equate to assembly code.

    Assembly applies if you're:
    - Working with Hardware
    - Looking for Efficiency
    - "Learning" about how a machine functions at the very base level
    - Attempting to debug an error caused by an anomalous string (Such as a null-byte.)
    - Programming in general, at all

    Languages like Java, while high in readability, are going to create such a problem that efficiency (one of the CORE principles when programming) will be thrown out the window. Granted Java is for cross-platformability, it is what is currently being taught in Computer Science courses. And, what truly bothers me is the fact that one can program without knowing how to do it efficiently, or without knowing how that piece of code truly interacts within the machine.

    Oh, and if you're doing anything that requires massive calculations, also, assembly is for you.

  152. HELL YEAH by kitanai · · Score: 1

    Many high level languages do too much for the "programmer" hence creating monkeys that just speak a different language, not actual programmers.

    I have found that assembly language gave me a unique insight into how cpus work...which has helped me with a low level understanding of how to improve my high level code, as well as giving me that extra edge for design and bug tracking.

    1. Re:HELL YEAH by Anonymous Coward · · Score: 0

      > Many high level languages do too much for the "programmer"

      Yes, that's the whole fucking point of high level languages. I do not care to do type inference in asm.

  153. Critical loops! by Anonymous Coward · · Score: 0

    Assembly is essential for many applications in stream processing, like image processing, audio, etc, espescially in critical loops (the data processing that takes the majority of the time in your code). I used to work at Matrox Imaging, where we had to have assembly versions of all our imaging operations to optimize for speed. We'd outpace the regular C/C++ code by FAR. Then you can also use efficient MMX/SSE operations to go through your data in a parallel fashion. It's really super interesting when you get your hands dirty with it.

    P.S.: the human checks on Slashdot comments are getting really rough...

  154. Computers in general by Anonymous Coward · · Score: 0

    Assembly is the closest thing you can get to true machine code. If you do not understand how a computer "works", how can you truly understand how to write programs that utilize the true potential of the hardware? In these days, you use a "high level" language to write code, but it all compiles down to assembler/machine code. From what I have seen in my experience, as more and more "high level" compilers are utilized, the more bloated the code becomes, and the more inefficient it becomes. The answer is to throw more hardware at the problem, instead of actually breaking the problem down into it's most trivial parts, hence the reason I would have to mortage my home in order to afford the hardware that is required to even run M$ Vista. People these days write code in VB and .Net, because they can get a product to market in the blink of an eye, without reguard to how efficient the code actually is. I truly believe that assembler is, and should be a requirement for any degree or certification program that is in existance. I see too many people who take a training course in VB and get a certification, and then declare that they are programmers. True programmers understand what big O notation actually is, and if you do, then you also understand why assembly is still extremely relavent.

  155. Efficiency sometimes irrelevant by davidwr · · Score: 5, Insightful
    In most programs, easy-to-read, easy-to-maintain code is worth a size and speed penalty of up to several times that of hand-optimized assembly code, and it's almost always worth a 0-50% penalty.

    This is particularly true for programs that
    • don't need to be shoehorned into memory or onto disk
    • spend most of their time waiting, not running

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  156. Assembler is where you have to start off... by wikes82 · · Score: 1

    My first language was Intel 8088 Assembler, before I learn higher level programming language It helped me a lot in understanding how computer works (Interrupt functions, Memory addresses,ports,etc). even after I knew high level languages, I was still using it to interface (It was called Inlined) with high level languages. I dunno about now, but once upon a time when you're taking computer science major, you need to read andrew tannenbaum book on how operating system works, and minix codes contain assembler.

    1. Re:Assembler is where you have to start off... by wikes82 · · Score: 1

      replace all "Assembler" in my previous post to "Assembly" Sorry about the typo...

  157. Just an observation by Anonymous Coward · · Score: 0

    Whoever asked this question, should also ask, why the enrollment for CS majors in universities is declining? They should also understand why they are having to outsource their employees to India, China or other countries to get the "talent" they need to write the programs they want.

  158. Learn at least one by Myria · · Score: 1

    Even if you're programming C# or Java the rest of your life, go learn it. The lessons you learn will apply everywhere, even if you never write assembly language again.

    In college, there was a mandatory assembly language class. The assembly language that was being used was MIPS. There's probably no better assembly language to learn first, because MIPS doesn't do anything for you. You have to learn how to manage memory and registers yourself because there's nothing helping you.

    However, it was taught by a professor that wasn't particularly good at it, and the class suffered as a result. I got a low grade on a test because I did this to calculate the absolute value of register "a0":

    bgtz a0, label
    label:
    subu a0, zero, a0

    "bgtz" is "branch if greater than zero" and "subu x, y, z" means "x = y - z". Register "zero" is simply a register whose value is hardwired to 0, so that "subu" means "a0 = -a0".

    The reason that this works is because in MIPS, the instruction immediately after a branch executes before the branch takes effect, but after the branch condition is checked. If the branch happens (a0 > 0), a0 is negated twice; if not, a0 is negated once. The reason for this effect in MIPS is due to pipelined CPUs not being able to "stop on a dime". Learning this effect and why MIPS has this design quirk is an interesting discussion of modern processor design and very important for understanding computers.

    The professor teaching the class hadn't seen this before. This is probably because "gas" actually abstracts this out: unless you use ".set noreorder", gas will actually reorder the opcodes such that your code executes as if on a traditional CPU. Professors shouldn't be teaching things they're not experts in. Also, not teaching the real MIPS hides an important computer science lesson.

    Melissa

    --
    "Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
  159. Re:All's quiet (unless .NET takes over) by Douglas+Goodall · · Score: 1

    The whole point of the .NET architechture, and the Trusted Computing Initiative, is that the average joe cannot be trusted to write assembly language. Instead they should write in higher level languages that compile into intermediate code that may get JIT compiled into real code, if the module happens to be signed with a certificate provided by the certification authorities. In a few more years, we will be lucky if there are enough people around whoo still remember how to low level code.

  160. The only correct answer to the question.... by Anonymous Coward · · Score: 0

    Mu.

  161. Re:Isn't it the root of all programming languages? by mrnick · · Score: 1

    Yes, for example when C++ is compiled it is converted into assembly language and assembled and linked into an executable.

    So for the most part the majority of programmers don't need to know assembly language. But, it is definitively not something that should be abandoned because without it making more efficient / optimizing compilers and the like would end.

    There is a big difference between a programmer and computer scientists. I think that it is very important for a computer scientist to have a good understanding of how assembly language, and in turn machine language works for future develop of the science of computers. Though, if your goals are to be a Java or C++ programmer then I think you could do without every learning about assembly language.

    Nick Powers

    --

    Encryption: I may not agree with what you say, but I will defend your right to encrypt it...
  162. I respectfully disagree. by jd · · Score: 1
    Now, I agree that 99.9% of business software is indeed written the way you describe, but I would point out that application bugs, poor UIs, interoperability issues, unexpected downtime, security breeches, high learning curves and inefficient implementations are costing corporations billions, if not trillions, on a global basis. And by "cost", I mean exactly that. This is how much less corporations are making than they would do if they used archaic but reliable products that have had many of these issues eliminated over the decades.

    Which is why you get power stations using twenty-to-thirty-year-old systems for controlling equipment. I don't believe there are any that still use TRS-80s, but Windows NT 3.x is widely used for mission-critical systems. Why? Because it works, it's a known quantity, and it's much more solid than any later Microsoft product. I've seen hospitals use MS-DOS for medical imaging. Why? It has many defects, but fragility isn't one of them.

    What about corporate desktops? Every time a machine blue-screens, it costs the company money. Time is money - and lots of it. Ten minutes of downtime may not sound much, but that's ten minutes of productivity lost. A sales rep or an engineer using nothing more than a pad of paper can earn small fortunes in ten minutes, but the same person in front of a blue screen can do nothing. They become dependent on the technology, so the loss of it means the total loss of activity. Depending on the size of the company, ten minutes could be worth anything from one thousand to a hundred thousand.

    Chances are, you'll have more than one application crashing hard on one desktop per year. For most corporate applications, if they can get away with a net loss of one day's loss for every hundred days worked, they're doing well. After a single year, that's 3.65 days (about 525 minutes) that are probably going to be wasted from downtime. At the conservative estimate I gave, that's over half a million per year. For a major corporation, it's probably closer to thirty million. That's every year.

    Do you know how many semi-trained programmers you could turn into seasoned, high-grade professionals for thirty million dollars? And you only have to do that once. They don't need retraining the next year. One company's losses for one year, if spent on raising the bar instead of drinking at the bar, could slash corporate losses from downtime across the entire industrialized world. The money saved from improved reliability would more than cover the cost of the work.

    On the whole, code monkeys produce products that help earn $1 for every $2 spent. That is not a good return. Businesses may want the software fast, but it hurts them, it hurts the economy, it hurts the shareholders, it hurts the consumers. If you'd earn more money with an abacus and a stack of post-it notes than with the latest copy of Vista and a quad-CPU, quad-core PC, then don't throw good money after bad. If you'd see better profits from a slide-rule and a stencil set than with the latest AutoCAD, then don't upgrade.

    I'm in favour of technology and am certainly no Luddite, but the phrase 'no pain, no gain' does NOT mean that if you suffer horribly, you will get something wonderful. If you suffer horribly, the odds are very high that suffering horribly is ALL you will get.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    1. Re:I respectfully disagree. by kiberovca · · Score: 1

      Offtopic... Actually, I'd say that 10 minutes downtime equals about 2 days loss of productivity, for at least one person. Why? Well, after you manage to put the system online again (even after "only" 10 minutes), it takes about 1-2 days to analyze what went wrong, and how to make it sure (if possible) not to repeat the same downtime. Instead of working on something else.

      --
      Eric: "What're quantum mechanics?"
      Rincewind: "I don't know. People who repair quantums, I suppose."
    2. Re:I respectfully disagree. by leenks · · Score: 1

      For a corporation I agree, but most software isn't written for corporations - it is written for use by much smaller outfits. Think of all the simple MS Access databases, Excel spreadsheets, VB applications etc. that Joe from accounts coded up in his spare time. That software usually increases productivity in those companies by orders of magnitude, even if it is full of bugs.

  163. it teaches you to think by spasm · · Score: 1

    using a computer is an exercise in thinking in a particular way.

    if you learn to program in a high-level language, you find day-to-day use of the computer much easier. your mum and gamer friends start to call you because you seem to be able to 'just work it out' even on an unfamiliar system / OS (alright, except windows. but windows was written by marketing droids, not programmers. that thing is the work of the devil). learning to program taught you something about how other programmers think, so working out what might be going wrong on your mum's computer gets easier because you have some sense of what the possibilities / constraints are.

    if you learn to program in assembly, you find programming in high level languages gets much easier. your mum calls you to help work out what's wrong with her latest php code, even though it's not a language you're super familiar with (your gamer friends are still useless morons though). learning assembly taught you something about the building blocks of high level languages, and you have some sense of the underlying structure and constraints associated with any high-level language.

    assembly is an exercise in thinking in a particular way. it's a way of thinking that facilitates anything 'higher level' with computers, be it programming or simply using one as a tool.

    and it's fun.

  164. *.asm by Takei+Shihan · · Score: 1

    Pprogramming PCs can be done quite quickly and easily with drag and drop Visual programming, which makes Assembly Programming a bit too slow for most people ... but what about programming robots or large mainframes instead of PCs ???

    As a programmer with a Ph.D. in math, I like Assembly Programming, but seldom actually get the chance to use it (other than one or two drops to it within Visual C for some special subroutine). The last time was for a medium sized company here in Montreal, when they bought a robotic spindler from China. I was supposed to take a spool of wire and wrap it to make any one of a large choice of electomagnets or electric motors ... it would not interface ... since Chinese Mandarin is my 5th of 6 languages, they hired me to rewrite the controlling software ... and they actually wanted it done in Assenbler! ... but yeah, MS Visual Studio gets called for with almost all my other programming ...

    --
    A warrior's greatest weapon is wisdom, therefore, keep your mind even sharper than you keep your sword.
  165. Very relevant by gatesvp · · Score: 1

    There are two simple reasons.

    1. Assembly and C are the fundamental languages for OSes. This isn't magically going to change, even Microsoft's C#-based Singularity is still running Assembly and C code for the basic DLLs. We will continue to need programmers for this stuff.
    2. The vast majority of business programming (for which we're pumping out grads like mad), is done in Declarative programming languages. Well, Assembly and C are the simplest and most performant declarative languages. Understanding complex performance issues eventually requires that you have some knowledge of "what's going on" at base levels. You may never need to write assembly after school, but that's not to say that the knowledge is irrelevant.
  166. Ridiculous. by Inoshiro · · Score: 1

    "Consider the following question given the current hardware development needs, and also the claims of the transistor lovers for it being a device that gives one insights of the internal working of a computer. How relevant or useful is it to learn BJT transistors in the current era? "

    You don't have to know everything, but you should probably know something.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  167. "C melds the flexibility&power of AL programmi by veliath · · Score: 1

    Theres a fortune message that captures what I feel about the C vs AL programming debate: "The C Programming Language -- A language which combines the flexibility of assembly language with the power of assembly language".

    In my experience, one cannot truly understand C without knowing AL programming. C is like a thin macro layer of sorts over the AL underneath. C is a systems/low-level language because it abstracts what most contemporary processors can do in non-privileged mode - access memory, evaluate expressions, change the flow of execution, make sub-routine calls. C does not provide I/O features or knowledge of any device semantics other than the CPU. Therefore to understand C one must know what it assumes the canonical processor can do - one must know atleast one AL well. I know atleast 4 ALs well and I feel I understand C better for it.

    Further, to understand or define UNIX on an ISA - even at the application level - one needs to not only know C, but also the ABI - the implementation of linking calling and register use conventions - for that ISA. Try making sense of a core-dump - especially a core-dump from a production site where debug symbols would have been stripped - without knowledge of C and the underlying AL conventions used.

    To me C & AL together define UNIX on an ISA. So without AL, I'd feel pretty ignorant.

    veliath

  168. Re:Isn't it the root of all programming languages? by bm_luethke · · Score: 1

    You do not even need know it to create one - I have written a small high level language that "compiled" to python. There was no need at all to learn assembly, only to know python and language design. It isn't terribly uncommon for obscure or in house languages to compile to ANSI C, both because that is quite portable and the compilers do an extremely great job of optimizing code. For a language creation Formal Language is MUCH more useful and you pretty much never touch assembly in that and you may not even touch it in compiler theory. I know there are compilers out there that compile to an intermediate internal language that is then sent to the "real" compile part. It is only useful if you are compiling direct to assembly and then good knowledge of it is only useful if you want to optimize the binary.

    Though, I do agree that Assembly is useful to know and I do not care about what microprocessor you use. In fact, it is also good do have some idea of micro-code. When I was in college (not that long ago) we used a processor simulator and wrote our own assembly language in micro-code. We then wrote a small assembly program that ran on top of that processor. For the students who didn't know any of this stuff you could see a few light bulbs go off - "Ahhh, so *that's* why I have to do it this way".

    --
    ------- Sorry about the spelling, I suffer from two problems. Dyslexia makes it difficult to spell well, lazy makes it
  169. What an ignorant question by geekoid · · Score: 1

    of course there is a need for it. There is more to programming the desktop applications you know.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  170. Yep by Anonymous Coward · · Score: 0

    If you don't know assembly, you don't know how to program.

  171. Re:Why bother? Just ... by Anonymous Coward · · Score: 0

    ...or hire 3 foreigners to write something kinda like assembly.

    "It has to compile too?? so many requirements you Americans want..."

  172. Tags by Anonymous Coward · · Score: 0

    That has got to be the most useless set of tags e v e r!! 'Yes, very, no, maybe'. C'mon guys, you can do better than that.

    1. Re:Tags by MLease · · Score: 1

      Yeah. They should have thrown in a 'haha', a 'wtf?', and a '42'. Then it would make sense!

      -Mike
      (who is starting to get punchy from working all night)

      --
      I'm sorry; I don't know what I was thinking!
  173. Tag of doom! by Anonymous Coward · · Score: 0

    None of this separate tags bit. When I want to find 'controversial' topics, gimmie a tag to use (not 'controversial'!)... use 'yesnomaybe'!

  174. Not really. by Anonymous Coward · · Score: 0

    I haven't used assembler in a long time, though it has it's rewards (it was
    actually /fun/ when I did it) the fact is, there really isn't an actual use for
    it in modern desktop machines.

    However, I don't regret learning from assembler. I remember once writing two
    routines to do case conversion, one involved calculation the other involved a
    no-brainer lookup table.

    Logically, the no-brainer should have run faster, but it was slower.

    Understanding the value of branch prediction, conditional jumps and processor
    cache is a lot easier having written those two simple routines. A useless
    program, but it makes other things make sense.

    Put it another way, is addition relevant now that we have calculators?

  175. Re:Well, no. by A+nonymous+Coward · · Score: 1

    The particular instance I had in mind was a subroutine which built up a 500 byte string from several dozen strcats.

    You might want to pause a moment before writing next time. You might want to absorb the gist of what you have read rather than pick one small part and assume the writer is clueless. You might instead think of the writer actually having said something useful and consider that maybe you need to adjust your perceptions a bit rather than throw out gratuitous fatuous comments.

  176. Re:6502 Programming by yo303 · · Score: 0, Flamebait

    Dumbass. You have no idea what you're talking about.

  177. On mainframes by SpaghettiPattern · · Score: 0

    Om mainframes assembly is still used. More than on *nix. Assembly on mainframes is backwards compatible. There are programmers out there that are still more knowledgeable about assembly on the mainframe than say C. Writing intermediate to good C together with the optimisation capabilities of the compiler should do the trick but still sometimes assembly is still preferred.
    For instance, I have seen code written in assembly for base64 encoding/decoding. Reason for doing so is to allow encoding/decoding to take place in a CICS transaction (which must be completed as quickly as possible.)

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  178. Assembler is alive and well. by Anonymous Coward · · Score: 0

    Well, yes. I still program in assembler now and then. Despite all the boasting about how good compilers have got, they still lag well behind humans when it comes to getting that last 300% out of some critical routine. (Yes, a 3 fold improvement over a good C compiler is typical).

    The big advantage of learning assembler programming is that you'll learn to think logically, and how to minimize your solution effort. You do actually have to think about what you are doing, the compiler or JRE won't save you here.

  179. Biology analogy by quokkapox · · Score: 1

    I dunno -- I still would like my onocologist to understand on a fundamental level how RNA transcriptase works and the biophysical interactions that take place during radiation therapy. I want my psychiatrist to understand why inhibiting serotonin reuptake is sometimes desirable. In fact, I want them to have a deeper level of knowledge and understanding of all these concepts than my own.

    Same thing for programmers. The best professionals in any field will have a very deep understanding of their knowledge domain. A programmer doesn't have to go down to the level of electrons on bare wires (the electrical engineers can do that) but at least should have a feel for what they're doing down at the level of registers and operating system.

    --
    it's a blue bright blue Saturday hey hey
  180. Very relevant in the firmware/DSP/uC world. by Ihlosi · · Score: 1
    How relevant or useful is it to learn Assembly programming language in the current era?



    If you're trying to do anything in the microcontroller/DSP world and aren't willing to at least look at you device's assembly dialect, your colleagues will consider you a C-idiot.



    Assembly is very useful for things that need to be fast (as in: X needs to happen within Y processor cycles of event Z), fast (as in: this calculation may only take X% of the CPU cycles), small (as in: the whole program needs to fit in 2 kB and use less than 128 bytes of RAM), to check if your compiler is buggy (yes, that really happens), or if your compiler simply doesn't know 50% of the processors instructions (yes, that really happens. And yes, the compiler was made by the company that also makes the chip in question).



    Of course, much of the uC/DSP code can and is written in C. But the programmer needs to keep the assembly in mind when writing C (it's hilarious to see people try to program an 8051 who have only learned "C on the PC"), and know when assembly will do a better job.

  181. Learning about how you work by Peter+(Professor)+Fo · · Score: 1

    Assembler is brain-food. It is a challenge where you're on your own with very little of the modern comforts that people take for granted nowadays. This trains you not to be sloppy, to think before typing, and keep baggage down to the minimum you can carry. Out in the wilderness you can reach places the air conditioned coach tours don't go; but the real value of giving everyone an opportunity to write in assembler is what you learn about self discipline, good working habits and how much you can cram in your brain if the conditions are right.

  182. From someone who ACTUALLY WORKED in Asssmbly by RationalRoot · · Score: 1

    First:
    I spent a good few years writing ISRs (Interrupt service routines), TSRs (Terminate and Stay Resident apps for DOS), simple device drivers for serial and parallel ports on the DOS based PCS.

    Pretty much all of what I worked on is now obviated by having an operating system that works. (mostly works)

    There are a LIMITED number of roles for assembly writers in embedded systems, but pretty much all device drivers now are written mostly in C or even C++; Many embeded systems use C cross compilers.

    Second:
    By redesigning a function that some had written, I took the execution time down from 32 seconds to 100ms (I stopped timing after that). Poor design trumps poor coding in terms of performance EVERY TIME.

    Third:
    Doing ANYTHING in assembly take N times longer, where N is just HUGE. Really, HUGE. If you can do it in a high level language, then writing it in assembly is either a hobby, a college project, or a waste of time.

    Having said that...

    I believe that writing that all that assembly gave me a very good grounding in what goes on inside the box.

    But writing assembly teaches you Nothing about Ojbect oriented Design.

    Should we teach maths students to differentiate, or just tell them to used the computer ?

    Teach assembly, but don't use it any more than you would calculate Fischer Exact Test for association by hand.

    Don't. Not unless you _REALLY_ have to.

    --
    http://davesboat.blogspot.com/
    1. Re:From someone who ACTUALLY WORKED in Asssmbly by Ihlosi · · Score: 1
      There are a LIMITED number of roles for assembly writers in embedded systems,



      I think you underestimate the volume of the embedded/uc/DSP market.



      Poor design trumps poor coding in terms of performance EVERY TIME.



      True. But algorithm design has little to do with the programming language, while coding has little to do with algorithm design.



      But writing assembly teaches you Nothing about Ojbect oriented Design.



      Writing C++/whatever also doesn't teach you anything about object oriented design. Since the latter is a design concept which, at first, doesn't have a lot to do with the the actual programming language. You can use OO concepts when writing in assembler, and you can produce truly abysmally designed code in Java/C++/whatever.

    2. Re:From someone who ACTUALLY WORKED in Asssmbly by RationalRoot · · Score: 1

      There are a LIMITED number of roles for assembly writers in embedded systems,

      I think you underestimate the volume of the embedded/uc/DSP market.

      No, I imagine you overestimate the number of people using assembly in embedded/uc/DSP market. People I know working in embedded systems or DSPs are using C or specialized languages.

      Poor design trumps poor coding in terms of performance EVERY TIME.

      True. But algorithm design has little to do with the programming language, while coding has little to do with algorithm design.

      My point was that if you want to improve performance, check the design first, this gives the big performance gains. Then consider looking at the language.

      But writing assembly teaches you Nothing about Object oriented Design.

      Writing C++/whatever also doesn't teach you anything about object oriented design. Since the latter is a design concept which, at first, doesn't have a lot to do with the actual programming language. You can use OO concepts when writing in assembler, and you can produce truly abysmally designed code in Java/C++/whatever.

      Yes. I agree. I've fixed (i.e. deleted and rewritten) some of that truly abysmal code. But Assembly does not facilitate OO concepts. My point was that while learning assembly teaches you about the internals of a machine, the internals of a machine are very far removed from what you need to know about to design large systems. So yes, assembly is useful, but it's just one tool in building up and understanding and you need more arrows for your bow

      --
      http://davesboat.blogspot.com/
  183. Because assembly is so funny ! by Rastignac · · Score: 1

    Here is an (very old) joke from an (very old) assembly programmer I met once: "Mr Push and Mr Pop are in a boat. Mr Pop falls in the water. Who pushed him ?". Ah, ah, funny, isn't it ?? Assembly is so funny.

    --
    -- Rastignac was here.
  184. Re:Why bother? Just ... by Random+Walk · · Score: 1
    Hire someone else to code in assembly.

    Good luck. Actually tried once (for an x86-64 assembly task), and had problems to find someone. Finally found a coder who did decent work, but there seems to be a significant shortage of assembly coders to hire.

  185. Re:6502 Programming by Anonymous Coward · · Score: 0

    Prove it.

  186. Going FORTH by Anonymous Coward · · Score: 0

    FORTH is assembly's version of meta-programming. You can pretty much define your own opcodes. May lose a bit in speed, but I've heard it works great for low memory systems.

  187. I love articles like this by Nethead · · Score: 1

    I love articles like this where all the (low numbered) old dogs come out to play with the pups.

    --
    -- I have a private email server in my basement.
  188. Embedded Systems by Anonymous Coward · · Score: 0

    I program in assembly all the time.
    Why? I create small embedded systems and often C is not an option. Like it or not. Not everyone programs PCs.

    PS. I am paid 50% more than what the guy in my office that can't program assembly does, even though he has been programming longer.

  189. Yup. by Ihlosi · · Score: 1
    Why? I create small embedded systems and often C is not an option.



    Well, it is an option, but the more expensive one. If you do embedded systems, you're selling hardware and software at the same time. The software is developed once, but the hardware needs to be manufactured for each single unit you sell. If you can shave $.50 off the hardware costs by using assembly (since you can cram the program into the 16 kB version instead of using the 64 kB one), and you're planning on selling a million units, you have a $500k incentive for using assembly. $500k does buy a lot of engineering hours.

  190. Re:Isn't it the root of all programming languages? by pla · · Score: 1

    You can still be a good programmer if you know the cost (in terms of resources) for the operations you choose to make use of.

    Don't forget the cost of all pairs of instructions, and pairing/interleaving of instructions, and memory-reference-density of instructions, and memory reference order, and branch prediction miss penalties, and...

    You can program without understanding how the hardware actually executes your code. But a "good" programmer? No. A hack (and not in the complimentary sense) at best.

  191. 2 relevancy questions.. by andr0meda · · Score: 1


    The one who posed the relevance question is actually asking 2 questions. One about relevancy in understanding and capability of programmers in general, and one about usage in the real world. I guess both are, to some extend, relevant.

    Basically - and this coming from one of the bastards that "make you study it in one of your college courses" - you need to have at least some understanding of how a CPU works when you call yourself a proficient programmer. If you never 'got it', it means you don't understand what's going on. You may think you understand frameworks like .NET and J2EE, but you really don't. And when things go wrong, you will wonder why, and you will think it's all magically gone wrong somehow.

    If you however know what is going on on the lowest level, you will know where to look, what to expect, and how to solve and issue. You will have more confidence, make planning a more accurate game, and basically be a better asset to your project.

    It makes a huge difference. The people that don't get it right, will probably never want to. It's not hard, it's just a different way of thinking about constructing programs, and it requires a little more work.

    Usage relevancy is already mentioned in parent post, so +1.

    --
    With great power comes great electricity bills.
  192. Re:Well, no. by Anonymous Coward · · Score: 0

    That doesn't make strcat() bad, that just means the architect and/or developer of that algorithm is a dumbass.

  193. Fud, fud, fud. by master_p · · Score: 1

    Writing assembly in Windows NT/2K/XP/2003/VISTA does not have to do with any 16-bit code, or any DOS-like interface. You use the Win32 API as in C. In the worst case, you might use the NT HAL, which is an API like win32 as well.

    Even writing Windows kernel drivers is very straightforward and has nothing to do with DOS.

  194. Yes, today, tomorrow and until Von Nuemann is dead by vallef · · Score: 1

    Ask yourself these questions: Would you employ a carpenter that cannot hit a nail into a piece of wood. Important, even though they may use a automatic nail/hammer driver nowadays. Would you let a surgeon operate on you who did not know the human bodies internal organs. Would you let a plumber fix your plumbing if he could no put two pipes together. Even though nowdays we have plastic push & fit pipes. Good code generators must be used nowadays to improve productivity, however, when performance goes downhill, must be able to understand assembler and computer architecture to fix it. Otherwise just buy a faster CPU. Buying faster high Ghz CPU's are just bad for the environment (heat, cooling etc) so the bad coders keep the hardware suppliers in business.

  195. not a career usually by tomstdenis · · Score: 1

    Usually assembly is just one of many things you need to be useful at to be a software developer. Not many jobs out there just for assembly programmers.

    And yes, it's still important. Knowing how processors/computers work is step 1 in figuring out efficient algorithms.

    To stoke the fire, C is still important.

    Tom

    --
    Someday, I'll have a real sig.
  196. I will say today... by muffen · · Score: 1

    ... the same thing I said around 10 years ago, Assembly is the absolutely best language to know, and the absolutely worst to write something in.

  197. Lots of interesting posts by rbanffy · · Score: 1

    But I would like to sum it up as

    "There are good programmers and excellent programmers that really understand what they are doing. Those understand assembly."

    There is simply no other way to know what makes PIC, Power, MIPS, SPARC and x86 different from each other. There is simply no other way you can understand the trade-offs of many different architectures.

    I started programming with the 6502. Did some x86 too and never touched it again, but it gave me and my generation the current "widget pusher" programmers can't match.

    And don't get me started on how productive your java object-persistence engine can make you. If you don't see your computer as something moving and adding words (64 bit wide these days) back and forth, you really don't get what you are doing.

  198. You will learn it anyway by indy · · Score: 1

    ...at least if you ptogram in C/C++. It's so easy to mess up the stack. Being able to understand what's going on is a necessity.

  199. Making your own computer and assembly by Alioth · · Score: 2, Interesting

    I'm building my own computer (no, not getting some random PCI cards and plugging them into a motherboard), but designing a simple Z80 system for fun.

    If you want to mess around with this sort of thing, you cannot avoid writing things in asm. I've got this far:

    http://www.alioth.net/Projects/Z80/Z80-Project/Z80 -Project-Pages/Image19.html

    - having laid out a double sided PCB, and got everything shoehorned onto a 160x100mm 'Eurocard' sized motherboard.

    However, I've also retargeted the z88dk (Z88 Development Kit, originally designed for the Cambridge Z88 portable computer) to my Z80 board because while it'll be best to have all the low level stuff done in assembly language, writing things that use floating point will just be ten times faster to write in C.

    But even if you never intend to hack hardware, it's still important to at least be familiar with assembly language - if only to know why unchecked buffers are bad. If you've ever written a program in asm and accidentally overwritten the stack and tromped all over your return address, you fundamentally understand why this is a bad thing. We've got into a whole world of hurt because many programmers didn't understand this.

    1. Re:Making your own computer and assembly by chthon · · Score: 1

      I am even designing my system from the ground up, using a microprogrammable architecture and standard logic components.

      It should become a 12-bit system. Don't know when I will get a working implementation, because for me this project is more than designing a 12-bit system : I have written simulations of my basic components in Common Lisp, so part of my time was also spent learning Common Lisp, writing component implementations and test harnesses, and trying to grok how to implement a simulation on bus/wire level.

      This 12-bit system is necessary to gather basic knowledge and tools, because ultimately I want to go to something larger, for which I probably will need FPGA technology.

      Well, I'll see. I am busy on this since August 2006, and I have learned a lot in the meantime.

      Additional goals for a wider implementation are porting LCC to the architecture, or try to obtain an architecture which could run Scheme on the bare metal.

    2. Re:Making your own computer and assembly by Alioth · · Score: 1

      Now that's cool :-) I've seen the Magic-1 (someone's implementation of their own architecture, completely in 74 series TTL). I always get a really nice feeling of satisfaction when I try a new piece of hardware I've made and it *works*; doing the same with an entire homebrew architecture...

      Good luck with your project!

  200. Erk by Fross · · Score: 2, Funny

    One day won't there be little nanobots floating around with 512 bytes of memory and a 1 mhz processor that need to buzz around your body and eat up your precancerous cells?

    Now I'm picturing something like Alfred Hitchcock's The Birds, only with ZX81s.

  201. Z80 Assembly? by nbritton · · Score: 1

    I have a TI-86 graphing calculator that can be programed in assembly, would this be a good starting point for learning assembly?

    The calculator has a 6 MHz ZiLOG Z80 processor, 96KB ram. and a 128x64 pixel screen.

    1. Re:Z80 Assembly? by ajb44 · · Score: 1

      Not really; the Z80 is a pretty strange processor.

    2. Re:Z80 Assembly? by CrankyOldBastard · · Score: 1
      I have fond memories of learning Z80 on a Sinclair ZX81. You'd have to translate assembler to machine code, and then to the "extended character set", then embed that in a BASIC REM statement. You then set the PC to the start of the comment. doing non-trivial tasks in 1k of ram (or 16k if you had the extension pack) taught me a lot about the fine details of programming, and about "thinking before coding".

      Later I got to play with a TRS-80, still the Z80 but with a whopping 64k of RAM. The Z80 had two sets of registers as well as a way of setting up banked memory addressing, and by cunning use of coroutines you could simulate a primitive sort of multitasking. Was a lot of fun for a young fellow (18yo as I recall), and made me a much better programmer in C (when I finally got me a 486 many years later).

      I also had the pleasure of programming in MACRO on a DEC-20 (KA-10 as I recall) around 1980. Although not quite assembler (it featured some very high level monitor calls) I still remember the joy of writing a file copy program in about 24 instructions.

  202. "Assemblers are a dying breed" by burnttoy · · Score: 4, Interesting

    OK, First of all I'll blow my own trumpet. Over the last 20 years or so I've programmed 6502, Z80, x86 (16/32/MMX/SSE/SSE2), ARM and various proprietory SIMD & RISC machines and pseudo-MIMD machines. TBH the payoff for these skills simply isn't worth it.

    As an asm coder I _may_ find a full time job but asm will take as little as 10% of my time. Contract asm work is out of the question and I haven't seen any in years (since I wrote a serial port driver for Win3.1). I actually like programming in assembler but for the sake of my pay packet and career I have reskilled in PHP, MySQL, CSS, XHTML, JavaScript etc simply because I can find contract work that pays well. Something that appears unachievable with asm. Maybe this is why we are a dying breed.

    Lastly, you're right. This discussion crops up so frequently on BBS's, Usenet etc. It seems that the answer must be that asm coders are still needed and asm is still relevant! If they weren't why would we be discussing its relevance!

    Incidentally, if anyone would like to hire an asm coder who like asm mail asm@burnttoys.net ;-)

    --
    Time flies like an arrow. Fruit flies like a banana.
    1. Re:"Assemblers are a dying breed" by Mr2cents · · Score: 1

      I don't understand why you went from ASM to web development. Surely there are some other markets where you can make more use of your skills? Embedded development in C is going very strong, and assembler knowledge is very helpful in that area. I'm an embedded software engineer myself and looking at compiler outputs, and pouring through CPU manuals is all part of the job.

        Most of the code isn't written in assembler, but that would just be foolish: in C you can target any processor you want, even your PC. No need to rewrite that queue implementtion when a new processor architecture is used.

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
  203. DCR on PPC by Inode+Jones · · Score: 1

    Actually, with gcc you _can_ access DCR on a PowerPC from C.

    It's something like:

    #define mtdcr(r,v) asm("mtdcr %0,%1" : "r", "v")

    (I can't remember the exact syntax, but I'm doing this at work. It's funny putting things like isync in your C code :-)

    1. Re:DCR on PPC by StrongAxe · · Score: 1

      #define mtdcr(r,v) asm("mtdcr %0,%1" : "r", "v")

      Oh? What is this asm instruction of which you speak? Could it possibly be assembler? Even if the facility is included in the compiler as a matter of convenience, it is useless to the devloper unless he also has an understanding of the machine/assembler level model of the architecture (as opposed to the C/C++ level abstraction thereof).

    2. Re:DCR on PPC by Austerity+Empowers · · Score: 1

      You're correct, and it's my preferred way of dealing with them. It was a fast example, but:
      1) Note you still have "__asm__" in there, that causes the compiler to emit that instruction
      2) One of the more common reasons to be accessing DCRs in the first place, is for example, setting up the cache, or doing some "pre-C code" initialization
      3) Many special instructions or chip registers require more than a simple one liner depending on the variety of PPC. You'll end up with a multiple step bound define for accessing an address and a data registers, both within a DCR to cause a move to occur.

      One way or another, asm is unavoidable. It's one thing to say "eh, i'll learn it OTJ if I need it", but it's a lot to learn and a totally different system of thinking than the current OOP abstract and expand methodology that's successful at the higher level. Understanding how hardware actually works is not strictly the domain of hardware engineers, a lot of us cannot code at all. I happen to do it a lot, but I don't really want to...it's just that we have so few good FW people (in every place I've worked).

      Now off to service one of said FW people, who doesn't understand an ISR...

  204. High Performance Computing by Anonymous Coward · · Score: 0

    Assembly is useful in High Performance Computing. On a multi million $ machine, a few percent of peak performance means real money.
    Good assembler can occasionally give speed ups of 5x to 10x over C/C++ code (code dependent statement of course)
    That is significant on machines like BlueGene / Cray or even just your local cluster.

  205. Dumb question by sasdrtx · · Score: 1

    Compilers don't write and compile themselves.

    --
    Most people don't even think inside the box.
  206. That's baloney. by Ihlosi · · Score: 1
    Machine code is just another programming language and is interpreted by the CPU.

    No. And that is the difference between machine code and any other language:

    There is nothing to interpret.
    The majority of the CPUs has zero degrees of freedom when executing machine code. Every code sequence will cause the CPU to perform exactly the memory accesses and register manipulations that are specified by that code sequence. A "MOV #0, A" will do one thing while an "XOR A, A" will do another thing, even if their end result may be the same.


    If you have CPUs that take several clock cycles per instruction (like a good old '51 12-clocker), then you will even have to know what exactly happens at each of the cycles if you want the CPU to play well with the rest of the hardware.

    1. Re:That's baloney. by msormune · · Score: 1

      So what does the CPU do when a single operation takes several clock cycles to complete? It processes your machine code instruction, thus interpreting it. Machine code (and registers, for example) is also an abstraction of the tasks CPU is really doing. Even if this is really the lowest level of programming (apart micro code and such), it is still being interpreted by the CPU.

  207. Re:Isn't it the root of all programming languages? by oliverthered · · Score: 1

    And by far the easiest way of knowing the costs of the operations is to know what will be produced when the application is complied.

    Knowledge of assembly language is probably the easiest way to know this.

    --
    thank God the internet isn't a human right.
  208. For debuging, Knowledge of assembler is important by scharkalvin · · Score: 1

    If you do any embedded work, knowledge of assembler will come in handy.
    Some low cost debugging tools do not support source debugging and you
    have to look at your breakpoints in machine (assembler) code.

    Also the day will come when a bit of code looks like it should work but
    doesn't because the compiler screwed up and optimized your logic out of
    existance. THEN you need to be able to compare the generated machine (assembler)
    code against your source code to find the problem. This has happened to me
    several times (AVR-GCC).

  209. Using it at work right now! by pfft · · Score: 1

    I've just spent a working day pouring over the disassebly to find out why a particular method was unexpectedly slow, realising that MSVC++ is doing an absolutely awful job with STL iterators, changing it to use plain arrays, and ka-ching!, 25% speedup. :) So yes, I think it's relevant.

  210. An AI program to generate slashdot comments by dildo · · Score: 1

    I am a kickass programmer, that is why I am spending my time writing comments on Slashdot. When I was only 2 years old I had created my first hello world program on a computer I had created using nothing but pinball relays and twine. Did I mention that I invented the first Apple computer? I gave credit to Steve Wozniak because I am a charitable person and I have no qualms about the size of my programming penis.

    So, about this assembly language thing. If you want to be a good programmer (like me), you will learn how to do assembly language for every single processor -- including ones that were outdated 30 years ago. Let me put it this way: you are a moron if you don't know assembly, and you are an even bigger moron if you don't write your own webserver, compiler, and quantum computer on a daily basis in assembly -- like I do.

    You young whippersnappers don't understand that real programmers carry data between registers in leaky buckets uphill both ways.

    Listen, my programming expertise might appear like it is drawn exclusively from reading wikipedia, but I assure you that it is much much greater than that!

    Did I mention that I wrote my own webserver in Brain****, it is more secure than OpenBSD and runs in 8k of ram?

    Oh, and yes, I am not insecure about my job position, my achievements in life, my salary, or the intelligence of people younger than me. I am most certainly too busy being successful to write this comment on Slashdot to impress other successful people who write thousands of lines of x86 assembly that run missile silos and medical equipment.

    Someone once said that on the internet, everyone has a 12-inch constantly hard penis. All of the other suckers have to lie about it -- with me, it's the truth!

    By the way, I rock. I am cool. Really, I'm not a loser.

  211. Re:All's quiet (unless .NET takes over) by KudyardRipling · · Score: 1

    There is a plainly understood reason for why this is so. Assembly language while being archecture dependent offers too much ***power*** to the programmer. Think "Atheros HAL" and FCC regs. Someone knowing assmebler could (already has been done) hack the code to let the wifi cards do things that are federal no-no's. This is where public policy quietly and with little notice piggybacks onto market forces. To the tyrant, everyone is a criminal and everything is a weapon. Therefore: A well-regulated militia being necessary for the security of a free State the right of the people to keep and bear arms (assembly language skills INCLUDED) shall not be infringed.

    Learning and using assembly language is a political act. Enjoy it.

    --
    Submission as evidence constitutes plaintiff and/or prosecutorial misconduct.
  212. assembly rationale. by hensto · · Score: 1
    Over the years I've seen many use assembly for making Operating systems and library routines.

    For use in Operating systems you will be better off using C for the most part and assembler where it is needed. Most mortals aren't so good that they can beat a C compiler at optimizing, so they are better off using C, as a bonus the code will be more readable and you will be more productive.

    For library routines, for instance graphic routines assembler rocks, but here also assembler is mostly useful for the inner loops only. The biggest optimizing gains can be achieved at medium or high-level code, if your software algorithms suck than assembler sure won't help.

    And yes I do have a talent for stating the obvious... i know. ^.^

  213. I just graduated from college.. by zyl0x · · Score: 1

    ..and I took a basic assembler course in my last year. Though I can safely say I will never program in assembler, the insight into how data is stored in memory (little endian, for example) is important. Also, programming in such small steps allows you to appreciate system resources. It has made me a more efficient C-language programmer. I do not regret my choice, and as long as computers still operate on the same foundations they always have, assembler will always have it's place.

    --
    Blerg.
  214. You're making the same mistake that you criticise by Viol8 · · Score: 1

    You accuse some people of not really understanding whats going on but you yourself don't appear to understand the reason some things are done as they are:

    "Never mind that the new end of the first string would be very handy for the next strcat to that same string.)"

    Yes , but only if you wanted to use another strcat() immediately afterwards. Aside from in that case the pointer would be fairly useless. strcat() like a lot of routines returns its argument so you can pipe stuff together without having to use intermediate variables. eg:

    void func(char *teststr)
    {
            char str[100] = "hello";

            if (!strcmp(teststr,strcat(str," world")))
            {
                      do something
            }
    }

    Obviously thats a contrived example but you get the idea - no intermetidate variable required , the 2nd parameter passed to strcmp() comes (hopefully) straight off the stack, not via an intermediate.

  215. In any case by BrokenHalo · · Score: 2, Funny

    One of the best reasons to learn to do assembly programming is because it's fun.

    Though I can't say that's why I did it. In my case (back in the early fourteenth century), we all wrote assembly code because that's how serious programming was done. Sure, we had COBOL to update ledgers and write reports, and FORTRAN to take the hard work out of maths computation, but for anything that really needed any kind of optimisation on those old core-memory machines, assembly was the only way to go.

    There were other reasons too; I worked in a computer bureau with several Burroughs B3700 machines, and we had one or two clients for whose packages the source code had been long since mislaid.

    So rather than re-writing the thing from scratch whenever mods needed to be made, a couple of us used to hack directly on the binary. It's not all that easy, but it's job security. ;-)

    1. Re:In any case by chthon · · Score: 1

      I started with assembly, because I got nothing else. It was 1980/1981, I was fourteen years old, and a computer was just too expensive. However, the library got this fantastic book from Dirksen, which laid out microprocessors and microcomputers with the 8080. There was also an engineer in our neighbourhood who had designed and built a microcomputer himself, so I could ask this person questions. Mostly, I read books about microcomputers and assembly.

      However, I did not have the pleasure to really start programming until I was 18, and in my last year of highschool in Electronics. We got 8080 SDK's. A couple of months later I was able to buy my first computer, a Sinclair ZX Spectrum. Until then, I had not programmed in any high-level language.

      <joke>Young kids these days</joke>

  216. Yes, it is relevent. by Anonymous Coward · · Score: 0

    If you are writing software tools that place hooks into the target application (or the target runtime) so that you can monitor performance, code coverage, memory allocations, thread switching, perform flow tracing, perform debugging, then yes, assembly is necessary. I work for a software tool company that produces the above software tools targetting languages from C++ to JavaScript, Ruby, Python and Lua. To hook these languages requires assembly experience as all of these languages (even the ones that provide a helpful profiling API) fail to provide access to all the data that is needed. Thus you need to modify some functions and insert your own hooks. For Ruby and Python this is the only way to write a decent Memory Analysis profiler.

    The company I work for is Software Verification, but my comments apply pretty much to most of the other companies that provide such tools. Java is the only language in mainstream use that doesn't seem to require assembly use to hook into any part of the system.

    So far my favourite languages are C++, assembly and Ruby.

    One of the biggest weaknesses we see in the current crop of software engineers is that anyone that hasn't worked in assembly, as a general rule, has no idea or concept of the size of datatypes and why it is important to know the size and what the implications are of not knowing the size of fundamental datatypes for a given architecture.

    How big is a void *? Is it 2 bytes? 4 bytes? 8 bytes? Something else? Well that depends in the architecture. Amazing how many people can't answer this simple question, even when told the architecture they use. Then you find out they only have experience writing web applications and have never needed to know.

    Nothing wrong with web apps - but you do need to have knowledge outside that arena.

    So which architectures might has a 2 byte void *?

    Ask Chuck Peddle :-)

    Stephen

  217. "Under the hood" by gatkinso · · Score: 1

    Don't know about you, but my computer does not HAVE a hood....

    --
    I am very small, utmostly microscopic.
  218. Two main programmer mindsets by justthinkit · · Score: 2, Insightful

    I've worked with people with very focused high-level programming skills and found that while they could write mostly decent code, their code was also most likely to fail in production since they were completely mentally removed from concepts like disk-seek times or bandwidth constraints.

    I'm not a great programmer, but I've always had a good "sense" (for lack of a better word) about technical things. I worked a bit at a company doing mid to high level (V)FoxPro programming. They put me on the least desired machine and I set to work. Within minutes I realized the machine was not running right, CPU at 100% or close to it most of the time. Turns out it was virus-infected (despite NAV, of course). I found the name of the EXE, renamed it in autoexec.bat before it loaded, then deleted same. Problem solved and the oldest 'clunker' became a quite acceptable computer.

    I think this story illustrates the two broad classes of programmers. (1) those able to get a task done, no matter how nerdy or obscure (but who are pathologically incapable of documenting their work, or teaching others) [e.g. my co-worker who had used that computer for months or years without noticing the virus] and (2) those who are good at interface, optimization, and documentation but lack the penetrating power to solve the more difficult problems [e.g. myself -- I had to leave that job because I couldn't 'crack' the OO stuff].

    Speaking to this thread's main question: both classes of programmer would need to understand some assembly, but for different reasons. Group 1ers would likely end up using it (or having to debug/change it) from time to time -- and it would be no big deal to them to learn it, use it, whatever. Group 2ers would likely want to know _when_ to use it, and probably get someone else to do that coding.

    In the geek cred hungry world of /., not many would want to admit to being a Group 2er but I have no problem with it. For example, Group 2ers would also know when a Group 1er's code sucked, from a performance standpoint. Coders with a trailblazer mindset are rarely good optimizers.

    BTW, in considering where Woz, Ciarcia, Kahn and Hertzfeld fit into this, I think they are Group 1ers who simply took an interest in Group 2 stuff. If you can learn both mindsets, you are one powerful programming dude, IMO. [Pity that 2ers like myself can't easily (ever?) become 1ers.] Most 1ers just want to get the job done and move on, yet so much can be learned after you think you have finished your program. [MS deserves props for realizing this and assigning a second unit to work on optimizing the code already working -- Win95 crap became slightly less crappy Win98 through this process (pdf)]

    --
    I come here for the love
  219. Interesting artlce on the need by GrenDel+Fuego · · Score: 1

    If you're looking for a reason why assembly would be a good thing to learn, check out the below article from Joel on Software.

    http://www.joelonsoftware.com/articles/LeakyAbstra ctions.html

  220. embeded systems are getting too complex for asm by Anonymous Coward · · Score: 0

    Many new embedded applications (like set top boxes or TV sets) are done (or will be done) with 32bits processors and have a extermly high complexity. These systems you can not program anymore in assembly. You will need an higher level language for this!

    Besides that, some (embeded) processors are too complicated to program in assembly. I did work on a VLW processor with 5 instructions per word. Although you could program in in assembly, the C-compiler would almost always do a much better job at it.

    1. Re:embeded systems are getting too complex for asm by Ihlosi · · Score: 1
      Many new embedded applications (like set top boxes or TV sets) are done (or will be done) with 32bits processors and have a extermly high complexity.



      ARM assembly isn't too terribly complex, neither is are the dialects of various DSPs. And if the processor is too complicated for the compiler programmer (i.e. it can do stuff like circular buffers, bit reversed addressing, polynomial evaluation, FIR filtering in hardware), you're back to assembly if you want your program to actually use the processor anywhere near its full potential.

  221. Would you trust these professionals? by mikehoskins · · Score: 5, Insightful

    The original post asks if Assembly is still relevant today. I'll ask some rhetorical questions (the only kind in a blog) and see how they apply:

    * Would you want an astronaut to understand physics and math?
    * Would you want a doctor to understand chemistry and biology?
    * Should somebody studying to be a Literature teacher take their full set of liberal arts courses, including history?
    * Should somebody earning a business degree take music appreciation?

    Most of us probably said, "Yes" to most or all of those above. Even if the study seems irrelevant or too "low-level" or too "high-level" at the time, there are areas of coursework that help us understand things better.

    I see a lot of dead wood in the IT industry. There are enormous numbers of people who either have no passion or who do not have a deep-enough or broad-enough knowledge of computer science to do their daily data processing job well. They are dependent on others around them for everything, even though they may be very skilled in one area.

    By having both a broader and a deeper knowledge, people are necessarily better at troubleshooting and at understanding the areas outside their particular specialty. It makes them be better at all of IT and helps them do their specific role.

    You should learn IT two ways -- deeply and broadly. You should deeply learn specific skills (Java/C#/Linux/Windows/scripting in Ruby/whatever) and you should learn broad skills (computing theory/relational databases/networking/troubleshooting/programming/a nalysis/architecture/whatever). The difference is training vs. education.

    There is an enormous difference between training and education. Training is learning specific skills for specific tasks (narrow/specific), while education is broader and teaches you how to think, understand, and apply (broad/general).

    While taking Assembly may not seem relevant at the time and you may never directly use it again, for every programming task, having a strong background in all of computing theory (including how the CPU handles its low-level instructions) educates you and gives you a deeper understanding. (Don't just be trained, be educated!)

    My recommendation is the book My Job Went to India (And All I Got was this Lousy Book). If you can't afford it, read the sample chapters, especially the "Being a Generalist" and "Being a specialist" chapters at http://www.pragmaticprogrammer.com/titles/mjwti/in dex.html.

    Personally, unless you need the specific class/training, I'd say that FORTRAN or COBOL ought to be abolished as required material in all colleges and shouldn't be in the degree program. Those should be electives only. Assembly, on the other hand, should remain required, for a deeper and broader education. (Don't settle for a dumbed-down program).

    The difference, again, is training (specific/skill-oriented/task-oriented) vs. education (general/broad/understanding-oriented). Education and being a generalist will reap large rewards, long term. So stick with it and take that class. Assembly is a very important foundation class that educates you, long-term....

    Another rhetorical question I have is this: "Are you passionate for IT or is it just a high-paying (presumably) job?" If it isn't a passion of yours, find you passion and do it well. If it is, take Assembly and like it -- it'll help you appreciate IT, your computer, your high-level language, and give you a more educated view of the "soul" of your computer.

    (They don't make you take Assembly at many/most schools for their health. It would be a crying shame to remove it from the required courses).

    1. Re:Would you trust these professionals? by shadwstalkr · · Score: 1

      I mostly agree with you, except that I think FORTRAN needs to stay in the curriculum, at least in a survey course. Unfortunately there are a lot of science departments that use FORTRAN exclusively, because older professors have decades of code and no motivation to learn a new language. Until the next few generations of grad students can convince professors to use SWIG and Python (or something similar), a complete CS training requires at least a general knowledge of FORTRAN.

    2. Re:Would you trust these professionals? by suggsjc · · Score: 1, Insightful

      Should somebody earning a business degree take music appreciation?
      All of your other examples had a direct correlation. I'm not knocking music appreciation, but it does seem like more of a stretch than the others.

      Anyway, the real question/headline should be "Is Assembly Programming Still Relevant to Mainstream Developers, Today?" and the answer is simply no. Because that analogy would be something more like:
      Should an elementary school teacher have an MBA so that she can understand the inner-workings of the business environment of her school system in order to be able to more cost effectively teach her students in a manner that maximizes her usage of government funding?

      You made some other good points, but I'm just too lazy to comment on those.
      --
      When I have a kid, I want to put him in one of those strollers for twins and then run around the mall looking frantic.
    3. Re:Would you trust these professionals? by mdwh2 · · Score: 1

      * Would you want an astronaut to understand physics and math?
      * Would you want a doctor to understand chemistry and biology?
      * Should somebody studying to be a Literature teacher take their full set of liberal arts courses, including history?
      * Should somebody earning a business degree take music appreciation?

      Most of us probably said, "Yes" to most or all of those above. Even if the study seems irrelevant or too "low-level" or too "high-level" at the time, there are areas of coursework that help us understand things better.


      You've lost me on the last two of those? There's no harm in taking them, but I wouldn't say that they should be taken (possibly this is due to my UK background, where unlike the US, people don't tend to study as wide a range of subjects at university level).

      The answer may be Yes to the first two, but this is comparable to saying that a computer programmer should understand maths or computer science. Learning assembly, whilst it may still be useful in some ways, is a lot more specific than that.

      I would agree that learning "broadly" is good as well as deeply, and assembly can be one example of that. But at the same time, those people who haven't studied assembly may have studied broadly in other areas, such as how an operating system works, or mathematics.

    4. Re:Would you trust these professionals? by dkasak · · Score: 1

      This is one of the best posts I've read on /. in a while. Great job!

    5. Re:Would you trust these professionals? by starX · · Score: 2, Insightful

      Here here!

      Asking why study Assembler is a little like asking "why study Latin." It's important to have an understanding of the low level programming because it will help you understand what's going on when using something higher level like malloc(), which will in turn help you write better programs.

      Just my $.02

    6. Re:Would you trust these professionals? by Marxist+Hacker+42 · · Score: 1

      The answer may be Yes to the first two, but this is comparable to saying that a computer programmer should understand maths or computer science. Learning assembly, whilst it may still be useful in some ways, is a lot more specific than that.

      I disagree. A good course on assembly and how it relates to machine language IS math AND computer science. It's the junction between the two that brings the relationship into sharp focus.

      Which is why I not only say university students should learn assembly- but that it doesn't matter *what* specific architecture they take it on. In fact, for history's sake, those who will be programming in C or .NET should probably take DEC PDP assembly- if for no other reason than to have INC and DEC instructions that map directly to ++ and --.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    7. Re:Would you trust these professionals? by guaigean · · Score: 1

      Additionally, as it stands now, FORTRAN is one of the main languages of Supercomputing. Sure, C and C++ have made some headway, but the old die-hard codes out there are still tooling along in FORTRAN. As much as I hate it, there are a lot of scientists still using it, and you have to weight the time it would take them to rewrite it versus the net benefit gained. So, as the parent states... FORTRAN should at least have a brief overview, as the odds are good that anyone entering the computer science field (NOT application programming... there IS a difference) will see it in the future.

      --
      Microsoft Sucks, F/OSS Rocks. I get mod points now right?
    8. Re:Would you trust these professionals? by ncc74656 · · Score: 1

      I mostly agree with you, except that I think FORTRAN needs to stay in the curriculum, at least in a survey course. Unfortunately there are a lot of science departments that use FORTRAN exclusively, because older professors have decades of code and no motivation to learn a new language.

      Math, too...I had to pick up enough FORTRAN to get by in a computational linear algebra course. That particular course (as opposed to the regular linear algebra course) was (and is) a degree requirement.

      --
      20 January 2017: the End of an Error.
    9. Re:Would you trust these professionals? by 644bd346996 · · Score: 1

      These days, most of the computation done in undergrad math classes is done with Matlab. FORTRAN no longer dominates those kind of classes.

    10. Re:Would you trust these professionals? by mdwh2 · · Score: 1

      A good course on assembly and how it relates to machine language IS math AND computer science.

      It's one particular type of maths and computer science, but unless you think a computer programmer should know everything there is to know about maths and computer science, this doesn't mean that assembly is a requirement.

    11. Re:Would you trust these professionals? by Zontak · · Score: 1

      Learning assembly is like learning Latin or Greek or Old English. It's a really good idea. You might not learn a whole lot of it, but a little goes a long way.

    12. Re:Would you trust these professionals? by NeilTheStupidHead · · Score: 1

      There! There!

      --
      Lose: misplace or fail || Loose: not bound together
    13. Re:Would you trust these professionals? by ioshhdflwuegfh · · Score: 1

      the real question/headline should be "Is Assembly Programming Still Relevant to Mainstream Developers, Today?" Why is this the "real" question?
    14. Re:Would you trust these professionals? by ioshhdflwuegfh · · Score: 1

      Asking why study Assembler is a little like asking "why study Latin." It's important to have an understanding of the low level programming because it will help you understand what's going on when using something higher level like malloc(), which will in turn help you write better programs. No, not really: people don't write in Latin anymore, but they do in assembler. Assembler is alive and well.
    15. Re:Would you trust these professionals? by Marxist+Hacker+42 · · Score: 1

      It's one particular type of maths and computer science, but unless you think a computer programmer should know everything there is to know about maths and computer science, this doesn't mean that assembly is a requirement.

      I don't think a computer programmer should know everything about math. But he should know everything about computer science, and that would include the kind of math the computer is best at. Not every algorithim you're ever going to need is going to be already in an abstracted dynamic link library. And if you know binary math and boolean algebra, you'll understand how to write a new algorithim in such a way in a higher level language so that the compiler will end up with a very efficient and reusable piece of machine code.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    16. Re:Would you trust these professionals? by mdwh2 · · Score: 1

      But he should know everything about computer science, and that would include the kind of math the computer is best at. Not every algorithim you're ever going to need is going to be already in an abstracted dynamic link library. And if you know binary math and boolean algebra, you'll understand how to write a new algorithim in such a way in a higher level language so that the compiler will end up with a very efficient and reusable piece of machine code.

      I guess I suck then, as I don't know everything there is to know ever about computer science.

      Out of interest, can you give me an example where knowledge of the assembly can allow you to write code to improve the efficiency of the code the compiler outputs? I'm not saying it never happens - but does this happen for all types of programmers, and how often does it occur compared with say writing efficient algorithms in the first place?

    17. Re:Would you trust these professionals? by mikehoskins · · Score: 1

      Thanks. I felt some rare inspiration.

      It came from that book I referred to in the previous post.

      Some also came from reading about 1/3 of the online book here johntaylorgatto.com/.

      I've been rethinking my thinking.... :-)

    18. Re:Would you trust these professionals? by Marxist+Hacker+42 · · Score: 1

      I'm not saying it never happens - but does this happen for all types of programmers, and how often does it occur compared with say writing efficient algorithms in the first place?

      It's a part of knowing how to write efficient algorithms. Your algorithms will be more efficient if you take into account that certain data types match certain processors better. For instance, a floating point add instruction may take 3 clock cycles to complete, where a single word add will only take one clock cycle (therefore, you should always match the variable type of your for loop to the word size of the intended microprocessor). That sort of thing.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
  222. Nah. by Ihlosi · · Score: 1
    This is exactly why you should start with the i386.

    No no no. Start programming in C on a PC, and then learn assembly on a platform that's completely un-like a PC ('51, anyone ? Six different memory types is fun).

    Similarly, I consider myself lucky to have English as a first language -- anything but Russian seems almost boring by comparison.

    Bah. English is simple enough as far as rules go, you just need to learn all the exceptions, the pronunciation of every single word, and the huge vocabulary. Try German if you want a challenge. There's rules for everything.
    And stay away from languages that are direct derivatives of Latin (i.e. French, Spanish, Portugese, Italian, etc). They're easy. Slashdotter parents? Hello???

    *raises hand* Yup. My DS (I'll let you puzzle over that one. It's a common acronym on many boards, only the slashdot crowd might be utterly unfamiliar with it) is going to grow up bilingual. And I'll have to get him started with a nice 8-bit home computer once he turns 3. Hehe.

    1. Re:Nah. by Anonymous Coward · · Score: 0

      According to acronymfinder the most likely candidate is Down's Syndrome...

    2. Re:Nah. by Anonymous Coward · · Score: 0

      English is a Germanic language, so aside from the oddness of tenses (some german tongue twisters "nest" a bunch of past-tense clauses since the verb is at the end), it's going to be really familiar to english speakers. The gendered nouns aren't that terribly bad, you simply learn the gender as part of the noun.

      Slavic languages are painful. And chinese is still gobbledygook to me.

  223. interrupts for system calls by pikine · · Score: 1

    I don't know what the grandparent is having in mind, but he probably discovered in his horror that deep down ntdll.dll, it still uses interrupt to make system call to the kernel, just as Int 0x21 for DOS.

    It is a standard system practice really, and it's one of the few ways that unprivileged code (user mode) can run privileged code (kernel mode). I think interrupt is preferred because it has a clear namespace in IDT compared to overloaded GDT and LDT namespace, which contain descriptions for code segment, data segment, stack, and call and task gates.

    Even Linux on x86 uses a software interrupt for system call.

    There is still segmentation in 32-bit x86, by the way. You just normally don't use it because your CS, DS, ES and SS are all pointing to the same flat 32-bit address space mapped and managed by page table. However, I think in Win32, FS and GS are used for thread local storage---global variable for threads.

    --
    I once had a signature.
    1. Re:interrupts for system calls by Gazzonyx · · Score: 1
      Doesn't this mean a costly context switch from user/kernel mode?

      Forgive my ignorance; I'm writing ASM on Solaris for school right now...so, it's like I'm playing baseball and trying to figure out kricket at the same time with no point of reference other than my limited experience...

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

    2. Re:interrupts for system calls by pikine · · Score: 1

      Not really. The hardware can do user/kernel context switch fast enough, costing about tens of cycles. It is costly when you have to emulate it in a virtual machine, because the interrupt first traps to the host OS kernel, then is dispatched to the VMM, then to the guest OS kernel. We're talking about thousands of cycles here.

      Context switch can be costly in hardware as well. It happens when you have to change address space from one process to another, which requires reloading the page table.

      User/kernel context switch does not involve reloading page table because the kernel is usually mapped to the same address space.

      --
      I once had a signature.
  224. not as far as I'm concerned... by kriswd40 · · Score: 1

    Took Assembly in college for my Computer Science degree which i finished with in 2003... I can't recall ever seeing any jobs that required Assembly in all my job searching since then. Along with Cobol, it seems like another legacy language that is only required in very specific cases if at all.

  225. Other burning questions of our time.... by gorehog · · Score: 1

    Hey, I have a much more important question...

    With the advanced steel alloys we have these days is iron mining still important? How relevant is mining, smelting, and refining ore anyway?

  226. No by Erich · · Score: 1

    I work for a communications/semiconductor company.

    --

    -- Erich

    Slashdot reader since 1997

  227. Re:x86 ASM for Windows by Glasswire · · Score: 1

    The famous Steve Gibson, author of Spinrite, writes all his software (Windows mostly) in pure ASM and the speed and efficiency of his apps speak for themselves.

  228. Why web development... by burnttoy · · Score: 1

    ...because in London alone there will be, maybe, 150 to 200 JS/PHP/SQL jobs paying well whilst for embedded C/asm work there will be 5 or 6.

    Thus it is far easy to find webdev work from the very outset despite the increased numbers of candidates for each position.

    Also, those 5->6 embedded jobs in London will be for 1, maybe 2 companies. Basically if it say "ARM" or "Embedded" it will be Symbian. Either that or it'll be 3DLabs in Egham. Hmmm... worked for both of them already!

    --
    Time flies like an arrow. Fruit flies like a banana.
    1. Re:Why web development... by Anonymous Coward · · Score: 0

      Dude, with your skills you could pull down big bucks working fulltime on ASM if you go work at a game studio. Places that do PS2 and PS3 games are crying out for hardcore ASM dudes to write and optimise VU microcode (VLIW!) and Cell SPU jobs.

  229. Still relevant. by jshriverWVU · · Score: 1

    Some people say Assembly or the ghz war is over. But in some sectors they're still very important. While it might be true, unless you're a gamer, a 1-2ghz machine is more than enough to do typical stuff like web/email/aim/etc. For people who do massive parallel processings tuning a specific function with inline assembly can potentially save you time. Say you run a program on a 10 node cluster and it takes you 1 week to render a video or analyze some dataset. If there was a way to take your bottleneck functions and inline asm some of it to give you even 10% more efficiency, then you're looking at saving not only time but potentially a lot of money in electrical costs/cooling/etc. Beside that there's always the embedded world. I wouldnt want to write a VB.net on a PIC chip ;)

  230. Assembly - Quertie forgot at least one by bronsinbound · · Score: 1

    Also, you'll find a bunch of it in the Linux kernel code. Most of the kernel is in C, but parts just cannot be done that way... and, there, you'd better know your stuff!

  231. Assembler SHOULD be required. by gdrumm0356 · · Score: 1

    Why? In an assembler, also called ASM or MASM, class the student gains many valuable lessons about programming practices. You may learn the hardware of a particular CPU or controller, but you are also learning how to design and implement a program using a low-level language, possibly with no libraries, monitor program, or OS to "handle the details" in making it work. POP and PUSH are from the stack-based CPUs, (and a few interpreters/languages) which are based on Embedded Controllers like the X86, 68000, 6502,... Not all CPUs are stack-based. B and C were designed for stack-based CPUs. C on a mainframe, or or other CPUs without stacks, don't have stack overflows. If you are using ASM on a stack-based CPU, YOU must do your own checks before running out of stack space. Developing in ASM forces the programmer-to-be to actually think about what they are trying to do, where and in what order their data is declared, and what parameters are being used in calling/called programs or subroutines/functions. Calls from external programs, or even internal calls, must be validated for length, and a sanity check performed on all values or pointers. (Language features which are standard in COBOL, Fortran, etc :-) An experienced ASM programmer would be shocked (I was) at the library routines used by C. No wonder there are so many stack and buffer overflows. No checks are made for valid lengths or bounds of the arguments passed. New libs are now available, IF someone pays attention and actually uses them. SANS weekly vulnerabilty reports are running about 80+% in "failing to sanitize or validate user supplied data, or parameters". People get so caught up in the bells and whistles of their favorite language-of-the-week, they forget to apply rules that would be learned using ASM, or WHY a language like COBOL defines what happens during a move/copy if the receiving field is smaller or larger than the sending. (truncate or space fill). C for example allows the programmer to create a fast, tightly-coded program, with STYLE, but which could crash when it encounters data it was not expecting-just like ASM!

    --
    Former geek, now I can rest...
  232. John Titor was right by Vexorian · · Score: 1

    If you take a look to Jonh Titor's sayings you can easily tell it is a vintage programmer in disguise. The apocalyptic situation he describes is a world full of vb programmers that need to travel back in time so they can borrow an old computer that is able to do some binary executable code translation...

    --

    Copyright infringement is "piracy" in the same way DRM is "consumer rape"
  233. debugging by walshy007 · · Score: 1

    while debugging has been mentioned here previously by people as a reason for which assembly is helpful, the majority I think are a bit out of the right scope it should be in.

    while for programs written in c/c++ source level debuggers are a very handy piece of work, what happens when the bug in question actually originates in the compiler or assembler putting your program together.

    my logic with debugging is a layered approach, if something screws up, go to the layer beneath it to see why. long story short, when it comes down to the lowest level, your dealing with machine code, to debug that it helps to understand it :)

  234. If you are programming microcontrollers, It is by Agent0013 · · Score: 1

    You can program some of the larger and more powerful micro-controllers with languages other than assembler. But even then there will be parts of the main routines, or O.S. if you want to call it that, that you may want to write in assembler just to get the speed and efficiency of assembler for. In particular things like interrupt routines and the low level routines for lighting a LED grid would be written in assembler.

    If you get into the smaller, cheaper micro-controllers, like Microchip's PIC controllers, you will probably always be using assembler. But the job of a smaller micro-controller is simpler, it is more of a customized piece of circuitry for your circuit, rather than a full-fledged computer. A motor controller for reading the pulse-width generated signals from an RC controller to operate a large DC motor for a battle robot is a good example of a small micro-controller that does a simple but important job. Assembler runs fast and does the simple job of reading the input signal and generating the output signal better than any higher level language could handle it.

    --

    -- ssoorrrryy,, dduupplleexx sswwiittcchh oonn.. -Quote found on actual fortune cookie.
  235. When performance matters, assembly matters by gothmogged · · Score: 1

    Previous replies have covered the conceptual justifications. They make sense and can be summarized by the dictum: effective tool use is proportional to the depth of their user's knowledge of how and why they work.

    In the land of high performance computing (HPC aka supercomputers) time quite literally is money. The longer it takes your application to solve a problem, the more it will cost in real dollars and in missed opportunities. 99.9% of your application code will be written in a higher level language, but if you want to find out why the compiled code is not getting peak performance you have to read the assembly code.

    The more complicated a chip is, the more difficult it is to write a generally effective compiler for it. Itanium (and now the new multicore chips) are well publicized examples where maximum performance cannot be achieved without deep knowledge of the hardware and how the compiler interacts with it. This knowledge cannot be achieved by ignorance of assembly code.

    Awards and accolades in the HPC community go to the people who can make all the hardware, right down to the bare metal, sing to their tune.

  236. Excellent background for C, embedded, etc. by DCheesi · · Score: 1

    Chances are that you'll never actually have to use assembler in your professional life. However, learning one of the simpler assembly languages (eg. the 68k processor family) provides insight into the inner working of the processor. And that in turn can help in understanding programming language features, OS/driver code, etc. For instance, I never really understood C pointers until I learned assembler.

    If you only ever plan to play in the highly abstracted realms of Java/Perl/Basic, then you could probably get by without it. But if you think you might ever deal with C (or even C++), any amount of embedded programming, or situations where processor efficiency is crucial, then you really should familiarize yourself with assembler.

  237. Relevant by jchap · · Score: 1

    "How relevant or useful is it to learn Assembly programming language in the current era?"

    Pretty amazingly relevant actually.

    Since the point of Assembly is to have a pretty much one to one relationship with the machine code of the target processor and all languages have to produce (or in the case of an interpreted language string together at run time) machine executable code at some point all programmers are essentially writing in assembly already. Compilers, interpreters etc are an intermediate stage designed to save the programmer work.

    There are two points to remember when discussing these intermediate coding stages: firstly you don't get portability, high level coding, object orientation or other benefits at no *cost*. There is always a trade-off between program size, program speed and ease of code generation. The second point to remember is that a lot of us assume that the compiler will do a pretty much perfect job in the conversion to assembly without first having a look at the actual output of our favourite one.

    As a final note, remember that that which looks beautiful, elegant and simple in a high level language can look like a dog when it comes to the assembly output or in execution (think recursive functions).

    To understand these points and make the most appropriate language choice for a given project there is simply no substitute for an understanding of Assembly Language. It's like trying to say you can learn to program without bothing to 'look under the hood' at all that ''Boolean logic'' stuff!


    Btw. 'Learning Assembly' means writing some real projects with it - not just reading about it in the bathroom for a couple of dumps.

  238. Assembleur by chro57 · · Score: 0

    You need to understand assembleur to write a compiler. And you need a compiler for this new language and operating system that is going to beat Microsoft, Sun, Apple, and IBM. But you also need verilog and VHDL to design the new CPU that is going to beat Intel, IBM, Motorola, Arm, and others. And a degree in materials to design a better silicium cristal. And a degree in business and finance to sell the thing. Otherwise, agriculture still needs arms. And lots of work too in water adduction and treatment. House building, too. Good luck.

  239. In a word, yes by whitroth · · Score: 1

    I've never done much in assembly, and what I did was a loooong time ago. But I *do* know some, and it is important. Here's one example of why: a number of years ago, at one job, some younger consultants came to me (as the senior tech resource) to tell me this one program kept crashing, and it was doing so in a linked-to commercial library (Tuxedo, if you must know), and they had no idea why.

    I proceded to run the program under the debugger, got to the library call, and then did something they had no idea you could do: stepi, and stepped *into* the library, with the debugger doing the disassembly. I worked my way through and found the function it was cratering in. Now, I had no idea of the purpose of the function, and there were no comments, of course. But had the authority and the knowledge to call BEA support, tell them I needed info from their developers, and could tell them both the name of the function, and though I wasn't familiar with assembly on a SPARC, I could still offer them some variable names, and about where it was happening.

    Within a day, I had the answer, and that's with waiting for a callback from tech support. Try *that*, if all you know is OOEmeraldSerpent++#....

                                mark

  240. Games by Anonymous Coward · · Score: 0

    Where would all our cracked games be without ASM?

  241. driving stick w/o knowing how engine works by davidwr · · Score: 1

    To drive a stick, you don't need to know how an engine works.

    You do need to know to be gentle with the clutch without riding it, and you need to know that if your car sounds a certain way or feels a certain way it's time to change gears.

    Engine louder than "normal"? Up-shift.
    Not accelerating fast enough? Down-shift.
    Is the car vibrating? Down-shift
    If you have a tachometer, is the needle above X? up-shift. Below Y? down-shift. Don't worry your sweet little head what the tachometer actually means.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  242. Free Machine Language/Assembly books by tut21 · · Score: 1

    You can fire up an emulator and start with something simple like Machine Language for Beginners...

    Or download the PDF of The Art of Assembly Language from the book's fugly website.

  243. Assembler is not relevant - it is essential by idkk · · Score: 1

    Now don't think I'm suggesting that we should all of us write lots of code in assembler. What I am saying is that we should know how to write assembler code, and (more important) how to read assembler code. Until a programmer understands at least something of what is going on unter the hood s/he cannot appreciate the basic costs of high-level language statements.

    --
    Ian D. K. Kelly

    idkk Consultancy Ltd.

    "Quality through Thought"

  244. You must've had REALLY poor classes outside of asm by Valdrax · · Score: 1

    You must have had really poor C programming and operating systems classes if you didn't get most of that without knowledge of asm. The only thing that you can't really do well without knowledge of assembly language is write a compiler.

    A basic C class should expose you to debugging and the three memory related issues you brought up. A good OS class will teach your about threads vs. processes. A good class on archetectures will teach you the general differences between historical hardware and how basic things like virtual memory and context switching works. Any low-rent school that fails to cover all this material effectively outside of an assembly class isn't going to do a good job explaining it there either.

    There are really only a couple of things I got out of assembler that I didn't get out of other classes -- how function calls work (and how much overhead is involved) and how memory alignment and data packing differs from architecture to architecture. (In other words, why you can't just dump memory structures into a file and expect the data to be easily readable cross-platform even if you pay attention to LSB vs. MSB).

    --
    If it's for-profit but free, you're not the customer -- you're the product (e.g., the Slashdot Beta's "audience").
  245. assembly language by Ozgur+Uksal · · Score: 1
    Here are a few reasons you might need proficiency in assembly language:

    You're writing software for a low-speed or low-memory chip for an embedded system (e.g. one of the PIC chips). Such chips are used either because they are cheap or because they need very little power. You can often program these chips in some variant of C, but if you need that last drop of performance, you use assembly.

    You're writing a compiler. In this case you may not have to write assembly directly, but you'll have to understand it intimately in order to convert source code to machine language. (Replace "assembly" with "bytecode" or "IL", if making a Java or .NET compiler)

    You are reverse-engineering closed-source software (another case where you must comprehend assembly)

    You're designing or testing a computer chip, in which case you may have all sorts of tests cases written in assembly language.

    You're maintaining an old "legacy" system that uses assembly.

    You're writing an emulator for another computer, and you need high performance. In this case you may need to understand the assembly language of both the real and emulated machines, as I learned when I wrote a Super Nintendo emulator.

    Those bastards make you study it in one of your college courses.

    Ozgur Uksal
    http://www.adobe.com/

  246. Two places where you need Assembly by rfc1394 · · Score: 1

    I would say that in probably 90% or more of all applications, Assembly is unnecessary. In the last fifteen years I don't think I've had to use Assembly to solve a problem at work even once. Then again, typical business applications don't (now) need Assembly language. Over twenty years ago I worked for a bulk-mail company in Long Beach, California that did mainframe applications almost exclusively in IBM 360 mainframe assembler, we probably could have used COBOL but BAL was the shop's language.

    Now, if your shop's language isn't Assembly then you aren't going to use it in normal circumstances. Typically you do not want to use Assembly unless unavoidable, simply because you don't want to have to support multiple languages in the code base. Also, because the level of abstractions is lower in Assembly, it takes more time and effort to do things in Assembly than it does in higher level langauages, unless you use it consistently and use all the tricks available (such as structured macros and such), in which case you'd probably get most of the performance in C with fewer hassles.

    Now, there are two places where Assembly is important, if not critical. First is when you have a bottleneck in which performance is inadequate, and after the code has been optimized, you still can't get adequate performance, then you need to move to Assembly language. It's often said that when you have a performance problem and speed is an issue, you'll get 80% of the improvement from changes in only 20% of the code, thus you might need to simply rewrite a small piece of the code (in the high-level language) to get an improvement - maybe significant improvement - in performance.

    I say that because you might get the code to provide satisfactory performance - without needing Assembly - after refactoring or changing it to alter how it performs. Then you don't have to support two source language bases and you get the performance boost you needed without resorting to Assembly. This option may not be available in the case of, say, programming a video card, you may have to use assembler (or data in the application which is passed to the card as a program in its native machine code, which is essentially the same thing) to be able to get the necessary performance or special features.

    Also, you need to know what needs to be optimized depending on what the application does. For example, if you have a data entry program, optimizing the startup to take one minute instead of two will get less benefit than dropping the time needed to enter a transaction by one second, because (1) over the course of the day on entry of, say, 600 transactions, the time saved will be ten minutes, which would allow the operators to enter additional transactions and (2) the operators will find the application more "snappy" and have more job satisfaction. On the other hand, if the application is being used once in a while for a single use at a time, cutting the amount of time for it to startup over allowing the transaction to take longer might be a better choice, since reducing the extra minute waiting for it to start up might be more critical than reducing the time for the transaction to finish.

    Second is when a particular feature or functionality is unavailable except in Assembly. If you need to implement a type of internal functionality such as a task switch, specialized error trapping, or to read or write certain machine registers, or where you need access to do I/O to a specialized device, you may have no choice but to use Assembly. This is indirectly related to the last sentence of the previous paragraph, in which the extra performance is unavailable except in Assembly. Az much as I dislike C, it has eliminated a lot of need for the use of Assembly because so many of the constructs in C are either direct representations of machine language or almost exactly implemented as the most efficient machine instructions available to perform the task.

    Compilers have gotten considerably better over the years, to the poin

    --
    The lessons of history teach us - if they teach us anything - that nobody learns the lessons that history teaches us.
  247. Re:All's quiet (unless .NET takes over) by Anonymous Coward · · Score: 0

    Therefore: A well-regulated militia being necessary for the security of a free State the right of the people to keep and bear arms (assembly language skills,soldering equipment and oscilloscopes INCLUDED), shall not be infringed.

    There, fixed!

  248. Re:Isn't it the root of all programming languages? by ranton · · Score: 1

    You can program without understanding how the hardware actually executes your code. But a "good" programmer? No. A hack (and not in the complimentary sense) at best.

    That is a very elitist statement. I used to think like that when I was younger. People writing code in Visual Basic were not real programmers, only people like me using C/C++ and assembler code when necessary were real programmers.

    But then I got into the real world, where results are whats important and not the way you obtain those results. I used to access the mouse using dos interrupts and wrote directly to video card's buffer for graphics. Sure it was great for improving the refresh rates of some little game I was programming, but the effort necessary was tremendous.

    When I started actually being paid to write code, no one cared how I wrote their machine design simulation program. They just cared that it was done in a month. I had learned Visual Basic along side Visual C++ back in the 5.0 days (im not that old), so I knew that was the best way to solve the problem. They still use that program today to help design machines that are sold for upwards to a million dollars each. Man I should have been paid more.

    Now I use MouseDown and Paint events to write my code. I use C++ every now and then to write *.Dlls and other libraries, but C# has become my language of choice. I write my own software and sell it retail now. I dont write video games, so ultimate performance is not a very high priority. I write software that helps companies run their business.

    A good programmer is someone who can produce results on a schedule. A "hack" is someone who spends time worrying about memory reference densities and branch prediction miss penalties when all their customer needs is a User Interface to input invoices. In the real world people want a product, not a programmer telling them it should hopefully be done in another month.

    --

    --
    -- All that is necessary for the triumph of evil is that good men do nothing. -- Edmund Burke
  249. Yes by BitMaskBitMask · · Score: 1

    Reverse engineering and debugging of tough problems.

  250. Programming is warfare by cbacba · · Score: 1

    Programming is the battle between a stupid machine and someone trying to coerce it to perform particular tasks. Programming languages are the weapons and asm is the equivalent of hand to hand combat and it is also the language of the machine.

    To survive the battle with the machine, suitable weapons must be engaged to effectively fight it. Also, to defeat one's enemy, they must know the enemy and how it 'thinks'.

    Contrary to popular opinion, asm can be modular and structured and even object oriented. It's up to the author to do so as they are not constrained in their efforts by the language. Details (presumed to be irrelevent to programers) are often not hidden (to the point of near impossibility when attempting to find the needed information).

    Asm like all languages has advantages and disadvantages. There are several disadvantages which make it pretty much last on the list of weapons to use. First and foremost, the code is tied to a particular processor. Second, learning an asm language for each possible processor gets to be a major burden. Third, it usually takes a much greater number of instructions to accomplish a task. Fourth, there is no handholding for the programmer or protection from their screwups.

    Asm has advantages over others. It's capable of the ultimate tight fast code. It can be totally open for analysis and bug chasing and doesn't suffer from compiler errors injected by other programmers at other companies. It's a very short list of very positive advantages which are outweighed most of the time by the longer list of disadvantages.

    For any of you who back in the dark ages of window's 3.1 attempted to use the borland 4.0 or 4.5 c compiler with optimization on, my condolences. I discovered one of my production programs to fail dramatically when engaging a rare command line parameter - whose only application turned out to simply be initializing an array of 10 elements with different than default values for crt display coloring. Considering that the program bombed out totally almost immediately, it was a 10 minute job to trace thru execution in asm to determine that the compiler's code generation was attempting to set in local storage, the final loop value for a register variable that had no local storage. Net result, the base pointer register value stored on entry to the subroutine was stomped thus screwing up all local variables in all higher level routines, resulting in massive program failure. Borland went through at least one major release after being notified of the bug without fixing it. I migrated over to mickiesoft's visual c after their failure to fix that problem.

    There are two morals to that story. First off, knowing asm can get you through problems caused by others - like compiler vendors. Second, asm can be used to generate projects that don't have serious bugs whereas even perfect coding in a project can have serious bugs injected by suppliers of other software.

    Despite the added cost of doing much asm (rather than limiting it to very small portions of a project), the costs of not doing these tend to remain with us in massively bloated and slow code requiring much higher performance equipment and in the form of never ending bugs.

    Unfortunately, there's probably not even enough people capable of doing excellent asm to ever permit it to be a substantial component of any current or future projects. However, it's value in improving the capabilities of programmers in general is undoubtedly worth far more than a PE course (phys ed) or extra history class requirement in the span of a 4 year degree.

  251. Of course by Z00L00K · · Score: 1
    Assembly language programming is still of interest in education.

    A large number of embedded systems can't do without assembly language, even if most are using C or C++. This since there are sometimes time-critical implementations that can't depend on the accuracy of a C compiler to produce consistent code. There are also cases where a C compiler may produce code that in general works fine, but can't produce code for some very specific instructions that a certain processor has. It's not too uncommon that embedded systems base their instruction set on a well-known processor, but extend it with their custom instructions for some features.

    And in some cases the use of a high-level language like C is resulting in an overhead that isn't really what's necessary or even possible on the selected hardware. This may be the case for applications were low power consumption is at a premium and every clock cycle counts. It can make a large difference in lifetime of a battery-powered device.

    And don't forget, even if most students aren't going to use assembly in the future you can't tell which students that will need that knowledge.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  252. Joel is an idiot by fm6 · · Score: 1

    Which is as idiotic as all his articles. He thinks that K&R chose null-terminated strings because that's what the PDP-7 supported? What crap. It's a semi-low-level design that fit in nicely with their semi-low-level language. Now, you can criticize the design of C all you want (and there's certainly a lot to criticize) but to suggest that its features are driven by the architecture of an ancient, obsolete system (the PDP-7 didn't even have byte-addressable memory!) is insulting to two great computer scientists.

    On the other hand, that's exactly what Joel would do. The fact that he even cares about the best way to implement strings at this late date identifies him as a clueless bit twiddler. Nowadays, a serious programmer uses a standard string library, and doesn't worry about its precise implementation. If the library is any good, it will have been carefully planned and implemented by computer scientists who have thought through every possible efficiency and reliability issue. Then it will have been remorselessly attacked by nitpicking QA people. When you go off and implement your own strings, you lose all that.

    1. Re:Joel is an idiot by ioshhdflwuegfh · · Score: 1

      Nowadays, a serious programmer uses a standard string library, and doesn't worry about its precise implementation. If the library is any good, it will have been carefully planned and implemented by computer scientists who have thought through every possible efficiency and reliability issue. Do you actually believe this or you are just joking?
    2. Re:Joel is an idiot by fm6 · · Score: 1

      Do you have something to say, or are you just talking to yourself?

    3. Re:Joel is an idiot by ioshhdflwuegfh · · Score: 1

      Do you have something to say, or are you just talking to yourself? When you said:

      If the library is any good, it will have been carefully planned and implemented by computer scientists who have thought through every possible efficiency and reliability issue. you were on the right track to assembly, just going in the wrong direction: it is exactly because there is no such library that the assembly is interesting. Even if we hypothetically assume the existence of such a library where "every possible efficiency and reliability issue" was taken into account, there will still remain the question of the efficient implementation of inlined functions from the library. Even if your hypothetical computer scientists programed everything optimally in assembly, there will still be some functions needed that are not in the library, or are in the library but not doing exactly the right thing (e.g doing too many things) and so on.
    4. Re:Joel is an idiot by fm6 · · Score: 1

      Even if your hypothetical computer scientists programed everything optimally in assembly, there will still be some functions needed that are not in the library Excuse me? We're talking string manipulation. There are only so many things you can do with a string. Please name a fundamental string operation that isn't widely implemented in standard libraries.

      or are in the library but not doing exactly the right thing (e.g doing too many things) You're talking in circles. My whole point is that you should either assume your library is "doing the right thing" or you should be using another library. If you're doing exotic stuff, then yes, you probably need to implement your own library. (Though probably not in assembler — your compiler is probably a better assmbler coder than you are.) But for common use cases, like string manipulation, there are already plenty of solid libraries out there you would be hard put to improve upon.
    5. Re:Joel is an idiot by ioshhdflwuegfh · · Score: 1

      Excuse me? We're talking string manipulation. There are only so many things you can do with a string. Please name a fundamental string operation that isn't widely implemented in standard libraries.

      You're talking in circles. My whole point is that you should either assume your library is "doing the right thing" or you should be using another library.
      There are only so many things you can do with strings: about an infinite number of them. Example: strcmp. It's widely implemented, and it still does not do exactly what some people expect or find useful, thus strncmp, which is the same but different.
      As fundamental as the comparison of two strings may be, it is no less difficult to define: You can thing of it as a comparison of two continuous blocks of memory terminated by 0, or defined by their lengths, but also as a character-by-character comparison of two texts, and then there are all sorts of useful routines that are not there: comparison of two strings independently of the case in which letters are written, or the number of spaces between words, or all kinds of reductions to normal forms, or pattern matchings for which a full-blown optimally programmed regular-expression routines are just taking too much time to execute and/or are too long.

      If you're doing exotic stuff, then yes, you probably need to implement your own library. (Though probably not in assembler -- your compiler is probably a better assmbler coder than you are.) But for common use cases, like string manipulation, there are already plenty of solid libraries out there you would be hard put to improve upon. I don't know whether examples above qualify as "exotic" or not. In any case, if it happens now that somebody's program spend 50% of time spinning string routines, being as fundamental as they are, well, getting them 20% faster is still 10% of overall gain. Then, the more one compute with the computer, the more these 10% mean, etc.

      In short, I'm not arguing with you that there are no good string libraries around, just that even with those there are things that sometimes can benefit from assembly...
  253. Of Course! Especially if you write real time code! by MrJerryNormandinSir · · Score: 1

    Nothing is faster or more effecient than assembly code. I design robots as a hobby. All my interface code for the sonar, digital compass, quade encoders, servos, it's all written in assembler. My "Glue" code and logic.. well that's all in C.

  254. Pointers are easy. by DeadCatX2 · · Score: 1

    I never, ever had problems understanding pointers. I mean, they're called pointers. They point somewhere. You can change where they point. There's some information the compiler keeps around to tell it what exactly it's pointing at. There's a way to get at what is being pointed at.

    I mean...their very name is pointers...it just makes sense. I never understood how anyone could struggle with it.

    --
    :(){ :|:& };:
  255. Still Widely Used by Brokenantimatter · · Score: 1

    I am not a fan of Assembly but it is still one of the most widely used programming languages for hardware and low resource applications: Camera's Automobiles PCB Calculators MP3 Players Portable Gaming Devices Small Electronic Devices 90% of those use Assembly so even though they have also a non-existent purpose in any environment where C/++ is the most logical choice they still have hundreds of thousands of applications.

  256. Is metallurgy still relevant, today? by smithmc · · Score: 1

    If you're designing bridges for a living, should you still be taking the time to learn about mechanical engineering, and the properties of metals? After all, there are "higher" concepts to consider like traffic flow, and wheelchair accessibility, and the social effects of the bridge's aesthetics, no? So why bother learning about the nuts-and-bolts details? The "best" bridge builder isn't the one who makes the sturdiest bridge in the shortest time using the least material, he's the one who picks the prettiest color paint, right?

    --
    Downmodding is the refuge of the weak. Don't downmod, make a better argument!
  257. Re:Isn't it the root of all programming languages? by XLawyer · · Score: 1

    Saying that a skilled programmer needs to understand the underlying hardware is hardly the same thing as saying that programming in Visual Basic is not "real" programming. The question is, do people who understand the hardware write, for example, better Visual Basic? In my admittedly limited experience, they do.

    Conversely, a good programmer can certainly do "real" programming in Visual Basic or C# or even VBScript.

    Producing results on a schedule is not necessarily the mark of a good programmer. A good programmer presumably is one who produces good results on schedule. In programming, moreover, a good result is reliable, effective, and maintainable, not just one that compiles and executes for a while before crashing.

    Understanding the hardware is not all--or even most--of what you have to do to be a good programmer, of course. But I think one is hard pressed to be a good programmer without it.

  258. Of course it's relevant... by rockmuelle · · Score: 1

    ...if you're doing it from Python

    -Chris

  259. Assemby plus high-performance skills are valuable. by edp · · Score: 1

    I am one of the few programmers who still work in assembly language. I work in a specialized group at Apple that produces numerical libraries. One is the standard math library that provides functions like sin and log. Others are high-performance libraries for signal and image processing.

    The high-performance numerical work requires more than just assembly programming. You also need some mathematics, understanding of processor internals and system architecture, and how to use assembly programming to get high performance. Getting the most out of a modern processor can be quite complicated. Although compilers get better, processors get more complicated, and there are gaps. Sometimes these gaps are large, so good assembly programmers can get huge performance gains over compilers. And that makes it worth paying them.

    A modern processor does not just execute one instruction after another. It may start a floating-point multiplication in one of its execution units and an integer add in another. In the next processor cycle, the add may be done, but the multiplication has two more cycles to go. Meanwhile, the processor is fetching data for a load that was requested five cycles ago. It is not in cache, so you have to wait longer for it. There is a store waiting to execute, but it cannot start because it needs the multiply to finish. Dozens of instructions are in various stages of execution at one time.

    Good compilers "know" some of this, and they can do some instruction scheduling to reduce some of the wait times. But they are not great, and programmers can do a lot more. They can rearrange data structures or patterns of use so that data is in cache when it is needed. They can overlap different parts of their code so that while that store is waiting for that multiply, a different multiply for another set of data can execute. Some compilers might spot a few of those opportunities, but a programmer can rearrange code in ways a compiler is not allowed to. A programmer might know that a load is reading from a different address than a store is writing to, so it is okay to move the load instruction ahead of the store instruction. A compiler is not allowed to make that assumption.

    Compilers are also not good at using Single Instruction Multiple Data (SIMD) instructions (as in AltiVec or SSE). SIMD exists because the control logic of a processor is very complicated -- a lot of logic is needed to keep track of which instructions have started executing, what data they need, what other instructions depend on their outputs, and so on. Some processors have speculative branching; they "guess" which way a conditional branch will go and start work early on instructions along that branch. If the guess turns out to be wrong, they have to throw away the speculative work and restore to an earlier state -- processor contents, flags, everything has to appear as if the branch had never been taken. That takes a lot of silicon. So one way to get more work done without creating more instructions to be kept track of is SIMD instructions -- one instruction does the same operation on multiple pieces of data. Processors with SIMD instructions have registers that may be 128 bits wide, enough to hold four single-precision floating-point values or eight 16-bit integers, or other combinations. Executing one SIMD instruction may multiply each of the four numbers in one register by each of the four numbers in another register.

    That is great, you can get a lot of work done, but how much of your code is written to multiply four numbers by four other numbers? Most programmers just think about one set of data at a time, and that is what they write, so that is what the compiler sees. When you compile regular code, you get regular instructions, not SIMD instructions. Wouldn't you rather your code go four times as fast? If you have a nice clean loop that processes all the contents of several arrays, some compilers, called vectorizing compilers, can generate SIMD instructions for your loop. If you really want to take advantage

  260. Lovin' every minute of it! by System_390 · · Score: 1

    I've got to make this pretty quick. :)

    I've been programming since 1969. Started with Fortran, moved to Cobol soon after, then Assembly around 1971, all on a System/360 mainframe. Today I still do a fair amount of Asm on the big iron System/390. I've been doing x86 Asm since the original IBM 8088. I also spent several years doing 6502 Asm.

    I haven't read this entire thread yet, but one thing I did notice was someone saying that Assembly is more than just machine instructions. Boy, is he right! For example the MACRO facalities on the mainframe are very powerful. The programmer can access the type, length, number of "sub operands", and assorted other information for each macro operand. He can also do "sub string" processing on the operand (or each sub-operand). This means a single macro can generate different code, sometimes radically different code, depending on the operands. The mainframe assembler also has "global variable symbols". These are used to pass all sorts of information between macros, which can again result in the macro generating different code, etc.

    Another point, just bacause I write in Asm doesn't mean that my code can't be reused. I've accumulated quite a library of source code after all these years. A good part of that "library" has been tweaked, optimized, well debuged, and other wise fine tuned over time. There are certain applications where I can dance circles around even the best "hi level" programmer, as far as development time goes.

    One last thing, for now. Like I ssaid I haven't read the thread, but if you're interested in playing with 32-bit Windows programming in Assembly, check out this site:

    http://www.masm32.com/

    Here you can download a package that contains a free version of Microsoft MASM, LINK, RC etc, as well as copy books and .LIB files that define most of the WIN32API, example programs, and so on. And be sure to check out the forum.

    I can program in more languages than I can remember. But Assembly, on any platform, is still my favorite by far. For many, many reasons... :)

  261. Re:6502 Programming by Anonymous Coward · · Score: 0

    Fell through a crack in the space time continuum in 1982?

    Just a guess, but its the most plausible one I could come up with.

  262. Racing Tires - Unseen While Driving by pg--az · · Score: 0

    What a great analogy, eh ? Please upgrade my karma ! While driving a car, your view through the windshield is somewhat like a software requirements document. Your High-Level-Programming-Language is analogous to the steering wheel. The steering-stuff is like a compiler, and ultimately assembly language is somewhere near the "rubber-meets-the-road" level. ESPECIALLY because you don't directly see what's going on, it's vital to have some mental image of what's going on down there. If you know what I'm talkin' bout, you didn't need to read this ! PG

  263. Tires, Engine - Unseen While Driving by pg--az · · Score: 0

    What a great analogy, eh ? Please upgrade my karma ! While driving a car, thw windshield-view is like a requirements document. Your High-Level-Programming-Language is analogous to the steering wheel. ESPECIALLY because you don't directly see what's going on in the drivetrain or where the rubber-meets-the-road, it's vital to have a mental model of what's going on "down there". PG

  264. By the numbers... by Gazzonyx · · Score: 1
    So, from the code that I've seen:
    90% of coders need not apply
    The greater majority of the remaining 10% are probably reading this article, the rest are hacking right now.

    Ironic, those who don't know, don't know they don't know.

    --

    If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

  265. How about SPARC? by Gazzonyx · · Score: 1
    I'm learning right now on SPARC - I really like it! Then, again, I'm really geeky.

    I just don't like delay slots... I mean, I can squeeze more out of them, but I lose points on projects for using 'set' commands in the delay. I don't much see the harm. Oh well. I guess I should learn X86 as well, since the world is married to the architecture, whether I like it or not.

    --

    If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

  266. Assembly is good to learn by wikinerd · · Score: 1

    I think every programmer should know Assembly and understand hardware. Many employers don't share this viewpoint, but I don't think you should limit your knowledge to what employers are asking for.

  267. Renaissance of the efficiency-optimized program by Madwand · · Score: 1

    We're going to hit the quantum wall and the end of Moore's "Law" soon. The signs are all around us: CPU manufacturers throwing more processors ("cores") into chips and systems, CPU clock rate increases slowing down year over year. You won't be able to just "throw hardware at the problem" any more, in the very near future.

    So, what does this mean for programmers?

    Two things:

    1. Parallel programming. You're going to have to figure out how to pull as much parallelism out of your problem (and spread that across all the CPUs you have to use) as you possibly can. However, there will always be an irreducible, non-parallel part of your program. That's the message of Amdahl's Law. Which leaves us with ...

    2. Instruction-efficient programming for those non-parallel codes. We won't be able to make the individual CPUs go faster once we hit the quantum wall; all we can do is use what we can get out of the hardware as efficiently as possible.

    Study your algorithms well, and learn assembly language, if you want your programs to run fast. Compilers still aren't that good (though I have no doubt that there will be a renewed interest in making them better so that all the programmers who can't grok assembly can still be useful; it's called "leverage").

    Oh, and keep an eye on FPGAs - reconfigurable computers morphed for the problem to be computed might just be the next big thing.

  268. from a money perspective by Anonymous Coward · · Score: 0

    my friend's dad works at EA as senior programmer. When we were talking he said that the game industry is so desperate for people who know how assembly that they can make $120,000 straight out of school instead of the usual $50000 to $70000. The main reason EA wanted assemble programmers was because C was too slow for the graphics engine part of their games, so this might not be relevent to all fields, but if you know assembly you can charge more for your services if the customer cares about efficiency because assembly is still about 200 times faster than C

  269. VMMs by olego · · Score: 1

    Do VMMs really trap to the host OS? The reason I ask is that I recently discovered Red Pill which raised the following question: Since programs inside VMM indicate that the IDT is located at the address 0xFF......, doesn't that mean that it is VMM's own IDT, completely separate from host OS's IDT? (This implies that VMM has a driver that runs at Ring-0 privilege, among other things.) If my assumption is correct, then virtual machines are actually faster than suspected, and only the switch from VMM back to host OS is somewhat slow, requiring a change of IDT, GDT, and LDT.

    1. Re:VMMs by pikine · · Score: 1

      My memory on this is already vague, so it's hard to say whether the Red Pill page is misinformed.

      They're correct in saying that there is only one IDT register in the computer, and that SIDT instruction is non-privileged, so reading IDTR does not trap.

      In addition, we need to remember that guest OS kernel is still unprivileged code, so it can never set IDTR; IDTR always points to host OS kernel. I think that's where the "relocation" bit is confusing.

      Bear in mind that most VMM nowadays use dynamic code recompilation to avoid traps at all, converting privileged instructions and software interrupts to stub code, and they can surely disarm SIDT instruction too. I think Red Pill might just be discovering discrepancy in how VMware and Virtual PC simulate IDTR.

      --
      I once had a signature.
  270. Mental Math by olego · · Score: 1

    What's wrong with AT&T syntax?

    From what I know, there are only four differences between the two:

    * Registers are decorated with %, and numbers with $
    * The addressing is in form offset(base) and not [base+offset]
    * Ambiguous commands are resolved using a suffix (movl instead of mov dword)
    * The order of operands is swapped

    Granted, AT&T syntax is used very infrequently (I've used both), but is there really a benefit to not learning it?