Question 9

AQA Computer Science June 2022 Paper 2 (7517/2)A level10 marks

On the specification

9.1
4.7 Fundamentals of computer organisation and architecture
9.2
3.4 Theory of computation3.7 Fundamentals of computer organisation and architecture
9.3
3.4 Theory of computation3.7 Fundamentals of computer organisation and architecture
9.4
3.6 Fundamentals of computer systems
9.5
3.6 Fundamentals of computer systems
Question text

9 box Figure 7 shows an assembly language program that has been written using the AQA Assembly Language Instruction Set, which is given in Table 1 on page 20. Figure 7 LDR R0, 120 LDR R1, 121 MOV R3, #0 loop: CMP R1, #0 BEQ exit AND R2, R1, #1 CMP R2, #0 BEQ skip ADD R3, R3, R0 skip: LSL R0, R0, #1 LSR R1, R1, #1 B loop exit: STR R3, 122 HALT 9.1 State the name of the addressing mode used in the instruction ADD R3, R3, R0 [1 mark] 9.2 Memory location 120 contains the value 23 and memory location 121 contains the value 5. Complete the trace table to show how the contents of the memory locations and registers change when the program in Figure 7 is executed. [5 marks] Memory locations Registers 120 121 122 R0 R1 R2 R3 23 5 9.3 State the purpose of the program in Figure 7. [1 mark] 9.4 The program in Figure 7 has been written using assembly language. State two reasons why the programmer may have chosen to write this program in assembly language rather than in a high-level programming language. [2 marks] Reason 1 Reason 2 9.5 The program in Figure 7 will be translated into machine code. Explain the relationship between an assembly language instruction and a machine code instruction. [1 mark]