Instruction Set
4-193
REPE
Repeat While Equal
REPE
REPZ
Repeat While Zero
What It Does
REPE and REPZ repeatedly execute a single string
comparison instruction; an unsigned
number in CX tells the microcontroller the maximum number of times to execute the
instruction. Once the instruction compares two components and finds they are not equal,
the instruction is no longer executed.
Syntax
Description
REPE is a prefix that repeatedly executes a single string
comparison instruction (CMPS or
SCAS). While CX is not 0 and ZF is 1, the microcontroller repeats the following sequence
of operations:
1. Acknowledges and services any pending interrupts
2. Executes the string comparison instruction
3. Subtracts 1 from the unsigned number in CX
4. Compares ZF with 0
When CX is 0 or ZF is 0, the microcontroller begins executing the next instruction.
REPZ is a synonym for REPE.
Form
Prefix
Opcode
Description
Clocks
Am186 Am188
REPE CMPS
m8,m8
F3 A6
Find nonmatching bytes in ES:[DI] and segment:[SI]
5+22
n
5+22
n
REPE CMPS
m16,m16
F3 A7
Find nonmatching words in ES:[DI] and segment:[SI]
5+22
n
9+22
n
REPE SCAS
m8
F3 AE
Find non-AL byte starting at ES:[DI]
5+15
n
5+15
n
REPE SCAS
m16
F3 AF
Find non-AX word starting at ES:[DI]
5+15
n
9+15
n
REPZ CMPS
m8,m8
F3 A6
Find nonmatching bytes in ES:DI and segment:[SI]
5+22
n
5+22
n
REPZ CMPS
m16,m16
F3 A7
Find nonmatching words in ES:DI and segment:[SI]
5+22
n
9+22
n
REPZ SCAS
m8
F3 AE
Find non-AL byte starting at ES:DI
5+15
n
5+15
n
REPZ SCAS
m16
F3 AF
Find non-AX word starting at ES:DI
5+15
n
9+15
n
To repeat a string comparison instruction
until CX is 0 or two components are not
equal, use REPE or its synonym, REPZ.
Both forms perform the same operation.
REPE
instruction
REPZ
instruction
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...