Sign in to follow this  
Pufixas

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

Recommended Posts

Pufixas    1167

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
richardurich    1352

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

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