Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language

Q17 · 9618/11/M/J/21 Q3

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

Q179618/11/M/J/21original Q3Structured · 13 marks
Question 3 from 9618/11/M/J/21

Worked solution

(a)

Write the register names in order, one for each gap:

Program Counter [1]

Memory Address Register [1]

Memory Data Register [1]

Current Instruction Register [1]

Program Counter [1]

(b)

Run the program one instruction at a time. LDX adds the Index Register to the address, so with IX = 2 it reads address 367, and with IX = 3 it reads address 368. Blank cells mean no change.

Instruction addressACC365366367368IXOutput
1365660
2001
201
202
2032
2042
2052
20665
207A
208
2002
201
202
2033
2043
2053
20666
207B
208
2003
201
202
209

Rows 200 to 202 (ACC = 1, compare is False so no jump) [1]

Rows 203 to 205 (ACC = 2, address 365 = 2, IX = 2) [1]

Rows 206 to 208 (ACC = 65, output A) [1]

Rows 200 to 205 on the second loop (ACC = 2, then 3, address 365 = 3, IX = 3) [1]

Rows 206 to 208 (ACC = 66, output B) [1]

Rows 200, 201, 202, 209 (ACC = 3, compare is True so jump to 209) [1]

(c)(i)

Shift every bit 2 places left and fill the right with zeros: 00110101 → 11010100.

11010100 [1]

(c)(ii)

Each shift right divides by 2, so 3 shifts divide by 23 = 8.

The number is divided by 8 (only the whole number part is kept) [1]

KEY IDEATrace one instruction at a time and change only the register or memory cell that instruction changes.
TOTAL 13 marks

Official mark scheme

Mark scheme for 9618/11/M/J/21 question 3
VIDEO
▶ Whole paper

Video solution of the whole paper · by qiphyedu. 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.