
Instruction Set
4-191
REP
Repeat
REP
What It Does
REP repeatedly executes a single
string instruction; an unsigned number in CX tells REP
how many times to execute the instruction.
Syntax
Description
REP is a prefix that repeatedly executes a single
string instruction (INS, LODS, MOVS,
OUTS, or STOS). 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 instruction
3. Subtracts 1 from the unsigned number in CX
When CX is 0, the microcontroller begins executing the next instruction.
Operation It Performs
Form
Prefix
Opcode
Description
Clocks
Am186 Am188
REP INS
m8,DX
F3
6C
Input CX bytes from port in DX to ES:[DI]
8+8
n
8+8
n
REP INS
m16,DX
F3 6D
Input CX words from port in DX to ES:[DI]
8+8
n
12+8
n
REP LODS
m8
F3 AC
Load CX bytes from segment:[SI] in AL
6+11
n
6+11
n
REP LODS
m16
F3
AD
Load CX words from segment:[SI] in AX
6+11
n
10+11
n
REP MOVS
m8,m8
F3 A4
Copy CX bytes from segment:[SI] to ES:[DI]
8+8
n
8+8
n
REP MOVS
m16,m16
F3 A5
Copy CX words from segment:[SI] to ES:[DI]
8+8
n
12+8
n
REP OUTS DX,
m8
F3 6E
Output CX bytes from DS:[SI] to port in DX
8+8
n
8+8
n
REP OUTS DX,
m16
F3 6F
Output CX words from DS:[SI] to port in DX
8+8
n
12+8
n
REP STOS
m8
F3 AA
Fill CX bytes at ES:[DI] with AL
6+9
n
6+9
n
REP STOS
m16
F3 AB
Fill CX words at ES:[DI] with AX
6+9
n
10+9
n
REP
instruction
while (CX != 0)
/* repeat */
{
serviceInterrupts();
execute(
instruction);
/* decrement counter */
CX = CX - 1;
if (ZF == 0)
/* not equal */
break;
}
Содержание 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...