BASIC INSTRUCTION SET
Direct
JMP
outside
of
the current code segment. Direct
JMP
instructions that specify a target location
outside the current code segment contain a full 32-bit pointer. This pointer consists of a selector for
the
new
code segment and an offset within the
new
segment.
Example:
JMP
F AR_NEWCODE_FOO. Places the selector contained in the instruction into CS and
the offset into IP. The program resumes execution
at
this location
in
the
new
code segment.
Indirect
JMP
outside
of
the current code segment. Indirect
JMP
instructions
that
specify a target
location outside the current code segment use a double-word variable to specify the pointer.
Example:
JMP
NEW
CODE.
NEWCODE
the first word of two consecutive words
in
memory which
represent the
new
pointer.
NEWCODE
contains the
new
offset for
IP
and the word
follow-
ing
NEW
CODE contains the selector for CS. The program resumes execution at this
location in the
new
code segment. (Protected mode programs treat this differently. See
Chapters 6 and 7).
Direct
JMP
outside
of
the current code segment to a call gate.
If
the selector included with the instruc-
tion refers to a call gate, then the processor ignores the offset in the instruction and takes the pointer
of the routine being entered from the call gate.
JMP
outside of current code segment may only
go
to
the same level.
Example:
JMP
CALL_GATE_FOO.
The
selector
in
the
instruction
refers to
the
call
gate
CALL_GATE]OO,
and the call gate actually provides the
new
contents of CS and
IP
to
specify the address of the next instructions.
Indirect
JMP
outside the current code segment to a call gate.
If
the selector specified
by
the instruc-
tion refers to a call gate, the processor ignores the offset in the double-word and takes the address of
the routine being entered from the call gate. The
JMP
instruction uses the same format
to
indirectly
specify a task gate or a task state segment.
Example:
JMP
CASE_TABLE
[BX1.
The instruction refers to the double-word
in
the array of point-
ers called CASE_TABLE. The specific double-word chosen depends
on
the value
in
BX
when the instruction executes. The selector portion of this double-word selects a call gate,
and the processor takes the address of the routine being entered from the call gate.
3.6.1.2
CALL
INSTRUCTION
CALL
(Call Procedure) activates an out-of-iine proceciure, saving
on
the sla"k
iht;
addre •• uf the
instruction following the CALL
for
later use
by
a
RET
(Return) instruction. An intrasegment CALL
places the current value of IP
on
the stack. An intersegment
CALL
places both the value of
IP
and
CS
on
the stack. The
RET
instruction in the called procedure uses this address to transfer control back
to the calling program.
A long CALL instruction
that
invokes a task-switch stores the outgoing task's task state segment selec-
tor in the incoming task state segment's link field and sets the nested task flag in the
new
task. In this
case, the
IRET
instruction takes the place of the
RET
instruction to return control
to
the nested task.
3-18