110
EI 502 Microprocessors & Microcontrollers Part 5(16 bit 8086) Debasis Das 1 Mallabhum Institute of Technology Debasis Das Sep-Oct 2011

Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Embed Size (px)

DESCRIPTION

8086 Architecture, Instruction set

Citation preview

Page 1: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 1

EI 502Microprocessors

& Microcontrollers

Part 5(16 bit 8086)

Debasis Das

Sep-Oct 2011

Page 2: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 2

Intel 8086

Sep-Oct 2011

Page 3: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 3

Features

Direct addressing of 1 MB memory space, 20

bit addressing bus

16 bit data bus, Bit/ byte/block operations

Multiplexed bus

Multiprocessor features

Sep-Oct 2011

Page 4: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 4

Features8086 is designed to operate in two modes,

Minimum and Maximum.

It can pre-fetch up to 6 instruction bytes from memory and queue them in order to speed up instruction execution.

Address ranges from 00000H to FFFFFH

Memory is byte addressable - Every byte has a separate address

Sep-Oct 2011

Page 5: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 5

8086 Microprocessor

Belongs to a popular microprocessor series

8086, 80186, 80286, 80386, 80486, Pentium

INTEL launched 8086 in 1978

Sep-Oct 2011

Page 6: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 6

8086 Internal Architecture 8086 CPU has two parts which operate

independently (asynchronously) at the same time

Bus Interface Unit Execution Unit

CPU functions1. Fetch

2. Decode3. Execute

8086 CPU

Bus Interface Unit (BIU)

Execution Unit(EU)

Sep-Oct 2011

Page 7: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 7

8088 Microprocessor

Processor that drove the first PC

It is a 8 bit processor

Handles 8 bit data, hence database is 8 bits.

Otherwise most details are same as the 8086

Sep-Oct 2011

Page 8: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 8

BIU & EU FeaturesBoth units operate asynchronously to give

the 8086 an overlapping instruction fetch and execution mechanism which is called as Pipelining. This results in efficient use of the system bus and system performance.

BIU contains Instruction queue, Segment registers, Instruction pointer, Address adder.

EU contains Control circuitry, Instruction decoder, ALU, Pointer and Index register, Flag register

Sep-Oct 2011

Page 9: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 9

Bus Interface UnitSends out addresses for memory locations

Fetches Instructions from memory

Reads/Writes data to memory

Sends out addresses for I/O ports

Reads/Writes data to Input / Output ports

Sep-Oct 2011

Page 10: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 10

Execution UnitTells BIU (addresses) where to fetch

instructions or data

Decodes & Executes instructions

Dividing the work between BIU & EU speeds up

processing

Sep-Oct 2011

Page 11: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 11

8086 Block Diagram

Sep-Oct 2011

Page 12: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 12

8086 Architecture

Sep-Oct 2011

Page 13: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 13

Min/Max Pin-out Modes

Sep-Oct 2011

Page 14: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 14

Logical Signals

Sep-Oct 2011

Page 15: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 15

8088 Details

Sep-Oct 2011

Page 16: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 16

Min/Max ModesMinimum and Maximum Modes

The minimum mode is selected by applying logic 1 to the MN / MX# input pin. This is a single microprocessor configuration.

The maximum mode is selected by applying logic 0 to the MN / MX# input pin. This is a multi micro processors configuration.

Sep-Oct 2011

Page 17: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 17

Signal Description-1

Sep-Oct 2011

Page 18: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 18

Signal Description-2

Sep-Oct 2011

Page 19: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 19

Signal DescriptionMax Mode

Sep-Oct 2011

Page 20: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 20

Execution UnitMain components are

Instruction Decoder

Control System

Arithmetic Logic Unit

General Purpose Registers

Flag Register

Pointer & Index registers

Sep-Oct 2011

Page 21: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 21

Instruction DecoderTranslates instructions fetched from memory

into a series of actions which EU carries out

Control System Generates timing and control signals to

