Programs are set in motion by the operating system. When the program is finished, it must return control to the operating system. RET does this. Subprograms also use RET to return control to a calling program. RET works using the stack. It stands for RETURN.
Each time a function (or procedure) is called (with CALL) a memory address is pushed upon the stack.
When the function has finished it executes a RETurn, which pops the address from the stack and continues execution at this address.
;Main
...
CALL proc ;push this address and jump to proc
...
;proc
...
RET ;pop 4 bytes (the return address if stack well maintained) and jump to this address
Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.