GATE Computer ScienceModerateGATE CS (PYQ pattern)

An x86-like addressing mode computes EA = base + index × scale + displacement, where the displacement is an 8-bit field that is sign-extended to 32 bits. With base = 0x1000, index = 0x20, scale = 4 and displacement field 0xFC, what is the effective address?

  1. A. 0x107C
  2. B. 0x117C
  3. C. 0x101C
  4. D. 0x111C

Correct answer: A. 0x107C

0xFC as a signed byte is −4. EA = 0x1000 + 0x20 × 4 − 4 = 0x1000 + 0x80 − 4 = 0x107C. Zero-extending the displacement gives 0x117C; forgetting the scale gives 0x101C; both slips together give 0x111C.

More Computer Organization and Architecture questions

Exams that ask this topic