Intel 80287, 80286 manual LOOP/LOOPcond-Loop Control with CX Counter, Instruction SET

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 280
Image 280

THE 80286 INSTRUCTION SET

LOOP/LOOPcond-Loop Control with CX Counter

Opcode

Instruction

Clocks

Description

E2

cb

LOOP cb

8,noj=4

DEC CX; jump short if CX;toO

E1

cb

LOOPE cb

8,noj=4

DEC CX; jump short if CX;to 0 and equal (ZF= 1)

EO

cb

LOOPNE cb

8,noj=4

DEC CX; jump short if CX;to 0 and not equal

 

.cb

LOOPNZ cb

 

(ZF=O)

EO

·8,noj=4

DEC CX; jump short if CX;toO and ZF=O

E1

cb

LOOPZ cb

8,noj=4

DEC CX; jump short if CX;toO and zero (ZF=1)

FLAGS MODIFIED

None

FLAGS UNDEFINED

None

OPERATION

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

Page 280
Image 280
Intel 80287, 80286 manual LOOP/LOOPcond-Loop Control with CX Counter, Instruction SET