COS2621 ASSIGNMENT 2 SOLUTIONS 2022
QUESTION 1
(a) The following table reflects the memory contents of a part of memory in a one address machine with
an accumulato
What values do the following instructions load into the accumulator? LOAD DIRECT 300 LOAD DIRECT 320
LOAD INDIRECT 325
SOLUTIONS
LOAD DIRECT 300: Load direct means that the instruction contains the address of
the operand: The value 325 is stored in address 300, so the value 325 will be stored
in the accumulator.
LOAD DIRECT 320: Load direct means that the instruction contains the address of
the operand: The value 300 is stored in address 320, so the value 300 will be stored
in the accumulator.
LOAD INDIRECT 325: Load indirect means that the address that contains the address of
the operand forms part of the instruction. Therefore, address 325 contains the address
of the operand, ie the address of the operand is 300. Address 300 contains 320, thus the
value 320 will be stored in the accumulator.
(b) Give examples of x86 instructions in which the following addressing modes are used: Immediate
addressing Direct addressing Stack addressing Indexed addressing Base-addressing Register indirect
addressing
SOLUTIONS
QUESTION 2
,
QUESTION 1
(a) The following table reflects the memory contents of a part of memory in a one address machine with
an accumulato
What values do the following instructions load into the accumulator? LOAD DIRECT 300 LOAD DIRECT 320
LOAD INDIRECT 325
SOLUTIONS
LOAD DIRECT 300: Load direct means that the instruction contains the address of
the operand: The value 325 is stored in address 300, so the value 325 will be stored
in the accumulator.
LOAD DIRECT 320: Load direct means that the instruction contains the address of
the operand: The value 300 is stored in address 320, so the value 300 will be stored
in the accumulator.
LOAD INDIRECT 325: Load indirect means that the address that contains the address of
the operand forms part of the instruction. Therefore, address 325 contains the address
of the operand, ie the address of the operand is 300. Address 300 contains 320, thus the
value 320 will be stored in the accumulator.
(b) Give examples of x86 instructions in which the following addressing modes are used: Immediate
addressing Direct addressing Stack addressing Indexed addressing Base-addressing Register indirect
addressing
SOLUTIONS
QUESTION 2
,