微原循环移位指令
As we know that any machine (system) works on machine language, which consists of binary numbers. In the 8086 microprocessor, we have 16-bit registers to handle our data. Sometimes, the need to perform some necessary shift and rotate operations on our data may occur according to the given condition and requirement. So, for that purpose, we have various Shift and Rotate instructions present in the 8086 microprocessor. Let us discuss them one by one and understand their working:
众所周知,任何机器(系统)都可以使用机器语言,该机器语言由二进制数组成。 在8086微处理器中,我们有16位寄存器来处理数据。 有时,根据给定的条件和要求,可能需要对我们的数据执行一些必要的平移和旋转操作 。 因此,为此目的,我们在8086微处理器中提供了各种Shift和Rotate指令。 让我们一一讨论他们并了解他们的工作:
SHR : Shift Right
SHR:右移
SAR : Shift Arithmetic Right
SAR:右移算术运算
SHL : Shift Left
SHL:左移
SAL : Shift Arithmetic Left
SAL:左移算术
ROL : Rotate Left
ROL:向左旋转
ROR : Rotate Right
ROR:向右旋转
RCL : Rotate Carry Left
RCL:向左旋转
RCR : Rotate Carry Right
RCR:向右旋转
1)SHR:右移 (1) SHR : Shift Right)
The SHR instruction is an abbreviation for ‘Shift Right’. This instruction simply shifts the mentioned bits in the register to the right side one by one by inserting the same number (bits that are being shifted) of zeroes from the left end. The rightmost bit that is being shifted is stored in the Carry Flag (CF).
SHR指令是“ Shift Right”的缩写。 通过从左端插入相同数量的零(正在移位的位),该指令将寄存器中提到的位简单地一一移位到右侧。 被移位的最右边的位存储在进位标志(CF)中。
Syntax: SHR Register, Bits to be shifted
Example: SHR AX, 2
Working:
加工:
2)SAR:右移算术 (2) SAR : Shift Arithmetic Right)
The SAR instruction stands for ‘Shift Arithmetic Right’. This instruction shifts the mentioned bits in the register to the right side one by one, but instead of inserting the zeroes from the left end, the MSB is restored. The rightmost bit that is being shifted is stored in the Carry Flag (CF).
SAR指令代表“移位算术右移”。 该指令将寄存器中提到的位一一移位到右侧,但是恢复了MSB,而不是从左端插入零。 被移位的最右边的位存储在进位标志(CF)中。
Syntax: SAR Register, Bits to be shifted
Example: SAR BX, 5
Working:
加工:
3)SHL:左移 (3) SHL : Shift Left)
The SHL instruction is an abbreviation for ‘Shift Left’. This instruction simply shifts the mentioned bits in the register to the left side one by one by inserting the same number (bits that are being shifted) of zeroes from the right end. The leftmost bit that is being shifted is stored in the Carry Flag (CF).
SHL指令是“向左移动”的缩写。 通过从右端插入相同的零数(正在移位的位),该指令将寄存器中提到的位简单地一一移至左侧。 被移位的最左位存储在进位标志(CF)中。
Syntax: SHL Register, Bits to be shifted
Example: SHL AX, 2
Working:
加工:
4)SAL:左移算术 (4) SAL : Shift Arithmetic Left)
The SAL instruction is an abbreviation for ‘Shift Arithmetic Left’. This instruction is the same as SHL.
SAL指令是“左移算术”的缩写。 该指令与SHL相同。
Syntax: SAL Register, Bits to be shifted
Example: SAL CL, 2
Working:
加工:
5)ROL:向左旋转 (5) ROL : Rotate Left)
The ROL instruction is an abbreviation for ‘Rotate Left’. This instruction rotates the mentioned bits in the register to the left side one by one such that leftmost bit that is being rotated is again stored as the rightmost bit in the register, and it is also stored in the Carry Flag (CF).
ROL指令是“向左旋转”的缩写。 该指令将寄存器中提到的位一一旋转到左侧,以便将被旋转的最左边的位再次存储为寄存器中的最右边的位,并且还将其存储在进位标志(CF)中。
Syntax: ROL Register, Bits to be shifted
Example: ROL AH, 4
Working:
加工:
6)ROR:向右旋转 (6) ROR : Rotate Right)
The ROR instruction stands for ‘Rotate Right’. This instruction rotates the mentioned bits in the register to the right side one by one such that rightmost bit that is being rotated is again stored as the MSB in the register, and it is also stored in the Carry Flag (CF).
ROR指令代表“右旋转”。 该指令将寄存器中提到的位一一旋转到右侧,以使被旋转的最右边的位再次作为MSB存储在寄存器中,并且也存储在进位标志(CF)中。
Syntax: ROR Register, Bits to be shifted
Example: ROR AH, 4
Working:
加工:
7)RCL:向左旋转 (7) RCL : Rotate Carry Left)
This instruction rotates the mentioned bits in the register to the left side one by one such that leftmost bit that is being rotated it is stored in the Carry Flag (CF), and the bit in the CF moved as the LSB in the register.
该指令将寄存器中提到的位一一旋转到左侧,以使正在旋转的最左边的位存储在进位标志(CF)中,并且CF中的位作为寄存器中的LSB移动。
Syntax: RCL Register, Bits to be shifted
Example: RCL CH, 1
Working:
加工:
8)RCR:向右旋转 (8) RCR : Rotate Carry Right)
This instruction rotates the mentioned bits in the register to the right side such that rightmost bit that is being rotated it is stored in the Carry Flag (CF), and the bit in the CF moved as the MSB in the register.
该指令将寄存器中提到的位旋转到右侧,以使正在旋转的最右边的位存储在进位标志(CF)中,并且CF中的位作为MSB在寄存器中移动。
Syntax: RCR Register, Bits to be shifted
Example: RCR BH, 6
Working:
加工:
微原循环移位指令