Processor fundamentals and assembly language – A Level Computer Science (9618)
Quick quiz: 10 random questions from this topic. Answer them all, then open the Summary.
Question text
8
(a) Identify the purpose of the first pass of a two-pass assembler.
…
… [1]
(b) The following table shows part of the instruction set for a processor. The processor has two
registers, the Accumulator (ACC) and the Index Register (IX).
Instruction
Explanation
Opcode
Operand
LDR
#n
Immediate addressing. Load the number n to IX
STO
<address>
Store contents of ACC at the given address
ADD
<address>
Add the contents of the given address to the ACC
INC
<register>
Add 1 to the contents of the register (ACC or IX)
CMP
#n
Compare the contents of ACC with number n
JPE
<address>
Following a compare instruction, jump to <address> if the compare was True
OUT
Output to the screen the character whose ASCII value is stored in ACC
<address> can be an absolute or symbolic address
# denotes a denary number, e.g. #123
(i)
Give one example of an instruction that belongs to each of the following instruction
groups.
Only use the instructions given in the table. Each instruction must have a suitable
operand.
Data movement …
Arithmetic operation …
Conditional instruction …
[3]
(ii)
The instruction LDR #2 uses immediate addressing.
Give one similarity and one difference between direct addressing and indexed addressing.
Similarity …
…
…
Difference …
…
…
[2]
(iii)
Identify one other mode of addressing.
…
… [1]
(c) The following table shows another part of the instruction set for the same processor.
Instruction
Explanation
Opcode
Operand
AND
Bn
Bitwise AND operation of the contents of ACC with the operand
XOR
Bn
Bitwise XOR operation of the contents of ACC with the operand
LSR
#n
Bits in ACC are shifted logically n places to the right. Zeros are introduced on
the left hand end
# denotes a denary number, e.g. #123
B denotes a binary number, e.g. B01001101
(i)
The current contents of the ACC are:
1
0
0
1
1
1
1
0
Show the contents of the ACC after the execution of the following instruction.
AND B10100101
…
…
[1]
(ii)
The current contents of the ACC are:
0
0
0
1
0
1
1
1
Show the contents of the ACC after the execution of t
Question text
3
A program is written in assembly language.
(a) The program is converted into machine code by a two‑pass assembler.
Draw one or more lines to identify the pass or passes in which each action takes place.
Action
Pass
generates object code
first
reads the source code one line at a time
removes white space
second
adds labels to the symbol table
[3]
(b) Assembly language statements can use different modes of addressing.
Complete the following description of addressing modes.
… addressing is when the operand holds the memory address of
the data.
… addressing is when the operand holds a memory address that
stores the memory address of the data.
… addressing is when the operand is the data.
[3]
Question text
3
The table shows part of the instruction set for a processor. The processor has one general purpose
register, the Accumulator (ACC).
Instruction
Explanation
Opcode
Operand
AND
#n
Bitwise AND operation of the contents of ACC with the operand
Bitwise AND operation of the contents of ACC with the contents
AND
<address>
of <address>
XOR
#n
Bitwise XOR operation of the contents of ACC with the operand
Bitwise XOR operation of the contents of ACC with the contents
XOR
<address>
of <address>
OR
#n
Bitwise OR operation of the contents of ACC with the operand
Bitwise OR operation of the contents of ACC with the contents of
OR
<address>
<address>
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
(a) The ACC currently contains the following positive binary integer:
0
1
1
0
0
1
0
1
Write the bit manipulation instruction that would change the binary integer in ACC to:
1
1
1
1
1
1
1
1
Opcode … Operand …
[2]
(b) The ACC currently contains the following positive binary integer:
0
1
1
0
0
1
0
1
Write the bit manipulation instruction that would change the binary integer in ACC to:
1
0
0
1
1
0
1
0
Opcode … Operand …
[2]
(c) Convert the following positive binary integer into hexadecimal.
0 1 1 1 1 1 1 0
… [1]
(d) A three-place logical shift to the left is performed on the following positive binary integer.
Show the result of this logical shift.
0 1 1 1 1 1 1 0
… [1]
(e) Convert the denary numbers 127 and 12 to 8-bit binary and then perform the subtraction
12 − 127 in binary.
Show your working.
127 in binary …
12 in binary …
12 − 127 in binary …
…
…
…
…
[3]
Question text
6
The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Opcode
Operand
LDM
#n
Immediate addressing. Load the number n to ACC
LDD
<address>
Direct addressing. Load the contents of the location at the given
address to ACC
LDX
<address>
Indexed addressing. Form the address from <address> + the
contents of the index register. Copy the contents of this calculated
address to ACC
LDR
#n
Immediate addressing. Load the number n to IX
STO
<address>
Store contents of ACC at the given address
ADD
<address>
Add the contents of the given address to the ACC
ADD
#n
Add the denary number n to the ACC
INC
<register>
Add 1 to the contents of the register (ACC or IX)
CMP
#n
Compare the contents of ACC with number n
JPE
<address>
Following a compare instruction, jump to <address> if the
compare was True
JPN
<address>
Following a compare instruction, jump to <address> if the
compare was False
OUT
Output to the screen the character whose ASCII value is stored in
ACC
END
Return control to the operating system
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
B denotes a binary number, e.g. B01001101
(a) The current contents of main memory and selected values from the ASCII character set are
given.
(i)
Trace the program currently in memory using the trace table.
Memory address
Instruction
ACC
IX
Output
address
Address
Instruction
100
101
110
111
112
77
LDR
#0
0
0
66
65
35
78
LDX
110
79
CMP
#35
80
JPE
92
81
ADD
100
82
STO
101
83
LDM
#1
84
ADD
100
85
STO
100
86
INC
IX
87
LDX
110
88
CMP
#35
89
JPN
81
90
LDD
100
91
ADD
#48
92
OUT
93
END
…
100
0
101
0
…
110
66
111
65
112
35
ASCII
Character
value
49
1
50
2
51
3
52
4
65
A
66
B
67
C
68
D
[4]
(ii)
The following instructions are repeated for your reference.
Instruction
Explanation
Opcode
Operand
LDD
<address>
Direct addressing. Load the contents of the location at the given
address to ACC
STO
<address>
Store contents of ACC at the given address
State the purpose of this part of an assembly language program.
LDD
100
STO
165
LDD
101
STO
100
LDD
165
STO
101
…
…
[1]
Question 6(b) begins on page 16.
(b) The following table shows another part of the instruction set for the processor.
Instruction
Explanation
Opcode
Operand
AND
#n
Bitwise AND operation of the contents of ACC with the operand
AND
Bn
Bitwise AND operation of the contents of ACC with the binary number n
XOR
#n
Bitwise XOR operation of the contents of ACC with the operand
XOR
Bn
Bitwise XOR operation of the contents of ACC with the binary number n
OR
#n
Bitwise OR operation of the contents of ACC with the operand
OR
Bn
Bitwise OR operation of the contents of ACC with the binary number n
LSR
#n
Bits in ACC are shifted logically n places to the right. Zeros are
introduced on the left-hand end
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
B denotes a binary number, e.g. B01001101
(i)
The current contents of the ACC are:
1
0
0
1
0
0
1
1
Show the result after the execution of the following instruction.
XOR B00011111
…
…
[1]
(ii)
The current contents of the ACC are:
1
0
0
1
0
0
1
1
Show the result after the execution of the following instruction.
AND B11110000
…
Question text
3
The following table shows part of the instruction set for a processor. The processor has two
registers: the Accumulator (ACC) and an Index Register (IX).
Instruction
Explanation
Opcode
Operand
Immediate addressing. Load the number n to ACC
LDM
#n
Direct addressing. Load the contents of the location at the given
LDD
<address>
address to ACC
Indirect addressing. The address to be used is at the given address.
LDI
<address>
Load the contents of this second address to ACC
Indexed addressing. Form the address from <address> + the contents
LDX
<address>
of the index register. Copy the contents of this calculated address to
ACC
Immediate addressing. Load the number n to IX
LDR
#n
Add the number n to the ACC
ADD
#n/Bn/&n
Add the contents of the given address to the ACC
ADD
<address>
Subtract 1 from the contents of the register (ACC or IX)
DEC
<register>
Subtract the number n from the ACC
SUB
#n/Bn/&n
Subtract the contents of the given address from the ACC
SUB
<address>
Add 1 to the contents of the register (ACC or IX)
INC
<register>
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
B denotes a binary number, e.g. B01001010
& denotes a hexadecimal number, e.g. &4A
,
,
(a) The current contents of memory are shown:
Address
Data
51
48
6
49
48
50
50
51
49
52
50
53
6
54
The current contents of the ACC and IX are shown:
2
ACC
50
IX
Complete the table by writing the content of the ACC after each program has run.
Program number
Code
ACC content
LDM #50
INC ACC
1
SUB #1
LDI 51
2
ADD 52
LDR #2
LDX 50
3
DEC ACC
LDD 52
SUB 54
4
INC ACC
[4]
,
,
(b) The processor includes these bit manipulation instructions:
Instruction
Explanation
Opcode
Operand
AND
#n/Bn/&n
Bitwise AND operation of the contents of ACC with the operand
Bitwise AND operation of the contents of ACC with the contents of
AND
<address>
<address>
XOR
#n/Bn/&n
Bitwise XOR operation of the contents of ACC with the operand
Bitwise XOR operation of the contents of ACC with the contents of
XOR
<address>
<address>
OR
#n/Bn/&n
Bitwise OR operation of the contents of ACC with the operand
Bitwise OR operation of the contents of ACC with the contents of
OR
<address>
<address>
Bits in ACC are shifted logically n places to the left. Zeros are
LSL
#n
introduced on the right-hand end
Bits in ACC are shifted logically n places to the right. Zeros are
LSR
#n
introduced on the left-hand end
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
B denotes a binary number, e.g. B01001010
& denotes a hexadecimal number, e.g. &4A
The current contents of memory are shown:
Address
Data
00001101
100
10111110
101
11110011
102
00110111
103
00000000
104
The current content of the ACC is shown:
1
1
1
1
1
1
1
1
,
,
Complete the table by writing the content of the ACC after each instruction has run.
The binary number 11111111 is reloaded into the ACC before each instruction is run.
Instruction number
Instruction
ACC content
LSL #2
1
XOR 100
2
AND 103
3
[3]
Question text
6
(a) The processor uses several registers, including the Accumulator (ACC) and the Current
Instruction Register (CIR).
Complete the table by describing the role of each register.
Register
Role
…
ACC
…
…
CIR
…
[2]
(b) Increasing the number of cores in a processor can affect the performance of a computer.
Describe the drawbacks of increasing the number of cores in a processor.
…
…
…
… [2]
(c) State three differences between Dynamic RAM (DRAM) and Static RAM (SRAM).
1 …
…
2 …
…
3 …
…
[3]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞû¸þ×
Question text
6
An interrupt is generated when a key is pressed on a computer keyboard.
Explain how the computer handles this interrupt.
…
…
…
…
…
…
…
…
…
… [5]
Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer‑related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
3
(a) (i)
State what is meant by relative addressing.
…
…
… [1]
(ii)
Registers such as the Accumulator (ACC) and the Index Register (IX) are used in the
CPU.
Identify two special purpose registers used in the CPU. Do not include the ACC or IX in
your answers.
1 …
2 …
[2]
ĬÏĊ®Ġ´íÈõÏĪÅĊÝü·þ×
,
,
(b) The following table shows part of the instruction set for a processor. The processor has two
registers: the ACC and an IX.
Instruction
Explanation
Opcode
Operand
LDM
#n
Immediate addressing. Load the number n to ACC
LDD
<address>
Direct addressing. Load the contents of the location at the given
address to ACC
LDI
<address>
Indirect addressing. The address to be used is at the given address.
Load the contents of this second address to ACC
LDX
<address>
Indexed addressing. Form the address from <address> + the contents
of the index register. Copy the contents of this calculated address to
ACC
LDR
#n
Immediate addressing. Load the number n to IX
<address> can be an absolute or symbolic address
# denotes a denary number, e.g. #127
The current contents of the main memory and the index register are shown.
Address
Instruction
8
98
16
99
3
100
98
101
32
102
2
IX
Write the contents of the ACC after each instruction is executed.
Instruction
Value in ACC
LDM #98
LDI 101
LDX 100
[3]
ĬÍĊ®Ġ´íÈõÏĪÅĊßú·Ā×
,
,
(c) A student buys a new computer. The table shows the specifications of the old computer and
the new computer.
Old computer
New computer
1.8 GHz dual core processor
2.3 GHz dual core processor
16 MB cache
32 MB cache
Explain why increasing the clock speed and increasing the cache memory will improve the
performance of the computer.
Clock speed …
…
…
…
Cache memory …
…
…
…
[4]
ĬÏĊ®Ġ´íÈõÏĪÅĊßü·Ā×
Question text
9
The following table shows part of the instruction set for a processor. The processor has two
registers, the Accumulator (ACC) and the Index Register (IX).
Instruction
Explanation
Opcode
Operand
Direct addressing. Load the contents of the location at the given
LDD
<address>
address to ACC
Indexed addressing. Form the address from <address> +
the contents of the index register. Copy the contents of this
LDX
<address>
calculated address to ACC
LDR
#n
Immediate addressing. Load the number n to IX
STO
<address>
Store the contents of ACC at the given address
ADD
#n
Add the denary number n to the ACC
JMP
<address>
Jump to the given address
INC
<register>
Add 1 to the contents of the register (ACC or IX)
CMP
<address>
Compare the contents of ACC with the contents of <address>
Indirect addressing. The address to be used is at the given
CMI
<address>
address. Compare the contents of ACC with the contents of this
second address
Following a compare instruction, jump to <address> if the
JPE
<address>
compare was True
IN
Key in a character and store its ASCII value in ACC
Output to the screen the character whose ASCII value is stored
OUT
in ACC
END
Return control to the operating system
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
(a) The instructions in the processor’s instruction set can be grouped according to their function.
Identify the instruction group for each of the following opcodes.
IN …
ADD …
JPE …
CMI …
[4]
(b) The current contents of main memory and selected values from the ASCII character set are
given on page 15.
Trace the program currently in memory using the trace table when the input is ‘1’.
Address
Instruction
Memory address
Output
Instruction
ACC
IX
address
LDR #0
10
100
101
110
111
0
0
51
65
IN
11
STO 101
12
LDX 110
13
CMP 100
14
JPE 21
15
LDD 101
16
ADD #16
17
INC IX
18
STO 100
19
JMP 13
20
OUT
21
END
22
...
0
100
0
101
...
51
110
65
111
ASCII
Character
value
49
1
50
2
51
3
[4]
52
4
...
65
A
66
B
67
C
68
D
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
4
The table shows part of the instruction set for a processor. The processor has one register, the
Accumulator (ACC).
Instruction
Explanation
Opcode
Operand
AND
#n / Bn / &n
Bitwise AND operation of the contents of the ACC with the
operand
AND
<address>
Bitwise AND operation of the contents of the ACC with the
contents of <address>
XOR
#n / Bn / &n
Bitwise XOR operation of the contents of the ACC with the
operand
XOR
<address>
Bitwise XOR operation of the contents of the ACC with the
contents of <address>
OR
#n / Bn / &n
Bitwise OR operation of the contents of the ACC with the
operand
OR
<address>
Bitwise OR operation of the contents of the ACC with the
contents of <address>
LSL
#n
Bits in ACC are shifted logically n places to the left. Zeros
are introduced on the right-hand end.
LSR
#n
Bits in ACC are shifted logically n places to the right. Zeros
are introduced on the left-hand end.
<address> can be an absolute or symbolic address
# denotes a denary number, e.g. #127
B denotes a binary number, e.g. B10010001
& denotes a hexadecimal number, e.g. &4A
(a) The ACC currently contains the following positive binary integer:
0
0
0
1
1
1
1
0
Write a bit manipulation instruction that uses a binary shift to change the contents of the ACC to:
0
1
1
1
1
0
0
0
Instruction … [1]
ĬÑĊ®Ġ´íÈõÏĪÅĊßù¶Ā×
,
,
(b) The ACC currently contains the following positive binary integer:
1
1
1
0
0
0
1
1
Write the contents of the ACC after the instruction XOR &12 is carried out.
[1]
(c) The ACC currently contains the following positive binary integer:
1
1
1
0
0
0
1
1
Write the contents of the ACC after the instruction AND #63 is carried out.
[1]
(d) The ACC currently contains the following positive binary integer:
1
1
1
0
0
0
1
1
The current contents of memory are:
Data
Address
00100100
98
00110001
99
00110011
100
10100011
101
10101100
102
Write the contents of the ACC after the instruction OR 100 is carried out.
[1]
ĬÓĊ®Ġ´íÈõÏĪÅĊßû¶Ā×