Question 10
AQA Computer Science June 2019 Paper 2AS11 marks
On the specification
- 10.1
- 3.7 Fundamentals of computer organisation and architecture3.1 Fundamentals of programming
- 10.2
- 3.6 Fundamentals of computer systems
- 10.3
- 3.6 Fundamentals of computer systems
Question text
10 Figure 2 shows an algorithm, written in pseudo-code, that is used to multiply two box variables W and X together. The resulting answer is stored in variable Y. It can be assumed that both W and X are positive integers. Z is a temporary variable. The operation DIV performs integer division. Line numbers are included but are not part of the algorithm. Figure 2 1 W 9 2 X 12 3 Y 0 4 REPEAT 5 Z W LOGICAL BITWISE AND 1 6 IF Z = 1 THEN 7 Y Y + X 8 END IF 9 W W DIV 2 10 X X * 2 11 UNTIL W = 0 10.1 Write a sequence of assembly language instructions that perform multiplication using the same method shown in Figure 2. Assume that registers 0, 1, 2 and 3 are used to store the values represented by variables W, X, Y and Z accordingly. Some lines, including those equivalent to line numbers 1 to 5 in Figure 2, have been completed for you. [7 marks] MOV R0, #9 MOV R1, #12 MOV R2, #0 startloop: AND R3, R0, #1 jump: B startloop endloop: 10.2 Describe two differences between machine code and assembly language. box [2 marks] 10.3 Assemblers and compilers are two different types of translator. Describe one similarity and one difference between the role of an assembler and the role of a compiler. [2 marks]