Jump to content
  • Advertisement
Sign in to follow this  
dudedbz1

ASM

This topic is 4652 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 was wondering if I could use ASM directly with C++. I've seen something like
__asm{
     ;Blah
}
but I never had any idea what it meant... The commands inside looked like assembly.. So does that mean I could use assembly directly with C++? If so, what headers do I need? Is it compiler specific? Maybe you can show me a littly C++ sample with asm inside. And if its possible, will c++ variables declared outside __asm{} be usable inside? All this baffles me... Thanks in advance. ~dudedbz1~

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can use assembler directly within C++. It's called "inline assembler".

You shouldn't need to include any special headers. Different compilers implement inline assembler differently. They expect a different syntax and handle local variables differently too.

This might help: Inline Assembler: Microsoft Specific.

Share this post


Link to post
Share on other sites

inline assembly is compiler dependant. google will help you out with the specifics. For example, this turned up when searching for "gcc assembly"

Bottom line, it's relatively easy to embed assembly in C/C++ or to call an assembly function from C/C++. It's also well documented on the internet.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!