RET Return from Procedure Flags: not altered
RET optional-pop-value
Logic: POP IP
If FAR RETURN (inter-segment)
POP CS
SP SP + optional-pop-value (if specified)
RET transfers control from a called procedure back to the instruction
following the CALL, by:
þ Popping the word at the top of the stack into IP
þ If the return is an intersegment return:
þ Popping the word now at the top of the stack into CS
þ Adding the optional-pop-value, if specified, to SP
The assembler will generate an intrasegment RET if the procedure
containing the RET was designated by the programmer as NEAR, and an
intersegment RET if it was designated FAR. The optional-pop-value
specifies a value to be added to SP, which has the effect of popping
the specified number of bytes from the top of the stack.
--------------------------------------------------------------------------
Operands Clocks Transfers Bytes Example
(intrasegment, no pop) 20 1 1 RET
(intrasegment, with pop) 24 1 3 RET 4
(intersegment, no pop) 32 2 1 RET
(intersegment, pop) 31 2 3 RET 2
--------------------------------------------------------------------------
Seealso:
This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster