Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SAL/SAR/SHL/SHR
◄SHL op.► ◄SHR op.► ◄Summary► ◄Detail► ◄Example► ◄Key to Flags►
──────────────────────────────────────────────────────────────────────────────
Shift Flags: O D I T S Z A P C
═════════════════
Syntax: SHL dest,1 ± ± ± ? ± ±
SHL dest,CL
SHL dest,number (80186/286/386 Only)
Shifts the bits in the destination operand the number of times specified
by the source operand. SAL and SHL shift the bits left; SAR and SHR
shift right.
With SHL, SAL, and SHR, the bit shifted off the end of the
operand is copied into the carry flag and the leftmost or rightmost bit
opened by the shift is set to 0. With SAR, the bit shifted off the
end of the operand is copied into the carry flag and the leftmost bit
opened by the shift retains its previous value (thus preserving the sign
of the operand). SAL and SHL are synonyms; they have the same
effect.
On the 8088 and 8086, the source operand can be either CL or 1. On the
80186-80386 processors, the source operand can be CL or an 8-bit con-
stant. On the 80186-80386 processors, shift counts larger than 31 are
masked off, but on the 8088 and 8086, larger shift counts are performed
despite the inefficiency involved. The overflow flag is only modified by
single-bit variations of the instruction; for multiple-bit variations it
is undefined.
-♦-