GATE Computer ScienceVery hardGATE CS (PYQ pattern)

An 8-bit CPU adds the 16-bit two's-complement numbers 0x7F9C and 0x00A7 with ADD on the low bytes followed by ADC (add with carry) on the high bytes. The flags after ADC are set from the high-byte operation alone (N = sign, Z = zero, C = carry out, V = signed overflow). What is the 16-bit result, and what are the flags after ADC?

  1. A. 0x8043; N=1 Z=0 C=0 V=1
  2. B. 0x7F43; N=0 Z=0 C=1 V=0
  3. C. 0x8043; N=1 Z=0 C=1 V=0
  4. D. 0x8043; N=1 Z=0 C=0 V=0

Correct answer: A. 0x8043; N=1 Z=0 C=0 V=1

Low: 0x9C + 0xA7 = 0x143 → 0x43 with carry 1. High: 0x7F + 0x00 + 1 = 0x80, no carry out (C = 0), result negative (N = 1), and two non-negative operands gave a negative result, so V = 1: the 16-bit signed sum 32668 + 167 = 32835 overflows. Dropping the carry gives 0x7F43.

More Computer Organization and Architecture questions

Exams that ask this topic