Intel 80286, 80287 manual Intel, Flag Control Instructions

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 81
Image 81

intel"

BASIC INSTRUCTION SET

Example: LDS SI, STRING_X. Loads DS with the word identifying the segment pointed to by STRING-X, and loads the offset of STRING-X into SI. Specifying SI as the destination operand is a convenient way to prepare for a string operation on a source string that is not in the current data segment.

LES (Load Pointer Using ES) operates identically to LDS except that ES receives the offset word rather than DS.

Example: LES DI, DESTINATION-X. Loads ES with the word identifying the segment pointed to by DESTINATION_X, and loads the offset of DESTINATION-X into DI. This instruc- tion provides a convenient way to select a destination for a string operation if the desired location is not in the current extra segment.

3.9 FLAG CONTROL INSTRUCTIONS

The flag control instructions provide a method of changing the state of bits in the flag register.

3.9.1Carry Flag Control Instructions

The carry flag instructions are useful in conjunction with rotate-with-carry instructions RCL and RCR. They can initialize the carry flag, CF, to a known state before execution of a rotate that moves the carry bit into one end of the rotated operand.

STC (Set Carry Flag) sets the carry flag (CF) to 1.

Example: STC

CLC (Clear Carry Flag) zeros the carry flag (CF).

Example: CLC

CMC (Complement Carry Flag) reverses the current status of the carry flag (CF).

Example: CMC

3.9.2Direction Flag Control Instructions

The direction flag control instructions are specifically included to set or clear the direction flag, DF, which controls the left-to-right or right-to-left direction of string processing. IF DF=O, the processor automatically increments the string memory pointers, SI and DI, after each execution of a string primi- tive. If DF= 1, the processor decrements these pointer values. The initial state of DF is O.

CLD (Clear Direction Flag) zeros DF, causing the string instructions to auto-increment SI and/or DI. CLD does not affect any other flags.

Example: CLD

STD (Set Direction Flag) sets DF to 1, causing the string instructions to auto-decrement SI and/or DI. STD does not affect any other flags.

Example: STD

3-25

Page 81
Image 81
Intel 80286, 80287 manual Intel, Flag Control Instructions