Define addressing modes. Explain various addressing modes in 8086 microprocessor.
Addressing modes : The different methods (modes) to select (address) the operand are called the addressing modes.
Various addressing modes in 8086 microprocessor are as follows :
(i) Register addressing :
In this type of addressing, the operand to be accessed is specified as residing on one of the internal register of 8086.
The contents of CX ( 16 bit word), the source operand is moved to BX, the destination of operand. In this instruction, both the source and destination operand have been specified as the consents of external registers of 8086, i.e. CX and BX respective.
The datum is in the register that is specified by the instruction for a 16 bit operand, a register may be AX, BX, CX, DX, SI, DI, SP or BP and for an 8 bit operand a register may be AL, AH, BL, BH, CL, CH, DL, or DH.
Instruction Register
Register --> Operand
(ii) Immediate Addressing :
In this type of addressing the source operand is the part of the instruction itself instead of the contents of any internal register or memory location. The immediate operand can be either a byte or word of data.
Example, MOV BL, 10 H
The source operand is 10H and is an example of byte wide immediate source operand.
MOB BX, 1234H
The source is 1234H and is an example of world wide immediate source operand.
Instrcution
Operand
(iii) Direct Addressing :
In this type of addressing the bit effective memory address of the operand follows the instruction opcode. This effective address (EA) is actually an offset of the storage location of the operand from the location specified by the current value of the DS register. The EA is combined with the current contents of DS in the 8086 to produce the actual physical address (PA) of the operand. As an example, in the following instruction. The source operand follows the direct addressing mode.
MOV CX, [1234]
It means "Move the contents of the memory location which is at an offset 1234 from the current data segment, into the internal register CX". When the instruction is executed, the 8086 combines 1234 H with the current contents of DATA segment to get the physical address of the source operand. Let DS = 0400H. Then, PA = 04000 + 1234 = 05234 H. So the contents of the physical address 05234 H its copied into the internal register CX of 8086.
(iv) Register Indirect Addressing :
In this mode, the effective address of the operand is not the direct part of the instruction, But resides in either a base register or an index register within the 8086. The base register can either be BX or base pointer register BP, and the enclose register either be SI or DI, i.e source index register a destination index register.
Example : MOV CX [SI] The EA is in the source index register.
"Move the contents of the memory location when is at on offset equal to the contents of source index register from the current data segment, into the internal response CX".
Let, DS = 0400H, SI = 1002H
Pa = 0400 + 1002 = 05002 H
and then the contents of 05002H memory location is stored into internal register CX of 8086.
(V) Register Relative Addressing :
In this type of addressing, the EA of the operand in the sum of an 8 bit displacement and the contents of either a base register or an index register.
The base register can be either BX or BP and index register can be either SI or DI. As an example, in the following instruction the EA is the sum of source indirect displacement.
MOV AH, [SI] + DISP
i.e. EA = DI + EA + DISP
PA = DS + EA
Let, [DS] = 0400H
[SI] = 2000H and
DISP = 04000 + 2000 + 1234 = 007234H
04000
2000
+ 1234
07234
Then as a result of the indirect on given the contents of 07234H is copied in the AH register, i.e higher byte part of register AX of 8086.
Post a Comment