• Advertisement

Archived

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

Assembly Language

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

In a lot of the books I have read about game programming, assembly language is mentioned as a great help. However, the books don''t explain why or how. So I''m asking here, Why? How?

Share this post


Link to post
Share on other sites
Advertisement
short answear (im sick and tired of writing for the moment):
why: speed.
how: excluded in the short answear, some other day maybe.

Share this post


Link to post
Share on other sites
why: assembly is closer to machine language than c/c++ or any other high level language. you can write the most optimized code the closer you get to machine level. dont even mess with it until you need to optimize certain functions for speed or dont mess with it at all.

how: figure it out when you need to know

Share this post


Link to post
Share on other sites
Thank you for responding, but I am aware of the reasons that you both have submitted. However, I raise another question... how do you include the assembly language in a game written using a C++ compiler?

Share this post


Link to post
Share on other sites
1) using inline assembler (most C/C++ support it)
2) compile the asm files into seperate objects and link it all together.

using the inline assembler is a trival task, usually its something like (in MSVC is it _exactly_ this):

_asm (asm in borland)
{
push eax
mov eax,ebx
...
}

Edited by - Staffan on 2/9/00 4:32:56 PM

Share this post


Link to post
Share on other sites
Why: Its harder , more challenging , more control as to how you program is executed ( Can anyone say Re-entrant self self altering code ? )

How:Use Masm32 or Tasm

Share this post


Link to post
Share on other sites
Read the "Win32 Assembly" guide on this site. It tells you exactly how to do it and theres a link to download MASM32.

http://www.gamedev.net/reference/programming/features/win32asm1/

Share this post


Link to post
Share on other sites
As Staffan showed earlier, your C++ compiler is also an assembler. You''d rarely need to compile your assembly program seperate from your C++ program.

E:cb woof!

Share this post


Link to post
Share on other sites

  • Advertisement