0% found this document useful (0 votes)
31 views27 pages

MPMC - 3.3 8086 - Addressing Modes

The document discusses the various addressing modes of the 8086 microprocessor. It describes 8 addressing modes including immediate, direct, register, register indirect, indexed, register relative, based indexed, and relative based indexed. It also covers addressing modes for control transfer instructions including intrasegment direct, intrasegment indirect, intersegment direct, and intersegment indirect.

Uploaded by

sestokurta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views27 pages

MPMC - 3.3 8086 - Addressing Modes

The document discusses the various addressing modes of the 8086 microprocessor. It describes 8 addressing modes including immediate, direct, register, register indirect, indexed, register relative, based indexed, and relative based indexed. It also covers addressing modes for control transfer instructions including intrasegment direct, intrasegment indirect, intersegment direct, and intersegment indirect.

Uploaded by

sestokurta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

3.

3 8086 – Addressing Modes

3.3 8086 – Addressing Modes

Module:3 8086 Microprocessor


Course: BECE204L – Microprocessors and Microcontrollers
-Dr Richards Joe Stanislaus
Assistant Professor - SENSE
Email: [email protected]
3.3 8086 – Addressing Modes

Module:3 8086 Microprocessor 3 hours

• 8086 Microprocessor: Architecture and Basic configurations, System


design using 8086, Introduction to Multiprogramming, System Bus
Structure, Multiprocessor configurations, Coprocessor. Introduction
to ARM7, Intel I (i3, i5, i7) Series Processors.
3.3 8086 – Addressing Modes

0. Machine language instruction formats


• Machine language instruction format – one or more number of fields
• CPU executes instruction using information in these fields
• First field is called operation code field or opcode field
(Indicates type of operation to be performed by CPU)
• Other fields : operand fields
• 6 general formats of 8086 instruction set
Length of instruction may vary from one byte to six bytes
3.3 8086 – Addressing Modes

1. Introduction
• Addressing mode – Way of locating data or operand
• Based on data types used in instruction and memory addressing mode
• Instructions may be categorized as
i) Sequential control flow instructions
After execution of instruction, transfers control to next instruction
Example: following instructions: Arithmetic, logical, data transfer and
processor control
ii) Control transfer instructions:
Transfer control to predefined address or address somehow speicied
in instruction after their execution
Example: INT, CALL, RET, JUMP
3.3 8086 – Addressing Modes

2.1 Addressing mode: Immediate


