Exercise 2: Tracing LDI's Two-Step Indirect Lookup — Possible Solution ==================================================================== GIVEN ------------------------------ Instruction: LDI R1, PTR PTR is stored at address x3050, and contains the value x4000 Memory address x4000 contains the value #99 THE TWO-STEP TRACE ------------------------------ Per the chapter's own Indirect formula: pointer address = PC + SEXT(offset9) effective address = mem[pointer address] Step 1 -- Compute the pointer address: The assembler already worked out, at assemble time, that the label PTR corresponds to address x3050. So the CPU's PC-relative computation (PC + offset9) resolves to x3050 -- this is the "pointer address," i.e. where to find the REAL address, not the data itself. Step 2 -- Follow that pointer to get the effective address: The CPU reads the value stored AT address x3050. That value is x4000. So the effective address -- where the actual data lives -- is x4000. Step 3 -- Read the data at the effective address: Memory address x4000 contains #99. That's the value that actually gets loaded. FINAL RESULT ------------------------------ R1 ends up holding #99. WHY THIS WORKS AS AN ANSWER ------------------------------ It follows the chapter's own two-line Indirect formula exactly, distinguishing clearly between the "pointer address" (x3050, where the pointer itself lives) and the "effective address" (x4000, where the real data lives) rather than conflating the two, and arrives at the correct final value (#99) rather than stopping at the pointer.