INSTRUCTION SET DESCRIPTIONS

Table C-4. Instruction Set (Continued)

Name

Description

Operation

Flags

Affected

 

 

 

 

 

 

 

REP

Repeat:

do while (CX) 0

AF –

REPE

Repeat While Equal:

service pending interrupts (if any)

CF –

REPZ

Repeat While Zero:

execute primitive string

DF –

REPNE

Repeat While Not Equal:

Operation in succeeding byte

IF –

REPNZ

Repeat While Not Zero:

(CX) (CX) – 1

OF –

 

Controls subsequent string instruction

if

PF –

 

primitive operation is CMPB,

SF –

 

repetition. The different mnemonics

 

CMPW, SCAB, or SCAW and

TF –

 

are provided to improve program

 

(ZF) ≠ 0

ZF –

 

clarity.

 

then

 

 

REP is used in conjunction with the

 

 

exit from while loop

 

 

MOVS (Move String) and STOS (Store

 

 

 

 

 

String) instructions and is interpreted

 

 

 

as "repeat while not end-of-string" (CX

 

 

 

not 0).

 

 

 

REPE and REPZ operate identically

 

 

 

and are physically the same prefix byte

 

 

 

as REP. These instructions are used

 

 

 

with the CMPS (Compare String) and

 

 

 

SCAS (Scan String) instructions and

 

 

 

require ZF (posted by these instruc-

 

 

 

tions) to be set before initiating the

 

 

 

next repetition.

 

 

 

REPNE and REPNZ are mnemonics

 

 

 

for the same prefix byte. These

 

 

 

instructions function the same as

 

 

 

REPE and REPZ except that the zero

 

 

 

flag must be cleared or the repetition is

 

 

 

terminated. ZF does not need to be

 

 

 

initialized before executing the

 

 

 

repeated string instruction.

 

 

 

Instruction Operands:

 

 

 

none

 

 

 

 

 

 

NOTE: The three symbols used in the Flags Affected column are defined as follows:

the contents of the flag remain unchanged after the instruction is executed ¸? the contents of the flag is undefined after the instruction is executed

the flag is updated after the instruction is executed

C-37

Page 360
Image 360
Intel 80C188XL, 80C186XL Repeat While Equal, Repeat While Zero, Repeat While Not Equal, Repeat While Not Zero