Jump to content
  • Advertisement
Sign in to follow this  
Pufixas

What do call/ret opcodes in assembly (NASM) actually do?

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

Very quick question here. I tried searching for it on google, but I can't find direct answer, and my debbuger is acting weirdly for some reason.

 

So I don't know if I'm right or not, but am I correct saying that CALL opcode pushed return address onto the stack, and goes to the specified routine? While RET opcode pops that return address from the stack and returns back to where CALL left off?

 

Thank you in advance.

Share this post


Link to post
Share on other sites
Advertisement

Yes, your explanation of CALL/RET is basically right.

 

http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html gives you the manuals for x86 assembly, including the instruction set reference. That will give you the exact logic used for each instruction (CALL's logic is over a page long), which flags are altered, what exceptions can occur, etc. Those docs are pretty much invaluable if you're going to be doing a lot of x86/x64 ASM.

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.

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!