Jump to content
  • Advertisement
Sign in to follow this  
SSJCORY

Assembly?

This topic is 5402 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

Well I was looking into assembly because I heard that you could use it to make segments of code faster but I read a beginners article here and it says that assembly code is not portable even between different processors. The Article How can the big game companies use assembly for certain parts of their games when assembly is not portable across different processor types? (Confussed)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SSJCORY
Well I was looking into assembly because I heard that you could use it to make segments of code faster...
Only if you're an expert and you know exactly what you're doing. 999 times out of 1000, the compiler will produce better assembly than you could.

Quote:
Original post by SSJCORY
How can the big game companies use assembly for certain parts of their games when assembly is not portable across different processor types?
(Confussed)
They only use assembly for very small parts of code, or specialised code. The last game I know of that made any extensive use of assembly was Quake I, and that was in 1990 or something.

Share this post


Link to post
Share on other sites
Yeah I know small parts. It said that it uses them for functions that are called a lot of times a second. But it also said it doesn't work cross processor.

Share this post


Link to post
Share on other sites
Technically, assembly is not portable across processor architectures. So Intel and AMD assembly are approximately the same. The 'big' game companies generally develop for the PC, so they can get away with this. Even the Linux ports are generally run on PCs. When it comes to porting to a Mac, you end up having to use preprocessor directives (#if, #define, etc.) This requires that you write assembly for both platforms and compile a different executable for both platforms.

cyn

Share this post


Link to post
Share on other sites
Quote:
Original post by SSJCORY
Yeah I know small parts. It said that it uses them for functions that are called a lot of times a second. But it also said it doesn't work cross processor.
It says that the special features don't work cross-processor. For example, the pentium 4 uses SIMD instructions, and AMD uses the 3DNow extensions. What you can do, is support both, and some default for if neither processor is recognised. In fact, the D3DX library (from DirectX) does this for all its math functions. When you start the program up, it checks your CPU type, and will use the most optimised version of the function for your processor.

Share this post


Link to post
Share on other sites
As long as you use x86 assembly then it will work on all x86 processors. When you use somehting like MMX, 3D Now, etc instructions(which are extensions to x86 instruction set) then your code won't work on processors that don't support those instructor(obviously). One way to handle this issue is to generate multiple binaries(one including the special code and one now) or to detect what features a CPU supports and then to use function pointers or similar method to use different code branches depending on what features a processor support.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"They only use assembly for very small parts of code, or specialised code. The last game I know of that made any extensive use of assembly was Quake I, and that was in 1990 or something" by Evil Steve

What about quake 2 ?
and today, what about handhelds devices ? huh ?

As long as computer exist , you can still learn asm for useful purposes.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"They only use assembly for very small parts of code, or specialised code. The last game I know of that made any extensive use of assembly was Quake I, and that was in 1990 or something" by Evil Steve

What about quake 2 ?
and today, what about handhelds devices ? huh ?

As long as computer exist , you can still learn asm for useful purposes.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
sorry about double posts.

Share this post


Link to post
Share on other sites
I wasn't aware Quake II used any assembly. In Quake I the only assembly in it was the drawing routines. All the rest was done in C. In Quake II, its all done through OpenGL, so theres no need for assembly in the drawing routines.

EDIT: Ah, Quake II had a software renderer didn't it? I forgot about that...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!