CSc. Worksheet-Assembly Language 3 (Solution)
CSc. Worksheet-Assembly Language 3 (Solution)
A’S
Paper 1
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.
√
CMP found
√
STO 20
X 1 0 1 1 1 0 1 0
Ans: 186
Ans: BA
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.
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