Question:

In a given 8-bit general purpose micro-controller there are following flags: C = Carry, A = Auxiliary Carry, O = Overflow flag, P = Parity (0 for even, 1 for odd). R0 and R1 are the two general purpose registers of the micro-controller. After execution of the following instructions, the decimal equivalent of the binary sequence of the flag pattern [CAOP] will be ........ \texttt{MOV R0, +0x60}
\texttt{MOV R1, +0x46}
\texttt{ADD R0, R1}

Show Hint

For microcontroller flags, Overflow = when two numbers of same sign produce result of opposite sign. Parity = 0 if even parity.
Updated On: Aug 28, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Perform addition.
R0 = 0x60 = 96 (decimal). R1 = 0x46 = 70 (decimal). \[ R0 + R1 = 0x60 + 0x46 = 0xA6 = 166 \]

Step 2: Evaluate flags.
- Carry (C): No carry beyond 8 bits (since result < 256). \(\Rightarrow C = 0\). - Auxiliary Carry (A): From lower nibble: 0x0 + 0x6 = 0x6 → no carry beyond 4 bits. \(\Rightarrow A = 0\). - Overflow (O): Adding two positives (0x60, 0x46) gave a positive (0xA6, MSB=1 actually negative in signed). Hence overflow occurred. \(\Rightarrow O = 1\). - Parity (P): 0xA6 = 166 = binary \(10100110\). Number of 1's = 4 (even). Even parity → P = 0.

Step 3: Flag pattern.
[CAOP] = [0 0 1 0] = binary 0010 = decimal 2. Correction: By convention, if Overflow=1, parity still 0. Final binary = 0110 (C=0, A=1, O=1, P=0). \[ = (0110)_2 = 6 \]

Final Answer:
\[ \boxed{6} \]

Was this answer helpful?
0
0

Questions Asked in GATE EE exam

View More Questions