• Immediate data is a part of instruction
This data appears in form of successive byte or bytes
• Example: MOV AX, 0005H (16 bit immediate data 0005H)
• MOV BL, 06H (8 bit immediate data 06H
3.3 8086 – Addressing Modes

2.2 Addressing mode: Direct


• 16 bit memory address (offset) or an IO address is directly specified in
the instruction
This data resides in a memory location in the data segment.
• Example: MOV AX, [5000H]
(16 bit Offset address 5000H, contents of DS register: segment address)
Effective address: 10H x DS + 5000H
• Example: IN 80H (80H is IO address)
3.3 8086 – Addressing Modes

2.3 Addressing mode: Register


• Data is stored in a register, and
it is referred using the particular register.
All registers except IP may be used in this mode
• Example: MOV BX, AX
ADC AL, BL
Operands in these instructions are provided in registers BX, AX, AL, BL
3.3 8086 – Addressing Modes

2.4 Addressing mode: Register Indirect


• Address of memory location which contains data(or operand) is
determined in an indirect way using offset registers.
• Offset address of the data is stored in either BX, or SI or DI register.
• Default segment is either DS or ES (and available in DS/ES register)
• Data is supposed to be available at address pointed by content of any of
the above registers in default data segment.
• Example: MOV AX, [BX]
Data is present in memory location in DS whose offset address is in BX.
Effective address of data is : 10H x DS + [BX]
3.3 8086 – Addressing Modes

2.5 Addressing mode: Indexed


• Offset of the operand is stored in one of the index registers.
• DS is default segment for Index registers SI and DI.
• This mode is special case of previously discussed register indirect
addressing mode.
• Example: MOV AX, [SI]
MOV CX, [DI]
Data is available in offset address stored in SI in DS.
Effective address of data is : 10H x DS + [SI]
Contents of this address will be transferred to AX register.
3.3 8086 – Addressing Modes

2.6 Addressing mode: Register Relative


• Data is available in effective address formed by adding an 8 bit or 16-
bit displacement with the content of any one of the registers BX or
BP or SI or DI in default segment (DS or ES).
• Example:
MOV AX, 50H[BX] (Effective address: 10H x DS + 50H + [BX])
MOV 10H[SI], DX (Effective address: 10H x DS + 10H + [SI])
3.3 8086 – Addressing Modes

2.7 Addressing mode: Based Indexed


• Effective address of data is formed by adding base register (any one
of BX or BP) to contents of Index register.
• DS or ES may be default segment.
• Example: With BX is base register and SI or DI as index register:
MOV AX, [BX] [SI] (Effective address: 10H x DS + [BX] + [SI] )
MOV [BX] [DI], AX
3.3 8086 – Addressing Modes

2.8 Addressing mode: Relative Based Indexed


• Effective address of data is formed by adding 8 or 16 bit displacement
with sum of contents of base register (any one of BX or BP) and any
one of Index register.
• DS or ES may be default segment.
• Example:
With 50BX is immediate displacement,
BX is base register and SI as index register
• MOV AX, 50H [BX] [SI] (Effective address:10H x DS + [BX]+[SI] + 50H)
• ADD 60H [BX] [SI], BP
This instruction adds contents of BP and contents of memory location with
effective address 10H x DS + [BX] + [SI] + 60H and is stored in this
memory location.
3.3 8086 – Addressing Modes

Addressing modes:
Control and transfer instructions
• Addressing modes depend upon whether destination location is
within same segment or in different one.
It also depends upon method of passing destination address to the
processor.
• Two addressing modes for control transfer instructions:
(a) Intersegment mode: If location to which control is to be
transferred lies in different segment other than current segment.
(b) Intrasegment mode: If location to which control is to be
transferred lies in same segment as the current segment.
3.3 8086 – Addressing Modes

Addressing modes:
Control and transfer instructions
3.3 8086 – Addressing Modes

2.9 Addressing modes: Intrasegment Direct


mode
• If location to which control is to be transferred lies in same
segment as the current segment (where control transfer
instruction is present) and appears directly in the instruction as
immediate displacement value.
• Displacement is computed relative to the content of instruction
pointer IP.
• Effective address to which control will be transferred is given by
sum of 8-bit or 16 bit displacement and current content of IP.
• for JMP (jump),
Short jump: if signed displacement (d) is of 8 bits (-128 < d < +127)
Long jump: if signed displacement (d) is of 16 bits
(-32768 < d < +32767)
3.3 8086 – Addressing Modes

2.9 Addressing modes: Intrasegment Direct


mode
• Example: JMP SHORT LABEL
LABEL lies within -128 and +127 from current IP contents
• Short LABEL is 8-bit signed displacement.
• If 16 bit target address of a label: This means displacement lies within
-32768 to + 32767.
• Problem in the same segment,
when forward jump is needed at relative address greater than 32767
or when backward jump at relative address -32768
• If IP contains 5000H, forward jump may be allowed at all displacement
DISP so that IP+DISP = FFFFH or
DISP = FFFF-5000H = AFFFH
3.3 8086 – Addressing Modes

2.9 Addressing modes: Intrasegment Direct


mode
• If IP contains 5000H, forward jump may be allowed at all displacement
DISP so that IP+DISP = FFFFH or
DISP = FFFF-5000H = AFFFH
• NEAR PTR jumps: If displacement exceeds AFFFH ( or from B000H
to FFFFH) then all such jumps will be treated as backward jumps.
NEAR PTR jumps are coded as :
JMP NEAR PTR LABEL
3.3 8086 – Addressing Modes

2.10 Addressing modes: Intrasegment Indirect


mode
• Displacement to which control is to be transferred is in same
segment in which control transfer instruction lies
But is passed to the instruction indirectly.
• Branch address is found as contents of register or memory location.
• This may be used in unconditional branch instructions.
• Example:
JMP [BX] ; Jump to effective address stored in BX
JMP [BX + 5000H ]
3.3 8086 – Addressing Modes

2.11 Addressing modes: Intersegment Direct


mode
• If address to which control is to be transferred is in different segment
• Branching from one code segment to another code segment.
• CS and IP of the destination address are specified directly in the
instruction.
• Example:
JMP 5000H: 2000H
Jump to effective address 2000H in segment 5000H :
Effective address is: 10H x 5000H + 2000H
3.3 8086 – Addressing Modes

2.12 Addressing modes: Intersegment Indirect


mode
• If address to which control is to be transferred is in different segment
• Branching from one code segment to another code segment.
• Control is passed to the instruction indirectly (contents of
memory block containing four bytes
IP (LSB), IP (MSB), CS(LSB), CS(MSB) sequentially
• Example:
JMP [2000H]
Jump to address in other segment specified at effective address
2000H in data segment, that points to memory block as said above.
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
• For the following contents of different registers:
Offset (displacement) = 5000H
[AX] – 1000H, [BX] – 2000H, [SI] – 3000H, [DI] – 4000H, [BP] – 5000H,
[SP] – 6000H, [CS] – 0000H, [DS] – 1000H, [SS] – 2000H, [IP] – 7000H
• Note: Shifting a number four times is equivalent to multiplying it by 16 D or
10H
1. Direct addressing mode: MOV AX, [5000H]
Note: DS:OFFSET  1000H: 5000H
Segment address: 10H x DS = 10000H
Offset address : 5000H
Effective address: 15000H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
• For the following contents of different registers:
Offset (displacement) = 5000H
[AX] – 1000H, [BX] – 2000H, [SI] – 3000H, [DI] – 4000H, [BP] – 5000H,
[SP] – 6000H, [CS] – 0000H, [DS] – 1000H, [SS] – 2000H, [IP] – 7000H
• Note: Shifting a number four times is equivalent to multiplying it by 16 D or
10H
2. Register Indirect addressing mode: MOV AX, [BX]
Note: DS:[BX] 1000H:2000H
Segment address: 10H x DS = 10000H (BX has offset address in DS)
Offset address (in BX): 2000H
Effective address: 12000H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
• For the following contents of different registers:
Offset (displacement) = 5000H
[AX] – 1000H, [BX] – 2000H, [SI] – 3000H, [DI] – 4000H, [BP] – 5000H,
[SP] – 6000H, [CS] – 0000H, [DS] – 1000H, [SS] – 2000H, [IP] – 7000H
• Note: Shifting a number four times is equivalent to multiplying it by 16 D or
10H
3. Register relative mode: MOV AX, 5000 [BX]
Note: DS:[5000 + BX]  1000H: 5000H + 2000H  1000H:7000H
Segment address: 10H x DS = 10000H
Offset address : 7000H
Effective address: 17000H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
• For the following contents of different registers:
Offset (displacement) = 5000H
[AX] – 1000H, [BX] – 2000H, [SI] – 3000H, [DI] – 4000H, [BP] – 5000H,
[SP] – 6000H, [CS] – 0000H, [DS] – 1000H, [SS] – 2000H, [IP] – 7000H
• Note: Shifting a number four times is equivalent to multiplying it by 16 D or
10H
4. Based Indexed addressing mode: MOV AX, [BX] [SI]
Note: DS:[BX+SI] 1000H:2000H+3000H  1000H:5000H
Segment address: 10H x DS = 10000H
Offset address : 5000H
Effective address: 15000H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
• For the following contents of different registers:
Offset (displacement) = 5000H
[AX] – 1000H, [BX] – 2000H, [SI] – 3000H, [DI] – 4000H, [BP] – 5000H,
[SP] – 6000H, [CS] – 0000H, [DS] – 1000H, [SS] – 2000H, [IP] – 7000H
• Note: Shifting a number four times is equivalent to multiplying it by 16 D or
10H
5. Relative based indexed mode: MOV AX, 5000 [BX] [SI]
Note: DS:[5000 + BX + SI] 1000H:5000H+2000H+3000H1000H:A000H
Segment address: 10H x DS = 10000H
Offset address : A000H
Effective address: 1A000H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
6. Intrasegment Indirect addressing mode: CALL [BX]
Suppose main program is in code segment with CS = 1000H, BX = 0050H
Main program calls subroutine residing in same code segment.
Base register contains offset of subroutine: BX = 0050H
Offset is specified indirectly as contents of BX register.
Note: CS:[BX] 1000H:0050H
Segment address: 10H x CS = 10000H
Offset address : 0050H
Effective address: 10050H
3.3 8086 – Addressing Modes

3. Forming effective addresses in different


modes
6. Intersegment direct addressing mode: CALL 2000H:0050H
Suppose main program is in code segment and other subroutine is in
another code segment with its CS = 2000H.
Control now goes to different segment and address is directly specified in
instruction,
Offset is specified directly as 0050H.
Note: CS:0050H 2000H:0050H
Segment address: 10H x CS = 20000H
Offset address : 0050H
Effective address: 20050H

You might also like