微原循环移位指令_8086微处理器中的移位和旋转指令

本文介绍了8086微处理器中的移位和旋转指令,包括SHR、SAR、SHL、SAL、ROL、ROR、RCL和RCR。这些指令用于在寄存器中进行位操作,如右移、左移、算术移位和旋转,并涉及进位标志CF的变化。
摘要由CSDN通过智能技术生成

微原循环移位指令

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指令。 让我们一一讨论他们并了解他们的工作:

  1. SHR : Shift Right

    SHR:右移

  2. SAR : Shift Arithmetic Right

    SAR:右移算术运算

  3. SHL : Shift Left

    SHL:左移

  4. SAL : Shift Arithmetic Left

    SAL:左移算术

  5. ROL : Rotate Left

    ROL:向左旋转

  6. ROR : Rotate Right

    ROR:向右旋转

  7. RCL : Rotate Carry Left

    RCL:向左旋转

  8. 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:

加工:

shift and rotate instructions 1

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:

加工:

shift and rotate instructions 2

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:

加工:

shift and rotate instructions 3

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:

加工:

shift and rotate instructions 4

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:

加工:

shift and rotate instructions 5

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:

加工:

shift and rotate instructions 6

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:

加工:

shift and rotate instructions 7

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:

加工:

shift and rotate instructions 8

翻译自: https://www.includehelp.com/embedded-system/shift-and-rotate-instructions-in-8086-microprocessor.aspx

微原循环移位指令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值