SlideShare a Scribd company logo
UNIT-I
MICROPROCESSOR
PROGRAMMING AND
STACK
INTEL 8086
16 BIT Processor.
Released by INTEL 1978
Designed using HMOS technology.
Now it manufactured using HMOS III technology.
It contains 29000 transistor
40 pin DIP
5 Volt Supply
Clock signal is not generated internally.
Requires an external asymmetric clock source with 30% duty cycle.
8284 clock generation is used to generate the required clock for
8086.
Maximum internal clock 5MHz
8086-110MHz
8086-2  8 MHz
8086-4  4 MHz.
8086 uses a 20 bit address to access memory
Memory capacity  2^ no.of address line =2 ^20=1 Mbyte.
8086 has two memory bankk512k byte each
Two memory bank
1.Even
2.Odd
The address line A0 is used to select even bank.
BHE’ is used for select odd bank.
I/O access:
Separate 16 bit address
So generate 2^16 =64 k address.
The signal M/I0’ is used to differentiate the memory & I/O adderess.
M/Io’  high  Memory adderss
 low I/O address
Operating modes:
Two modes
1. Maximum mode
2. minimum mode.
The mode is decided by a signal at MN/MX’ pin
MN/Mx’  high minimum mode & system is called uni processor.
MN/Mx’ low  maximum mode  multiprocessor.
Normally  MN/MX’ pin is permanently tied to low or high.
So that 8086 system can work in any one of the mode.
8086 can work with 8087 co processor in maximum mode.
8086 has two family of processor
1.808616 bit data bus externally
2. 8088 uses 8 bit data bus externally
8086 access memory in words
8088 access memory in bytes.
IBM  designed 1st
personal computer using INTEL 8088
microprocessor as CPU.
UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx
ARCHITECTURE OF
8086
MICROPROCESSOR
UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx
UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx
UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
The instruction will specify the name of the
register which holds the data to be operated by
the instruction.
Example:
MOV CL, DH
The content of 8-bit register DH is moved
to another 8-bit register CL
(CL)  (DH)
Group I : Addressing modes for register
and immediate data
1
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
In immediate addressing mode, an 8-bit or 16-bit
data is specified as part of the instruction
1
Example:
MOV DL, 08H
The 8-bit data (08H) given in the instruction is
moved to DL
(DL)  08H
MOV AX, 0A9FH
The 16-bit data (0A9FH) given in the instruction is
moved to AX register
(AX)  0A9FH
Group I : Addressing modes for register
and immediate data
20 Address lines  8086 can address up to
1M bytes of memory
220 =
However, the largest register is only 16 bits
Physical Address will have to be calculated Physical
Address : Actual address of a byte in memory. i.e.
the value which goes out onto the address bus.
Memory Address represented in the form –
Seg :Offset(Eg - 89AB:F012)
Each time the processor wants to access memory, it
takes the contents of a segment register, shifts it one
hexadecimal place to the left (same as multiplying by
1610), then add the required offset to form the 20-
bit address
89AB : F012  89AB  89AB0 (Paragraph to byte  89AB x 10 = 89AB0)
(Offset is already in byte unit)
F012  0F012
+ -------
98AC2 (The absolute address)
16 bytes of contiguous
memory
5
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Here, the effective address of the memory
location at which the data operand is stored is
given in the instruction.
The effective address is just a 16-bit number
written directly in the instruction.
Example:
MOV BX, [1354H]
MOV BL,
[0400H]
The square brackets around the 1354H denotes
the contents of the memory location. When
executed, this instruction will copy the contents of
the memory location into BX register.
This addressing mode is called direct because the
displacement of the operand from the segment
base is specified directly in the instruction.
Group II : Addressing modes for
memory data
7
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
register which holds the effective address (EA)
will be specified in the instruction.
Registers used to hold EA are any of the following
registers:
BX, BP, DI and SI.
Content of
the
DS
register
is used for base
Group II : Addressing modes for
memory data
In Register indirect addressing, name of
the
address calculation.
Example:
MOV CX, [BX]
Operations:
EA = (BX)
BA = (DS) x 1610
MA = BA + EA
(CX)  (MA)
or,
(CL)  (MA)
(CH)  (MA +1)
Note : Register/ memory
enclosed in brackets refer to
content of register/ memory
8
9
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
In Based Addressing, BX or BP is used to hold the
base value for effective address and a signed 8-bit
or unsigned 16-bit displacement will be specified
in the instruction.
In case of 8-bit displacement, it is sign extended
to 16-bit before adding to the base value.
When BX holds the base value of EA, 20-bit
physical address is calculated from BX and DS.
When BP holds the base value of EA, BP and SS is
used.
Example:
MOV AX, [BX + 08H]
Operations:
0008H  08H (Sign extended)
EA = (BX) + 0008H
BA = (DS) x 1610
MA = BA + EA
(AX)  (MA) or,
(AL)  (MA)
(AH)  (MA + 1)
Group II : Addressing modes for
memory data
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
SI or DI register is used to hold an index value for
memory data and a signed 8-bit or unsigned 16-
bit displacement will be specified in the
instruction.
Displacement is added to the index value in SI or
DI register to obtain the EA.
In case of 8-bit displacement, it is sign extended
to 16-bit before adding to the base value.
Example:
MOV CX, [SI + 0A2H]
Operations:
FFA2H  A2H (Sign extended)
EA = (SI) + FFA2H
BA = (DS) x 1610
MA = BA + EA
(CX)  (MA) or,
(CL)  (MA)
(CH)  (MA + 1)
Group II : Addressing modes for
memory data
17
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
In Based Index Addressing, the effective address
is computed from the sum of a base register (BX
or BP), an index register (SI or DI) and a
displacement.
Example:
MOV DX, [BX + SI + 0AH]
Operations:
000AH  0AH (Sign extended)
EA = (BX) + (SI) + 000AH
BA = (DS) x 1610
MA = BA + EA
(DX)  (MA) or,
(DL)  (MA)
(DH)  (MA + 1)
Group II : Addressing modes for
memory data
18
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Employed in string operations to operate on string
data.
The effective address (EA) of source data is stored
in SI register and the EA of destination is stored in
DI register.
4. Register Indirect Addressing
Segment register for calculating base address of
source data is DS and that of the destination data
is ES
Example: MOVS BYTE
Operations:
Calculation of source memory location:
EA = (SI) BA = (DS) x 1610 MA = BA + EA
Calculation of destination memory location:
EAE = (DI) BAE = (ES) x 1610 MAE = BAE + EAE
(MAE)  (MA)
If DF = 1, then (SI)  (SI) – 1 and (DI) = (DI) - 1
If DF = 0, then (SI)  (SI) +1 and (DI) = (DI) + 1
Group II : Addressing modes for
memory data
Note : Effective address of the
Extra segment register
19
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
These addressing modes are used to access data
from standard I/O mapped devices or ports.
In direct port addressing mode, an 8-bit port
address is directly specified in the instruction.
Example: IN AL, [09H]
Operations: PORTaddr = 09H
(AL)  (PORT)
Content of port with address 09H is
moved to AL register
In indirect port addressing mode, the instruction
will specify the name of the register which holds
the port address. In 8086, the 16-bit port address
is stored in the DX register.
Example: OUT [DX], AX
Operations: PORTaddr = (DX)
(PORT)  (AX)
Content of AX is moved to port
whose address is specified
by DX register.
Group III : Addressing modes for
I/O ports
20
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
In this addressing mode, the effective address of
a program instruction is specified relative to
Instruction Pointer (IP) by an 8-bit signed
displacement.
Example: JZ 0AH
Operations:
000AH  0AH
If ZF = 1, then
(sign extend)
EA = (IP) + 000AH
BA = (CS) x 1610
MA = BA + EA
If ZF = 1, then the program control jumps to
new address calculated above.
If ZF = 0, then next instruction of
the program is executed.
Group IV : Relative
Addressing
mode
21
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Instructions using this mode have no operands.
The instruction itself will specify the data to be
operated by the instruction.
Example: CLC
This clears the carry flag to zero.
Group IV : Implied
Addressing
mode
22

