Question 9
AQA Computer Science June 2023 Paper 2 (7516/2)AS4 marks
On the specification
- 3.1 Fundamentals of programming3.7 Fundamentals of computer organisation and architecture
Question text
9 box Figure 4 shows an algorithm written in pseudo-code. It is used to calculate the value of the contents of variable A multiplied by the contents of variable B. Line numbers are included in the pseudo-code but are not part of the algorithm. Figure 4 1 A 4 2 B 3 3 C 0 4 WHILE B > 0 5 C C + A 6 B B – 1 7 ENDWHILE Write a sequence of assembly language instructions that would perform the same function as the pseudo-code in Figure 4. Registers R1, R2 and R3 are used to hold the values of A, B and C respectively. The assembly language code equivalent to line numbers 1 to 3 in Figure 4 have been completed for you. [4 marks] MOV R1, #4 MOV R2, #3 MOV R3, #0