文章说,对于溢出只是针对于有符号数,但是对于无符号数,比如8为寄存器,表示的
范围是0~255,如果两个正数相加超过了255,不叫溢出了吗?为什么这里只讨论的是有
符号的数
关于8086CPU标志寄存器溢出的问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- nswcfd 2015-06-15 04:08关注
手头没有8086的文档,模糊记得eflags里面有CF和OF两个标记,你说的“溢出”应该对应CF,即产生了进位。OF对于有符号数。
The status flags (bits 0, 2, 4, 6, 7, and 11) of the EFLAGS register indicate the results of arithmetic instructions,
such as the ADD, SUB, MUL, and DIV instructions. The status flag functions are:
CF (bit 0) Carry flag — Set if an arithmetic operation generates a carry or a borrow out of the mostsignificant
bit of the result; cleared otherwise. This flag indicates an overflow condition for
unsigned-integer arithmetic.
OF (bit 11) Overflow flag — Set if the integer result is too large a positive number or too small a negative
number (excluding the sign-bit) to fit in the destination operand; cleared otherwise. This
flag indicates an overflow condition for signed-integer (two’s complement) arithmetic.解决评论 打赏 举报无用 1