String Instructions
String Instructions
If DF=0 then:
Location Content
Re giste r SI 501H
Me mory loca tion 500H 'A'
Re giste r AL 'A'
Location Content
Re giste r SI 4FFH
Me mory loca tion 500H 'A'
Re giste r AL 'A'
STOSB/STOSW
Transfers the contents of the AL/AX registers
to the memory byte/word pointed to by DI
relative to ES.
After the transfer is made, the DI register is
automatically updated as follows:
DI is incremented if DF=0.
DI is decremented if DF=1.
STOSB/STOSW
Examples:
STOSB
ES:[DI]=AL; DI=DI 1
STOSW
ES:[DI]=AX; DI=DI 2
STOSB/STOSW
Example
Assume:
Location Content
Re giste r DI 500H
Me mory loca tion 500H 'A'
Re giste r AL '2'
If DF=0 then:
Location Content
Re giste r DI 501H
Me mory loca tion 500H '2'
Re giste r AL '2'
Location Content
Re giste r DI 4FFH
Me mory loca tion 500H '2'
Re giste r AL '2'
MOVSB/MOVSW
Transfers the contents of the memory
byte/word pointed to by SI relative to DS
to the memory byte/word pointed to by
DI relative to ES.
After the transfer is made, the DI register is
automatically updated as follows:
DI is incremented if DF=0.
DI is decremented if DF=1.
MOVSB/MOVSW
Examples:
MOVSB
ES:[DI]=DS:[SI]; DI=DI 1;SI=SI 1
MOVSW
ES:[DI]= DS:[SI]; DI=DI 2; SI=SI 2
MOVSB/MOVSW
Example
Assume:
Location Content
Re giste r SI 500H
Re giste r DI 600H
Me mory loca tion 500H '2'
Me mory loca tion 600H 'W '
If DF=0 then:
Location Content
Re giste r SI 501H
Re giste r DI 601H
Me mory loca tion 500H '2'
Me mory loca tion 600H '2'
Location Content
Re giste r SI 4FFH
Re giste r DI 5FFH
Me mory loca tion 500H '2'
Me mory loca tion 600H '2'
CMPSB/CMPSW
Compares the contents of the memory
byte/word pointed to by SI relative to DS to
the memory byte/word pointed to by DI
relative to ES and changes the flags
accordingly.
After the comparison is made, the DI and SI
registers are automatically updated as
follows:
DI and SI are incremented if DF=0.
DI and SI are decremented if DF=1.
SCASB/SCASW
Compares the contents of the AL/AX
register with the memory byte/word pointed
to by DI relative to ES and changes the flags
accordingly.
After the comparison is made, the DI
register is automatically updated as follows:
DI is incremented if DF=0.
DI is decremented if DF=1.
REP/REPZ/REPNZ
These prefixes cause the string instruction
that follows them to be repeated the
number of times in the count register CX or
until:
ZF=0 in the case of REPZ (repeat while equal).
ZF=1 in the case of REPNZ (repeat while not
equal).