ROR 打开溢出标志 [英] ROR turns on the Overflow flag

查看:27
本文介绍了ROR 打开溢出标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在汇编 emu8086 模拟器中有以下几行:

I have the following lines in assembly emu8086 emulator :

 mov al,00100000b  
 ror al,8

al 等于 0000 0001 时,两个标志 Carry &溢出被关闭,但是当 al 等于 1000 0000 时,两个标志被打开.

when al is equal to 0000 0001 the two flags Carry & Overflow are turned off, but when al is equal to 1000 0000 the two flags are turned on.

进位标志没问题——最后一位1在标志中,但为什么这个操作也会打开溢出标志?

Carry flag is ok - the last digit 1 is in the flag , but why this operation turns on the Overflow flag too?

感谢您的帮助!!!

推荐答案

来自 英特尔手册第 2B 卷

OF 标志仅针对 1 位循环定义;在所有其他情况下都是未定义的(除了 RCL 和 RCR 指令仅:零位旋转不执行任何操作,即不影响任何标志).对于左旋转,OF 标志设置为异或CF 位(旋转后)和结果的最高有效位.对于右旋,OF 标志设置为结果的两个最高有效位的异或.

The OF flag is defined only for the 1-bit rotates; it is undefined in all other cases (except RCL and RCR instructions only: a zero-bit rotate does nothing, that is affects no flags). For left rotates, the OF flag is set to the exclusive OR of the CF bit (after the rotate) and the most-significant bit of the result. For right rotates, the OF flag is set to the exclusive OR of the two most-significant bits of the result.

不完全知道为什么 ROR 有这种行为,也许这个特性可以用来计算奇偶校验位.

Don't exactly know why ROR has this behavior maybe this features may be used to compute a parity bit.

这篇关于ROR 打开溢出标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