注册,携带,溢出标志(议会) [英] Sign, Carry, and Overflow Flag (Assembly)

查看:132
本文介绍了注册,携带,溢出标志(议会)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.data
val1 BYTE 10h
val2 WORD 8000h
val3 DWORD 0FFFFh
val4 WORD 7FFFh

如果将val2 1使用ADD指令增加,会是怎样的进位值
和注册的标志吗?

If val2 is incremented by 1 using the ADD instruction, what will be the values of the Carry and Sign flags?

如果VAL4由1使用ADD指令增加,这将是超额的价值
流量和注册标志?

If val4 is incremented by 1 using the ADD instruction, what will be the values of the Over- flow and Sign flags?

我回答都和让他们都错了。为什么的答案是什么?

I answered both and got them both wrong. Why is the answer what it is?

推荐答案

把它想象成一种模拟时钟。在实际的时钟时代六55(55)和五到七年(-5)是相同的。这只是你的定义的问题,时钟本身并不知道自己的定义和运行一圈又一圈又一圈......与CPU相同。请看下面的CPU时钟:

Imagine it as a kind of analog clock. In a real clock the times "six fifty-five" (55) and "five to seven" (-5) are identical. It's just an issue of your definition, the clock itself doesn't know your definition and runs round and round and round... The same with the CPU. Look at the following "CPU-clock":

我选择的4位时钟,但原理是每个其它组比特(字节,字,双字等)。同样的

I've chosen a 4-bit-clock, but the principle is the same for every other group of bits (BYTE, WORD, DWORD etc.).

后,时钟从15跃升至0。正是在这种情况下,未签名的溢出位标志将被设定。

The carry flag will be set after the clock has jumped from 15 to 0. It is in this case a flag for unsigned overflow.

后,时钟已经从7至-8跳溢​​出标志将被设置。它标志一个符号溢出。

The overflow flag will be set after the clock has jumped from 7 to -8. It flags a signed overflow.

符号标志标志可以是PTED为负数间$ P $的值。

The sign flag flags a value which can be interpreted as a negative number.

标志的行为是有点不同,如果算上向下:

The behavior of the flags is a little bit different, if you count downwards:

这篇关于注册,携带,溢出标志(议会)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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