Types of Addressing Mode

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

Contents

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.

Generally, the programs are written in a high-level language, as it is a convenient


way to define the variables and operations that the programmer needs to perform
on the variables. Later, this program is compiled to generate the machine code. The
machine code has low-level instructions.

The low-level instruction has opcode and operands. Addressing mode has nothing to


do with the opcode part. It focuses on presenting the operand’s address in the
instructions.

TYPES OF ADDRESSING MODES:

1. IMMEDIATE ADDRESSING MODE:


The simple form of addressing is immediate addressing, in which the operand is
actually present in the instruction.

Operand=A

example of immediate addressing mode:

Add R1, #100

Store R1, 100H

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.

Fig: Immediate Addressing Mode

2. DIRECT ADDRESSING MODE:


Every simple form of addressing is immediate addressing, in which the address
field contains the effective address of the operand.

Effective address of memory location: EA=A

For example, observe the examples below:

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.

Fig: Direct Addressing Mode

3. INDERECT ADDRESSING MODE:


The length of the address field is usually less than the word length in indirect
addressing, thus limiting the address range. One solution is to have the address
field refer to the address of a word in memory, which in turn contains a full-
length address of the operand. This is known as indirect addressing.
Symbolically, EA = B

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

our examples for register addressing mode.

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

5. REGISTER INDIRECT ADDRESSING MODE:


Register indirect addressing is similar to indirect addressing, except that the
address field refers to a register instead of a memory location. It requires only
one memory reference and no special calculation.

EA = Content of R=A

For example:

Load R2, (R1)   // Load R1, A

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

6. RELATIVE ADDRESSING MODE:


For Relative Addressing, the implicitly referenced register is the program
counter (PC). That is, the current instruction address is added to the address
field to produce the EA. Thus, the effective address is a displacement relative to
the address of the instruction.

EF= value of PC + Address

As here the operand addresses are found relative to the program counter. That’s
why it is referred to as relative address mode.

Relative addressing mode doesn’t require memory references. 

Relative addressing mode doesn’t have any disadvantage as such.

6
Fig: Relative Addressing Mode

7. INDEXED ADDRESSING MODE:


Index addressing mode is helpful when the instructions in the program are
accessing the array or the large range of memory addresses. In this mode, the
effective address is generated by adding a constant to the register’s content.
The content of the register does not change.

The symbolic representation of index addressing mode is denoted as:

X(R)

And the effective address is denoted by

EA = X + (R)

For example, consider the instruction below:

Load R1, A

Load R2, (R1)

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.

Fig: Index Addressing Mode

8. AUTO INCREMENT ADDRESSING MODE:


Once the content of the register is accessed by the instruction the register’s
content is incremented to refer the next operand.

It is represented as:

(R)+

Here, the effective address is content of the register as it is enclosed by


parenthesis. The content of register which is referring to a memory location is
incremented so that it could point the next memory location where the next
operand is stored.

8
Fig: Auto increment addressing mode

9. AUTO DECREMENT ADDRESSING MODE:


It is just opposite of auto-increment mode. In auto decrement mode the content
of the register is decremented initially and then the decremented content of the
register is used as effective address.

It is presented as:

-(R)

The auto-increment and decrement mode help to implement the stack structure.

7F 3000

6B 2900

5C 2800

Fig: Auto decrement addressing mode

9
Installation of DOSBox

CODE IN ALP:

10
CODE IN ALP:

VARIFICATION OF OUTPUT:

11
REFERENCES:

2020. [online] Available at: <https://www.youtube.com/watch?v=M-


to5_5gOlg&list=PL8pd8Qy1uoSl8pKPK53G9x7epPM8UO6VZ&index=3

GeeksforGeeks. 2020. Geeksforgeeks | A Computer Science Portal For Geeks.


[online] Available at: <https://www.geeksforgeeks.org/> [Accessed 18 March
2020].

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

You might also like