Call Procedure                                

86/88

Y

186

Y

286

Y

386

Y

486

Y

CALL procedure

Ovfl

N

Dir

N

Int

N

Trap

N

Sign

N

Zero

N

Aux

N

Prty

N

Carry

N

    CALL transfers control to a procedure that can either be within the
    current segment (a NEAR procedure) or outside it (a FAR procedure).
    The two types of CALLs result in different machine instructions, and
    the RET instruction that exits from the procedure must match the type
    of the CALL instruction (the potential for mismatch exists if the
    procedure and the CALL are assembled separately).

       Notes:         For an inter-segment procedure (procedure in a
                      different segment), the processor first pushes the
                      current value of CS onto the stack, then pushes the
                      current value of IP (which is pointing to the
                      instruction following the CALL instruction), then
                      transfers control to the procedure.

                      For an intra-segment procedure (procedure in the
                      same segment), the processor first pushes the
                      current value of IP (which is pointing to the
                      instruction following the CALL instruction) onto the
                      stack, then transfers control to the procedure.

                      CALL can also read the procedure address from a
                      register or memory location.  This form of CALL is
                      called an indirect CALL.

------------------------------------ Timing ----------------------------------

OpCode          Instruction             386     286     86
E8 cw           CALL rel16              7+m     7       19
FF/2            CALL r/m16              7/10+m  7/11    16/21+EA
9A cd           CALL ptr16:16           17+m    13      28
        call gate, same priveledge      52+m    41
        call gate, more priv, no params 86+m    82
        call gate, more priv, X params  94+4X   86+4X
        call to task                    ts      177/182
FF/3            CALL m16:16             22+m    16/29   37+EA
        call gate, same priveledge      56+m    44
        call gate, more priv, no params 90+m    83
        call gate, more priv, X params  98+4x   90+4x
        call to task                    5+ts    180/185
E8 cd           CALL rel32              7+m
FF/2            CALL r/m32              7/10+m
9A cp           CALL ptr16:32           17+m
        call gate, same priveledge      52+m
        call gate, more priv, no params 86+m
        call gate, more priv, X params  94+4x+m
        call to task                    ts
FF/3            CALL m16:32             22+m
        call gate, same priveledge      56+m
        call gate, more priv, no params 90+m
        call gate, more priv, X params  98+m
        call to task                    5+ts

------------------------------------ Logic -----------------------------------

        if FAR CALL (inter-segment)
                PUSH CS
                CS = dest seg
        PUSH IP
        IP = dest ofs

See Also RET JMP INT


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .