Assembly

This is a discussion on Assembly within the Game Programming forums, part of the General Programming Boards category; Ok what is Assembly like as a language(I have never seen any code in Assembly) and why is it necessary ...

  1. #1
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179

    Assembly

    Ok what is Assembly like as a language(I have never seen any code in Assembly) and why is it necessary for game programmers to know??
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  2. #2
    bobish
    Guest
    Assembly is estually machine code. It is usfull but no necessary to know.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    it's faster!
    but u need to write more!

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by pode
    it's faster!
    Actually, that depends on the coder
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179
    Can anyone give me a quick example of assembly code like a line or 2 if you don't mind. Also how is it faster if it is machine code which as far as I know is all 0's and 1's so how is that faster. Please help.
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    example
    Code:
    XOR EAX, EAX
    INC EAX
    SHL EAX, 2
    PUSH EAX
    CALL MyFunc
    MOV EBX, [ECX]
    what does the above code do?? nothing useful! that's the kind of syntax you are looking at though.

    Generally people will say that ASM code is faster because you have more control over what is going on and therefore you dont put in unnecessary code. But like Magos says, it depends on the coder.

    These days, the optimisations that compilers do for you is enough to get the extra speed. i'll bet there are few people on this board that can write better ASM code than an optimising compiler.

    Most of the time if you are looking for extra speed, you should rethink your algorithm! or the way you are going about your algorithm.

    Bobish is right, it's handy to know... and useful when you really need to use it, and it really helps understand what's going on inside the PC when you are running yorr code.. but it's not necessary

    hope that helps
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    To do something realistic in ASM (not just part of your code using an inline assembler) is a hair tearing experience (but amazingly there are still diehard dedicated ASM coders in abundance out there on the web!)

    I had a mess around for a while with 32Bit ASM calling WINAPI functions....not because I felt it was important, but it helped me work out and understand a few key things that I took for granted before......For example I have attached a program I wrote in for the TASM32 assembler.......It produces a window on the screen with a catchy caption!

    It resizes the text when the window size changes...uses custom icons (the TASM package comes with BRC - the borland resource compiler which works for C progs too).....implements a basic message procedure..and does what you would expect to do in VC++ with virtually no effort.....but I must admit doing this in ASM was a killer at times.....

    Still...keeps me from doing anything constructive with life
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    May 2002
    Posts
    317
    Hey, where could I pick up a good 32 bit assembly compiler? I'd like to get back into assembly; last time I touched it I was programming apps for the P100 (Weren't those the days?)

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Probably the best free 32bit assembler (well for windows coding if that's your interest) is MASM......

    The best pace to get it is this site here which is owned by a guy called Steve Hutchesson....he writes libraries and updates for it from time to time too.....

  10. #10
    Registered User
    Join Date
    May 2002
    Posts
    317
    hey thanx alot.

  11. #11
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    i'm a fan of TASM myself. do a search for TASM 5 on google and i'm sure you'll find a download somewhere. Someones even making an IDE for it.

    good luck!
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  12. #12
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179
    Ok I would thank you all (if I had any idea what the heck you were talking about , jj) How in the world is Assembly faster(depending on the coder I know) than lets say C or C++, how does it give you more control, and what parts of games would you use it in.

    Also I got one other question, I don't know how old all of you guys are but what is a good age to start learing C, C++, or Assembly. I am 14 right now and trying to learn C when did you start and how long am I in for studying.
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  13. #13
    Tmitt
    Guest

    Bump

    When you write code in C, or C++ it is
    translated into assembly by the compiler,
    and then assembled by the assembler.

    Since the compiler is turning the high level
    code into assembly, it has the tendency
    to include alot of unnecessary code.

    This problem has been worked on since
    compilers were first developed, and we've
    come a long way. This is the reason that
    it is possible to write faster code in asm.

    - transmitt

  14. #14
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Assembly programs are direct instructions to your computer. Each command corresponds to a specific machine code instruction. It has a very small number of simple commands, basically MOV (move) this here or ADD that to this. It is much more time consuming than high level languages but the benefit is you know exactly what your code is doing. When you program in C/C++ or other high level languages, you use a compiler to translate the code to assembly before it becomes machine code. Even though commercial compilers are highly optimized (better than your average assembly coder) it is not a direct translation. In game programming, speed is a main goal so you don't want any overhead. Thus, game programmers use assembly when they need to make sure things get done quickly (quite often for low-level graphics routines). It should be noted that unless you are a good assembly programmer it would be much better to use a language like C or C++ and let the compiler take care of optimizations (you could actually make the program go slower).

    Here is a link you might find useful.
    http://webster.cs.ucr.edu/Page_asm/ArtOfAsm.html
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  15. #15
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    I hate it when someone else posts the same thing at the same time.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21