03.01.2015 Views

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OVERVIEW OF THE 80C186 FAMILY ARCHITECTURE<br />

Individual bits in bytes and words can also be rotated. The processor does not discard the bits rotated<br />

out of an operand. The bits circle back to the other end of the operand. The number of bits<br />

to be rotated is taken from the count operand, which can specify either an immediate value or the<br />

CL register. The carry flag can act as an extension of the operand in two of the rotate instructions.<br />

This allows a bit to be isolated in the Carry Flag (CF) and then tested by a JC (jump if carry) or<br />

JNC (jump if not carry) instruction.<br />

2.2.1.4 String Instructions<br />

Five basic string operations process strings of bytes or words, one element (byte or word) at a<br />

time. Strings of up to 64 Kbytes can be manipulated with these instructions. Instructions are available<br />

to move, compare or scan for a value, as well as to move string elements to and from the<br />

accumulator. Table 2-7 lists the string instructions. These basic operations can be preceded by a<br />

one-byte prefix that causes the instruction to be repeated by the hardware, allowing long strings<br />

to be processed much faster than is possible with a software loop. The repetitions can be terminated<br />

by a variety of conditions. Repeated operations can be interrupted and resumed.<br />

Table 2-7. String Instructions<br />

REP<br />

REPE/REPZ<br />

REPNE/REPNZ<br />

MOVSB/MOVSW<br />

MOVS<br />

INS<br />

OUTS<br />

CMPS<br />

SCAS<br />

LODS<br />

STOS<br />

Repeat<br />

Repeat while equal/zero<br />

Repeat while not equal/not zero<br />

Move byte string/word string<br />

Move byte or word string<br />

Input byte or word string<br />

Output byte or word string<br />

Compare byte or word string<br />

Scan byte or word string<br />

Load byte or word string<br />

Store byte or word string<br />

String instructions operate similarly in many respects (see Table 2-8). A string instruction can<br />

have a source operand, a destination operand, or both. The hardware assumes that a source string<br />

resides in the current data segment. A segment prefix can override this assumption. A destination<br />

string must be in the current extra segment. The assembler does not use the operand names to address<br />

strings. Instead, the contents of the Source Index (SI) register are used as an offset to address<br />

the current element of the source string. The contents of the Destination Index (DI) register are<br />

taken as the offset of the current destination string element. These registers must be initialized to<br />

point to the source and destination strings before executing the string instructions. The LDS, LES<br />

and LEA instructions are useful in performing this function.<br />

2-22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!