perform the internal operations of the microprocessor

Arithmetic Logic Unit EU has a 16-bit ALU which can ADD,

SUBTRACT, AND, OR, increment, decrement, complement or shift binary numbers

Sep-Oct 2011

Page 22: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 22

Memory Organization

Sep-Oct 2011

Page 23: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das

23

General Purpose RegistersEU has 8 general

purpose registersCan be individually

used for storing 8-bit data

AL register is also called Accumulator

Two registers can be combined to form a 16-bit register

The valid register pairs are – AX, BX, CX, and DX

AH AL

BH BL

CH CL

DH DL

AH AL AX

BH BL BX

CH CL CX

DH DL DX

Sep-Oct 2011

Page 24: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das

24

Flag Register8086 has a 16-bit flag register

Contains 9 active flags

There are two types of flags in 8086

Conditional flags – six flags, set or reset by EU

on the basis of results of some arithmetic

operations

Control flags – three flags, used to control

certain operations of the processorSep-Oct 2011

Page 25: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das

25

U U U U OF DF IF TF SF ZF U AF U PF U CF

Flag Register

1. CF CARRY FLAG Conditional Flags(Compatible with 8085, except OF)

2. PF PARITY FLAG

3. AF AUXILIARY CARRY

4. ZF ZERO FLAG

5. SF SIGN FLAG

6. OF OVERFLOW FLAG

7. TF TRAP FLAG Control Flags8. IF INTERRUPT FLAG

9. DF DIRECTION FLAG

Sep-Oct 2011

Page 26: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 26

Bus Interface Unit

Main Components are

Instruction Queue

Segment Registers

Instruction Pointer

Sep-Oct 2011

Page 27: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 27

Instruction Queue

8086 employs overlapped processing

When EU is busy decoding or executing current

instruction, the system bus of 8086 may not be in use.

At that time, BIU can use buses to fetch up to six

instruction bytes of the instructions next in program

BIU stores these pre-fetched bytes in a FIFO register

called Instruction Queue

When EU is ready for its next instruction, it simply

reads the instruction from the queue in BIU

Sep-Oct 2011

Page 28: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 28

Instruction PipelineEU of 8086 does not have to wait for BIU to

fetch next instruction byte from memory

The presence of a queue in 8086 speeds up

the processing

Fetching the next instruction while the current

instruction executes is called Instruction look

aheadSep-Oct 2011

Page 29: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 29

Instruction Pipeline

Sep-Oct 2011

Page 30: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 30

Memory Segmentation8086 has a 20-bit address bus

So it can address a maximum of 1MB of memory

8086 works with four 64KB segments at a time within this

1MB range (can be overlapped in exactly the same space)

These four memory segments are called

Code segment

Stack segment

Data segment

Extra segment

Sep-Oct 2011

Page 31: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 31

Segment RegistersHolds the upper 16-bits of the starting

address for each of the segments

The four segment registers are

CS (Code Segment register)

DS (Data Segment register)

SS (Stack Segment register)

ES (Extra Segment register)

Sep-Oct 2011

Page 32: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 32

Memory Address Generation

Sep-Oct 2011

Page 33: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 33

Code SegmentThat part of memory from where BIU is currently

fetching instruction code bytes

Stack Segment A section of memory set aside to store

addresses and data while a subprogram executes, accommodates stacks

Data & Extra Segments Used for storing data values to be used in the

program

Sep-Oct 2011

Page 34: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 34

Reserved MemoryLocations

Sep-Oct 2011

Page 35: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 35

Min Mode LogicalPin out

Sep-Oct 2011

Page 36: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 36

Min ModeInterface-1

When the Minimum mode operation is selected, the 8086 provides all control signals needed to implement the memory and I/O interface

The minimum mode signal can be divided into the following basic groups: address/data bus, status, control, interrupt and DMA.

Address/Data Bus : these lines serve two functions. As an address bus is 20 bits long and consists of signal lines A0 through A19. A19 represents the MSB and A0 LSB. A 20bit address gives the 8086 a 1Mbyte memory address space.

Independent I/O address space which 64K bytes in length

Sep-Oct 2011

Page 37: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 37

Min ModeInterface-2

The 16 data bus lines D0 through D15 are actually multiplexed with address lines A0 through A15 respectively. The bus works as an address bus during first machine cycle and as a data bus during next machine cycles. D15 is the MSB and D0 LSB

When acting as a data bus, they carry read/write data for memory, input/output data for I/O devices, and interrupt type codes from an interrupt controller

Sep-Oct 2011

Page 38: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 38

Min ModeInterface-3

Status signal : The four most significant address lines A19 through A16 are also multiplexed but in this case with status signals S6 through S3. These status bits are output on the bus at the same time that data are transferred over the other bus lines.

Bit S4 and S3 together form a 2 bit binary code that identifies which of the 8086 internal segment registers are used to generate the physical address output on the address bus during the current bus cycle

Code S4,S3 = 00 identifies a register known as extra segment register as the source of the segment address

Sep-Oct 2011

Page 39: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 39

Min ModeInterface-4

Sep-Oct 2011

Page 40: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 40

Min ModeInterface-5

Status line S5 reflects the status of another internal characteristic of the 8086. It is the logic level of the internal enable flag. The last status bit S6 is always at the logic 0 level

Control Signals : The control signals are provided to support the 8086 memory & I/O interfaces. They control functions such as when the bus is to carry a valid address, in which direction data are to be transferred over the bus, when valid write data are on the bus and when to put read data on the system bus

Sep-Oct 2011

Page 41: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 41

Min ModeInterface-6

ALE is a pulse to logic 1 that signals external circuitry when a valid address word is on the bus. This address must be latched in external circuitry on the 1-to-0 edge of the pulse at ALE.

Another control signal that is produced during the bus cycle is BHE bank high enable. Logic 0 on this used as a memory enable signal for the most significant byte half of the data bus D8 through D1. These line also serves a second function, which is as the S7 status line

Using the M/IO and DT/R lines, the 8086 signals which type of bus cycle is in progress and in which direction data are to be transferred over the bus.

Sep-Oct 2011

Page 42: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 42

Min ModeInterface-7

The logic level of M/IO tells external circuitry whether a memory or I/O transfer is taking place over the bus. Logic 1 at this output signals a memory operation and logic 0 an I/O operation.

The direction of data transfer over the bus is signalled by the logic level output at DT/R. When this line is logic 1 during the data transfer part of a bus cycle, the bus is in the transmit mode. Therefore, data are either written into

memory or output to an I/O deviceOn the other hand, logic 0 at DT/R signals that the bus is

in the receive mode. This corresponds to reading data from memory or input of data from an input port

Sep-Oct 2011

Page 43: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 43

Min ModeInterface-8

The signal read RD and write WR indicates that a read bus cycle or a write bus cycle is in progress. The 8086 switches WR to logic 0 to signal external device that valid write or output data are on the bus

On the other hand, RD indicates that the 8086 is performing a read of data of the bus. During read operations, one other control signal is also supplied. This is DEN ( data enable) and it signals external devices when they should put data on the bus

There is one other control signal that is involved with the memory and I/O interface. This is the READY signal

Sep-Oct 2011

Page 44: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 44

Min ModeInterface-9

READY signal is used to insert wait states into the bus cycle such that it is extended by a number of clock periods. This signal is provided by an external clock generator device and can be supplied by the memory or I/O subsystem to signal the 8086 when they are ready to permit the data transfer to be completed.

Interrupt signals : The key interrupt interface signals are interrupt request (INTR) and interrupt acknowledge( INTA)

INTR is an input to the 8086 that can be used by an external device to signal that it need to be serviced

Sep-Oct 2011

Page 45: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 45

Min ModeInterface-10

Logic 1 at INTR represents an active interrupt request. When an interrupt request has been recognized by the 8086, it indicates this fact to external circuit with pulse to logic 0 at the INTA output

The TEST input is also related to the external interrupt interface. Execution of a WAIT instruction causes the 8086 to check the logic level at the TEST input

If the logic 1 is found, the MPU suspends operation and goes into the idle state. The 8086 no longer executes instructions, instead it repeatedly checks the logic level of the TEST input waiting for its transition back to logic 0

Sep-Oct 2011

Page 46: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 46

Min ModeInterface-11

As TEST switches to 0, execution resume with the next instruction in the program. This feature can be used to synchronize the operation of the 8086 to an event in external hardware.

There are two more inputs in the interrupt interface: the non-maskable interrupt NMI and the reset interrupt RESET

On the 0-to-1 transition of NMI control is passed to a non-maskable interrupt service routine. The RESET input is used to provide a hardware reset for the 8086. Switching RESET to logic 0 initializes the internal register of the 8086 and initiates a reset service routine

Sep-Oct 2011

Page 47: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 47

Min ModeInterface-12

DMA Interface signals :The direct memory access DMA interface of the 8086 minimum mode consist of the HOLD and HLDA signals

When an external device wants to take control of the system bus, it signals to the 8086 by switching HOLD to the logic 1 level. At the completion of the current bus cycle, the 8086 enters the hold state. In the hold state, signal lines AD0 through AD15, A16/S3 through A19/S6, BHE, M/IO, DT/R, RD, WR, DEN and INTR are all in the high Z state. The 8086 signals external device that it is in this state by switching its HLDA output to logic 1 level

Sep-Oct 2011

Page 48: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 48

Max ModeBlock Diagram

Sep-Oct 2011

Page 49: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 49

Max ModeInterface-1

When the 8086 is set for the maximum-mode configuration, it provides signals for implementing a multiprocessor / coprocessor system environment

By multiprocessor environment we mean that one microprocessor exists in the system and that each processor is executing its own program

Usually in this type of system environment, there are some system resources that are common to all processors

They are called as global resources. There are also other resources that are assigned to specific processors. These are known as local or private resources

Sep-Oct 2011

Page 50: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 50

Max ModeInterface-2

In multiple processor situation a second processor is in the system. Both processors do not access the bus at the same time

One passes the control of the system bus to the other and then may suspend its operation

In the maximum-mode 8086 system, facilities are provided for implementing allocation of global resources and passing bus control to other microprocessor or coprocessor.

Sep-Oct 2011

Page 51: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 51

Max ModeInterface-2

8288 Bus Controller – Bus Command and Control Signals: 8086 does not directly provide all the signals that are required to control the memory, I/O and interrupt interfaces

Specially the WR, M/IO, DT/R, DEN, ALE and INTA, signals are no longer produced by the 8086. Instead it outputs three status signals S0, S1, S2 prior to the initiation of each bus cycle. This 3- bit bus status code identifies which type of bus cycle is to follow

S2,S1,S0 are input to the external bus controller device, the bus controller generates the appropriately timed command and control signals

Sep-Oct 2011

Page 52: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 52

Max ConfigurationUsing 8288 Bus Controller

Sep-Oct 2011

Page 53: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 53

8288 Pin out

Sep-Oct 2011

Page 54: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 54

Max ModeInterface-3

Sep-Oct 2011

Page 55: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 55

Max ModeInterface-4

The 8288 produces one or two of these eight command signals for each bus cycles. For instance, when the 8086 outputs the code S2S1S0 equals 001, it indicates that an I/O read cycle is to be performed

If the code 111 is output by the 8086, it is signalling that no bus activity is to take place

The control outputs produced by the 8288 are DEN, DT/R and ALE. These 3 signals provide the same functions as those described for the minimum system mode. This set of bus commands and control signals is compatible with the Multibus (an industry standard) for interfacing microprocessor systems.

Sep-Oct 2011

Page 56: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 56

Max ModeInterface-5

8289 Bus Arbiter – Bus Arbitration and Lock Signals : This device permits processors to reside on the system bus. It does this by implementing the Multibus arbitration protocol in an 8086-based system

Addition of the 8288 bus controller and 8289 bus arbiter frees a number of the 8086 pins for use to produce control signals that are needed to support multiple processors

Bus priority lock ( LOCK) is one of these signals. It is input to the bus arbiter together with status signals S0 through S2.

Sep-Oct 2011

Page 57: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 57

8289 Block Diagram

Sep-Oct 2011

Page 58: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 58

8289 Pin Out

Sep-Oct 2011

Page 59: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 59

Max ModeInterface-6

The output of 8289 are bus arbitration signals: bus busy (BUSY), common bus request (CBRQ), bus priority out (BPRO), bus priority in (BPRN), bus request (BREQ) and bus clock (BCLK).

They correspond to the bus exchange signals of the Multibus and are used to lock other processor off the system bus during the execution of an instruction by the 8086

In this way the processor can be assured of uninterrupted access to common system resources such as global memory.

Sep-Oct 2011

Page 60: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 60

Max ModeInterface-7

Queue Status Signals : Two new signals that are produced by the 8086 in the maximum-mode system are queue status outputs QS0 and QS1. Together they form a 2-bit queue status code, QS1QS0

Following table shows the four different queue status

Sep-Oct 2011

Page 61: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 61

Max ModeInterface-8

Local Bus Control Signal – Request / Grant Signals:

In a maximum mode configuration, the minimum

mode HOLD, HLDA interface is also changed. These

two are replaced by request/grant lines RQ/ GT0 and

RQ/ GT1, respectively. They provide a prioritized bus

access mechanism for accessing the local bus.

Sep-Oct 2011

Page 62: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 62

Instruction Pointer (IP) Register

A 16-bit register

Holds 16-bit offset, of the next instruction byte in

the code segment

BIU uses IP and CS registers to generate the 20-bit

address of the instruction to be fetched from

memorySep-Oct 2011

Page 63: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 63

Stack Segment (SS) Register Stack Pointer (SP) Register

Upper 16-bits of the starting address of stack

segment is stored in SS register

It is located in BIU

SP register holds a 16-bit offset from the start of

stack segment to the top of the stack

It is located in EUSep-Oct 2011

Page 64: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 64

Other Pointer & Index Registers

Base Pointer (BP) register

Source Index (SI) register

Destination Index (DI) register

Can be used for temporary storage of data

Main use is to hold a 16-bit offset of a data word in

one of the segmentsSep-Oct 2011

Page 65: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 65

Memory Space

Sep-Oct 2011

Page 66: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 66

8086 System RelatedChips

Sep-Oct 2011

Page 67: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 67

8286/7 OctalTransceivers

Sep-Oct 2011

Page 68: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 68

8 Bit I/O Ports8282/8283

Sep-Oct 2011

Page 69: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 69

8284A Clock generator

Sep-Oct 2011

Page 70: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 70

Instruction Set

Sep-Oct 2011

Page 71: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 71

Instruction Format

Sep-Oct 2011

Page 72: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 72

Addressing ModesAddressing mode indicates a way of locating data or

operands Depending upon the data types used in the

instruction and the memory addressing modes, any instruction may belong to one or more addressing modes, or some instruction may not belong to any of the addressing modes

Addressing modes describe the types of operands and the way they are accessed for executing an instruction. Instructions may be categorized as Sequential control flow instructions and Control transfer instructions

Sep-Oct 2011

Page 73: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 73

Instruction Type Modes

Sequential control flow instructions are the instructions, which after execution, transfer control to the next instruction appearing immediately after it (in sequence) in the program For example, the arithmetic, logical, data transfer and

processor control instructions are sequential control flow instructions

The control transfer instructions, on the other hand, transfer control to some predefined address somehow specified in the instruction after their execution. For example, INT, CALL, RET and JUMP instructions fall under this category

Sep-Oct 2011

Page 74: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 74

Sequential Control Flow

Modes

Sep-Oct 2011

Page 75: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 75

Immediate ModeIn this type of addressing, immediate data is a

part of instruction, and appears in the form of successive byte or bytes.Example: MOV AX, 0005H

In the above example, 0005H is the immediate data. The immediate data may be 8-bit or 16-bit in size

Sep-Oct 2011

Page 76: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 76

Direct ModeIn the direct addressing mode, a 16-bit

memory address (offset) is directly specified in the instruction as a part of it.Example: MOV AX, [5000H]

Here, data resides in a memory location in the data segment, whose effective address may be computed using 5000H as the offset address and content of DS as segment address. The effective address, here, is 10H*DS+5000H

Sep-Oct 2011

Page 77: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 77

Register ModeIn register addressing mode, the data is

stored in a register and it is referred using the particular register. All the registers, except IP, may be used in this mode.

Example: MOV BX, AX

Sep-Oct 2011

Page 78: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 78

Register IndirectSometimes, the address of the memory location, which

contains data or operand, is determined in an indirect way, using the offset registers. This mode of addressing is known as register indirect mode. In this addressing mode, the offset address of data is in either BX or SI or DI registers. The default segment is either DS or ES. The data is supposed to be available at the address pointed to by the content of any of the above registers in the default data segment.Example: MOV AX, [BX]

Here, data is present in a memory location in DS whose offset address is in BX. The effective address of the data is given as 10H*DS+ [BX]

Sep-Oct 2011

Page 79: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 79

IndexedIn this addressing mode, offset of the operand

is stored in one of the index registers. DS and ES are the default segments for index registers SI and DI respectively. This mode is a special case of the above discussed register indirect addressing mode.Example: MOV AX, [SI]

Here, data is available at an offset address stored in SI and DS. The effective address, in this case, is computed as 10H*DS+ [SI]

Sep-Oct 2011

Page 80: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 80

Register RelativeIn this addressing mode, the data is available

at an effective address formed by adding an 8-bit or 16-bit displacement with the content of any one of the registers BX, BP, SI and DI in the default (either DS or ES) segment. The example given before explains this mode. Example: MOV Ax, 50H [BX]

Here, effective address is given as 10H*DS+50H+ [BX]

Sep-Oct 2011

Page 81: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 81

Based IndexedThe effective address of data is formed, in this

addressing mode, by adding content of a base register (any one of BX or BP) to the content of an index register (any one of SI or DI). The default segment register may be ES or DS.Example: MOV AX, [BX] [SI]

Here, BX is the base register and SI is the index register. The effective address is computed as 10H*DS+ [BX] + [SI]

Sep-Oct 2011

Page 82: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 82

Relative Based Indexed

The effective address is formed by adding an 8-bit or 16-bit displacement with the sum of contents of any one of the bases registers (BX or BP) and any one of the index registers, in a default segment. Example: MOV AX, 50H [BX] [SI]

Here, 50H is an immediate displacement, BX is a base register and SI is an index register. The effective address of data is computed as 160H*DS+ [BX] + [SI] + 50H

Sep-Oct 2011

Page 83: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 83

Control TransferModes

Sep-Oct 2011

Page 84: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 84

Basis of ModesFor the control transfer instructions, the addressing

modes depend upon whether the destination location is within the same segment or a different one. It also depends upon the method of passing the destination address to the processor. Basically, there are two addressing modes for the control transfer instructions, viz. inter-segment and intra-segment addressing modes.

If the location to which the control is to be transferred lies in a different segment other than the current one, the mode is called inter-segment mode. If the destination location lies in the same segment, the mode is called intra-segment.

Sep-Oct 2011

Page 85: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 85

Control Transfer Modes

Modes

Inter segment

Inter segment direct

Inter segment indirect

Intra segment

Intra segment direct

Intra segment indirect

Sep-Oct 2011

Page 86: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 86

Instruction CategoriesCategories Categories

Data TransferArithmeticStringLogicalShiftRotateProgram Execution

Transfer

InterruptHLL SupportProcessor ControlBit ManipulationIteration Control

Sep-Oct 2011

Page 87: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 87

Data Transfer-1MOV destination, sourcePUSH sourcePUSH / PUSHADPOP destinationPOPA / POPADXCHG destination, sourceXLAT

Sep-Oct 2011

Page 88: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 88

Data Transfer-2MOXZX destination, source

MOVSZ destination, source

CBW

CDW

CWDE

CDQ

Sep-Oct 2011

Page 89: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 89

Data Transfer-3LEA register, source

LDS register, source

LSS register, source

LES register, source

LGS register, source

LFS register, source

Sep-Oct 2011

Page 90: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 90

Data Transfer-4LAHFSAHFPUSHFPOPFPUSHFDPOPFDSTCCLCCMCSTDCLDCLTS

Sep-Oct 2011

Page 91: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 91

Data Transfer-5

IN accumulator, port number

OUT port number, accumulator

Sep-Oct 2011

Page 92: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 92

Arithmetic-1ADD destination, sourceADC destination, sourceINC destinationAAADAASUB destination, sourceSBB destination, sourceDEC destination

Sep-Oct 2011

Page 93: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 93

Arithmetic-2NEG registerCMP destination, sourceAASDASMUL sourceAAMDIV sourceIDIV sourceAAD

Sep-Oct 2011

Page 94: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 94

Logical-1

NOT destination

AND destination, source

OR destination, source

XOR destination, source

TEST destination, source

Sep-Oct 2011

Page 95: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 95

Logical-2

Sep-Oct 2011

SAL / SHL Destination, CountSAL BX, 01SAL BP, CLMOV CL, 04HSAL AL, CL

Page 96: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 96

Logical-3SHR Destination, CountSHR BP, 01SHR AL, CL

Sep-Oct 2011

Page 97: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 97

Logical-4SAR Destination, CountSAR DI, 1SAR AL, 01

Sep-Oct 2011

Page 98: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 98

Logical-5ROL Destination, CountROL AX, 1ROL BL, CL

Sep-Oct 2011

Page 99: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 99

Logical-6RCL Destination, CountRCL AX, 1RCL BL, CL

Sep-Oct 2011

Page 100: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 100

Logical-7ROR Destination, CountROR BL, 01ROR AL, CL

Sep-Oct 2011

Page 101: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 101

Logical-8RCR Destination, CountRCR BL, 01RCR AL, CL

Sep-Oct 2011

Page 102: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 102

Program Execution Transfer

Call Procedure

CALL SQRT

CALL BX

CALL WORD PTR(BX)

RET

Sep-Oct 2011

Page 103: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 103

Jump Instructions-1JMP label

Sep-Oct 2011

Page 104: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 104

Jump Instructions-2

Sep-Oct 2011

Page 105: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 105

Jump Instructions-3

Sep-Oct 2011

Page 106: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 106

Iteration Control Instructions

Sep-Oct 2011

Page 107: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 107

InterruptSTI

CLI

INT type

INTO

IRET

Sep-Oct 2011

Page 108: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 108

Bit ManipulationBT – Bit test and put specified bit in carry flag.

E.g. BT ECX, 4BTSBTRBTCBSF – BSF BX, CXBSR

Sep-Oct 2011

Page 109: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 109

String InstructionsMOVS / MOVSB / MOVSW / MOVSDINS / INSB / INSWOUTS / OUTSB / OUTSWCMPS / CMPSB / CMPSW / CMPSDSCAS / SCASB / SCABW / SCASDLODS / LODSB / LODSW / LODSDSTOS / STOSB / STOSW / STOSDREP / REPE / REPZ / REPNE / REPNZ

Sep-Oct 2011

Page 110: Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1

Mallabhum Institute of Technology Debasis Das 110

Processor Control

HLT

WAIT

ESC

LOCK

NOP

Sep-Oct 2011