Jump to content
  • Advertisement


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

Venerable Vampire

inline assembly?

This topic is 5250 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''m terribly confused. I''ve heard about something called "inline assembly". I have no idea what this is. How does it relate to normal assembly? What exactly can you do with it? What is up with the "__asm" keyword in my c compiler? Also, I thought assembly was rather machine specific, while c syntax is not (not talking about API, just the syntax). Can someone explain assembly and c for me or point to a tutorial? -------------------------------------------------------- Life would be so much easier if we could just get the source code.

Share this post

Link to post
Share on other sites
Inline assembly is a compiler-specific extension that allows you to insert assembly code in the middle of regular C code. Yes, its machine specific, so you need to know your target platform beforehand. The __asm keyword tells the compiler that all the code within its scope is assembly. So you can usually write either:

__asm mov eax, 0
__asm cmp ebx, eax


mov eax, 0
cmp ebx, eax

Note that the prefixed underscores denote compiler-specific keywords. How the assembly code integrates with the C code depends on your compiler. Also note that GCC handles x86 assembly in AT&T syntax, which is unusual and you can google for it.

[edited by - dcosborn on June 8, 2004 7:12:44 PM]

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!