8086 Microprocessor
8086 Microprocessor
Microprocessor
2
Microprocessor Fifth Generation Pentium
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
Third Generation 32 bit processors
During 1978 Physical memory space 224 bytes = 16 Mb
HMOS technology Faster speed, Higher Virtual memory space 240 bytes = 1 Tb
packing density Floating point hardware
16 bit processors 40/ 48/ 64 pins Supports increased number of addressing
Easier to program modes
Dynamically relatable programs
Processor has multiply/ divide arithmetic Intel 80386
hardware
More powerful interrupt handling
capabilities Second Generation
Flexible I/O port addressing During 1973
NMOS technology Faster speed, Higher
Intel 8086 (16 bit processor) density, Compatible with TTL
4 / 8/ 16 bit processors 40 pins
First Generation Ability to address large memory spaces
Between 1971 – 1973 and I/O ports
PMOS technology, non compatible with TTL Greater number of levels of subroutine
4 bit processors 16 pins nesting
8 and 16 bit processors 40 pins Better interrupt handling capabilities
Due to limitations of pins, signals are 3
multiplexed Intel 8085 (8 bit processor)
Microprocessor Functional blocks
AD0-AD15 (Bidirectional)
Address/Data bus
7
8086 Microprocessor
Pins and Signals Common signals
MN/ MX
MINIMUM / MAXIMUM
TEST
READY
RESET (Input)
CLK
Pins 24 -31
Pins 24 -31
14
8086 Microprocessor
Pins and Signals Maximum mode signals
15
8086 Microprocessor
Pins and Signals Maximum mode signals
16
8086 Microprocessor
Pins and Signals Maximum mode signals
17
Architecture
8086 Microprocessor
Architecture
Segment
Registers
21
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
16-bit
22
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
16-bit
23
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
16-bit
24
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
16-bit
25
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
16-bit
26
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
Instruction queue
A group of First-In-First-
Out (FIFO) in which up to
6 bytes of instruction
code are pre fetched
from the memory ahead
of time.
27
8086 Microprocessor
Architecture Execution Unit (EU)
EU decodes and
executes instructions.
A decoder in the EU
control system
translates instructions.
and
Some of the 16 bit registers can be
Index registers (Source used as two 8 bit registers as :
Index, Destination Index)
each of 16-bits AX can be used as AH and AL
BX can be used as BH and BL
CX can be used as CH and CL 28
DX can be used as DH and DL
8086 Microprocessor
Architecture Execution Unit (EU)
29
8086 Microprocessor
Architecture Execution Unit (EU)
30
8086 Microprocessor
Architecture Execution Unit (EU)
Example:
31
8086 Microprocessor
Architecture Execution Unit (EU)
32
8086 Microprocessor
Architecture Execution Unit (EU)
33
8086 Microprocessor
Architecture Execution Unit (EU)
34
8086 Microprocessor
Architecture Execution Unit (EU)
35
8086 Microprocessor
Architecture Execution Unit (EU)
Auxiliary Carry Flag
Carry Flag
This flag is set, when the This flag is set, if the result of This flag is set to 1, if the lower
result of any computation the computation or comparison byte of the result contains even
is negative performed by an instruction is number of 1’s ; for odd number
zero of 1’s set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Tarp Flag
Over flow Flag If this flag is set, the processor
This flag is set, if an overflow occurs, i.e, if the result of a signed enters the single step execution
operation is large enough to accommodate in a destination
mode by generating internal
register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit interrupts after the execution of
sign operations, then the overflow will be set. each instruction
8086 registers
categorized 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
into 4 groups
OF DF IF TF SF ZF AF PF CF
Program
A set of instructions written to solve
a problem.
Instruction
Directions which a microprocessor
follows to execute a task or part of a
task.
Computer language
1. Register Addressing
Group I : Addressing modes for
register and immediate data
2. Immediate Addressing
3. Direct Addressing
8. String Addressing
Group III : Addressing modes for
9. Direct I/O port Addressing
I/O ports
8. String Addressing
44
8086 Microprocessor Group I : Addressing modes for
Addressing Modes register and immediate data
1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
2. Immediate Addressing data is specified as part of the instruction
8. String Addressing
MOV AX, 0A9FH
(AX) 0A9FH
11. Relative Addressing
45
8086 Microprocessor
Addressing Modes : Memory Access
1. Register Addressing
2. Immediate Addressing
Here, the effective address of the memory
3. Direct Addressing location at which the data operand is stored is
given in the instruction.
4. Register Indirect Addressing
The effective address is just a 16-bit number
5. Based Addressing written directly in the instruction.
Example:
6. Indexed Addressing
49
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
Operations:
9. Direct I/O port Addressing
(CL) (MA) 50
(CH) (MA +1)
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
3. Direct Addressing
In case of 8-bit displacement, it is sign extended
to 16-bit before adding to the base value.
4. Register Indirect Addressing
6. Indexed Addressing
When BP holds the base value of EA, BP and SS is
used.
7. Based Index Addressing
Example:
8. String Addressing
Operations:
10. Indirect I/O port Addressing
3. Direct Addressing
Displacement is added to the index value in SI or
DI register to obtain the EA.
4. Register Indirect Addressing
6. Indexed Addressing
Example:
7. Based Index Addressing
EA = (SI) + FFA2H
11. Relative Addressing
BA = (DS) x 1610
MA = BA + EA
12. Implied Addressing
(CX) (MA) or,
52
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
3. Direct Addressing
Example:
4. Register Indirect Addressing
MOV DX, [BX + SI + 0AH]
5. Based Addressing
Operations:
6. Indexed Addressing
000AH 0AH (Sign extended)
7. Based Index Addressing
EA = (BX) + (SI) + 000AH
8. String Addressing BA = (DS) x 1610
MA = BA + EA
9. Direct I/O port Addressing
(DX) (MA) or,
10. Indirect I/O port Addressing
(DL) (MA)
(DH) (MA + 1)
11. Relative Addressing
53
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
6. Indexed Addressing
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
In this addressing mode, the effective address of
a program instruction is specified relative to
4. Register Indirect Addressing Instruction Pointer (IP) by an 8-bit signed
displacement.
5. Based Addressing
Example: JZ 0AH
6. Indexed Addressing
Operations:
7. Based Index Addressing
000AH 0AH (sign extend)
8. String Addressing
If ZF = 1, then
9. Direct I/O port Addressing
EA = (IP) + 000AH
10. Indirect I/O port Addressing BA = (CS) x 1610
MA = BA + EA
11. Relative Addressing
If ZF = 1, then the program control jumps to
12. Implied Addressing new address calculated above.
56
If ZF = 0, then next instruction of the
8086 Microprocessor Group IV : Implied
Addressing Modes Addressing mode
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
5. Based Addressing
6. Indexed Addressing
Instructions using this mode have no operands.
7. Based Index Addressing The instruction itself will specify the data to be
operated by the instruction.
8. String Addressing
Example: CLC
9. Direct I/O port Addressing
This clears the carry flag to zero.
10. Indirect I/O port Addressing
57
INSTRUCTION SET
8086 Microprocessor
Instruction Set
1. Arithmetic Instructions
1. Logical Instructions
59
8086 Microprocessor
Instruction Set
60
8086 Microprocessor
Instruction Set
61
8086 Microprocessor
Instruction Set
OUT addr8, A
IN A, addr8
63
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
64
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADDC A, data
65
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
66
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB A, data
67
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
68
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
69
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
70
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
71
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
73
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
74
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
75
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
76
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
77
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
78
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
79
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
80
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
81
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
82
8086 Microprocessor
Instruction Set
83
8086 Microprocessor
Instruction Set
REP
84
8086 Microprocessor
Instruction Set
MOVS
(MAE) (MA)
CMPS
LODS
88
8086 Microprocessor
Instruction Set
STOS
89
8086 Microprocessor
Instruction Set
CLC Clear CF 0
NOP No operation
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
91
8086 Microprocessor
Instruction Set
Checks flags
92
8086 Microprocessor
Instruction Set
Mnemonics Explanation
JC disp8 Jump if CF = 1
JP disp8 Jump if PF = 1
JO disp8 Jump if OF = 1
JS disp8 Jump if SF = 1
94
Assembler directives
8086 Microprocessor
Assemble Directives
Used to :
› specify the start and end of a program
› attach value to variables
› allocate storage locations to input/ output data
› define start and end of segments, procedures, macros etc..
96
8086 Microprocessor
Assemble Directives
DB Define Byte
PROC Example:
FAR
NEAR LIST DB 7FH, 42H, 35H
ENDP
Three consecutive memory locations are reserved for
SHORT the variable LIST and each data specified in the
instruction are stored as initial value in the reserved
memory location
MACRO 97
ENDM
8086 Microprocessor
Assemble Directives
DB Define Word
PROC Example:
FAR
NEAR ALIST DW 6512H, 0F251H, 0CDE2H
ENDP
Six consecutive memory locations are reserved for
SHORT the variable ALIST and each 16-bit data specified in
the instruction is stored in two consecutive memory
location.
MACRO 98
ENDM
8086 Microprocessor
Assemble Directives
ORG
Segnam SEGMENT
END
EVEN …
EQU … Program code
… or
… Data Defining Statements
PROC …
FAR …
NEAR
ENDP Segnam ENDS
SHORT
User defined name of
the segment
MACRO 99
ENDM
8086 Microprocessor
Assemble Directives
MACRO 100
ENDM
8086 Microprocessor
Assemble Directives
PROC
FAR LOOP EQU 10FEH Value of variable LOOP is 10FEH
NEAR
ENDP
_SDATA SEGMENT In this data segment, effective address of
SHORT ORG 1200H memory location assigned to A will be 1200H
A DB 4CH and that of B will be 1202H and 1203H.
EVEN
MACRO B DW 1052H 101
ENDM _SDATA ENDS
8086 Microprocessor
Assemble Directives
MACRO 102
ENDM
8086 Microprocessor
Assemble Directives
DB
Examples:
DW
ORG RET
END ADD64 ENDP
EVEN
EQU
CONVERT PROC FAR The subroutine/ procedure named CONVERT
PROC is declared as FAR and so the assembler will
ENDP …
code the CALL and RET instructions involved
in this procedure as far call and return
FAR …
…
NEAR
RET
SHORT CONVERT ENDP
MACRO 103
ENDM
8086 Microprocessor
Assemble Directives
PROC
ENDP
FAR
NEAR
SHORT
MACRO 104
ENDM
8086 Microprocessor
Assemble Directives
PROC
ENDP
User defined name of
FAR
the macro
NEAR
SHORT
MACRO 105
ENDM
106
Interfacing memory and i/o
ports
8086 Microprocessor
Memory
Processor Memory
Registers inside a microcomputer
Store data and results temporarily
No speed disparity
Cost
Secondary Memory
Storage media comprising of slow
devices such as magnetic tapes and
disks
Hold large data files and programs:
Operating system, compilers,
databases, permanent programs etc. 108
8086 Microprocessor
Memory organization in 8086
8086 : 16-bit
Bank 0 : A0 = 0 Even
addressed memory bank
Bank 1 : = 0 Odd
addressed memory bank
109
8086 Microprocessor
Memory organization in 8086
1
1 Read/
Read/ Write
Write byte
byte at
at an
an even address
even address 1
1 0
0 D
D77 –
–DD00
2 Read/ Write byte at an odd address 0 1 D15 – D8
2 Read/ Write byte at an odd address 0 1 D15 – D8
111
8086 Microprocessor
Interfacing SRAM and EPROM
112
8086 Microprocessor
Interfacing SRAM and EPROM
No of Memory capacity
Address
pins In Decimal In kilo In hexa
113
8086 Microprocessor
Interfacing SRAM and EPROM
114
8086 Microprocessor
Interfacing SRAM and EPROM
Monitor Programs
Initialization of stack
115
8086 Microprocessor
Interfacing I/O and peripheral devices
I/O devices
Memory mapped
Data transfer types
Programmed I/ O
Data transfer is accomplished I/O mapped
through an I/O port
controlled by software
Interrupt driven I/ O
I/O device interrupts the
processor and initiate data
transfer
Direct memory access
Data transfer is achieved by 116
bypassing the microprocessor
8086 Microprocessor
8086 and 8088 comparison
The I/O ports or peripherals can be Only IN and OUT instructions can be
treated like memory locations and used for data transfer between I/O
so all instructions related to device and processor
memory can be used for data
transmission between I/O device
and processor
Data can be moved from any Data transfer takes place only
register to ports and vice versa between accumulator and ports
When memory mapping is used for Full memory space can be used for
I/O devices, full memory address addressing memory.
space cannot be used for
addressing memory. Suitable for systems which
require large memory capacity
Useful only for small systems
where memory requirement is less
For accessing the memory mapped For accessing the I/O mapped
devices, the processor executes devices, the processor executes I/O
memory read or write cycle. read or write cycle.
117
M / is asserted high M / is asserted low
8086 and 8088 comparison
8086 Microprocessor
8086 and 8088 comparison
8086 8088
16-bit Data bus lines obtained by 8-bit Data bus lines obtained by
demultiplexing AD0 – AD15 demultiplexing AD0 – AD7
In MIN mode, pin 28 is assigned the In MIN mode, pin 28 is assigned the
signal M / signal IO /
121
8086 Microprocessor
Co-processor – Intel 8087
122
8086 Microprocessor
Co-processor – Intel 8087
123
8086 Microprocessor
Co-processor – Intel 8087
BUSY
124
8086 Microprocessor
Co-processor – Intel 8087
125
8086 Microprocessor
Co-processor – Intel 8087
INT
126
8086 Microprocessor
Co-processor – Intel 8087
Status
1 0 0 Unused
1 0 1 Read memory
1 1 0 Write memory
1 1 1 Passive
QS0 – QS1
127
8086 Microprocessor
Co-processor – Intel 8087
Wake up the
coprocessor
Monitor
ESC 8086/
8088
Deactivate the
Execute the host’s TEST pin
8086 and execute the
instructions specific
operation
Activate
WAIT the TEST
pin
Wake up the
8086/ 8088
129
130