Intel 210200-002 Baby Furniture User Manual


 
ARCHITECTURE AND INSTRUCTIONS
Any:of the .primitive string instructions may
be preceded with a one-byte prefix indicating
that the operation
is
to be repeated until the
operation count in CX
is
satisfied. The test
for completion
is
made prior to each repeti-
tion
of.
the operation. Thus,
an
initial
operation count of zero
will
cause zero exe-
cutions of the primitive operation.
The repeat prefix byte also designates a value
to
compare with
ZF
flag.
If
the primitive
operation
is
one which
affeCts
the
ZF
flag,
and the
ZF
flag
is
unequal to the designated
value after' any execution of the primitive
operation, the repetition
is
terminated. This
permits the scan operation to serve as a scan-
while
or
a scan-until.
During the execution of a repeated primitive
operation the operand pointer registers
(SI
and
DI) and the operation count register
(CX)
are
updated
after
each repetition,
whereas the instruction pointer
will
retain the
offset
addres~
of
the repeat prefix byte
(assuming it immediately precedes the string
operation instruction). Thus, an interrupted
repeated operation will be correctly resumed
when control returns from the interrupted
task.
You should avoid using the two other prefix
bytes with a repeat-prefixed string instrilc-
tion.
One overrides the default segment
addressing for
the SI operand arid one locks
the bus to prohibit
acceSs by other bus
masters. Execution of the repeated string
operation
will
not
resume properly following
an
interrupt if more than one prefix
is
present
preceding the string primitive. Execution will
resume
One
byte before the' primitive (pre-
sumably where the repeat prefix resides), thus
ignoring the additional prefixes.
Primitive String Operations
Five primitive string
oper~tions
are provided:
,
"',"
'
MOVS transfers. a byte or word operand
from the source operand to the destination
operand.
As
a repeated operation this moves
.2-14
a string from one location in memory to
another.
CMPS
subtracts the destination byte or word
operand from the source operand and affects
the flags but does
not
return the result. As a
repeated operation this compares two strings.
With the appropriate repeat prefix it
is
pos-
sible to determine after which string element
the two strings become unequal, thereby
establishing an ordering between the strings.
SCAS subtracts the destination byte or word
operand from AL (or AX) and affects the
flags but does not return the result. As a
repeated operation this scans for the occur-
rence
of,
or departure from a given value in
the string. .
LODS transfers a byte or word operand
from the source operand to AL (or AX). This
operation ordinarily would not be repeated.
STOS transfers a byte or word operand from
AL
(or AX) to the destination operand. As a
repeated operation this fills a string with a
given value.
In all cases above, the source operand
is
addressed
by
SI and the destination operand
is
addressed
by
DI.
Software Operation Control
The repeat prefix provides for rapid iteration
in a hardware-repeated string operation. The
iteration control
operations· provide this
same control for implementing software
loops to perform complex string operations.
These iteration operations provide the same
operation count update,
operation comple-
tion test, and
ZF
flag tests that the repeat
prefix provides.
,
By
combining the'primidve string operations
and
iteration control operations with other
operations, it
is
possible to' build sophisti-
cated
yet efficient
string
manipulation
routines. One instruction that
is
particularly
useful in this context
is
XLA
T;
it permits a
byte fetched from
one string to
be
translated