8086 Shift Instructions

8086 Shift Instructions:

The 8086 Shift Instructions are follows

  • SAL/SHL
  • SHR
  • SAR

SAL/SHL Instruction : SAL/SHL destination, count.

SAL and SHL are two mnemonics for the same instruction. This instruction shifts each bit in the specified destination to the left and 0 is stored at LSB position. The MSB is shifted into the carry flag. The destination can be a byte or a word. It can be in a register or in a memory location. The number of shifts are indicated by count. But if the number of shifts required is one, you can place 1 in the count position. If number of shifts are greater than 1 then shift count must be loaded in CL register and CL must be placed in the count position of the instruction.

Diagram shows SAL instruction for byte operation.

8086 Shift Instructions

Flags : All flags are affected.

8086 Shift Instructions

SHR Instruction : SHR destination, count

This 8086 Shift Instructions each bit in the specified destination to the right and 0 is stored at MSB position. The LSB is shifted into the carry flag. The destination can be a byte or a word. It can be in a register or in a memory location. The number of shifts are indicated by count. If number of shifts required is one, you can place 1 in the count position. But if the number of shifts are greater than 1 then shift count must be loaded in CL register and CL must be placed in the count position of the instruction.

Diagram shows SHR instruction for byte operation.

8086 Shift Instructions

Flags : All flag’s are affected.

8086 Shift Instructions

SAR Instruction : SAR destination, count.

This 8086 Shift Instructions each bit in the specified destination some number of bit positions to the right. As a bit is shifted out of the MSB position, a copy of the old MSB is put in the MSB position. The LSB will be shifted into CF. In the case of multiple shifts, CF will contain the bit most recently shifted in from the LSB. Bits shifted into CF previously will be lost.

The destination can be a byte or a word. It can be in a register or in a memory location. The number of shifts are, indicated by count. If number of shifts required is one, you can place 1 in the count position. If number of shifts are greater than 1 then shift count must be loaded in CL register and CL must be placed in the count position of the instruction.

Diagram shows SAR instruction for byte operation.

8086 Shift Instructions

Flags : All flags are affected.

8086 Shift Instructions

MORE RELATED ARTICLE

Leave a Reply

Your email address will not be published. Required fields are marked *

COPYRIGHT © 2014 TO 2018 EEEGUIDE.COM ALL RIGHTS RESERVED | HOME | SITEMAP | CONTACT US | ABOUT US | PRIVACY POLICY | Frontier Theme