Intel 210200-002 Baby Furniture User Manual


 
CMPS
COMPARE STRING
(BYTE
OR
WORD)
CMPS
Operation:
(LSRC) - (RSRC)
if
(OF) = 0
then
(SI)
+-
(SI)
+ OELTA
(01)
+-
(01)
+
OEL
TA
else
(SI)
+-
(SI)
-
OEL
TA
(01)
+-
(01)
- OELTA
Description:
eM
PS
destination-string, source-string
CMPS (Compare String) subtracts the destina-
tion byte or word (addressed by DI) from the
source byte or word (addressed by SI). CMPS
affects the flags
but
does not alter either
operand, updates SI and DI to point to the
next string element and updates, AF, CF,
OF,
PF, SF and ZF to reflect the relationship of the
destination element to the source element. For
example, if a JG (Jump if Greater) instruction
follows CMPS, the
jump
is
taken if the des-
Encoding:
11010011wl
Flags Affected:
AF, CF, OF, PF,
SF,
ZF
tination element
is
greater than the source
element.
If
CMPS
is
prefixed with REPE or
REPZ, the operation
is
interrupted as "com-
pare while not end-of-string (CX not zero) and
strings are equal (ZF
= 1)."
If
CMPS
is
preceded by REPNE or REPNZ, the operation
is
interrupted as
"compare
while not end-of-
string (CX not zero) and strings are not equal
(ZF
=
0)."
Thus, CMPS can be used to find
matching or differing string elements.
if
w = 0
then
LSRC = (SI),
RSRC
= (01),
OEL
T A = 1
else
LSRC =
(SI)
+ 1 :(SI),
RSRC
=
(01)
+ 1 :(01),
OEL
TA = 2
CMPS
Operands
Clocks·
Transfers
Bytes
CMPS
Coding
Examples
dest-string,
source-string
22(30)
2 1
CMPSBUFF1,
BUFF2
(repeat)
dest-string,
source-string
9+22(30)/rep
2/rep
1
REP
COMPS
10,
KEY
*b(w): where b denotes the number of clock cycles for byte operands and
w denotes the number
of
clock cycles for word operands.
2-68