Search code examples
assemblymemory-addresscpu-registersinstruction-setlc3

How do I identify the instruction stored LC-3


I know this is not a programming question but I am struggling to understand how to get the solution to this problem. I'm not sure how this is figured out and I can't find a explained solution. enter image description here


Solution

  • The only change in the table is at address x3406. That tells us it was a store instruction as no other is capable of writing into memory.

    The available store instructions are ST, STI and STR. ST uses a 9 bit signed offset from PC which is given as x3010 in the question and is therefore out of range. STI could work but we are not provided with a memory location usable for the indirect address. That leaves STR for which the encoding allows for a 6 bit offset so to make the address x3406 we need a base from x33E6 to x3427 which leaves only a single possibility: R4 for which the offset is 6.

    The new value is xe373 which must have come from R2 since again that's the only option.