Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3.
Run the program from address 200, noting any change after each instruction (only changes are written).
LDD 81 loads 8. INC ACC makes 9. STO 83 stores 9 at address 83. LDI 82: address 82 holds 80, so load the contents of address 80, which is 10. CMP 83 compares 10 with 9: not equal, so JPE 209 does not jump and the program carries on at 206. LDD 83 loads 9. ADD #10 makes 19. JMP 210. STO 81 stores 19 at address 81.
| Instruction address | ACC | 80 | 81 | 82 | 83 |
|---|---|---|---|---|---|
| 10 | 8 | 80 | 81 | ||
| 200 | 8 | ||||
| 201 | 9 | ||||
| 202 | 9 | ||||
| 203 | 10 | ||||
| 204 | |||||
| 206 | 9 | ||||
| 207 | 19 | ||||
| 208 | |||||
| 210 | 19 |
Rows 200 and 201 (ACC 8 then 9) [1]
Row 202: address 83 = 9 [1]
Rows 203 to 206: ACC 10, no jump at 204, then ACC 9 [1]
Rows 207 to 210: ACC 19, then address 81 = 19 [1]
To set a bit to 1 and leave the others unchanged, use OR with a mask that has 1 only in the LSB.
OR B00000001
OR B00000001 (or OR #1 or OR &1) [1]
XOR with &FE (11111110) flips the left seven bits and leaves the last bit.
01010101 XOR 11111110 = 10101011 [1]
LSR #5 shifts right 5 places: the five right-hand bits fall off and zeros enter on the left.
01101011 → 00000011 [1]
▶ Starts at Q8 (2:16:19)
Starts at Q8 (2:16:19) · 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.