The 8085 includes five flip-flops, also called flags, which are set or reset after an operation according to data conditions of the result in the accumulator and other registers. They are called
Zero (Z); carry (CY), Sign(S), Parity (P) and Auxiliary Carry (AC) flags. And the most commonly used flags are Zero, Carry, and Sign. The 8085 uses these flags to test data conditions.
These flags have critical importance in the decision-making process of the 8085 simulator. The conditions (set or reset) of the flags are tested through software instructions. For example, the instruction JC (Jump on Carry) is implemented to change the sequence of a program when the CY flag is set. A good understanding about these five flags is essential in writing assembly language programs. The overall descriptions about these flags are:
1. S-Sign flag: After the execution of an arithmetic or logic operation, if the bit D7 of the result (usually in the accumulator) is 1, the sign flag is set. This flag is used with signed numbers. In a given byte, if D7 is 1, the number will be viewed as a negative number, if it is
0, the number will be considered positive, in arithmetic operations with signed numbers, bit
D7 is reserved for indicating the sign, and the remaining seven bits are used to represent the magnitude of a number. However, for unsigned numbers, even if bit D7 of a result is 1 and the flag is set, it does not mean the result is negative.
2. Z-Zero flag: The zero flag is set if the arithmetic and logical operation results in 0, and the
flag is reset if the result is not 0. This flag is modified by the results in the accumulator as well as in the other registers.
3. AC-Auxiliary Carry flag: In an arithmetic operation, when a carry is generated by digit D3 and passed to digit D4, the AC flag