0% found this document useful (0 votes)
457 views8 pages

Assembly Language Test 1

The document describes an assembly language for a processor with one general purpose register called the Accumulator (ACC) and an index register (IX). It includes instructions like LDD to load data into the ACC, LDX for indexed addressing, and a compare and jump instruction. An example is provided to demonstrate using the instructions including contents of memory and registers.

Uploaded by

Dennis Mumanyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
457 views8 pages

Assembly Language Test 1

The document describes an assembly language for a processor with one general purpose register called the Accumulator (ACC) and an index register (IX). It includes instructions like LDD to load data into the ACC, LDX for indexed addressing, and a compare and jump instruction. An example is provided to demonstrate using the instructions including contents of memory and registers.

Uploaded by

Dennis Mumanyi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1 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.

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 screen the character whose ASCII value is stored in ACC.

END Return control to the operating system.

(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:

Show how you obtained your answer.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[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

Selected values from the ASCII character set:

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]
2 . 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.

The diagram shows the contents of the main memory:

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:

Explain how you arrived at your answer.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]
(b) (i) Complete the trace table below for the following assembly language program. This
program contains denary values.

100 LDD 800


101 ADD 801
102 STO 802
103 LDD 803
104 CMP 802
105 JPE 107
106 JPN 110
107 STO 802
108 OUT
109 JMP 112
110 LDD 801
111 OUT
112 END
:
:
800 40
801 50
802 0
803 90

Selected values from the ASCII character set:

ASCII code 40 50 80 90 100


Character ( 2 P Z d

Trace table:

Memory address
ACC OUTPUT
800 801 802 803

40 50 0 90

[4]
(ii) There is a redundant instruction in the code in part (b)(i).

State the address of this instruction.

.......................................................................................................................................[1]

(c) The program used the ASCII coding system for character codes. An alternative coding system
is Unicode.

(i) Give two disadvantages of using ASCII code.

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

.......................................................................................................................................[2]

(ii) Describe how Unicode is designed to overcome the disadvantages of ASCII.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

You might also like