COS2621 ASSIGNMENT 1 SOLUTIONS 2022
QUESTION 1
(a) The following table reflects the memory contents of a part of memory in a oneaddress machine
with an accumulator
What values do the following instructions load into the accumulator?
LOAD IMMEDIATE 20
LOAD IMMEDIATE 20: Immediate addressing. The value to be used forms part of the
instruction. In this instance, the value 20 will be loaded into the accumulator.
LOAD DIRECT 20
LOAD DIRECT 20: Direct addressing. The instruction contains the address where the value
is to found. Address 20 contains the value 30, thus the value 30 will be loaded into the
accumulator.
LOAD INDIRECT 20
LOAD INDIRECT 20: Indirect addressing. The instruction contains the address where the
address of the value to be used, is to be found. Address 20 contains the address of the value
to be used, ie address 30. Address 30 contains 40, thus the value 40 will be loaded into the
accumulator.
(b) Give examples of Intel x86 instructions in which the following addressing modes are used:
Immediate addressing : Immediate addressing mov ax,23
Direct addressing : Direct addressing mov ax,[a]
, Stack addressing : Stack addressing push ax (pop ax)
Indexed addressing : Indexed addressing mov ax,[si] (mov [di],ax)
Base-addressing: Base‐addressing mov ax,[bp] (mov ax,[bx])
Register indirect addressing: Register indirect addressing mov ax,[bx]
OR
QUESTION 2
Question 2 [11]
(a) Briefly discuss the concepts of
QUESTION 1
(a) The following table reflects the memory contents of a part of memory in a oneaddress machine
with an accumulator
What values do the following instructions load into the accumulator?
LOAD IMMEDIATE 20
LOAD IMMEDIATE 20: Immediate addressing. The value to be used forms part of the
instruction. In this instance, the value 20 will be loaded into the accumulator.
LOAD DIRECT 20
LOAD DIRECT 20: Direct addressing. The instruction contains the address where the value
is to found. Address 20 contains the value 30, thus the value 30 will be loaded into the
accumulator.
LOAD INDIRECT 20
LOAD INDIRECT 20: Indirect addressing. The instruction contains the address where the
address of the value to be used, is to be found. Address 20 contains the address of the value
to be used, ie address 30. Address 30 contains 40, thus the value 40 will be loaded into the
accumulator.
(b) Give examples of Intel x86 instructions in which the following addressing modes are used:
Immediate addressing : Immediate addressing mov ax,23
Direct addressing : Direct addressing mov ax,[a]
, Stack addressing : Stack addressing push ax (pop ax)
Indexed addressing : Indexed addressing mov ax,[si] (mov [di],ax)
Base-addressing: Base‐addressing mov ax,[bp] (mov ax,[bx])
Register indirect addressing: Register indirect addressing mov ax,[bx]
OR
QUESTION 2
Question 2 [11]
(a) Briefly discuss the concepts of