Instruction Set
4-21
CALL
Call Procedure
CALL
What It Does
CALL calls a procedure.
Syntax
Description
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
rel16 and CALL r/m16 are 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
rel16 adds 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/m16 specifies 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:16 and CALL m16:16 are 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:16 uses a 4-byte operand as a long pointer to the called
procedure.
n
Far indirect calls: CALL
m16:16 fetches 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
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...