First page Back Continue Last page Overview Graphics
Condition Code Register
C - Carry/borrow. Set with a carry from an addition or borrow from a subtraction.
V - Overflow. Set if a 2’s complement overflow condition is generated.
Z - Zero. Set if result is zero.
N - Negative. Set if the result is negative.
H - Half-carry. Carry out of bit 3.
The zero flag is used extensively in loop counting and bit checking code. In a loop count routine, a register or variable can be set to an initial value and decremented every time the code goes through the loop. The zero flag can be checked with every pass through the loop and an appropriate branch instruction can exit the loop when the looping is complete.
The negative flag is set to a one whenever the sign bit of a number is 1. Half-carry is typically used with BCD arithmetic and will not be addressed in this course.