User's Manual

THE
80286
INSTRUCTION
SET
LOOP/LOOPcond-Loop
Control
with
CX
Counter
Opcode
Instruction
E2
cb LOOP
cb
E1
cb
LOOPE
cb
EO
cb
LOOPNE
cb
EO
.cb
LOOPNZ
cb
E1
cb LOOPZ cb
FLAGS
MODIFIED
None
FLAGS
UNDEFINED
None
OPERATION
Clocks
8,noj=4
8,noj=4
8,noj=4
ยท8,noj=4
8,noj=4
Description
DEC
CX;
jump short
if
CX;toO
DEC
CX; jump short
if
CX;to
0 and equal (ZF =
1)
DEC
CX; jump short
if
CX;to
0
and
not equal
(ZF=O)
DEC
CX; jump short
if
CX;toO
and
ZF=O
DEC
CX;
jump short
if
CX;toO
and zero
(ZF=1)
LOOP first decrements the ex register without changing any of the flags. Then, conditions are checked
as given in the description above for the form of
LOOP being used.
If
the conditions are met, then an
intra-segment jump
is
made. The destination to LOOP
is
in
the range from
126
(decimal) bytes before
the instruction to
127
bytes beyond the instruction.
The
LOOP instructions are intended to provide iteration control and
to
combine loop index manage-
ment with conditional branching. To use the
LOOP instruction you load an unsigned iteration count
into
ex, then code the LOOP
at
the end of a series of instructions to
be
iterated. The destination of
LOOP is,a label that points to the beginning of the iteration.
PROTECTED
MODE
EXCEPTIONS
#GP(O) if the offset jumped to
is
beyond the limits of the current code segment.
REAL
ADDRESS
MODE
EXCEPTIONS
None
8-70