Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language

Q29 · 9618/13/M/J/24 Q3

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

Q299618/13/M/J/24original Q3Structured · 7 marks
Question 3 from 9618/13/M/J/24

Worked solution

(a)

Work through each program (ACC starts at 2, IX = 50).

ProgramWorkingACC content
1LDM #50; INC ACC gives 51; SUB #1 gives 5050
2LDI 51: address 51 holds 50, address 50 holds 48; ADD 52 (49) gives 9797
3LDR #2 sets IX = 2; LDX 50: address 52 holds 49; DEC ACC gives 4848
4LDD 52 loads 49; SUB 54 (6) gives 43; INC ACC gives 4444

Program 1 = 50 [1]

Program 2 = 97 [1]

Program 3 = 48 [1]

Program 4 = 44 [1]

(b)

ACC starts as 11111111 each time.

InstructionWorkingACC content
1LSL #2: shift left 2 places, 0s on the right11111100
2XOR 100 (00001101)11110010
3AND 103 (00110111)00110111

Instruction 1 = 11111100 [1]

Instruction 2 = 11110010 [1]

Instruction 3 = 00110111 [1]

KEY IDEAResolve each addressing mode to a value, then apply the operation one step at a time.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/13/M/J/24 question 3
VIDEO
▶ Starts at Q3 (16:27)

Starts at Q3 (16:27) · by Pseudocode Pro. 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.