Status Register (ST0)
2-25Central Processing Unit
Z
Bit 4
Zero flag. Z is set if the result of certain operations is 0 or is cleared if the result is nonzero.
This applies to results that are loaded into ACC, AH, AL, another register, or a data-memory
location. At reset, Z is cleared.
The TEST ACC instruction sets Z if the value in ACC is 0. Otherwise, it clears Z.
Z can be summarized as follows:
0
The tested number is nonzero, or Z has been cleared.
1 The tested number is 0, or Z has been set.
C
Bit 3
Carry bit. This bit indicates when an addition or increment generates a carry or when a sub-
traction, compare, or decrement generates a borrow. It is also affected by rotate operations
on ACC and barrel shifts on ACC, AH, and AL.
During additions/increments, C is set if the addition generates a carry; otherwise C is
cleared. There is one exception: If you are using the ADD instruction with a shift of 16, the
ADD instruction can set C but cannot clear C.
During subtractions/decrements/compares, C is cleared if the subtraction generates a
carry; otherwise C is set. There is one exception: if you are using the SUB instruction with
a shift of 16, the SUB instruction can clear C but cannot set C.
This bit can be individually set and cleared by the SETC C instruction and CLRC C instruc-
tion, respectively. At reset, C is cleared.
C can be summarized as follows:
0
A subtraction generated a borrow, an addition did not generate a carry, or C has
been cleared. Exception: An ADD instruction with a shift of 16 cannot clear C.
1 An addition generated a carry, a subtraction did not generate a borrow, or C has
been set. Exception: A SUB instruction with a shift of 16 cannot set C.
Table 2−8 lists the bits that are affected by the C bit. For more information on
instructions, see Chapter 6.
Table 2−8. Bits Affected by the C Bit
Instruction Affect of or Affect on C
ABS ACC C = 0
ABSTC ACC C = 0
ADD ACC,#16bit << shift C = 1 on carry else C = 0
ADD ACC,loc16 << shift if(shift == 16)
C = 1 on carry
if(shift != 16)
C = 1 on carry else C = 0