What is the difference between the Q flag and the Overflow flag?

579 Views Asked by At

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 ?

1

There are 1 best solutions below

1
Clifford On

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.