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

Started by
1 comment, last by Pufixas 10 years, 3 months ago

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.

“There are thousands and thousands of people out there leading lives of quiet, screaming desperation, where they work long, hard hours at jobs they hate to enable them to buy things they don't need to impress people they don't like.”? Nigel Marsh
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.

Thats great then. Thank you for the link, it should be really useful. :)

“There are thousands and thousands of people out there leading lives of quiet, screaming desperation, where they work long, hard hours at jobs they hate to enable them to buy things they don't need to impress people they don't like.”? Nigel Marsh

This topic is closed to new replies.

Advertisement