0% found this document useful (0 votes)
20 views4 pages

CSc. Worksheet-Assembly Language 3 (Solution)

The document provides a practical worksheet on assembly language instructions for a processor with an accumulator and an index register. It explains various addressing modes, conversion of binary values to decimal and hexadecimal, and includes a trace table for an assembly language program. Additionally, it distinguishes between symbolic and absolute addressing for specific instructions.

Uploaded by

afreenmullaji79
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)
20 views4 pages

CSc. Worksheet-Assembly Language 3 (Solution)

The document provides a practical worksheet on assembly language instructions for a processor with an accumulator and an index register. It explains various addressing modes, conversion of binary values to decimal and hexadecimal, and includes a trace table for an assembly language program. Additionally, it distinguishes between symbolic and absolute addressing for specific instructions.

Uploaded by

afreenmullaji79
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/ 4

CSc Practical Worksheet 3(Solution)

A’S
Paper 1

Topic: Assembly Language 3


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

Direct addressing : The operand is the address where the data is stored

Indirect addressing :The operand is an address, that address holds another address where
the data is stored

(ii) Explain how the instruction ADD 20 can be interpreted as either direct or indirect
addressing.
Direct addressing : 20 is the address of the data

Indirect addressing : 20 is an address which holds the address where the data is stored

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

Instruction Symbolic Absolute



ADD 90


CMP found


STO 20

(c) The current contents of a general purpose register (X) are:

X 1 0 1 1 1 0 1 0

(i) The contents of X represent an unsigned binary integer.

Convert the value in X into denary.

Ans: 186

(ii) The contents of X represent an unsigned binary integer.

Convert the value in X into hexadecimal.

Ans: BA

(iii) The contents of X represent a two’s complement binary integer.

Convert the value in X into denary.

Ans : -70
(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.

Instruction ASCII code table (selected


LDX 200
70 codes only)
OUT
71 ASCII code Character
STO 203
72 127 ?
LDD 204
73 128 !
INC ACC
74 129 “
STO 204
75 130 *
INC IX
76 131 $
LDX 200
77 132 &
CMP 203
78 133 %
JPN 81
79 134 /
OUT
80
LDD 204
81 Instruction Instruction set
CMP 205 Explanation
82 Op
JPN 74 Operand
code
83
END Direct addressing. Load the contents of
84 LDD <address>
the location at the given address to ACC.
… Indexed addressing. Form the address
130 from <address> + the contents of the
LDX <address>
200 Index Register. Copy the contents of this
133 calculated address to ACC.
201
130 LDR #n
Immediate addressing. Load the number
202 n to IX.
0
203 STO <address> Store contents of ACC at the given
0 address.
204
2 ADD <address> Add the contents of the given address to
205 ACC.
Add 1 to the contents of the register (ACC
INC <register>
or IX).
IX 0
DEC <register> Subtract 1 from the contents of the
register (ACC or IX).
Compare contents of ACC with contents of
CMP <address>
<address>.
Following a compare instruction, jump to
JPE <address>
<address> if the compare was True.
Following a compare instruction, jump to
JPN <address>
<address> if the compare was False.
JMP <address> Jump to the given address.
Output to the screen the character whose
OUT
ASCII value is stored in ACC.
END Return control to the operating system.
Complete the trace table for the given assembly language program.

Instruction Memory address


ACC IX OUTPUT
address 200 201 202 203 204 205

70 130 130 133 130 0 0 2 0

71 *

72 130

73 0

74 1

75 1

76 1

77 133

78

79

81 1

82

83

74 2

75 2

76 2

77 130

78

79

80 *

81 2

82

83

84

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy