
Instruction Set
4-197
REPNE Repeat While Not Equal
REPNE
REPNZ Repeat While Not Zero
What It Does
REPNE and REPNZ 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 equal, the
instruction is no longer executed.
Syntax
Description
REPNE is a prefix that repeatedly executes a single string
comparison instruction (CMPS
and SCAS). While CX is not 0 and ZF is 0, 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 1
When CX is 0 or ZF is 1, the microcontroller begins executing the next instruction.
REPNZ is a synonym for REPNE.
Form
Prefix
Opcode
Description
Clocks
Am186 Am188
REPNE CMPS
m8,m8
F2 A6
Find matching bytes in ES:DI and segment:[SI]
5+22
n
5+22
n
REPNE CMPS
m16,m16
F2 A7
Find matching words in ES:DI and segment:[SI]
5+22
n
9+22
n
REPNZ CMPS
m8,m8
F2 A6
Find matching bytes in ES:DI and segment:[SI]
5+22
n
5+22
n
REPNZ CMPS
m16,m16
F2 A7
Find matching words in ES:DI and segment:[SI]
5+22
n
9+22
n
REPNE SCAS
m8
F2 AE
Find AL, starting at ES:DI
5+15
n
5+15
n
REPNE SCAS
m16
F2 AF
Find AX, starting at ES:DI
5+15
n
9+15
n
REPNZ SCAS
m8
F2 AE
Find AL, starting at ES:DI
5+15
n
5+15
n
REPNZ SCAS
m16
F2 AF
Find AX, starting at ES:DI
5+15
n
9+15
n
To repeat a string comparison instruction until
CX is 0 or two components are equal, use
REPNE or its synonym, REPNZ. Both forms
perform the same operation.
REPNE
instruction
REPNZ
instruction
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...