Worked solution from the Further Programming Paper 3 Advanced Theory booklet, Part 1 of 2.
LDM loads the number itself. LDD uses the address as given. LDI uses the address stored at that address.
| Instruction | Addressing mode | Contents of ACC |
|---|---|---|
| LDM #500 | Immediate | 500 |
| LDD 500 | Direct | 100 |
| LDI 500 | Indirect | 20 |
LDM #500: Immediate and 500 [1]
LDD 500: Direct and 100 [1]
LDI 500: Indirect and 20, because address 500 holds 100 and address 100 holds 20 [1]
Load 20 and store it in a labelled location. Then use LDI to load the value whose address is held in Y, add 20 and store in Z. Data locations go after the program code.
LDM #20
STO Twenty
LDI Y
ADD Twenty
STO Z
Twenty: #20
Y:
Z:LDM #20 is seen [1]
The value 20 is stored at an address (STO Twenty) [1]
That address is labelled (for example Twenty:) away from the program code [1]
Addresses labelled Y: and Z: away from the program code [1]
Correct use of LDI Y [1]
Correct use of STO Z [1]
Correct use of ADD with the labelled address of 20 [1]
Any suitable label name is fine.
▶ 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.