Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language

Q22 · 9618/12/O/N/22 Q7

Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3.

Q229618/12/O/N/22original Q7Structured · 12 marks
Question 7 from 9618/12/O/N/22

Worked solution

(a)

LDX 110 reads address 110 + IX. CMI 102 compares ACC with the contents of the address held in 102 (that is, address 112, which holds 0). Blank cells mean no change.

Instruction addressACCIX100101102103110111112
001124140
750
761
77
78
79
80
842
852
860
871
881
891
90
764
77
78
79
80
816
826
83
861
872
882
892
90

Rows 75 to 80 (IX = 0, ACC = 1, both compares False, jump to 84) [1]

Rows 84 to 90 (ACC = 2, 101 = 2, ACC = 0, then 1, 100 = 1, IX = 1) [1]

Rows 76 to 80 second time (ACC = 4, CMI is False, CMP 103 is True so no jump) [1]

Rows 81 to 83 (ACC = 6, 101 = 6, jump to 86) [1]

Rows 86 to 90 (ACC = 1, then 2, 100 = 2, IX = 2, stop at 90) [1]

(b)(i)

XOR flips the bits where the operand has 1: 01010011 XOR 00011111.

01001100 [1]

(b)(ii)

Address 50 holds 01001101. 01010011 AND 01001101.

01000001 [1]

(b)(iii)

Shift left 3 places and fill the right with zeros: 01010011 → 10011000.

10011000 [1]

(b)(iv)

Address 51 holds 10001111. 01010011 OR 10001111.

11011111 [1]

(c)

DescriptionRegister transfer notation
Copy the address of the next instruction into the MARMAR ← [PC]
Increment the Program CounterPC ← [PC] + 1
Copy the contents of the MDR into the CIRCIR ← [MDR]

MAR ← [PC] [1]

PC ← [PC] + 1 [1]

CIR ← [MDR] [1]

KEY IDEACMI compares with the contents of the address stored at the given address, and the register transfer notation follows the order MAR, PC, MDR, CIR.
TOTAL 12 marks

Official mark scheme

Mark scheme for 9618/12/O/N/22 question 7
VIDEO
▶ Whole paper

Video solution of the whole paper · by Audere Prep. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.