Question:hard

What is the state of carry, auxiliary carry and parity flags after execution of following instructions: MOV A, #3F
ADD A, #BE

Show Hint

Parity = 1 for even number of 1s, else 0.
Updated On: Jul 2, 2026
  • CY=0, AC=0, P=0
  • CY=1, AC=1, P=0
  • CY=0, AC=1, P=0
  • CY=1, AC=1, P=1
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Set up the addition in binary.
Write out both operands as 8-bit binary numbers, $3F_H = 0011\,1111$ and $BE_H = 1011\,1110$. Adding a byte to a byte can produce carries at the nibble boundary and at the very top bit, and it is exactly these two carries that set the AC and CY flags.
Step 2: Track the carry out of the lower nibble.
Adding the lower four bits, $1111 + 1110$, produces a carry that ripples into the upper nibble. Since this carry crosses from bit 3 into bit 4, the Auxiliary Carry flag is set, giving $AC = 1$.
Step 3: Track the carry out of the whole byte.
Continuing the addition through the upper nibble with that carry included, the running carry keeps propagating all the way out past bit 7, so the Carry flag is also set, giving $CY = 1$.
Step 4: Check the parity of the result.
The resulting byte contains an odd number of 1 bits, and the 8051 parity flag is only set for an even count, so $P = 0$.
\[ \boxed{CY=1,\ AC=1,\ P=0} \]
Was this answer helpful?
0