Instruction Set
4-22
CALL
CALL
Operation It Performs
Flag Settings After Instruction
Examples
This example calls a procedure whose address is stored in a doubleword in memory.
/* save return offset */
push(IP);
if (
procedure == rel16)
/* near direct call */
IP = IP +
rel16;
if (
procedure == r/m16)
/* near indirect call */
IP = [
r/m16];
if ((
procedure == ptr16:16) || (procedure == m16:16))
/* far call */
{
/* save return segment */
push(CS);
if (
procedure == ptr16:16)
/* far direct call */
CS:IP =
ptr16:16;
else
/* far indirect call */
CS:IP = [
m16:16];
}
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
IF TF SF ZF
AF
PF
CF
? = undefined; – = unchanged
–
–
–
–
–
– res – res – res –
PROC_ADDR
DD
?
; full address of current procedure
; store address of current procedure in PROC_ADDR
...
LDS
SI,PROC_ADDR
; load segment of procedure into DS
; and offset of procedure into SI
; call procedure at address stored in doubleword in memory
CALL
DWORD PTR [SI]
Содержание 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...