Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


The usefulness of assembly today

This topic is 5807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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. *

[* Codeplay''s VectorC is meant to do a pretty good job for this kind of stuff]

For GBA games:

- yes.

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).

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!