Saturday, May 30, 2009

Addressing modes required for this machine?

Assume that a machine and its OS does not support stack, but support arrays, subroutine calls with maximum of 2 arguments; and other simple arithmetic, logic and shift instructions. What addressing modes would be required for this machine? Justify your answer.


Machine and its OS support arrays, Subroutines calls with maximum of 2 arguments, such as arithmetic, logic and shift instruments.

Arithmetic Operation:- Almost all the machines provide the four basic arithmetic operations on sign fixed point integer. Some machines provide operation on floating point and packed decimal number.
It arithmetic operations which can be provided in a machine in general are-
ADD, SUBTRACT, MULTIPLY, DIVIDE
ABSOLUTE, NEGATE, INCREMENT, DECREMENT

Logical and Shift Operation:- The logical operations are based an Boolean operation performed an binary data. Some of the logical operations are – AND, OR, NOT Exclusive OR.

Shift Operation:-

* In logical left most right shift the “bitin” is a O bit
*Arithmetic shift is same as logical shift except for the sign bit, which is not shifted.
*A Circular shift uses the “bit out” bit as the “bit in” bit
Subroutine Call:- It is a self user program which contains the code often used repeatedly in a large program.

In Subroutine is called explicity by a program stalment
100 CALL X
101
102
103 CALL X
200 SUB X
201 STATEMENT X
202
OTHER STATEMENT
300 RETURN


There are so many addressing modes such as: -
Ø Index- addressing mode.
Ø Relative- addressing mode.
Ø Indirect- addressing mode.
Ø Base- addressing mode.
Ø Direct- addressing mode.
Ø Immediate addressing mode.
Ø Displacement addressing mode
But for the above machine we can use Displacement addressing machine.

EA = A+ (R)
DA = DO (A)
EA = DA+ (R)
D = (EA)
(DA is the direct address)
IA = A + (R)
EA = (IA)
D = (EA)
(IA is Indexed address)

No comments:

Post a Comment