
Instruction Set
4-21
CALL
Call Proc edure
CALL
What It Does
CALL calls a procedure.
S yntax
Desc ription
CALL suspends execution of the current instruction sequence, saves the segment (if
necessary) and offset addresses of the next instruction, and begins executing the procedure
named by the operand. A return at the end of the called procedure exits the procedure and
starts execution at the instruction following the CALL instruction.
CALL rel16and CALL r/m16are near calls. They use the current Code Segment register
value. Near calls push the offset of the next instruction (IP) onto the stack. The near RET
instruction in the procedure pops the instruction offset when it returns control.
n
Near direct calls (relative):
CALL rel16adds a signed offset to the address of the next
instruction to determine the destination. CALL stores the result in the IP register.
n
Near indirect calls (absolute):
CALL r/m16specifies a register or memory location
from which the 16-bit absolute segment offset is fetched. CALL stores the result in the
IP register.
CALL ptr16:16and CALL m16:16are far calls. They use a long pointer to the called
procedure. The long pointer provides 16 bits for the CS register and 16 for the IP register.
Far calls push both the CS and IP registers as a return address. A far return must be used
to pop both CS and IP from the stack.
n
Far direct calls:
CALL ptr16:16uses a 4-byte operand as a long pointer to the called
procedure.
n
Far indirect calls:
CALL m16:16fetches the long pointer from the memory location
specified (indirection).
A CALL-indirect-through-memory, using the stack pointer (SP) as a base register,
references memory before the call. The base is the value of SP before the instruction
executes.
Form
Opcode
Description
Clocks
Am186 Am188
CALL rel16
E8 cw
Call near, displacement relative to next instruction
15
19
CALL r/m16
FF /2
Call near, register indirect/memory indirect
13/19
17/27
CALL ptr16:16
9A cd
Call far to full address given
23
31
CALL m16:16
FF /3
Call far to address at m16:16 word
38
54
CALL procedure