Hardware manual
Microcomputer Technical Q&A
2
Q&A No.: QAH8S-002
Category: CPU
Subject: Difference between V Flag and C Flag in CCR
Question
The V flag and C flag in CCR are both set if overflow occurs during an operation. What is the
difference between these flags?
Answer
The V flag in CCR is used to identify whether overflow occurs in a signed operation. To take the
example of a byte-size operation, this flag is set to 1 if the operation result is smaller than the
negative minimum value (H'80) larger than the positive maximum value (H'7F).
V flag
H'80
H'7FH'00
Overflow Overflow
The C flag, on the other hand, is used to identify whether overflow occurs in an unsigned
operation. To take the example of a byte-size operation, this flag is set to 1 if the operation result
is larger than the maximum value (H'FF) or smaller than the minimum value (H'00).
C flag
H'00
H'FF
Overflow Overflow