Instruction Set
4-192
REP
REP
Flag Settings After Instruction
Instruction prefixes do not affect the flags. See the instruction being repeated for the flag
values.
Examples
This example copies one string of ASCII characters stored in memory to another string in
the same segment. The microcontroller copies the characters, one by one, from first to last.
Tips
To repeat a block of instructions, use LOOP or another looping construct.
Related Instructions
If you want to
See
Process string components from lower to higher addresses
CLD
Copy a component from a port in I/O memory to a string in main memory
INS
Copy a component from a string in memory to a register
LODS
Copy a component from one string in memory to another string in memory
MOVS
Copy a component from a string in main memory to a port in I/O memory
OUTS
Repeat one string comparison instruction while the components are the same
REPE
Repeat one string comparison instruction while the components are not the same REPNE
Process string components from higher to lower addresses
STD
Copy a component from a register to a string in memory
STOS
; defined in SEG_A segment
SOURCE
DB
”Source string”
DESTINATION
DB
13 DUP (?)
; notify assembler: DS and ES specify
; the same segment
ASSUME DS:SEG_A, ES:SEG_A
; set up segment registers with same segment
MOV
AX,SEG_A
; load segment into DS
MOV
DS,AX
; DS points to SEG_A, source
MOV
ES,AX
; ES points to SEG_A, destination
; copy one string to another
; set up registers and flags
LEA
SI,SOURCE
; load source offset (segment = DS)
LES
DI,DESTINATION
; load dest. offset
MOV
CX,13
; set up counter
CLD
; process string low to high
; copy source string to destination
REP
MOVSB
Содержание 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...