9618/12/O/N/23 question 9: worked solution (October/November 2023, 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. Q26 9618/12/O/N/23 original Q9 Structured · 8 marks Worked solution (a) Name the group each opcode belongs to: IN: input and output of data [1] ADD: arithmetic operations [1] JPE: unconditional and conditional instructions [1] CMI: compare instructions [1] (b) The input '1' has ASCII value 49. Trace line by line, writing a value only when it changes. The first pass fails the compare (51 against 0). The loop then stores 65 in 100, so the second pass finds 65 equal and jumps to OUT. Instruction address ACC IX 100 101 110 111 Output 0 0 51 65 10 0 11 49 12 49 13 51 14 15 16 49 17 65 18 1 19 65 20 13 65 14 15 21 A 22 Rows 10 to 12 correct [1] Rows 13 to 16 correct [1] Rows 17 to 20 correct [1] Second pass rows 13, 14, 15, 21 and 22 correct, with output A [1] KEY IDEA In a trace, follow the jump back into the loop and stop when the compare is true. TOTAL 8 marks Official mark scheme VIDEO ▶ Starts at Q9 (1:39:53) Starts at Q9 (1:39:53) · by Pseudocode Pro. Tap the picture to open it on YouTube.