INTRODUCTION
execution. Bytes and words also may be
rotated. Bits rotated out
of
an
operand are
not lost as in a shift
but
are circled back into
the other end of the operand.
POWERFUL STRING PROCESSING
Five basic string instructions called primitives
allow a string of bytes or words to be oper-
ated on, one byte or word
at
a time. Strings
of
up to 64K bytes may be manipulated with
these instructions. Instructions are available
to move
data
from a source string to a desti-
nation string,
or
to compare two strings,
or
to scan one string for a given value. In addi-
tion, string instructions are provided to move
string elements to and from the AX register
in the
8088
(Fig.
1-19).
The specified operation
is
performed only
once when the string primitive
is
encountered
in the program.
If
the programmer desires
the operation to be performed repetitively,
LOGICALS
NOT
"Not"
byte
or
word
AND
"And"
byteorword
OR
"Inclusive
or"
byte
or
word
XOR
"Exclusive
or"
byte or word
TEST
"Test"
byte or word
SHIFTS
SHLISAL
Shift
logical/arithmetic left
byte or word
SHR
Shift logical right byte or word
SAR
Shift arithmetic right byte or
word
ROTATES
ROL
Rotate left byte
or
word
ROR
Rotate right byte or word
RCL
Rotate through carry left byte
or word
RCR
Rotate through carry right
byte
or
word
Figure 1-18. Bit Manipulation Instructions
1-11
such as in a block or string manipulation
operation, the basic string primitive may be
proceeded by a special one byte
"prefix" that
causes the instruction to be repeated by the
hardware. This prefix
is
called REPEAT.
The use of the
REPEAT
prefix allows long
strings to be processed much faster
than
would be possible with a software loop. The
repetitions
can
be terminated by a variety
of
conditions and a repeated operation may be
interrupted and resumed. The
ex
register
counts the number of times the string opera-
tion
is
performed.
When the
8088
moves a 16-bit quantity, it
does so 8 bits
at
a time automatically in the
hardware. Because of the variety of string
operations and the fact the 8088 can move
both 8-bit and 16-bit quantities using its
string instructions, the
8088
has the most
powerful string processing capabilities of any
8-bit microprocessor.
The program transfer instructions are shown
in Figure
1-20.
These instructions redirect the
flow of instruction execution to other loca-
tions in memory and many
of
them are
equivalent to instructions found in other 8-bit
microprocessors. The
8088,
however, offers
much more flexibility in how
an
instruction
is
performed. The unconditional transfer instruc-
tions may transfer control to a target
MOVS
Move byte
or
word string
CMPS
Compare byte
or
word
string
SCAS Scan byte
or
word string
LODS
Load byte
or
word string
STOS
Store byte
or
word string
REP
Repeat
REPE/REPZ
Repeat while
equal/zero
REPNE/REPNZ
Repeat while not
equal/not
zero
Figure 1-19. String Instructions