Chapter 6 Assembly Language Assignment
Chapter 6 Assembly Language Assignment
(c) The table shows assembly language instructions for a processor which has one general
purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Op code Operand
LDM #n Immediate addressing. Load the denary number n to ACC.
Direct addressing. Load the contents of the location at the given address to
LDD <address>
ACC.
Indexed addressing. Form the address from <address> + the contents of the
LDX <address>
Index Register. Copy the contents of this calculated address to ACC.
LDR #n Immediate addressing. Load the denary number n to IX.
STO <address> Store contents of ACC at the given address.
ADD <address> Add the contents of the given address to ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
CMP #n Compare contents of ACC with denary 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.
JMP <address> Jump to the given address.
OUT Output to screen the character whose ASCII value is stored in ACC.
END Return control to the operating system.
The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are:
IX 0
© UCLES 2019 9608/11/M/J/19
11
Trace the program currently in memory using the following trace table. The first instruction
has been completed for you.
65 67 69 69 68 33 0
20 0
21 0
22 0=0
True
23
28 65
29 A
30 0
31 1
32 1
33 1
34 1=2False
22 1=0 False
24 67
25 100
26 d
27
30 1
31 2
32 2
33 2
34 2=2 True
[8]
(c) The following table shows assembly language instructions for a processor which has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Op code Operand
LDM #n Immediate addressing. Load the denary number n to ACC
Direct addressing. Load the contents of the location at the given address to
LDD <address>
ACC
Indexed addressing. Form the address from <address> + the contents of the
LDX <address>
Index Register. Copy the contents of this calculated address to ACC
LDR #n Immediate addressing. Load the denary number n to IX
STO <address> Store contents of ACC at the given address
ADD <address> Add the contents of the given address to ACC
INC <register> Add 1 to the contents of the register (ACC or IX)
CMP #n Compare contents of ACC with denary 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
JMP <address> Jump to the given address
OUT Output to the screen the character whose ASCII value is stored in ACC
END Return control to the operating system
The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are:
IX 0
© UCLES 2019 9608/12/M/J/19
7
Trace the program currently in memory using the following trace table.
The first instruction has been completed for you.
2 5 0 4 64 0
50 0
51 0
52 2
53 2=0 (False)
54
55 2+64 = 66
56 B
57 0
58 1
59 1
60 1
61
52 5
53 5=0 False
54
55 69
56 E
57 1
[8]
(i) Convert the denary ASCII character code for ‘A’ into 8-bit binary.
[1]
(ii) Convert the denary ASCII character code for ‘A’ into hexadecimal.
..................................................................................................................................... [1]
..................................................................................................................................... [1]
(a) The op codes LDM and LDD are used to load a register. The op code LDM uses immediate
addressing, and the op code LDD uses direct addressing.
Describe what happens when the following instructions are run. 27 value
LDM #300
300
Address
...................................................................................................................................................
300
...................................................................................................................................................
ACC
LDD 300
...................................................................................................................................................
27
...................................................................................................................................................
[2]
ACC
(b) Assembly language instructions can be grouped by their purpose.
Tick (✓) one box in each row to indicate the group each instruction belongs to.
6 A processor has one general purpose register, the Accumulator (ACC), and an Index Register
(IX).
(a) The table gives three assembly language instructions for loading data into the ACC. It also
identifies the addressing mode used for each instruction.
(i) State the contents of the Accumulator after each of the instructions A, B and C are run.
193
A ........................................................................................................................................
...........................................................................................................................................
B ........................................................................................................................................
...........................................................................................................................................
C ........................................................................................................................................
...........................................................................................................................................
[3]
1 ........................................................................................................................................
2 ........................................................................................................................................
[2]
(b) The ACC is a general purpose register. The IX is a special purpose register.
Identify two other special purpose registers used in the fetch-execute cycle and describe
their role in the cycle.
Register 1 .................................................................................................................................
Role ..........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Register 2 .................................................................................................................................
Role ..........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
© UCLES 2020 9608/11/M/J/20
9
The table shows the denary values for three assembler op codes.
(i) Convert the denary value for the op code LDD into 8‑bit binary.
[1]
(ii) Convert the denary value for the op code STO into hexadecimal.
..................................................................................................................................... [1]
(iii) State why the denary value for the op code ADD cannot be represented in 8‑bit two’s
complement form. Justify your answer.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(c) The 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
Op code Operand
LDM #n Immediate addressing. Load the denary number n to ACC
Direct addressing. Load the contents of the location at the given address to
LDD <address>
ACC
Indexed addressing. Form the address from <address> + the contents of the
LDX <address>
Index Register. Copy the contents of this calculated address to ACC
LDR #n Immediate addressing. Load the denary number n to IX
STO <address> Store contents of ACC at the given address
ADD <address> Add the contents of the given address to ACC
INC <register> Add 1 to the contents of the register (ACC or IX)
CMP <address> Compare contents of the address given with the contents of ACC
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
JMP <address> Jump to the given address
OUT Output to screen the character whose ASCII value is stored in ACC
END Return control to the operating system
Complete the trace table for the following assembly language program. The first instruction
has been completed for you.
22 JPE 30 1 2 3 0
23 LDD 100 20 0
24 ADD 101
21 0=2
25 STO 100
22
26 LDD 103
27 INC ACC 23 1
28 STO 103 24 1+2=3
29 JMP 20
25 3
30 END
26 0
…
27 1
100 1
101 2
28 1
102 3 29
103 0 20 1
1=2
[6]
© UCLES 2020 9608/12/M/J/20 [Turn over
10
8 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an Index Register (IX).
Instruction
Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC.
Indexed addressing. Form the address from <address> + the
LDX <address> contents of the index register. Copy the contents of this calculated
address to ACC.
STO <address> Store contents of ACC at the given address.
ADD <address> Add the contents of the given address to ACC.
CMP <address> Compare contents of ACC with contents of <address>
Following a compare instruction, jump to <address> if the compare
JPE <address>
was True.
Following a compare instruction, jump to <address> if the compare
JPN <address>
was False.
JMP <address> Jump to the given address.
Output to the screen the character whose ASCII value is stored in
OUT
ACC.
END Return control to the operating system.
Main memory
800 0110 0100
801 0111 1100
802 1001 0111
803 0111 0011
804 1001 0000
805 0011 1111
806 0000 1110
807 1110 1000
808 1000 1110
809 1100 0010
:
:
2000 1011 0101
(a) (i) Show the contents of the Accumulator after execution of the instruction:
LDD 802
Accumulator:
[1]
(ii) Show the contents of the Accumulator after execution of the instruction:
LDX 800
Index Register: 0 0 0 0 1 0 0 1
Accumulator: 1 0
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
(b) (i) Complete the trace table below for the following assembly language program. This
program contains denary values.
Trace table:
Memory address
ACC OUTPUT
800 801 802 803
40 50 0 90
[4]
.......................................................................................................................................[1]
(c) The program used the ASCII coding system for character codes. An alternative coding system
is Unicode.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
.......................................................................................................................................[2]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
5 The table shows assembly language instructions for a processor that has one general purpose
register, the Accumulator (ACC) and an index register (IX).
Instruction
Explanation
Op Code Operand
Direct addressing. Load the contents of the given address to
LDD <address>
ACC.
Index addressing. Form the address from <address> +
LDX <address> the contents of the index register. Copy the contents of this
calculated address to ACC.
Indirect addressing. The address to be used is at the given
LDI <address>
address. Load the contents of this second address to ACC.
ADD <address> Add the contents of the given address to the ACC.
Main memory
(a) (i) Show the contents of the Accumulator after the execution of the instruction:
LDD 102
(ii) Show the contents of the Accumulator after the execution of the instruction:
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(iii) Show the contents of the Accumulator after the execution of the instruction:
LDI 103
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
(b) Complete the trace table below for the following assembly language program.
806 END
810 28
811 41
812 0
813 0
Trace table:
Memory address
ACC
810 811 812 813
28 41 0 0
28
29
29
41
70
70
[6]
8 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an Index Register (IX).
Instruction
Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC.
Indexed addressing. Form the address from <address> + the
LDX <address> contents of the index register. Copy the contents of this calculated
address to ACC.
STO <address> Store contents of ACC at the given address.
ADD <address> Add the contents of the given address to ACC.
CMP <address> Compare contents of ACC with contents of <address>
Following a compare instruction, jump to <address> if the compare
JPE <address>
was True.
Following a compare instruction, jump to <address> if the compare
JPN <address>
was False.
JMP <address> Jump to the given address.
Output to the screen the character whose ASCII value is stored in
OUT
ACC.
END Return control to the operating system.
Main memory
800 0110 0100
801 0111 1100
802 1001 0111
803 0111 0011
804 1001 0000
805 0011 1111
806 0000 1110
807 1110 1000
808 1000 1110
809 1100 0010
:
:
2000 1011 0101
(a) (i) Show the contents of the Accumulator after execution of the instruction:
LDD 802
Accumulator:
[1]
(ii) Show the contents of the Accumulator after execution of the instruction:
LDX 800
Index Register: 0 0 0 0 1 0 0 1
Accumulator:
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
(b) (i) Complete the trace table below for the following assembly language program. This
program contains denary values.
Trace table:
Memory address
ACC OUTPUT
800 801 802 803
40 50 0 90
[4]
.......................................................................................................................................[1]
(c) The program used the ASCII coding system for character codes. An alternative coding system
is Unicode.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
.......................................................................................................................................[2]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
Machine code
Instruction Binary Hexadecimal
OUTCH 1100 0111 C7
JNE CarryOn A B
Each of the numbers A and B represents the complete instruction in two bytes, one byte for
the op code and one byte for the operand.
(ii) Use the following instruction set to write the numbers for A and B.
A (binary) ........................................................................................................................
B (hexadecimal) .............................................................................................................
[3]
Instruction
Op code Op code Explanation
Operand
(mnemonic) (binary)
LDM #n 1100 0001 Immediate addressing. Load number n to ACC.
Direct addressing. Load the contents of the given
LDD <address> 1100 0010
address to ACC.
Relative addressing. Move to the address n locations
LDV #n 1100 0011 from the address of the current instruction. Load the
contents of this address to ACC.
STO <address> 1100 0100 Store the contents of ACC at the given address.
DEC 1100 0101 Decrement the contents of ACC.
Output the character corresponding to the ASCII
OUTCH 1100 0111
character code in ACC.
Following a compare instruction, jump to <address> if
JNE <address> 1110 0110
the compare was False.
JMP <address> 1110 0011 (Unconditionally) jump to the given address.
CMP #n 1110 0100 Compare the contents of ACC with number n.
(b) 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
Op code Op code Explanation
Operand
(mnemonic) (binary)
LDM #n 1100 0001 Immediate addressing. Load number n to ACC.
Direct addressing. Load the contents of the given
LDD <address> 1100 0010
address to ACC.
Relative addressing. Move to the address n locations
LDV #n 1100 0011 from the address of the current instruction. Load the
contents of this address to ACC.
STO <address> 1100 0100 Store the contents of ACC at the given address.
DEC 1100 0101 Decrement the contents of ACC.
Output the character corresponding to the ASCII
OUTCH 1100 0111
character code in ACC.
Following a compare instruction, jump to <address> if
JNE <address> 1110 0110
the compare was False.
JMP <address> 1110 0011 (Unconditionally) jump to the given address.
CMP #n 1110 0100 Compare the contents of ACC with number n.
Complete the trace table for the following assembly language program.
Label Instruction
StartProg: LDV #CountDown
CMP Num1
ASCII code table (selected codes only)
JNE CarryOn
<Space> 3 B C X
JMP Finish
32 51 66 67 88
CarryOn: OUTCH
LDD CountDown
DEC
STO CountDown
JMP StartProg
Finish: LDM #88
OUTCH
END
CountDown: 15
32
51
67
Num1: 32
Trace table:
[5]
Machine code
Instruction Binary Hexadecimal
OUTCH 1100 0111 C7
JNE CarryOn A B
Each of the numbers A and B represents the complete instruction in two bytes, one byte for
the op code and one byte for the operand.
(ii) Use the following instruction set to write the numbers for A and B.
A (binary) ........................................................................................................................
B (hexadecimal) .............................................................................................................
[3]
Instruction
Op code Op code Explanation
Operand
(mnemonic) (binary)
LDM #n 1100 0001 Immediate addressing. Load number n to ACC.
Direct addressing. Load the contents of the given
LDD <address> 1100 0010
address to ACC.
Relative addressing. Move to the address n locations
LDV #n 1100 0011 from the address of the current instruction. Load the
contents of this address to ACC.
STO <address> 1100 0100 Store the contents of ACC at the given address.
DEC 1100 0101 Decrement the contents of ACC.
Output the character corresponding to the ASCII
OUTCH 1100 0111
character code in ACC.
Following a compare instruction, jump to <address> if
JNE <address> 1110 0110
the compare was False.
JMP <address> 1110 0011 (Unconditionally) jump to the given address.
CMP #n 1110 0100 Compare the contents of ACC with number n.
4 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an index register (IX).
Instruction
Explanation
Op code 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
LDX <address> 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 ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
CMP <address> Compare contents of ACC with contents of <address>.
Following a compare instruction, jump to <address> if the compare
JPE <address>
was True.
Following a compare instruction, jump to <address> if the compare
JPN <address>
was False.
JMP <address> Jump to the given address.
OUT Output to the screen the character whose ASCII value is stored in ACC.
END Return control to the operating system.
(a) (i) State what is meant by direct addressing and indirect addressing.
...........................................................................................................................................
...........................................................................................................................................
[2]
(ii) Explain how the instruction ADD 20 can be interpreted as either direct or indirect
addressing.
...........................................................................................................................................
...........................................................................................................................................
[2]
(b) The assembly language instructions in the following table use either symbolic addressing or
absolute addressing.
Tick (3) one box in each row to indicate whether the instruction uses symbolic or absolute
addressing.
ADD 90
CMP found
STO 20
[2]
X 1 0 1 1 1 0 1 0
.......................................................................................................................................[1]
.......................................................................................................................................[1]
.......................................................................................................................................[1]
(d) The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are provided with a copy of the instruction set.
Complete the trace table for the given assembly language program.
[8]
3 The following table shows assembly language instructions for a processor which has one general
purpose register, the Accumulator (ACC) and an Index Register (IX).
Instruction
Explanation
Op code Operand
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 ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
CMP <address> Compare contents of ACC with contents of <address>.
JPE <address> Following compare instruction, jump to <address> if the compare was True.
JPN <address> Following compare instruction, jump to <address> if the compare was False.
JMP <address> Jump to the given address.
OUT Output to the screen the character whose ASCII value is stored in ACC.
END Return control to the operating system.
(a) (i) State what is meant by absolute addressing and symbolic addressing.
...........................................................................................................................................
...........................................................................................................................................
[2]
(ii) Give an example of an ADD instruction using both absolute addressing and symbolic
addressing.
(b) (i) State what is meant by indexed addressing and immediate addressing.
...........................................................................................................................................
...........................................................................................................................................
[2]
X 1 1 0 0 0 0 0 1
...................................................................................................................................... [1]
...................................................................................................................................... [1]
...................................................................................................................................... [1]
(d) The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are:
100 2
101 302
102 303
103 303
104 0
105 303
IX 1
Instruction
Explanation
Op code Operand
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 ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
CMP <address> Compare contents of ACC with contents of <address>.
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.
JMP <address> Jump to the given address.
OUT Output to the screen the character whose ASCII value is stored in ACC.
END Return control to the operating system.
Complete the trace table for the given assembly language program.
[7]
2 The following table shows assembly language instructions for a processor which has one general
purpose register, the Accumulator (ACC) and an Index Register (IX).
Instruction
Explanation
Op code Operand
Direct addressing. Load the contents of the location at the given address
LDD <address>
to ACC.
Indexed addressing. Form the address from <address> + the contents of
LDX <address>
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 ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
CMP <address> Compare contents of ACC with contents of <address>.
Following compare instruction, jump to <address> if the compare was
JPE <address>
True.
Following compare instruction, jump to <address> if the compare was
JPN <address>
False.
JMP <address> Jump to the given address.
OUT Output to the screen the character whose ASCII value is stored in ACC.
END Return control to the operating system.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[2]
X 1 1 1 1 0 0 1 0
.......................................................................................................................................[1]
.......................................................................................................................................[1]
.......................................................................................................................................[1]
(iv) Show the result on the general purpose register (X) after the following instruction is run.
INC X
[1]
(c) The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are provided with a copy of the instruction set.
Complete the trace table for the given assembly language program.
[7]
3 The table shows the assembly language instructions for a processor which has one general
purpose register – the Accumulator.
Instruction
Explanation
Op Code Operand
STO <address> store the contents of the Accumulator at the given address
(c) Trace this assembly language program using the trace table.
Memory Address
Accumulator 507 508 509 510
22 170 0 0
[5]
7 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC).
Instruction
Explanation
Op code Operand
Main memory
(a) (i) Show the contents of the Accumulator after execution of the instruction:
(ii) Show the contents of the Accumulator after execution of the instruction:
Accumulator:
0110 1001
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(iii) Show the contents of the Accumulator after execution of the instruction:
Operand + IX
LDX 120 + 6 = 126
Index Register: 0 0 0 0 0 1 1 0
4 2
0100 0001
Accumulator:
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(b) Trace the assembly language program using the trace table.
320 49
321 36
322 0
323 0
Trace table:
Memory address
Accumulator
320 321 322 323
49 36 0 0
36
37
37
[6]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every reasonable
effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the 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 International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.
9 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an index register (IX).
Instruction
Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of 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.
STO <address> Store contents of ACC at the given address.
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
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.
JMP <address> Jump to the given address.
OUT Output to screen the character whose ASCII value is stored in ACC.
(a) The diagram shows the current contents of a section of main memory and the index register:
60 0011 0010
61 0101 1101
62 0000 0100
63 1111 1001
64 0101 0101
65 1101 1111
66 0000 1101
67 0100 1101
68 0100 0101
69 0100 0011
...
1000 0110 1001
Index register: 0 0 0 0 1 0 0 0
8
© UCLES 2016 9608/11/M/J/16
13
(i) Show the contents of the Accumulator after the execution of the instruction:
LDX 60 +8 = 68
Accumulator: 0100 0101
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) Show the contents of the index register after the execution of the instruction:
DEC IX
Index register:
[1]
(b) Complete the trace table on the opposite page for the following assembly language program.
50 LDD 100
51 ADD 102
52 STO 103
53 LDX 100
54 ADD 100
55 CMP 101
56 JPE 58
57 JPN 59
58 OUT
59 INC IX
60 LDX 98
61 ADD 101
62 OUT
63 END
...
100 20
101 100
102 1
103 0
IX (Index Register) 1
ASCII Code 118 119 120 121 122 123 124 125
Character v w x y z { | }
Trace table:
Memory address
Instruction Working ACC IX OUTPUT
address space 100 101 102 103
20 100 1 0 1
50
51
52
53
54
55
[7]
9 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an index register (IX).
Instruction
Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of 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.
STO <address> Store contents of ACC at the given address.
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
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.
JMP <address> Jump to the given address.
OUT Output to screen the character whose ASCII value is stored in ACC.
(a) The diagram shows the current contents of a section of main memory and the index register:
60 0011 0010
61 0101 1101
62 0000 0100
63 1111 1001
64 0101 0101
65 1101 1111
66 0000 1101
67 0100 1101
68 0100 0101
69 0100 0011
...
1000 0110 1001
Index register: 0 0 0 0 1 0 0 0
(i) Show the contents of the Accumulator after the execution of the instruction:
LDX 60
Accumulator:
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) Show the contents of the index register after the execution of the instruction:
DEC IX
Index register:
[1]
(b) Complete the trace table on the opposite page for the following assembly language program.
50 LDD 100
51 ADD 102
52 STO 103
53 LDX 100
54 ADD 100
55 CMP 101
56 JPE 58
57 JPN 59
58 OUT
59 INC IX
60 LDX 98
61 ADD 101
62 OUT
63 END
...
100 20
101 100
102 1
103 0
IX (Index Register) 1
ASCII Code 118 119 120 121 122 123 124 125
Character v w x y z { | }
Trace table:
Memory address
Instruction Working ACC IX OUTPUT
address space 100 101 102 103
20 100 1 0 1
50
51
52
53
54
55
[7]
4 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an index register (IX).
Instruction Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC.
Indexed addressing. Form the address from <address> + the contents of the
LDX <address>
index register. Copy the contents of this calculated address to ACC.
STO <address> Store contents of ACC at the given address.
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
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 screen the character whose ASCII value is stored in ACC.
Index register: 1 1 0 0 1 1 0 1
(a) Show the contents of the index register after the execution of the instruction:
INC IX
Index register:
[1]
(b) Complete the trace table on the opposite page for the following assembly language program.
20 LDX 90
21 DEC ACC
22 STO 90
23 INC IX
24 LDX 90
25 DEC ACC
26 CMP 90
27 JPE 29
28 JPN 31
29 ADD 90
30 OUT
31 ADD 93
32 STO 93
33 OUT
34 END
:
:
90 2
91 90
92 55
93 34
IX 2
ASCII Code 65 66 67 68 69 70 71 72
Character A B C D E F G H
Trace table:
Memory address
Working ACC IX OUTPUT
Instruction
space 90 91 92 93
2 90 55 34 2
20
21
22
23
24
25
26
[7]
4 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
Op code Op code Explanation
Operand
(mnemonic) (binary)
Immediate addressing. Load the denary number n to
LDM #n 0000 0001
ACC.
Direct addressing. Load the contents of the location
LDD <address> 0000 0010
at the given address to ACC.
Indirect addressing. At the given address is the
LDI <address> 0000 0101 address to be used. Load the contents of this second
address to ACC.
Indexed addressing. Form the address from
<address> + the contents of the Index Register
LDX <address> 0000 0110
(IX). Copy the contents of this calculated address to
ACC.
LDR #n 0000 0111 Immediate addressing. Load number n to IX.
STO <address> 0000 1111 Store the contents of ACC at the given address.
The following diagram shows the contents of a section of main memory and the Index Register (IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.
IX 0 0 0 0 0 0 1 1
Main
(i) LDM #500
Memory
ACC 500
................................................................[1]
Address contents
495 13
(ii) LDD 500
496 86
ACC 496
................................................................[1] 497 92
(b) Each machine code instruction is encoded as 16-bits (8-bit op code followed by an 8-bit
operand).
LDM #17
LDX #97
[3]
(c) Using an 8-bit operand, state the maximum number of memory locations, in denary, that can
be directly addressed.
...............................................................................................................................................[1]
0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0
.......................................................................................................................................[2]
05 3F
Write the equivalent assembly language instruction, with the operand in denary.
.......................................................................................................................................[2]
5 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
Op code Op code Explanation
Operand
(mnemonic) (binary)
Direct addressing. Load the contents of
LDD <address> 0001 0011 the location at the given address to the
Accumulator (ACC).
Indirect addressing. The address to be used is
LDI <address> 0001 0100 at the given address. Load the contents of this
second address to ACC.
Indexed addressing. Form the address from
<address> + the contents of the Index
LDX <address> 0001 0101
Register. Copy the contents of this calculated
address to ACC.
Immediate addressing. Load the denary
LDM #n 0001 0010
number n to ACC.
Immediate addressing. Load denary number n
LDR #n 0001 0110
to the Index Register (IX).
Store the contents of ACC at the given
STO <address> 0000 0111
address.
The following diagram shows the contents of a section of main memory and the Index Register (IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.
IX 0 0 0 0 0 1 1 0
4 2
(i) LDD 355
Main
ACC 351
.................................................. [1] memory
Address contents
(ii) LDM #355
350
ACC 355
.................................................. [1] 351 86
(b) Each machine code instruction is encoded as 16 bits (8-bit op code followed by an 8-bit
operand).
LDM #67
LDX #7
[3]
0 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0
.......................................................................................................................................[2]
16 4D
Write the assembly language for this instruction with the operand in denary.
.......................................................................................................................................[2]
4 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
Op code Op code Explanation
Operand
(mnemonic) (binary)
Immediate addressing. Load the denary number n to
LDM #n 0000 0001
ACC.
Direct addressing. Load the contents of the location
LDD <address> 0000 0010
at the given address to ACC.
Indirect addressing. At the given address is the
LDI <address> 0000 0101 address to be used. Load the contents of this second
address to ACC.
Indexed addressing. Form the address from
<address> + the contents of the Index Register
LDX <address> 0000 0110
(IX). Copy the contents of this calculated address to
ACC.
LDR #n 0000 0111 Immediate addressing. Load number n to IX.
STO <address> 0000 1111 Store the contents of ACC at the given address.
The following diagram shows the contents of a section of main memory and the Index Register (IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.
IX 0 0 0 0 0 0 1 1
Main
(i) LDM #500
Memory
500 Address contents
ACC ................................................................[1]
495 13
(ii) LDD 500
496 86
ACC 496
................................................................[1] 497 92
(b) Each machine code instruction is encoded as 16-bits (8-bit op code followed by an 8-bit
operand).
(c) Using an 8-bit operand, state the maximum number of memory locations, in denary, that can
be directly addressed.
...............................................................................................................................................[1]
0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0
.......................................................................................................................................[2]
05 3F
Write the equivalent assembly language instruction, with the operand in denary.
.......................................................................................................................................[2]