Q flag also known as saturation flag sets when the results causes an overflow or saturation. Similarly, the overflow flag also sets when the results causes an overflow. What is the major difference between these two flags ?
Asked
Active
Viewed 451 times
-1
-
3Sounds like something that reading the core manual would answer quite early on. – Lundin Dec 08 '20 at 10:57
1 Answers
1
The Q flag is "sticky" it is not cleared my subsequent operations. It can there fore be used to determine whether saturation or overflow occurred at any point since it was last explicitly cleared.
The C (overflow or carry/borrow) flag is set or cleared as the result of a single arithmetic instruction, so must be tested immediately after the instruction that might set it. The C flag can be tested in conditional instructions and can be used to extend arithmetic allowing for example 64bit operations from 32 bit instructions.

Clifford
- 88,407
- 13
- 85
- 165
-
1An additional benefit is that only some operation affect the 'Q' flag. Ie, the instructions which set the 'Q` flag are a subset of those setting the 'C' flag. – artless noise Dec 10 '20 at 13:05