Saturday, June 29, 2013

What is flag? Explain different type of flag.



A flag in context to microprocessor is a one bit flip-flop that either store 0 or 1 indicating some logical result during arithmetical or logical calculation of data. The flag help to interpret the correct precision of the result despite of the storage limitation in the microprocessor.
The different types of flag (in 8085) are as follows:
·         S-flag(sign flag): The sign flag is set to 1 when the bit D7 of the result is 1, otherwise reset(0).
·         Z-flag(Zero flag): The zero flag is set to 1 when the result after calculation is zero, otherwise reset(0).
·         cy-flag(carry flag): The carry flag is set to 1 if the result generates an end carry, otherwise reset(0).
·         P-flag(parity flag): The parity flag is se to 1 is there are even number of 1 in the result, otherwise reset(0).
·         Ay flag(auxillary carry): The auxiliary carry flag is set to 1 if the bit D3 generates carry to D4, otherwise reset(0). This flag is frequently used in BCD calculation.  
                     D7    D6     D5     D4      D3     D2    D1     D0             
S
Z

Ay

P

Cy

No comments:

Post a Comment