Module 2
Module 2
consists of many millions of storage cells, each of which can store a bit
of information having the value 0 or 1.
are not handled individually. The usual approach is to deal with them in
groups of fixed size.
For this purpose, the memory is organized so that a group of n bits can
addresses.
string:
shown in the figure(b). In this case processor first reads the contents
of memory location A, then requests a second read operation using the
value B as an address to obtain the operand.
The initialization section of the program loads the counter value ‘n’
from memory location ‘N’ into R1 and uses the immediate addressing
mode to place the address value NUM1, which is the address of first
number in the list into R2.
Then it clears R0 to 0.
The first through the loop, the instruction
ADD (R2),R0
Fetches the operand at location NUM1 and adds it to R0.the second
ADD instruction adds 4 to the contents of the pointer R2,so that it
will contain the address value NUM2.
Effective Address:
EA= [Ri]+[Rj]
Syntax:
X(Ri,Rj)
EA=[Ri]+[Rj]+X
1) Autoincrement Mode
2) Autodecrement Mode
Autoincrement mode:
The effective address of an operand is contents of register specified
in the instruction. After accessing the operand, the contents of the
register are automatically incremented to point to the next item in
the list.
We denote autoincrement mode by putting the specified register in
parentheses, to show that contents of register are used as the
effective address.
44 Monday, March 4, 2019
The autoincrement mode is written as
(Ri)+
Autodecrement mode:
Assume that the first element is placed in location bottom, and when
new elements are pushed onto the stack, they are placed in
successively lower address locations. We use a stack that grows in
the direction of decreasing memory addresses in our discussion,
because this is common practice.
Subtract #4,SP
Move NEWITEM,(SP)
These two instructions move the word from location NEWITEM onto the
top of the STACK decrementing the stack pointer before the move.
In this case we must avoid pushing an item onto the stack when the
The stack pointer is loaded initially with the address value 2004. recall
off an empty stack the single instruction push and pop operations can
be replaced by the instruction sequences shown in the figure.
RETURN Instruction:
Loads the program counter(PC) with the contents of link register and
Later the subroutine returns other parameters, in this case the results
of the computation.
Figure shows how the program for adding a list of numbers can be
implemented as subroutine.
First Possibility:
The processor hardware ignores the interrupt-request line until
the execution of the first instruction of interrupt-service routine
has been completed.
Then, by using interrupt disable instruction as the first
instruction in the interrupt-service routine.
Typically the interrupt-enable instruction will be the last
instruction in the interrupt-service routine.