A flag is a flip flop. It indicates some condition produced by the execution of an instruction. The flag register of 8085 microprocessor consists of 5 flags. The flag register is connected to ALU. When an operation is performed by ALU the result is transferred on data bus and status of result will be stored in flip flops. The different flags and their positions in flag register are shown in following fig.
1) The carry flag(CF):-
This flag is set whenever there has been a carry out of, or a borrow into, the higher order bit of the result. The flag is used by the instructions that add amd subtract multibyte numbers.
1-carry out from MSB bit on addition or borrow into MSB bit on subtraction
0-no carry out or borrow into MSB bit
2) The parity flag(PF):-
This flag is set whenever the result has even parity, an even number of 1 bits. If parity is odd, PF is cleared.
1-low byte has even number of 1 bits
0-low byte has odd parity
3) The auxiliary carry flag(AF):-
This flag is set whenever there has been a carry out of the lower nibble into the higher nibble or a borrow from higher nibble into the lower nibble of an 8 bit quantity, else AF is reset. This flag is used by decimal arithmetic instructions.
1-carry out from bit 3 on addition or borrow into bit 3 on subtraction
4) The zero flag(ZF):-
This flag is set, when the result of operation is zero, else it is reset.
5) The sign flag(SF):-
This flag is set, when MSB (Most Significant Bit) of the result is 1. Since negative binary numbers are represented in the 8085 CPU in standard two’s complement notation, SF indicates sign of the result.
1-MSB is 1 (negative)
0-MSB is 0 (positive)