9618/12/O/N/21 question 8: worked solution (October/November 2021, paper 12)

Show as plain text

Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3. Q19 9618/12/O/N/21 original Q8 Structured · 15 marks Worked solution (a)(i) MAR and MDR each score up to 2. MAR stores the address of the next instruction to be fetched [1] This address is copied from the Program Counter , and the data at it is then fetched [1] MDR stores the data fetched from the address in MAR [1] The data is then copied to the Current Instruction Register [1] (a)(ii) Any one of: Program Counter (PC) , Current Instruction Register (CIR) , Status Register , Interrupt register [1] (b)(i) Do each operation bit by bit. Address 101 = 11110000, 104 = 11111111, 102 = 00001111. Current contents of the ACC Instruction New contents of the ACC 01010101 XOR 101 10100101 11110000 AND 104 11110000 00001111 LSL #4 11110000 11111111 OR 102 11111111 XOR 101: 10100101 [1] AND 104: 11110000 [1] LSL #4: 11110000 [1] OR 102: 11111111 [1] (b)(ii) Choose one instruction from the table for each group: Instruction Group Instruction Data movement LDM #2 Input and output of data IN Arithmetic operations INC ACC Unconditional and conditional instructions JMP 100 Compare instructions CMP 100 Input and output: IN (or OUT) [1] Arithmetic: INC ACC (or INC IX) [1] Unconditional and conditional: JMP or JPN with an address [1] Compare: CMP with an address [1] (b)(iii) Any one of these modes: Mode name: Indirect addressing [1] Description: the address to be used is at the given address (the contents of that address is the address of the data) [1] Other accepted answers: relative addressing (address is an offset from the current instruction), or indexed addressing (given address plus the Index Register), each with its matching description. KEY IDEA MAR holds the address, MDR holds the data, and each bitwise instruction works on the ACC one bit at a time. TOTAL 15 marks Official mark scheme VIDEO ▶ Starts at Q8 (36:19) Starts at Q8 (36:19) · by HyperDavester. Tap the picture to open it on YouTube.