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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OVERVIEW OF THE 80C186 FAMILY ARCHITECTURE<br />

Table 2-5. Arithmetic Interpretation of 8-Bit Numbers<br />

Hex<br />

Bit Pattern<br />

Unsigned<br />

Binary<br />

Signed<br />

Binary<br />

Unpacked<br />

Decimal<br />

Packed<br />

Decimal<br />

07 0 0 0 0 0 1 1 1 7 +7 7 7<br />

89 1 0 0 0 1 0 0 1 137 –119 invalid 89<br />

C5 1 1 0 0 0 1 0 1 197 –59 invalid invalid<br />

2.2.1.3 Bit Manipulation Instructions<br />

There are three groups of instructions for manipulating bits within bytes and words. These three<br />

groups are logical, shifts and rotates. Table 2-6 lists the bit manipulation instructions and their<br />

functions.<br />

Table 2-6. Bit Manipulation Instructions<br />

Logicals<br />

NOT<br />

AND<br />

OR<br />

XOR<br />

TEST<br />

“Not” byte or word<br />

“And” byte or word<br />

“Inclusive or” byte or word<br />

“Exclusive or” byte or word<br />

“Test” byte or word<br />

Shifts<br />

SHL/SAL<br />

SHR<br />

SAR<br />

Shift logical/arithmetic left byte or word<br />

Shift logical right byte or word<br />

Shift arithmetic right byte or word<br />

Rotates<br />

ROL<br />

ROR<br />

RCL<br />

RCR<br />

Rotate left byte or word<br />

Rotate right byte or word<br />

Rotate through carry left byte or word<br />

Rotate through carry right byte or word<br />

Logical instructions include the Boolean operators NOT, AND, OR and exclusive OR (XOR), as<br />

well as a TEST instruction. The TEST instruction sets the flags as a result of a Boolean AND operation<br />

but does not alter either of its operands.<br />

Individual bits in bytes and words can be shifted either arithmetically or logically. Up to 32 shifts<br />

can be performed, according to the value of the count operand coded in the instruction. The count<br />

can be specified as an immediate value or as a variable in the CL register. This allows the shift<br />

count to be a supplied at execution time. Arithmetic shifts can be used to multiply and divide binary<br />

numbers by powers of two. Logical shifts can be used to isolate bits in bytes or words.<br />

2-21

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

Saved successfully!

Ooh no, something went wrong!