Cambridge AS Level Computer Science 9618 · 4.2 Assembly Language

Q32 · 9618/12/M/J/25 Q7

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

Q329618/12/M/J/25original Q7Structured · 8 marks
Question 7 from 9618/12/M/J/25

Worked solution

(a)(i)

Run the program from address 100, writing only what changes.

LDD 10 loads 12. ADD 12 adds 10 to give 22. STO 11 stores 22 at address 11. CMP 14 compares 22 with 22: true. JPE 107 jumps to 107. STO 10 stores 22 at address 10.

Instruction addressACC1011121314
1211102222
10012
10122
10222
103
104
10722

ACC 12 at 100 and 22 at 101 [1]

Address 11 = 22 at 102 [1]

Rows 103, 104 then 107 with address 10 = 22 [1]

(a)(ii)

Write one effect:

10 is loaded into ACC instead of the contents of address 10 (12). The sum would be 20, not 22, so the comparison fails and the program loops forever. [1]

(a)(iii)

Name a mode that is not in the table and describe it. Any one pair:

Mode: Indirect [1]

Description: the operand is the address of a memory location that contains the address of the data. [1]

Other accepted pairs: Indexed (the address is the operand plus the contents of the Index Register) or Relative (the address is worked out from its distance from a base address).

(b)(i)

11110000 OR 00001111 = 11111111 [1]

(b)(ii)

#30 is 00011110. 00011101 XOR 00011110 = 00000011 [1]

KEY IDEATrace one instruction at a time; a compare and a jump change which address runs next, not the ACC.
TOTAL 8 marks

Official mark scheme

Mark scheme for 9618/12/M/J/25 question 7
VIDEO
▶ Whole paper

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