我看到了下一个代码:
shr AL, 1
jnc bit_0
由于shr指令,我不知道何时打开进位标志吗?谢谢
最佳答案
shr AL, 1
将AL
中的所有位右移一位。
原始的最右边的位从AL
寄存器移出到进位标志(新的最左边的位设置为0)。例如:
+------------------------+ +------------------------+
| 1 0 0 1 0 1 0 1 | | 0 1 1 0 0 1 0 0 |
+------------------------+ +------------------------+
\ \ \ \ \ \ \ \ or \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
+------------------------+ CF +------------------------+ CF
|(0) 1 0 0 1 0 1 0 | 1 |(0) 0 1 1 0 0 1 0 | 0
+------------------------+ +------------------------+
在您对另一个答案的评论中:
My book gives the next example: Before shift: AL = 10101110 ; shr AL, 1 ; After shift: 01011100, CF = 1 ; Is it mistake?
如果那是它的意思,那么是的。那是左移(
shl AL, 1
),而不是右移:AL
中的位都已向左移动一位,并且进位标志已设置为从左端移出的位。
关于assembly - 汇编-shr指令打开进位标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9824030/