Assembly for graphics

This is a discussion on Assembly for graphics within the Game Programming forums, part of the General Programming Boards category; Hi, I am looking to learn assembly language, so that I can write faster graphics routines. I know some fairly ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    43

    Assembly for graphics

    Hi,

    I am looking to learn assembly language, so that I can write faster graphics routines. I know some fairly basic stuff about architecture (for example, I know what a register is, what an ALU is, what the program counter and accumulator are) and I know C/C++ to an intermediate level.

    I want to be able to learn an assembly syntax which can be used on Windows and Linux. As far as I have seen, the best ones to learn are FASM or NASM. However I cannot find any good books which focus on those. A lot of places recommend on "Art of Assembly" which seems to use MASM. However, it is said that trying to learn another assembly syntax after learning MASM is hard because MASM uses something called HLA which the others do not.

    I am a bit lost and I could do with some guidance as to a good book/books to start off with!
    Windows XP Professional SP2, Code::Blocks Studio 1.0rc2, GCC/G++ 3.4.2 (20040916-1), mingw32-make 3.80.0-3, GDB 5.2.1-1, W32API 3.6

    MingW Runtime 3.9, BinUitls 2.15.91 (20040904-1), MingW Utilities 0.3, Tcl/Tk 8.4.1-1

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Don't use MASM's HLA (high-level assembly) features and you'll be pretty much set for NASM. Besides, NASM has its own macro engine, too.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Well, depending on what you are doing it will be hard for you to optimize more than the library/compiler in question. Are you having FPS problems? Maybe just some profiling and optimizing of parts of your code will do you better.

    I know ASM is good sometimes, but most times it is hard to make a difference using it compared to what the graphics API/compiler already has/does.

    Just my $0.02

  4. #4
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    If you google for NASM tutorials you can find several resources. I didn't go through each of them to check the quality but this one seems to have what you are looking for. http://webster.cs.ucr.edu/AsmTools/NASM/index.html
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    > I am looking to learn assembly language, so that I can write faster graphics routines
    I thought most high performance graphics basically use a driver to send commands to a graphics processor to do all the hard work of bit-bashing in the pixel buffer.

    If you're thinking of using ASM to do your own bit-bashing in pixel memory, then I'd say you're probably onto a losing battle, no matter how good a programmer you are.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Assembly for graphics is a lost cause. You will never be faster than the hardware and with the advent of pixel shaders you don't need assembly anyways.

    The video GPU can blit more pixels to the screen in 1 milli-second than there are pixels in the highest resolution possible on the card.

    I doubt a rep stosd is going to be faster than that. rep stosd will use the bus to pull data from the memory while the video card will pull it from it's onboard RAM and leave your code in the dust. Get with the times and get with the hardware. If you want extremely blazing fast graphics with excellent quality then put away the club and come out of the cave into the wonderful new world of shader programming. Or you can insist on being a caveman and using ancient tools.

    Assembly has it's place in game programming, but this is not one of those places and with more and more functions becoming available via the driver model, assembly is not going to help anything.
    Last edited by VirtualAce; 10-25-2006 at 06:34 AM.

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, 04:00 PM
  2. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 02: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, 01: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, 03:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 02:35 AM

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