
Instruction Set
4-156
MOVS
MOVSB Move S tring Byte
MOVSW Move S tring Word
Move S tring Component
MOV S
What It Does
MOVS copies a component from one string to another string.
S yntax
Desc ription
MOVS copies the byte or word at segment:[SI] to the byte or word at ES:[DI]. The destination
operand must be addressable from the ES register; no segment override is possible for the
destination. You can use a segment override for the source operand. The default is the DS
register. The contents of SI and DI determine the source and destination addresses. Load
the correct index values into the SI and DI registers before executing the MOVS instruction.
After moving the data, MOVS advances the SI and DI registers automatically. If the Direction
Flag (DF) is 0 (see STC on page 4-228), the registers increment. If DF is 1 (see STD on
page 4-231), the registers decrement. The stepping is 1 for a byte, or 2 for a word operand.
MOVSB and MOVSW are synonyms for the byte and word MOVS instructions, respectively.
Form
Opcode
Description
Clocks
Am186 Am188
MOVS m8,m8
A4
Copy byte segment:[SI] to ES:[DI]
14
14
MOVS m16,m16
A5
Copy word segment:[SI] to ES:[DI]
14
18
MOVSB
A4
Copy byte DS:[SI] to ES:[DI]
14
14
MOVSW
A5
Copy word DS:[SI] to ES:[DI]
14
18
MOVS destination,source
MOVSB
MOVSW
To override he default source segment
(DS) and to have the assembler type-
check your operands, use this form. In
this form, source is segment:[SI]. The
assembler uses the segment in DS un-
less you specify a different segment
register as part of the source string
component. The assembler uses the
definitions of the string components to
determine their sizes.
Regardless of he form of MOVS
you use, destination is always
ES:[DI]. Before using any form
of MOVS, make sure that ES
contains the segment of the des-
tination string, DI contains the
offset of the destination string,
and SI contains the offset of the
source string.
To copy a byte within a string located
in the source segment specified in DS
to a byte within a string located in the
destination segment specified in ES,
use this form.
To copy a word within a string located
in the source segment specified in DS
to a word within a string located in the
destination segment specified in ES,
use this form.