Thread: Beginning ASM.

  1. #1
    People Love Me
    Join Date
    Jan 2003
    Posts
    412

    Beginning ASM.

    I'm new to ASM, and I need just a tad of help.

    I understand the principle behind ASM and such...and how it is more low-level and often is very memory-address intensive. It can be much faster because it allows to have complete control of how memory is allocated..

    I just don't really get this whole register thing and memorizing all those register names and mnemonics.

    Just how important is ASM in the art of programming big-scale games? And what's a good place or way to go about learning it?

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    **DISCLAIMER: I don't know any assembly.

    >>It can be much faster because it allows to have complete control of how memory is allocated..
    Well, depends on how good you are at it. If you write bad assembly, it won't be any faster than c++. Besides, the machine code generated by your compiler is generally pretty good, assuming you've written good c++ code to begin with. With optimization features turned on for your compiler, even mildly bad C++ code will turn out nicely. On the other hand, if you write in assembly, I'm pretty sure there's no optimization done by your C++ compiler (otherwise it would be pointless, since the compiler just ignored your 'complete control' ) - the code you write must be good to begin with.

    >>Just how important is ASM in the art of programming big-scale games?
    No idea.

    >>And what's a good place or way to go about learning it?
    I think they have some tutorials at programmersheaven.com (?), and at Flashdaddee.com there's an assembly forum.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #3
    Registered User
    Join Date
    Dec 2004
    Location
    UK
    Posts
    109
    The big problem with assembly is that the language doesn't do anything for you. You have to keep track of everything by yourself and know exactly what is what and where it is. No more just sticking stuff in a variable just in case it might be useful, if you are not caregul you can easily end up overwriting half of you program by mistake.

    As far as I can tell assebmly is being used less and less as compilers improve and become capable of all the little optimisations that could only be achieved by man written assebly before. Moreover assembly is not portable at all and a nightmare to debug.

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    You can check out the Art of Assembly Language Programming. Anyway, also keep in mind that the speed performance you get from optimizing with assembly is going to be rather (read, very) small compared to optimizing your algorithm.

    Even a very poorly writtn O(lg N) algorithm will be better than a heavily optimized O(2^N) algorithm.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Well, I have written some assembly, but for embedded microcontrollers, never for a PC.

    I don't think it's used that much by game developers. It is used by people who write drivers and other hardware-related stuff. And, I suspect that DirextX, OpenGL and those types of libraries are written with lots of assembly.

    I just don't really get this whole register thing and memorizing all those register names and mnemonics.
    Hmmm... Your point about nmumonics is interesting.... I never thought about it! There is no good reason for using cryptic nmumonics. I suppose it's a holdover form the old days when you couldn't waste a single byte... (Assemblers existed before any high-level languages were created.)

    With assembly, you are writing a human-readable form of machine language. Every assembly instruction becomes one machine-language instruction. So, you do have to understand the particular "machine" and all of its registers.

    The microcontrollers & microprocessors I've written assembly for, have been simple devices, with only a few registers, and something like 30 - 60 instructions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc asm code syntax
    By Uberapa in forum C Programming
    Replies: 4
    Last Post: 06-15-2007, 01:16 AM
  2. Asm + C++
    By JaWiB in forum C++ Programming
    Replies: 17
    Last Post: 06-26-2003, 03:13 PM
  3. Understanding ASM
    By kuphryn in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 07-12-2002, 07:39 PM
  4. asm mov
    By manu in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2001, 12:59 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM