Results 1 to 11 of 11

Thread: Explain Assemble Please

  1. #1

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Explain Assemble Please

    I've always been curious, because I believe this is the method of choice for writing new video games, especially on console.

    It has been my current theory that assemble is like c++, cept like assembling units of code..i can't explain it.

    Someone care to give me an explanation?
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Assembly is considered to be one of the lowest levels of programming (besides going into straight hex. This has and is done.) C++ is considered to be a high-level language (HLL).

    C++ compilers take the code that you write and then (after some effort and intermediate steps) translates it into machine code. Depending on what you are using, assembly takes the assembly and translates it into machine code. Both approaches do the same thing but with assembly, you have a greater control over the application that you are writing.

    Assembly is NOT a good method to write an entire video game in (Believe me. I saw it. It was not pretty.) Its not a safe langauge. If you have like 472397 lines of assembly, it is very easy to do a lot of bad things (spaghetti code, pointer overruns, blowing the stack, etc.) Assembly, however, is excellent to optimize code.

    I hope that answered your question.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Here's a very good page to help you learn ASM if you are interested
    Have I helped you? Please Rate my posts.

  4. #4
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    However, that is just one flavor of assembler... There are several other instruction sets, each with their own way of doing things.

    You have 80x86 (i386), 680x0, 6805, Z-80, 8080... We also have the HLA (high level assembly) creature which in itself is the biggest oxymoron that I have ever seen.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  5. #5

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    Thanks for the info guys.

    So even tho it is not the language of complete choice for gaming. It is necessary in some case's...So if programming games is my career choice, it is time to learn right?
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    ASM is more or less never used anymore in games...they where hevily used in the mid 90's, but the rate of ASM is dropping incresingly. And before you are ready to take any jobs as a game programmer it is probably 100% out. Comiplers today is usualy much better then a programmer to optimize speed. So it is much better to be a REALY good C++ programmer, so you can make the code a certain way that it becomes easier for the compiler to optimize it...

  7. #7
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    I think it depends on the application and your level of skill. If you are able to optimize a part of your code to handle features such as pipelining and MMX AND if your development environment is such that you do not have to worry about your code being machine independent, then assembler is a great choice for chunks of code. I mean you cannot use assembler in Java.

    You should learn assembler for programming experience, but do think that you will be able to build a gaming career off of it.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  8. #8
    Hyperactive Member Maven's Avatar
    Join Date
    Feb 2003
    Location
    Greeneville, TN
    Posts
    322
    Originally posted by NoteMe
    ASM is more or less never used anymore in games...they where hevily used in the mid 90's, but the rate of ASM is dropping incresingly. And before you are ready to take any jobs as a game programmer it is probably 100% out. Comiplers today is usualy much better then a programmer to optimize speed. So it is much better to be a REALY good C++ programmer, so you can make the code a certain way that it becomes easier for the compiler to optimize it...
    Well that's not entirely true. Compilers do a very good job yes, but their is always room for improvment. Loops and arrays for example are an ideal place to start when you want to "Hand Optimize" code.

    I'm sure you use more handwritten asm code then what you are aware. A lot of string handling librarys are hand written in ASM which you call from c++. Reason being is that you can load up 4 bytes of a string into a doubleword interger and do test on it. IE: finding out where the null charector is for example which is used to terminate strings.

    Just so you know, if you want to be good at ASM, you must also be good at math. Combine the 2 and you can make some sweet algorithms.
    Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught. - Oscar Wilde

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    Furthermore, I think that at least a comfortable introductory understanding of assembler can make you a much better coder for high speed C++, even if you are not doing custom optimization.

    After all, the only way to really speed up a program is to test it. If you don't have any understanding of what is happening behind the scenes, what are you testing for? Will you start trying different things at random to see what works best, and build up a series of rules of thumb? You can do that, but you might as well have some foundational knowledge to start with.

    Also, if you start debugging C++, you will be able to find compiler bugs more easily if you can read assembler. Compiler bugs are FUN! I've found a few in VB, but without being able to see what is generated, there's always a chance that the behavior is not a bug (just a feature).
    My usual boring signature: Nothing

  10. #10
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    I would not be going on a bug hunt on each error that I get, but in the rare instance that you do need to check the compiler, then, assembly (or even just plain display statements) is a useful tool.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    Bug hunts are a last resort, but I confess to feeling a bit like a prospector with a nugget whenever I find one. I realize they are mostly annoying, but it's oddly satisfying when the bug isn't my doing.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width