12.07.2015 Views

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

80C186EB/80C188EB Microprocessor User's Manual - CEUNES

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.

INSTRUCTION SET DESCRIPTIONSTable C-4. Instruction Set (Continued)Name Description OperationSHLSALSARNOTE:Shift Logical Left:Shift Arithmetic Left:SHL dest, countSAL dest, countShifts the destination byte or word leftby the number of bits specified in thecount operand. Zeros are shifted in onthe right. If the sign bit retains itsoriginal value, then OF is cleared.Instruction Operands:SHL reg, n SAL reg, nSHL mem, n SAL mem, nSHL reg, CL SAL reg, CLSHL mem, CL SAL mem, CLShift Arithmetic Right:SAR dest, countShifts the bits in the destinationoperand (byte or word) to the right bythe number of bits specified in thecount operand. Bits equal to theoriginal high-order (sign) bit are shiftedin on the left, preserving the sign of theoriginal value. Note that SAR does notproduce the same result as thedividend of an "equivalent" IDIVinstruction if the destination operand isnegative and 1 bits are shifted out. Forexample, shifting –5 right by one bityields –3, while integer division –5 by 2yields –2. The difference in the instructionsis that IDIV truncates all numberstoward zero, while SAR truncatespositive numbers toward zero andnegative numbers toward negativeinfinity.Instruction Operands:SAR reg, nSAR mem, nSAR reg, CLSAR mem, CL(temp) ← countdo while (temp) ≠ 0(CF) ← high-order bit of (dest)(dest) ← (dest) × 2(temp) ← (temp) – 1ifcount = 1thenifhigh-order bit of (dest) ≠ (CE)then(OF) ← 1else(OF) ← 0else(OF) undefined(temp) ← countdo while (temp) ≠ 0(CF) ← low-order bit of (dest)(dest) ← (dest) / 2(temp) ← (temp) – 1ifcount = 1thenifhigh-order bit of (dest) ≠next-to-high-order bit of (dest)then(OF) ← 1else(OF) ← 0else(OF) ← 0The three symbols used in the Flags Affected column are defined as follows:– the contents of the flag remain unchanged after the instruction is executed? the contents of the flag is undefined after the instruction is executedüthe flag is updated after the instruction is executedFlagsAffectedAF ?CF üDF –IF –OF üPF üSF üTF –ZF üAF ?CF üDF –IF –OF üPF üSF üTF –ZF üC-40

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

Saved successfully!

Ooh no, something went wrong!