The usefulness of assembly today

Started by
2 comments, last by Shadow1234567890 21 years, 4 months ago
I have been looking at the assembly code use for the earlier versions of quake (not gl quake) and I was wondering if there is any use for assembly in games today now that we have graphics apis.
What do you mean ''Someday become a programmer?'' I'm a programmer right now!
Advertisement
For PC/Xbox games:

- Plain x86 code - no, the compilers do a very impressive job. Usually 100s of times better than an inexperienced assembly programmer, and often better than an experienced one!

- SSE/3DNow! - yes, although you can use intrinsics and provide compiler hints to take away the need to do them in pure assembler. It''s only worth using when you have a lot of data which needs a simple calculation applying repeatedly (for example transforming a 1000 vectors by a matrix for a physics routine).

- Shader assembler (vertex and pixel/fragment shaders) - yes, though its not really what I''d call "assembler", learning x86 isn''t going to help very much with it. The routines you write in shader assembler are very simple, and very short. And with the advent of HLSL, GL2, Cg etc even this will become less necessary.


For PS2/GC games:

- Plain code - not much. Though the compilers aren''t as mature so sometimes the code can benefit from a look to see what''s been generated and what might need optimising.

- SIMD processing in the main code. Yes, occasionally, compilers still aren''t very good at vector code. *

- PS2 only: VU micromode coding - absolutely, yes. *

[*]<br><br><br><br>For GBA games:<br><br>- yes.<br><br><br><br>Having said that, if you''re wondering whether its worth learning, having an understanding of what happens "under the covers" can be useful for writing optimal high level code (e.g. "this structure is going to be terribly cache inefficient, I''ll reorder and pad it") and for debugging code (e.g. being able to track back from the asm instructions in a release build which crashes to C++ code using a mapfile).<br><br> <br><br>–<br>Simon O''Connor<br>Creative Asylum Ltd<br><A HREF="http://www.creative-asylum.com">www.creative-asylum.com</A>

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

You also may sometimes need the skills to just read assembly, in case your compiler has a bug and creates the wrong byte code (yes, it''s happened--MSVC 6.0 most recently, haven''t seen any problems in .NET yet). Having a general understanding of the lower assembly that''s (probably) being generated can help you become a better high-level programmer, e.g. knowing how C/C++ functions set-up and tear-down in assembly.
Yes I would love to have an understanding of assembly. I have only heard bad things about it. What are the differences between MASM and gas? There is a ''gas2MASM'' convertor that is a part of the Quake source included in the download from id. It just converts gas to MASM.
What do you mean ''Someday become a programmer?'' I'm a programmer right now!

This topic is closed to new replies.

Advertisement