More Related Content

PPTX
02 Addressing Modes.pptx
PPTX
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
PPTX
4-ADDRESSING_MODES_E logic circuits.pptx
PPT
ADDRESSING MODES in 8086 MICROPROCESSOR.ppt
PPTX
Mastering Assembly Language: Programming with 8086
PPTX
Chapter 1 archietecture of 8086
PDF
8086 instruction set (with simulator)
PDF
8086 Register organization and Architecture details
02 Addressing Modes.pptx
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
4-ADDRESSING_MODES_E logic circuits.pptx
ADDRESSING MODES in 8086 MICROPROCESSOR.ppt
Mastering Assembly Language: Programming with 8086
Chapter 1 archietecture of 8086
8086 instruction set (with simulator)
8086 Register organization and Architecture details

Similar to UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx (20)

DOCX
Notes 8086 instruction format
PPTX
8086 addressing modes
PDF
8086addressingmodes-200319141110.pdf
PPT
PPT
PDF
physical_address segmentation.pdf
PPT
8086 ppt.ppt full understanding of micro
PPTX
introduction to Architecture of 8086 and it's application
PPTX
8086 microprocessor pptx JNTUH ece 3rd year
PDF
8086 Architecture, Pin diagram, Addressing modes (3).pdf
PPTX
instructionsetsofjdtufgmictfgfjh8086.pptx
PPT
1327 Addressing Modes Of 8086
PPTX
address5ng modes.pptx IS A GOOD MATERIAL
PPT
26677766 8086-microprocessor-architecture
PPTX
Chapter 4 addressing mode in microprocessor.pptx
PPTX
Lecture 9 examples (1)
PPTX
Microprocessor Architecture.pptx
PPTX
Introduction of 8086 micro processor .
PDF
Intrl 8086 instruction set
PPT
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Notes 8086 instruction format
8086 addressing modes
8086addressingmodes-200319141110.pdf
physical_address segmentation.pdf
8086 ppt.ppt full understanding of micro
introduction to Architecture of 8086 and it's application
8086 microprocessor pptx JNTUH ece 3rd year
8086 Architecture, Pin diagram, Addressing modes (3).pdf
instructionsetsofjdtufgmictfgfjh8086.pptx
1327 Addressing Modes Of 8086
address5ng modes.pptx IS A GOOD MATERIAL
26677766 8086-microprocessor-architecture
Chapter 4 addressing mode in microprocessor.pptx
Lecture 9 examples (1)
Microprocessor Architecture.pptx
Introduction of 8086 micro processor .
Intrl 8086 instruction set
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Ad

