Exercise 3: Explaining Three Chapter-Attribution Rows — Possible Solution ==================================================================== ROW 1: "[RDI + RCX*8] — full SIB addressing" -> assembly2-4 ------------------------------ Inside sum_array's own loop, ADD RAX, [RDI + RCX*8] reads each array element directly using the richest addressing mode assembly2-4 covered — Base (RDI, the array's starting address) plus Index (RCX, the loop counter) times Scale (8, matching each element's 8-byte qword width). This single instruction reads the correct array element on every pass without ever needing a separate multiply step to convert the index into a byte offset — exactly the capability assembly2-4 identified as genuinely new compared to the 6502's and Z80's own addressing modes. ROW 2: "PUSH RBP / MOV RBP, RSP / POP RBP" -> assembly2-5 ------------------------------ sum_array establishes a real stack frame on entry and tears it down before returning — the exact RBP-as-frame-pointer convention assembly2-5 introduced. Even though this particular function is simple enough not to strictly need a frame pointer for its own local variables, using it here demonstrates the real, standard pattern real x86-64 functions follow, tying directly back to assembly2-5's own explanation of why RBP exists at all. ROW 3: "SYSCALL, syscall numbers in RAX, arguments in RDI/RSI/RDX" -> assembly2-10 ------------------------------ The program's own output and exit are both produced via real Linux syscalls (write, then exit) — the syscall number goes in RAX, and the arguments go in RDI/RSI/RDX exactly as assembly2-10 specified. This is the real, modern, OS-specific replacement for assembly1-8's own unified LC-3 TRAP mechanism, and this capstone is the first time in either course this specific mechanism is actually used to produce real, visible output from a running program. WHY THIS WORKS AS AN ANSWER ------------------------------ It picks three specific rows, names the exact line(s) of capstone code each one refers to, and explains — using each earlier chapter's own stated material — precisely why that code needed that chapter's concept, rather than restating the table's own wording without connecting it back to the actual program.