Home »
Embedded Systems
Program Memory Addressing Mode of 8086 Microprocessor
In this tutorial, we will learn about the different addressing modes which lie within this program memory addressing mode in 8086 Microprocessor.
By Monika Sharma Last updated : May 15, 2023
Program Memory Addressing Mode
The program memory addressing mode is used in branch instructions. These branch instructions are instructions which are responsible for changing the regular flow of the instruction execution and shifting the control to some other location. In 8086 microprocessor, these instructions are usually JMP and CALL instructions.
Types of Program Memory Addressing Mode
The program memory addressing mode contains further three addressing modes within it. They are:
- Direct Program memory Addressing
- Indirect Program memory Addressing
- Relative Program memory Addressing
Let us study each of them in detail about their instructions and the way of processing by the microprocessor while executing them.
1) Direct Program Memory Addressing
In this addressing mode, the offset address where the control is to be shifted is defined within the instruction. This mode is called direct addressing mode because the required address is directly present in the instruction rather than being stored in some register.
Example:
JMP 4032H
Here, the working of the above instruction will be as follows:
The current value of IP which holds the address of next instruction to be executed will be stored in the TOP OF THE STACK. Now, the IP will be replaced by the mentioned value, i.e. IP <- 4032H
Now, the Memory address is calculated as: (Contents of CS) X 10H + (contents of IP)
2) Indirect Program Addressing mode
As the name suggests, in this addressing mode, the offset address is not present directly in the instruction. It is rather stored in any of the CPU registers (Internal Register). So, the contents of the Instruction Pointer (IP) will be replaced by the contents of that register.
Example:
JMP BX
Working:
Suppose that the content of the BX register is 0003H. So, the working of the microprocessor for executing the above instruction will be as follows:
IP <- contents of BX
i.e. IP <- 0003H
And the required memory address is calculated in a similar way as in Direct Addressing mode: (Contents of CS) X 10H + (contents of IP)
3) Relative Program Memory Addressing
In this Addressing mode, the offset address is equal to the content of the Instruction Pointer (IP) plus the 8 or 16-bit displacement. For the 8 bit displacement, SHORT is used and for 16-bit displacement, LONG is used. This type of displacement will only be intra-segment, i.e. within the segment.
Example:
JMP SHORT OVER
Here, SHORT is used to represent the 8-bit displacement and OVER is the Label defined for any particular memory location.