String Instructions - Intel 80C188EC User Manual

Hide thumbs Also See for 80C188EC:
Table of Contents

Advertisement

OVERVIEW OF THE 80C186 FAMILY ARCHITECTURE
Individual bits in bytes and words can also be rotated. The processor does not discard the bits ro-
tated out of an operand. The bits circle back to the other end of the operand. The number of bits
to be rotated is taken from the count operand, which can specify either an immediate value or the
CL register. The carry flag can act as an extension of the operand in two of the rotate instructions.
This allows a bit to be isolated in the Carry Flag (CF) and then tested by a JC (jump if carry) or
JNC (jump if not carry) instruction.
2.2.1.4

String Instructions

Five basic string operations process strings of bytes or words, one element (byte or word) at a
time. Strings of up to 64 Kbytes can be manipulated with these instructions. Instructions are avail-
able to move, compare or scan for a value, as well as to move string elements to and from the
accumulator. Table 2-7 lists the string instructions. These basic operations can be preceded by a
one-byte prefix that causes the instruction to be repeated by the hardware, allowing long strings
to be processed much faster than is possible with a software loop. The repetitions can be termi-
nated by a variety of conditions. Repeated operations can be interrupted and resumed.
REP
REPE/REPZ
REPNE/REPNZ
MOVSB/MOVSW
MOVS
INS
OUTS
CMPS
SCAS
LODS
STOS
String instructions operate similarly in many respects (see Table 2-8). A string instruction can
have a source operand, a destination operand, or both. The hardware assumes that a source string
resides in the current data segment. A segment prefix can override this assumption. A destination
string must be in the current extra segment. The assembler does not use the operand names to ad-
dress strings. Instead, the contents of the Source Index (SI) register are used as an offset to address
the current element of the source string. The contents of the Destination Index (DI) register are
taken as the offset of the current destination string element. These registers must be initialized to
point to the source and destination strings before executing the string instructions. The LDS, LES
and LEA instructions are useful in performing this function.
2-22
Table 2-7. String Instructions
Repeat
Repeat while equal/zero
Repeat while not equal/not zero
Move byte string/word string
Move byte or word string
Input byte or word string
Output byte or word string
Compare byte or word string
Scan byte or word string
Load byte or word string
Store byte or word string

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c186ec

Table of Contents