Exercise 1: Identifying Abstraction Levels — Possible Solution ==================================================================== The three lines: x = a + b -> high-level language (e.g. Python/C) ADD R1, R0, R2 -> assembly language 0001 001 000 0 00 010 -> machine code WHY EACH ONE BELONGS WHERE IT DOES ------------------------------ 1. "0001 001 000 0 00 010" IS the machine code -- it's the literal bit pattern an LC-3 CPU fetches from memory and decodes. There's nothing underneath it; it's the floor of the ladder. 2. "ADD R1, R0, R2" is assembly. It has a near-1:1 relationship with the machine code line above: the opcode bits (0001) mean ADD, the destination register field picks R1, the two source-register fields pick R0 and R2. One assembly instruction produced exactly one machine instruction, with no hidden extra work. 3. "x = a + b" is high-level. It doesn't say *how* the addition happens -- which registers get used, whether a and b even live in registers or memory, how the result gets stored back into x. A compiler has to make all of those decisions, which is exactly why one line of a high-level language can expand into several machine instructions rather than exactly one. WHY THE RELATIONSHIP IS "MUCH CLOSER" FOR ASSEMBLY ------------------------------ Assembly's whole purpose (per the chapter's own "Ladder of Abstraction" section) is to stay almost perfectly predictable against machine code -- each mnemonic maps to one instruction, each operand maps to one field in that instruction's encoding. A high-level language deliberately breaks that predictability on purpose, because hiding those decisions from the programmer is what makes the language convenient to write in. That's the actual trade-off: assembly gives up convenience in exchange for a transparent, predictable view of what the CPU is doing; a high-level language does the reverse. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly places all three lines using the chapter's own table, then explains the *mechanism* behind the difference (a fixed 1:1 mapping for assembly vs. a compiler making unseen decisions for high-level code) rather than just restating that assembly is "more detailed."