简体   繁体   中英

Not understanding CPU Flags well

Am having a problem understanding the indication of C and V Flags in the CPU Flags register.

For a C-Flag, its set when we genrate a carry or a borrow on the MSB. I think i understnad how its generated. However, am having a problem knowing what it indicates for the result of any arithmetic calculation.

My Tutor says that if C = 1, then the result of the addition or subtraction is wrong if we are dealing with an unsigned number.

I still dont undestand which is the unsigned number. Is it one of the two numbers that are being added or subtracted? what if one of them is negative and we generate C = 1, which is the number being referenced? Or is it the result?

I dont understnad why a V-Flag is generated in this case

90 - 55
  0101 1010  
- 1100 1001 (two's complement of 55) 
-------------------
  1001 0001 (-111)
N = 1, Z = 0, C = 1, V = 1

好吧,这将永远取决于程序员,这意味着汇编代码中的程序将根据任何二进制操作发出的标志来决定何时提供正确答案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM