You are on page 1of 85

INTEL 8086

MICROPROCESSOR

Microprocessor & Microcontroller


MODULE
1&2
Complete idea about INTEL 8086
Microprocessor
Microprocessor & Microcontroller
Topics to be covered

1. Software Architecture of the INTEL 8086.

2. Hardware Architecture of INTEL 8086.

3. 8086 Programming and program development.

Microprocessor & Microcontroller 3


Software architecture of the INTEL
8086
 Memory segmentation and addressing
 Block diagram of 8086
 Address space & Data organization
 Data Types
 Registers
 Stack
 I/O space
Microprocessor & Microcontroller 4
Hardware Architecture of INTEL 8086

 Pin Diagram and Pin Details


 min/max mode
 Coprocessor and Multiprocessor configuration
 Hardware organization of address space
 Control signals
 I/O interfaces

Microprocessor & Microcontroller 5


8086 programming and program
development.

 Assembly Language Programming.


 Instruction Set.
 Assembler Directives.
 Programming Exercises.

Microprocessor & Microcontroller 6


Software Architecture
of
INTEL 8086

RCET Microprocessor & Microcontroller 7


Microprocessor & Microcontroller
Software architecture of the INTEL
8086
 Memory segmentation and addressing
 Block diagram of 8086
 Address space & Data organization
 Data Types
 Registers
 Stack
 I/O space
Microprocessor & Microcontroller 8
Memory segmentation and addressing

• Von – Newman architecture & Harvard architecture


• Program Memory & Data Memory

• Need for Segmentation


– To implement Harvard architecture
– Easy to debug
– Same Interfacing ICs can be used
– To avoid overlap of stack with normal memory
– Compatible with 8085

Microprocessor & Microcontroller 9


Segmented Memory

Microprocessor & Microcontroller 10


Memory Address Generation
• The BIU has a dedicated adder for determining
physical memory addresses.
Offset Value (16 bits)

Segment Register (16 bits) 0000

Adder

Physical Address (20 Bits)

Microprocessor & Microcontroller 11


Segment : Offset Address
• Logical Address is specified as segment:offset
• Physical address is obtained by shifting the
segment address 4 bits to the left and adding the offset
address.
• Thus physical address of the logical address
the
A4FB:4872 is:
A4FB0
+ 4872
A9822

Microprocessor & Microcontroller 12


Segments, Segment Registers & Offset
Registers
• Segment Size = 64KB
• Maximum number of segments possible = 14
• Logical Address – 16 bits
• Physical Address – 20 bits
• 2 Logical Addresses for each Segments.
– Base Address (16 bits)
– Offset Address (16 bits)
• Segment registers are used to store the Base address of
the segment.
Microprocessor & Microcontroller 13
Segments, Segment Registers & Offset
Registers
• 4 Segments in 8086
– Code Segment (CS)
– Data Segment (DS) SEGMENT SEGMENT OFFSET REGISTER
REGISTER
– Stack Segment (SS)
Code Segment CSR Instruction Pointer
– Extra Segment (ES) (IP)
Data Segment DSR Source Index (SI)

Extra Segment ESR Destination Index


(DI)
Stack Segment SSR Stack Pointer (SP) /
Base Pointer (BP)

Microprocessor & Microcontroller 14


Block diagram of 8086

RCET Microprocessor & Microcontroller


Microcontroller 15
Pipelined architecture of the 8086
microprocessors

Microprocessor & Microcontroller


Execution and bus interface units

Microprocessor & Microcontroller


Software Model of the 8086 Microprocessors

Microprocessor & Microcontroller


Address space & Data organization

Storing a word in memory

What is the word in (b) in Hex?

Memory address space


Microprocessor & Microcontroller
Aligned and misaligned data word

Microprocessor & Microcontroller


Aligned and misaligned double words of data

Microprocessor & Microcontroller


Storing double word in memory

Microprocessor & Microcontroller


Data Types

Unsigned byte
integer
0 - 255

Unsigned word integer


0 – 65,535

Microprocessor & Microcontroller


Data Types

-128 - +127

Signed
integer
s
-32,768 - +32,767

Microprocessor & Microcontroller


Data Types

Binary Coded
Decimal (BCD)
Unpacked BCD

Packed BCD

Microprocessor & Microcontroller


American Standard Code for Information Interchange
(ASCII)

RCET Microprocessor & Microcontroller 26


Dedicated, Reserved, and General use
Memory

Microprocessor & Microcontroller


8086 Registers
Ge ne ral Purpose Inde
x
AH AL
BP
AX

SP
BH BL
BX
SI

CH CL
DI
CX

DH DL
DX Segme
nt

CS
Status and Control SS

Flags DS

IP ES

Microprocessor & Microcontroller


General Purpose Registers

AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register

• Normally used for storing temporary results


• Each of the registers is 16 bits wide (AX, BX, CX, DX)
• Can be accessed as either 16 or 8 bits AX, AH, AL
Microprocessor & Microcontroller
General Purpose Registers
• AX
– Accumulator Register
– Preferred register to use in arithmetic, logic and data
transfer instructions because it generates the shortest
Machine Language Code
– Must be used in multiplication and division
operations
– Must also be used in I/O operations

• BX
– Base Register
– Also serves as an address register

Microprocessor & Microcontroller


General Purpose Registers
• CX
– Count register
– Used as a loop counter
– Used in shift and rotate operations

• DX
– Data register
– Used in multiplication and division
– Also used in I/O operations

Microprocessor & Microcontroller


Pointer and Index Registers

• All 16 bits wide, L/H bytes are not accessible

• Used as memory pointers


– Example: MOV AH, [SI]
• Move the byte stored in memory location whose address is contained in
register SI to register AH

• IP is not under direct control of the programmer


Microprocessor & Microcontroller
Flag Register

Overflow Carry
Direction Parity

Interrupt enable Auxiliary Carry


Tra Zero
p
6 are status flags
Sign
3 are control
Microprocessor & Microcontroller
flag
8086 Programmer’s Model
ES Extra Segment
Code
BIU registers
(20 bit adder) CS
SS Segment
DS Stack Segment
IP Data Segment
Instruction Pointer

EU registers AX AH AL Accumulator
BX Base Register
CX BH BL Count Register
DX CH Data Register
SP CL Stack Pointer
DH Base Pointer
BP DL Source Index Register
SI Destination Index Register

DI
FLA
Microprocessor & Microcontroller
The Stack
• The stack is used for temporary storage of information
such as data or addresses.

• When a CALL is executed, the 8086 automatically PUSHes


the current value of CS and IP onto the stack.

• Other registers can also be pushed

• Before return from the subroutine, POP instructions can


be used to pop values back from the stack into the
corresponding registers.

Microprocessor & Microcontroller


The Stack

Microprocessor & Microcontroller


Example for PUSH

Microprocessor & Microcontroller


Example for POP

Microprocessor & Microcontroller


The I/O address space

Microprocessor & Microcontroller


Hardware Architecture
of
INTEL 8086

RCET Microprocessor & Microcontroller 40


Microprocessor & Microcontroller
Hardware Architecture of INTEL 8086

 Pin Diagram and Pin Details


 min/max mode
 Coprocessor and Multiprocessor configuration
 Hardware organization of address space
 Control signals
 I/O interfaces

RCET Microprocessor & Microcontroller 41


INTEL 8086 - Pin Diagram

Microprocessor & Microcontroller


INTEL 8086 - Pin Details
Power Supply
5V  10%
Ground

Reset
Registers,
seg regs,
flags
CS: FFFFH,
IP: 0000H
If high for
Clock minimum
Duty cycle: 33% 4 clks
Microprocessor & Microcontroller
INTEL 8086 - Pin Details

Address/Data Bus:
Contains address Address Latch Enable:
bits A15-A0 when
ALE is 1 & data bits When high,
D15 – D0 when ALE is multiplexed
address/data
0.
bus contains
address
information.

Microprocessor & Microcontroller


INTEL 8086 - Pin Details

INTERRUPT

Non -
maskable
interrupt

Interrupt
acknowledge

Interrupt request

Microprocessor & Microcontroller


INTEL 8086 - Pin Details
Direct
Memory
Access

Hold

Hold
acknowledge

Microprocessor & Microcontroller


INTEL 8086 - Pin Details

Address/Status Bus
Address bits A19 –
A16 & Status bits S6
– S3

Microprocessor & Microcontroller


INTEL 8086 - Pin Details

BHE#, A0: Bus High Enable/S7


0,0: Whole word Enables most
(16-bits) significant data bits
0,1: High byte D15 – D8 during read
to/from odd or write operation.
address
S7: Always 1.
1,0: Low byte
to/from even address

1,1: No selection

Microprocessor & Microcontroller


INTEL 8086 - Pin Details

Min/Max mode
Minimum Mode:
+5V Maximum
Mode: 0V

Minimum Mode Pins

Maximum
Mode
Pins

Microprocessor & Microcontroller


Minimum Mode- Pin Details

Read Signal

Write Signal

Memory or I/0

Data
Transmit/Receiv
e
Data Bus Enable
Microprocessor & Microcontroller
Maximum Mode - Pin Details

S2 S1 S0
000: INTA
001: read I/O port
010: write I/O port
011: halt
100: code access Status Signal
101: read memory
110: write Inputs to 8288 to
memory generate
111: none -passive eliminated signals
due to max mode.

Microprocessor & Microcontroller


Maximum Mode - Pin Details

Lock Output
Used to lock peripherals
off the system
DMA
Activated by using the Request/Grant
LOCK: prefix on any
instruction

Lock Output

Microprocessor & Microcontroller


Maximum Mode - Pin Details

QS1 QS0
00: Queue is idle
01: First byte of opcode
10: Queue is empty
11: Subsequent byte of
opcode
Queue Status
Used by numeric
coprocessor
(8087)
Microprocessor & Microcontroller
Minimum Mode 8086 System

Microprocessor & Microcontroller


Minimum Mode 8086 System

RCET Microprocessor & Microcontroller


Microcontroller 55
‘Read’ Cycle timing Diagram for
Minimum Mode

Microprocessor & Microcontroller


‘Write’ Cycle timing Diagram for
Minimum Mode

Microprocessor & Microcontroller


Maximum Mode 8086 System

Microprocessor & Microcontroller


Maximum Mode 8086 System

RCET Microprocessor & Microcontroller


Microcontroller 59
Maximum Mode 8086 System
• Here, either a numeric coprocessor of the type 8087 or another
processor is interfaced with 8086.

• The Memory, Address Bus, Data Buses are shared


resources between the two processors.

• The signals for Maximum mode of operation


control by the
generated areBus Controller chip 8788.

• The three status outputs S0*, S1*, S2* from the processor are
input to 8788.

• The outputs of the bus controller are the Control Signals, namely
DEN, DT/R*, IORC*, IOWTC*, MWTC*, MRDC*, ALE etc.

Microprocessor & Microcontroller


Memory Read timing in
Maximum Mode

Microprocessor & Microcontroller


Memory Write timing in
Maximum Mode

Microprocessor & Microcontroller


Memory Banking

RCET Microprocessor & Microcontroller


Microcontroller 63
Interface 8086 to 6116 Static RAM
A0, BHE*
6116 (2K x8)
20 21 A(11-1)
A A(10-0)
Latch D(7-0)
D(7-0)
BHE A(19-12) R/W Low byte
OE* (Even Bank)
16 CS*
ALE Addr
D Decoder RAMCS*
8086
A0 A(11-1) A(10-0)
MEM* D(7-0)
M/IO D(15-8)
R/W High byte
WR OE*
(Odd Bank)
RD BHE* CS*

64
Microprocessor & Microcontroller
8086 Interrupts

Microprocessor & Microcontroller


8086 Interrupts Procedure

Microprocessor & Microcontroller


8086 External Interrupts

Microprocessor & Microcontroller


8086 Interrupt Vector Table

Microprocessor & Microcontroller


8086 Interrupt Vector Table

Microprocessor & Microcontroller


Programmin
g with
INTEL 8086
RCET Microprocessor & Microcontroller 70
Microprocessor & Microcontroller
8086 programming and program
development.

 Assembly Language Programming.


 Instruction Set.
 Assembler Directives.
 Programming Exercises.

RCET Microprocessor & Microcontroller 71


General Syntax

Microprocessor & Microcontroller


General Syntax

Microprocessor & Microcontroller


x86 Instruction Set Summary
(Data Transfer)
1. CBW ;Convert Byte to Word AL  AX
2. CWD ;Convert Word to Double in AX DX,AX
3. IN ;Input
4. LAHF ;Load AH from Flags
5. LDS ;Load pointer to DS
6. LEA ;Load EA to register
7. LES ;Load pointer to ES
8. LODS ;Load memory at SI into AX
9. MOV ;Move
10. MOVS ;Move memory at SI to DI
11. OUT ;Output
12. POP ;Pop
13. POPF ;Pop Flags
14. PUSH ;Push
15. PUSHF ;Push Flags
16. SAHF ;Store AH into Flags
17. STOS ;Store AX into memory at DI
18. XCHG ;Exchange
19. XLAT ;Translate byte to AL
Microprocessor & Microcontroller
x86 Instruction Set Summary
(Arithmetic/Logical)
1. AAA ;ASCII Adjust for Add in AX
2. AAD ;ASCII Adjust for Divide in AX
3. AAM ;ASCII Adjust for Multiply in AX
4. AAS ;ASCII Adjust for Subtract in AX
5. ADC ;Add with Carry
6. ADD ;Add
7. AND ;Logical AND
8. CMC ;Complement Carry
9. CMP ;Compare
10. CMPS ;Compare memory at SI and DI
11. DAA ;Decimal Adjust for Add in AX
12. DAS ;Decimal Adjust for Subtract in AX
13. DEC ;Decrement
14. DIV ;Divide (unsigned) in AX(,DX)
15. IDIV ;Divide (signed) in AX(,DX)
16. MUL ;Multiply (unsigned) in AX(,DX)
17. IMUL ;Multiply (signed) in AX(,DX)
18. INC ;Increment
Microprocessor & Microcontroller
x86 Instruction Set Summary
(Arithmetic/Logical Cont.)
19. NEG ;Negate
20. NOT ;Logical NOT
21. OR ;Logical inclusive OR
22. RCL ;Rotate through Carry Left
23. RCR ;Rotate through Carry Right
24. ROL ;Rotate Left
25. ROR ;Rotate Right
26. SAR ;Shift Arithmetic Right
27. SBB ;Subtract with Borrow
28. SCAS ;Scan memory at DI compared to AX
29. SHL/SAL ;Shift logical/Arithmetic Left
30. SHR ;Shift logical Right
31. SUB ;Subtract
32. TEST ;AND function to flags
33. XLAT ;Translate byte to AL
34. XOR ;Logical Exclusive OR

Microprocessor & Microcontroller


x86 Instruction Set Summary
(Control/Branch)
1. CALL ;Call
2. CLC ;Clear Carry
3. CLD ;Clear Direction
4. CLI ;Clear Interrupt
5. ESC ;Escape (to external device)
6. HLT ;Halt
7. INT ;Interrupt
8. INTO ;Interrupt on Overflow
9. IRET ;Interrupt Return
10. JB/JNAE ;Jump on Below/Not Above or Equal
11. JBE/JNA ;Jump on Below or Equal/Not Above
12. JCXZ ;Jump on CX Zero
13. JE/JZ ;Jump on Equal/Zero
14. JL/JNGE ;Jump on Less/Not Greater or Equal
15. JLE/JNG ;Jump on Less or Equal/Not Greater
16. JMP ;Unconditional Jump

Microprocessor & Microcontroller


x86 Instruction Set Summary
(Control/Branch Cont.)
17. JNB/JAE ;Jump on Not Below/Above or Equal
18. JNBE/JA ;Jump on Not Below or Equal/Above
19. JNE/JNZ ;Jump on Not Equal/Not Zero
20. JNL/JGE ;Jump on Not Less/Greater or Equal
21. JNLE/JG ;Jump on Not Less or Equal/Greater
22. JNO ;Jump on Not Overflow
23. JNP/JPO ;Jump on Not Parity/Parity Odd
24. JNS ;Jump on Not Sign
25. JO ;Jump on Overflow
26. JP/JPE ;Jump on Parity/Parity Even
27. JS ;Jump on Sign
28. LOCK ;Bus Lock prefix
29. LOOP ;Loop CX times
30. LOOPNZ/LOOPNE ;Loop while Not Zero/Not Equal
31. LOOPZ/LOOPE ;Loop while Zero/Equal
32. NOP ;No Operation (= XCHG AX,AX)

Microprocessor & Microcontroller


x86 Instruction Set Summary
(Control/Branch Cont.)

33. REP/REPNE/REPNZ ;Repeat/Repeat Not Equal/Not Zero


34. REPE/REPZ ;Repeat Equal/Zero
35. RET ;Return from call
36. SEG ;Segment register
37. STC ;Set Carry
38. STD ;Set Direction
39. STI ;Set Interrupt
40. TEST ;AND function to flags
41. WAIT ;Wait

Microprocessor & Microcontroller


8086 Instruction set Summary

Microprocessor & Microcontroller


8086 Instruction set Summary

Microprocessor & Microcontroller


8086 Instruction set Summary

Microprocessor & Microcontroller


8086 Assembler Directives
1. end label end of program, label is entry point
2. proc far|near begin a procedure; far, near keywords specify
if the procedure is in different code segment
(far), or same code segment (near)
3. endp end of procedure
4. set a page format for the listing file
page
5. title title of the listing file
6. mark start of code segment
.code

Microprocessor & Microcontroller


8086 Assembler Directives
7. mark start of data segment
.data
8. .stack set size of stack segment
9. db define byte
10. dw define word (2 bytes)
11. dd define double word (4 bytes)
12. dq define quadword (8 bytes)
13. dt define tenbytes
14. equ equate, assign numeric expression to a name

Microprocessor & Microcontroller


Microprocessor & Microcontroller

You might also like