Types of Addressing Mode
Types of Addressing Mode
ADDRESSING MODES......................................................................................................................1
TYPES OF ADDRESSING MODES:..............................................................................................1
1. IMMEDIATE ADDRESSING MODE:.................................................................................1
2. DIRECT ADDRESSING MODE:..........................................................................................2
3. INDERECT ADDRESSING MODE:....................................................................................3
4. REGISTER DIRECT ADDRESSING MODES:................................................................4
5. REGISTER INDIRECT ADDRESSING MODE:...............................................................5
6. RELATIVE ADDRESSING MODE:.....................................................................................5
7. INDEXED ADDRESSING MODE:.......................................................................................6
8. AUTO INCREMENT ADDRESSING MODE:...................................................................7
9. AUTO DECREMENT ADDRESSING MODE:..................................................................8
Installation of DOSBox..................................................................................................................9
CODE IN ALP:.......................................................................................................................................9
CODE IN ALP:.....................................................................................................................................10
VARIFICATION OF OUTPUT:.......................................................................................................10
REFERENCES:....................................................................................................................................11
ADDRESSING MODES
Addressing mode refers to the specification of the location of data required by an
operation. Addressing modes are an aspect of the instruction set architecture in
most CPU design. The various addressing modes helps to identify the types of
operands in the instruction. Addressing modes are an aspect of the instruction set
architecture in most central processing unit design. An addressing mode specifies
how to calculate the effective memory address of an operand by using information
held in register and/or constant contained within a machine instruction or
elsewhere.
Operand=A
The Add instruction, adds 100 to R1’s content. The # sign in front of the value
indicates the immediate value to be operated. If a value does not have # sign in
front of it then it is the address of a memory location.
1
The next instruction Store considers the immediate value 100H as address as it
does not have # sign in front of it. The Store instruction stores the content of R2
at memory location 100H.
This mode can be used to define and use constant or set initial values of
variables. The advantage is that no memory reference other than the instruction
fetch is required to obtain the operand. The disadvantage is, the size of the
number sets, is small compare with the length.
Add R1, A
Store R1, B
2
The Add instruction includes the memory location A which has the value to be
added to the content of register R2. Similarly, the Store instruction has the
address of memory location B where the content of register R2 will be stored.
Below we have a figure showing the direct addressing of the operand A in the
Add instruction of the example above.
It required only one memory reference and special calculation. It is faster than
other memory addressing mode. To many bits are needed to specify address for
a large physical memory space.
When the shortened addressed is used, large physical memory can be addressed
with a relatively small number of bits. But slow to acquire an operand because of
an additional memory.
3
Fig: Indirect Addressing
Mode
4. REGISTER DIRECT ADDRESSING MODES:
In register direct addressing mode operand is placed in one of 8-bit or 16-bit
general purpose registers. Register direct addressing mode is similar to direct
addressing.
EA=R
Add R3, R2
Load R2, R1
In the examples above, the Add instruction uses registers to represent both of its
operands. Similarly, the Load instruction also uses registers to represent both of
its operands. So, the instruction above uses register addressing mode to
describe the address of the operand. Below, we have a figure showing the Add
instruction in the example above.
The advantages of register addressing are that only a small address field is
needed in the instruction and no memory reference is required. The
disadvantage of register direct addressing is that the address space is very
limited.
4
Fig: Register Direct Addressing Mode
EA = Content of R=A
For example:
The Load instruction above will load the value present at the memory location
contained by register R2 in the register R3. The figure below shows how the
register R3 gets loaded with the value stored in the memory location held by
register R2.
The advantages are that the same set of instructions can be used multiple times.
Disadvantages of relative addressing mode the number of memory reference is
more.
5
Fig: Register Indirect Addressing Mode
As here the operand addresses are found relative to the program counter. That’s
why it is referred to as relative address mode.
6
Fig: Relative Addressing Mode
X(R)
EA = X + (R)
Load R1, A
The above instructions will load the register R1, R2 with the contents, present at
the successive memory addresses from memory location A correspondingly.
7
Advantages of index addressing mode provides flexibility to specify memory
locations. Disadvantages is, the index addressing mode is complex to
implement.
It is represented as:
(R)+
8
Fig: Auto increment addressing mode
It is presented as:
-(R)
The auto-increment and decrement mode help to implement the stack structure.
7F 3000
6B 2900
5C 2800
9
Installation of DOSBox
CODE IN ALP:
10
CODE IN ALP:
VARIFICATION OF OUTPUT:
11
REFERENCES:
T, N., T, N., T, N., T, N. and T, N., 2020. Binary Terms - The Computer Science & IT
Guide. [online] Binary Terms. Available at: <https://binaryterms.com/>
[Accessed 18 March 2020].
12
13