Question 10
AQA Computer Science June 2024 Paper 2 (7517/2)A level11 marks
On the specification
- 10.1
- 4.7 Fundamentals of computer organisation and architecture
- 10.2
- 4.5 Fundamentals of data representation4.7 Fundamentals of computer organisation and architecture
- 10.3
- 4.6 Fundamentals of computer systems
- 10.4
- 4.1 Fundamentals of programming
Question text
10 box Figure 7 shows an assembly language program which has been written using the AQA assembly language instruction set. The instruction set is explained in Table 1 on page 33. Figure 7 LDR R1, 130 MOV R2, #0 MOV R4, #0 repeat: ADD R2, R2, #1 AND R3, R1, #1 CMP R3, #0 BEQ skip ADD R4, R4, #1 skip: LSR R1, R1, #1 CMP R2, #7 BNE repeat LDR R1, 130 AND R4, R4, #1 CMP R4, #0 BNE else ORR R1, R1, #128 B end else: AND R1, R1, #127 end: STR R1, 130 HALT The program performs a task on a value stored in memory location 130. The value in this memory location is a 7-bit ASCII code. For example, if memory location 130 was used to store the ASCII character ‘S’ then it would contain the value 83, which in binary is: 1 0 1 0 0 1 1 10.1 box Complete the trace table below to show the results of executing the program in Figure 7 when the initial value in memory location 130 is 83 Each register can hold an 8-bit value. You may find it easier to understand the operation of the program if you write the contents of memory location 130 and register R1 out in both binary and decimal. You may not need to use all the rows in the table. [6 marks] Memory Location R1 R2 R3 R4 130 83 (01010011) 10.2 The value in memory location 130 before the program is executed is the program’s input and the value stored in memory location 130 when the program finishes executing is its output. By considering your trace table for Question 10.1 and the assembly language code in Figure 7, describe the purpose of the program. [2 marks] 10.3 Describe two advantages of writing programs in assembly language over writing programs using a high-level language. [2 marks] Advantage 1 Advantage 2 10.4 Some high-level languages are described as being imperative. Explain what imperative means in this context. [1 mark]