RET
RETURN
RET
Operation:
(IP)
~
((SP) + 1 :(SP))
(SP)
+-
(SP) + 2 .
if
Inter-Segment then
(CS)
+-
((SP) + 1 :(SP))
(SP)
+-
(SP) + 2
if
Add Immediate to Stack Pointer
then
(SP)
+-
(SP) + data
Description:
RET
optional-pap-value
RET (Return transfers control from a pro-
cedure back to the instruction following the
CALL
that
activated the procedure. The
assembler generates an intrasegment RET if
the programmer has defined the procedure
NEAR,
or
an intersegment RET if the pro-
cedure has been defined
as
FAR. RET pops
the word
at
the top
of
the stack (pointed to by
register
SP) into the instruction pointer and
Flags AUected:
None
increments SP by two.
If
RET
is
intersegment,
the word at the
new
top
of
stack
is
popped into
the
CS
register, and SP
is
again incremented
by two.
If
an optional pop value has been
specified, RET adds that value to
SP. This
feature may be used to discard parameters
pushed onto the stack before the execution
of
the CALL instruction.
2-138