Chapter 6 Answers
Chapter 6 Answers
Task 6.02
For the LDI instruction the original operand is an address, the contents of that address are another address, and
the contents of this second address are to be loaded into the accumulator. The overall process is:
ACC ← [[[CIR(15:0)]]]
However, the instruction must use the MAR when accessing a memory address so the steps could be as follows:
MAR ← [CIR(15:0)]
ACC ← [[MAR]]
MAR ← [ACC]
ACC ← [[MAR]]
Flags: N V C
(1) 0000 0010 001
The addition is handled correctly with no negative or overflow flag set so the processor can ignore the carry bit.
Task 6.03
ACC MAX TOTAL COUNT
00110011
00000011 3
00000000 0 0
00110111
00000111
00000111 7
00000000
00000001 1
00111000
00001000
00001111 15
00000001
00000010 2
00111001
00001001
00011000 24
00000010
00000011 3
Note that the binary codes need to be displayed for the accumulator to show how the input value is first stored as
an ASCII code then converted to binary. For convenience the other values are recorded as denary values.
(3 for the four arrows, 1 for first one correct, 2 for first two correct)
ii 104 as shown. (1)
2 a Comments, directives and system calls are three strong answers (1 each)
The answer ‘macro calls’ also works because a macro call has to be replaced by the macro code. For the
purpose part of the question, learners could explain that a comment is there to assist the programmer when
reading the program.
b Memory addresses
Accumulator
201 202 203 204
0 10 0 204 5
10 4 11
11 9
5
4
9
The addresses are given as 4-bit binary values for illustration of this simple example.
4 This is Question 9 in 9608 Paper 11 June 2016. At the time of writing the published mark scheme is available
on the Cambridge International School Support Hub (requires registration). The Examiners Report for the June
2016 series is also available there and this may contain comments specific to this question.
The following are what the author of this chapter in the Teacher Resource would suggest as reasonable
answers with alternatives suggested where appropriate.
a i Accumulator: 0 1 0 0 0 1 0 1
The LDX instruction has an operand, which is an address. The value in the Index Register has to be added
to this value to get the address where the datum to be loaded is stored. So, the index register contains
00001000, which is the binary representation of denary 8. The value in address 68 must be loaded into
the accumulator.
ii Index Register 0 0 0 0 0 1 1 1
Cambridge International AS & A Level Computer Science 9608 paper 11 Q9a June 2016
Note that, the operand is usually an address, but it may also be the abbreviation for a register or a value. If it
is a value, it is preceded by #, B or & depending on whether the value is given in denary, binary or
hexadecimal, respectively. The addressing mode is all about where the value comes from that is to be used by
the operation defined by the opcode.
4 LDD and LDR are examples of assembly language mnemonics for the opcodes of instructions of the C type.
The machine code equivalent of these opcodes will in part have A defining the F but will have E to define the
D or B and the B or D involved.
Here, the knowledge needed is that the opcode of an instruction will define the operation to be performed,
the addressing mode to be used and the register to be used.
Note that as in Worksheet 6.1 the values stored are given in denary for convenience. In an alternative solution
it could be decided to convert the values and then use binary code for the entries in the trace tables.
However, the important part of the exercise is to follow the assembly code instructions.
3 Memory
Accumulator address Output
205
67 201 C
200 202 K
201 203 B
75 204 X
201
202
66
202
203
88
203
204
65