Flags in 8085 microprocessor

These are resisters containing 5 flip flops, the flip flop is set or reset by the flag according to the conditions that may arise during arithmetic or logical operation. The flags list for the 8085 microprocessor is as follows :

  1. Sign flag
  2. Zero flag
  3. Auxiliary flag
  4. Carry flag
  5. Parity flag

Flags in 8085 microprocessor

 

1 to 7 = Bit number

X = Undefine bits 

C = Carry status

P = Parity status

AC = Auxiliary carry status

Z = Zero status

S = Sign status

For article 8085 pin diagram , click here.

Sign flag in 8085 – (S)

The sign flag 1 will be set when the result of an arithmetic operation is negative and the sign flag is reset to 0 if the result of the arithmetic operation is positive.

If the number is negative then the sign bit will be 1, and for positive numbers the sign bit will be 0. 1010 , here in ‘1010’ 1 is most significant bit (MSB), 0 is least significant bit  (LSB) and 01 is magnitude bit.

So ‘MSB’ is use as the sign bit, it represents the sign of the number.

Z flag in 8085 or Zero flag 

If the result of a particular arithmetic operation is zero then zero flag will be set. If the result of the operation is 1,2 and 3 then it will reset.

AC flag in 8085 or auxiliary carry flag

Will set the auxiliary carry flag only if there is a carry from the 3rd bit to 4th bit.

Carry flag in 8085 – (CY)

If a carry is produce after the execution of an arithmetic instruction then we will set the carry flag to 1, otherwise we will set it to 0.

In carry flag we set or reset the carry flag for addition and subtraction. If the sum is larger than 8 bits a carry is produce and the carry flag set to 1.

In case of subtraction if borrow occurs we will set the carry flag to 1.

Parity flag in 8085 – (P)

This flag is set when the result has an even number of 1 and it is reset when the result has an odd number of 1.

PSW in microprocessor : 

Five bits this indicates five status flags and there are bits undefined. the combination of these 8 bits is know as program status word (PSW) .

PSW and accumulator are treat as 16-bits units for stack operation. 

Need more information about Intel 8255 programmable peripheral interface.

So this was about the flag of 8085 microprocessor,5 flip flops which acts as status flags of the microprocessor. In this post we also read what happens when 0 is there and what happens if it is 1. I have explained it in a very short way, which will be easier to understand and remember. Thank you

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.