More from tamil arasan (20)

PPTX
IO INTERFACING in unit 2 8086 Microprocessor
PPTX
Serial communication in 8051 microcontroller .pptx
PPTX
89C51 PROGRAMMING in Unit-4 of Microprocessor
PPTX
8051 Architecture in unit 3 for MPMC .pptx
PPTX
MOSFET Transistor Operation/ Characteristics Unit-2 VLSI.pptx
PPTX
Design of Arithmetic Building Block Unit-5 VLSI.pptx
PPTX
Dynamic CMOS DESIGN in VLSI Design-unit-3
PPTX
Sequential Logic Circuit Design Unit-4 VLSI.pptx
PPTX
Unit 3- OPTICAL SOURCES AND DETECTORS
PPTX
Unit II- TRANSMISSION CHARACTERISTIC OF OPTICAL FIBER
PPTX
Properties of dft
PDF
DSP lab manual
DOCX
Steps for design of butterworth and chebyshev filter
DOCX
EC6612 VLSI Design Lab Manual
PPTX
VLSI Design Sequential circuit design
PPTX
Unit i
PPTX
Unit 2
PPTX
Unit 3
PPT
Filter- IIR - Digital signal processing(DSP)
PPT
Finite word lenth effects
IO INTERFACING in unit 2 8086 Microprocessor
Serial communication in 8051 microcontroller .pptx
89C51 PROGRAMMING in Unit-4 of Microprocessor
8051 Architecture in unit 3 for MPMC .pptx
MOSFET Transistor Operation/ Characteristics Unit-2 VLSI.pptx
Design of Arithmetic Building Block Unit-5 VLSI.pptx
Dynamic CMOS DESIGN in VLSI Design-unit-3
Sequential Logic Circuit Design Unit-4 VLSI.pptx
Unit 3- OPTICAL SOURCES AND DETECTORS
Unit II- TRANSMISSION CHARACTERISTIC OF OPTICAL FIBER
Properties of dft
DSP lab manual
Steps for design of butterworth and chebyshev filter
EC6612 VLSI Design Lab Manual
VLSI Design Sequential circuit design
Unit i
Unit 2
Unit 3
Filter- IIR - Digital signal processing(DSP)
Finite word lenth effects
Ad

