Intel 80286 Computer Accessories User Manual


 
BASIC INSTRUCTION SET
seAS
(Scan String) subtracts the destination string element at ES:DI from AX or AL and updates
the flags AF, SF,
ZF, PF, CF and OF.
If
the values are equal,
ZF=
1;
otherwise, ZF=O.
If
DF=O,
the processor increments the memory pointer (DI) for the string. The segment register used for the
source address can
be
changed with a segment override prefix while the destination segment register
cannot
be
overridden. .
Example: SCASW. Compares the value
in
AX with the destination string element.
REPE/REPZ
(Repeat While
ex
Equal/Zero) and
REPNE/REPNZ
(Repeat While
ex
Not Equal/
Not Zero) are the prefixes that are used exclusively with the SCAS (ScanString) and CMPS (Compare
String) primitives.
The difference between these
two
types of prefix bytes
is
that
REPE/REPZ
terminates when
ZF=O
and
REPNE/REPNZ
terminates when
ZF=
1.
ZF
does
not require initialization before execution of
a repeated string instruction.
When these prefixes modify either the SCAS or CMPS primitives, the processor compares the value
of the current string element with the value
in
AX
for
word elements or with the value in AL for byte
elements. The resulting state of
ZF
can then limit the operation of the repeated operation
as
well
as a
zero value in CX.
Example: REPE SCASB. Causes the processor
to
scan the string pointed
to
by
ES:DI until it encoun-
ters a match with the byte value
in
AL or until CX decrements
to
zero.
LODS (Load String) places the source string element at DS:SI into
AX
for word strings or into AL
for
byte strings.
Example: LODSW. Loads AX with the value pointed
to
by
DS:SI.
3.8
ADDRESS MANIPULATION INSTRUCTIONS
The set of address manipulation instructions provide a
way
to
perform address calculations or
to
move
to a
nc;v
data segment
or
extra segment.
LEA
(Load Effective Address) transfers the offset of the source operand (rather than its value)
to
the
destination operand. The source operand must
be
a memory operand, and the destination operand must
be
a 16-bit general register (AX, DX,
BX,
CX, BP, SP, SI, or DI).
LEA does not affect any flags. This instruction
is
useful for initializing the registers before the execu-
tion of the string primitives or the XLAT instruction.
Example: LEA
BX
EBCDIC_TABLE. Causes the processor
to
place the address of the starting location
of the table labeled EBCDIC_TABLE intoBX.
LDS (Load Pointer Using DS) transfers a 32-bit pointer variable from the source operand
to
DS and
the destination register. The source operand must be a memory operand, and the destination operand
must
be
a 16-bit general register (AX, DX,
BX,
CX, BP, SP, SI
or
DI). DS receives the high-order
segment word of the pointer. The destination register receives the low-order word, which points
to
a
specific location within the segment.
3-24