Sign in to follow this  

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

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

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

This topic is 1444 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this