-1

What happens to the parity flag of an Intel 8085 microprocessor when there is no '1' bit in the accumulator?

For example, if the following instruction executes,

MVI A, 05H

MVI B, 05H

SUB B

the result will be A= 00H, in which there is no '1' bit. In this case what will be the state of the parity flag?

Durgesh
  • 3
  • 4

1 Answers1

3

The documentation for the 8085 says that after any arithmetic operation, for instance your SUB B, the parity flag is set if there are an even number of '1' bits in the accumulator.

Perhaps you're not sure whether zero, the number of '1' bits in the 00H result, is odd or even.

Zero is even. Odd numbers leave a remainder of 1 when divided by 2. Even numbers divide by 2 exactly.

As 0 is even, the parity flag will be set.

Neil_UK
  • 158,152
  • 3
  • 173
  • 387