Recently uploaded (20)

PDF
composite construction of structures.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Project quality management in manufacturing
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Digital Logic Computer Design lecture notes
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
PPT on Performance Review to get promotions
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
composite construction of structures.pdf
bas. eng. economics group 4 presentation 1.pptx
Project quality management in manufacturing
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
CH1 Production IntroductoryConcepts.pptx
Digital Logic Computer Design lecture notes
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Model Code of Practice - Construction Work - 21102022 .pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
R24 SURVEYING LAB MANUAL for civil enggi
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Construction Project Organization Group 2.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPT on Performance Review to get promotions
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
573137875-Attendance-Management-System-original
additive manufacturing of ss316l using mig welding
Foundation to blockchain - A guide to Blockchain Tech

UNIT-I MICROPROCESSOR PROGRAMMING AND STACK.pptx

  • 2. INTEL 8086 16 BIT Processor. Released by INTEL 1978 Designed using HMOS technology. Now it manufactured using HMOS III technology. It contains 29000 transistor 40 pin DIP 5 Volt Supply
  • 3. Clock signal is not generated internally. Requires an external asymmetric clock source with 30% duty cycle. 8284 clock generation is used to generate the required clock for 8086. Maximum internal clock 5MHz 8086-110MHz 8086-2  8 MHz 8086-4  4 MHz. 8086 uses a 20 bit address to access memory Memory capacity  2^ no.of address line =2 ^20=1 Mbyte. 8086 has two memory bankk512k byte each Two memory bank 1.Even 2.Odd
  • 4. The address line A0 is used to select even bank. BHE’ is used for select odd bank. I/O access: Separate 16 bit address So generate 2^16 =64 k address. The signal M/I0’ is used to differentiate the memory & I/O adderess. M/Io’  high  Memory adderss  low I/O address Operating modes: Two modes 1. Maximum mode 2. minimum mode.
  • 5. The mode is decided by a signal at MN/MX’ pin MN/Mx’  high minimum mode & system is called uni processor. MN/Mx’ low  maximum mode  multiprocessor. Normally  MN/MX’ pin is permanently tied to low or high. So that 8086 system can work in any one of the mode. 8086 can work with 8087 co processor in maximum mode. 8086 has two family of processor 1.808616 bit data bus externally 2. 8088 uses 8 bit data bus externally 8086 access memory in words 8088 access memory in bytes. IBM  designed 1st personal computer using INTEL 8088 microprocessor as CPU.
  • 11. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing The instruction will specify the name of the register which holds the data to be operated by the instruction. Example: MOV CL, DH The content of 8-bit register DH is moved to another 8-bit register CL (CL)  (DH) Group I : Addressing modes for register and immediate data 1
  • 12. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing In immediate addressing mode, an 8-bit or 16-bit data is specified as part of the instruction 1 Example: MOV DL, 08H The 8-bit data (08H) given in the instruction is moved to DL (DL)  08H MOV AX, 0A9FH The 16-bit data (0A9FH) given in the instruction is moved to AX register (AX)  0A9FH Group I : Addressing modes for register and immediate data
  • 13. 20 Address lines  8086 can address up to 1M bytes of memory 220 = However, the largest register is only 16 bits Physical Address will have to be calculated Physical Address : Actual address of a byte in memory. i.e. the value which goes out onto the address bus. Memory Address represented in the form – Seg :Offset(Eg - 89AB:F012) Each time the processor wants to access memory, it takes the contents of a segment register, shifts it one hexadecimal place to the left (same as multiplying by 1610), then add the required offset to form the 20- bit address 89AB : F012  89AB  89AB0 (Paragraph to byte  89AB x 10 = 89AB0) (Offset is already in byte unit) F012  0F012 + ------- 98AC2 (The absolute address) 16 bytes of contiguous memory 5
  • 14. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing Here, the effective address of the memory location at which the data operand is stored is given in the instruction. The effective address is just a 16-bit number written directly in the instruction. Example: MOV BX, [1354H] MOV BL, [0400H] The square brackets around the 1354H denotes the contents of the memory location. When executed, this instruction will copy the contents of the memory location into BX register. This addressing mode is called direct because the displacement of the operand from the segment base is specified directly in the instruction. Group II : Addressing modes for memory data 7
  • 15. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing register which holds the effective address (EA) will be specified in the instruction. Registers used to hold EA are any of the following registers: BX, BP, DI and SI. Content of the DS register is used for base Group II : Addressing modes for memory data In Register indirect addressing, name of the address calculation. Example: MOV CX, [BX] Operations: EA = (BX) BA = (DS) x 1610 MA = BA + EA (CX)  (MA) or, (CL)  (MA) (CH)  (MA +1) Note : Register/ memory enclosed in brackets refer to content of register/ memory 8
  • 16. 9 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing In Based Addressing, BX or BP is used to hold the base value for effective address and a signed 8-bit or unsigned 16-bit displacement will be specified in the instruction. In case of 8-bit displacement, it is sign extended to 16-bit before adding to the base value. When BX holds the base value of EA, 20-bit physical address is calculated from BX and DS. When BP holds the base value of EA, BP and SS is used. Example: MOV AX, [BX + 08H] Operations: 0008H  08H (Sign extended) EA = (BX) + 0008H BA = (DS) x 1610 MA = BA + EA (AX)  (MA) or, (AL)  (MA) (AH)  (MA + 1) Group II : Addressing modes for memory data
  • 17. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing SI or DI register is used to hold an index value for memory data and a signed 8-bit or unsigned 16- bit displacement will be specified in the instruction. Displacement is added to the index value in SI or DI register to obtain the EA. In case of 8-bit displacement, it is sign extended to 16-bit before adding to the base value. Example: MOV CX, [SI + 0A2H] Operations: FFA2H  A2H (Sign extended) EA = (SI) + FFA2H BA = (DS) x 1610 MA = BA + EA (CX)  (MA) or, (CL)  (MA) (CH)  (MA + 1) Group II : Addressing modes for memory data 17
  • 18. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing In Based Index Addressing, the effective address is computed from the sum of a base register (BX or BP), an index register (SI or DI) and a displacement. Example: MOV DX, [BX + SI + 0AH] Operations: 000AH  0AH (Sign extended) EA = (BX) + (SI) + 000AH BA = (DS) x 1610 MA = BA + EA (DX)  (MA) or, (DL)  (MA) (DH)  (MA + 1) Group II : Addressing modes for memory data 18
  • 19. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing Employed in string operations to operate on string data. The effective address (EA) of source data is stored in SI register and the EA of destination is stored in DI register. 4. Register Indirect Addressing Segment register for calculating base address of source data is DS and that of the destination data is ES Example: MOVS BYTE Operations: Calculation of source memory location: EA = (SI) BA = (DS) x 1610 MA = BA + EA Calculation of destination memory location: EAE = (DI) BAE = (ES) x 1610 MAE = BAE + EAE (MAE)  (MA) If DF = 1, then (SI)  (SI) – 1 and (DI) = (DI) - 1 If DF = 0, then (SI)  (SI) +1 and (DI) = (DI) + 1 Group II : Addressing modes for memory data Note : Effective address of the Extra segment register 19
  • 20. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing These addressing modes are used to access data from standard I/O mapped devices or ports. In direct port addressing mode, an 8-bit port address is directly specified in the instruction. Example: IN AL, [09H] Operations: PORTaddr = 09H (AL)  (PORT) Content of port with address 09H is moved to AL register In indirect port addressing mode, the instruction will specify the name of the register which holds the port address. In 8086, the 16-bit port address is stored in the DX register. Example: OUT [DX], AX Operations: PORTaddr = (DX) (PORT)  (AX) Content of AX is moved to port whose address is specified by DX register. Group III : Addressing modes for I/O ports 20
  • 21. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing In this addressing mode, the effective address of a program instruction is specified relative to Instruction Pointer (IP) by an 8-bit signed displacement. Example: JZ 0AH Operations: 000AH  0AH If ZF = 1, then (sign extend) EA = (IP) + 000AH BA = (CS) x 1610 MA = BA + EA If ZF = 1, then the program control jumps to new address calculated above. If ZF = 0, then next instruction of the program is executed. Group IV : Relative Addressing mode 21
  • 22. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing Instructions using this mode have no operands. The instruction itself will specify the data to be operated by the instruction. Example: CLC This clears the carry flag to zero. Group IV : Implied Addressing mode 22