8086 Micrprocessor
8086 Micrprocessor
Md Qaiser Reza
Microprocessor is a program-controlled
device, which fetches the instructions
from memory, decodes and executes the
instructions. Most Micro Processor are
single- chip devices.
Md Qaiser Reza
Comparison b/w 8085 & 8086
Md Qaiser Reza
Architecture of 8086
Md Qaiser Reza
BIU handle all Transfer of Data
& Address on buses
Sends Addresses
It consists of ALU
Md Qaiser Reza
Read instructions from Queue,
Decode & Execute.
Md Qaiser Reza
1.The process of fetching the next
FIFO
instruction when the present instruction
is being executed is called as pipelining.
2.Pipelining has become possible due to
the use of queue.
3.BIU (Bus Interfacing Unit) fills in the
queue until the entire queue is full.
4.BIU restarts filling in the queue when
at least two locations of queue are
vacant.
Advantages of pipelining:
•The execution unit always reads the next instruction byte from the queue in BIU. This is
faster than sending out an address to the memory and waiting for the next instruction byte
to come.
•In short pipelining eliminates the waiting time of EU and speeds up the processing. -The
8086 BIU will not initiate a fetch unless and until there are two empty bytes in its queue.
8086 BIU normally obtains two instruction bytes per fetch.
Md Qaiser Reza
Registers of 8086
Md Qaiser Reza
AX (Accumulator)
BX (Base Register)
CX (Counter Register)
purpose
registers
DX:AX together can be used as a 32 bits operand
BX is used for indirect addressing mode. MOV [BX], AX
CX is used for looping instruction, shift and rotate(CL),
and string instruction (for size of string)
DX is used with AX in case MUL & DIV when size is
Md Qaiser Reza
greater than AX
Flag register
CY (Carry Flag)
P (Parity Flag)
In 8086 there are 6 different flags AC (Auxiliary Carry Flag)
which are set or reset after 8-bit or Status Flags
16-bit operations. Z (Zero Flag)
S (Sign flag)
OF (Overflow Flag)
In 8086 there are 3 different flags DF (Direction Flag)
which are used to enable or disable
some basic operations of the Control Flags IF (Interrupt Flag)
microprocessor. TF (Trap Flag)
Md Qaiser Reza
Flag Register
Md Qaiser Reza
Flag Register
Overflow flag
If the result of an arithmetic operation on signed binary numbers performed by the CPU falls
inside the range, then OF = 0. OF = 1 if the signed result is out of bounds. The 8-bit signed
number range is from +7F to -80H, and the 16-bit signed number range is from +7FFF to -
8000H.
Directional flag
This is used in string related operations. DF = 1, then the string will be accessed from higher
memory address to lower memory address, and if DF = 0, it will do the reverse.
Interrupt flag
The hardware interrupt pin INTR can be enabled or disabled using the interrupt flag. When the
interrupt flag is set to zero with the CLI (Clear interrupt flag) instruction, the INTR interrupt is
disabled and the microprocessor will not recognize interrupt request from peripheral.
Trap Flag
This trap flag is used for on-chip debugging. When TF = 1, it will work in a single step mode.
After each instruction, one internal interrupt is generated. It helps to execute some program
instruction by instruction.
Md Qaiser Reza
Pointer and Index Register
In 8086 Microprocessor, they usually store the offset through which the actual address is
calculated.
Md Qaiser Reza
Physical Address Calculation
Physical Address: The 20-bit address of a byte
is called its physical Address.
But, it is specified as a Logical Address.
Logical address is in the form of:
Base Address : Offset
Offset is the displacement of the memory
location from the starting location of the
segment.
Q. The value of Code Segment (CS) Register is 4042H and the value of different offsets is as
follows:
BX: 2025H , IP: 0580H , DI: 4247H
Calculate the effective address of the memory location pointed by the CS register.
Q. The value of the DS register is 3032H. And the BX register contains a 16 bit value
which is equal to 3032H. 0008H is added to BX.
ADD BX, 0008H
The register AX contains some value which needs to be stored at a location as follows:
MOV [BX], AX
Calculate the address at which the value of the AX will be stored.
Md Qaiser Reza
Memory Segmentation
Segmentation is the process in which the main memory of the computer is logically divided into
different segments and each segment has its own base address. It is basically used to enhance
the speed of execution of the computer system, so that the processor is able to fetch and
execute the data from the memory easily and fast.
Md Qaiser Reza
Memory Segmentation
The number of address lines in 8086 is 20, 8086 BIU will send 20bit address, so as to access one
of the 1MB memory locations. The four segment registers actually contain the upper 16 bits of
the starting addresses of the four memory segments of 64 KB each with which the 8086 is
working at that instant of time. A segment is a logical unit of memory that may be up to 64
kilobytes long. Each segment is made up of contiguous memory locations. It is an independent,
separately addressable unit. Starting address will always be changing. It will not be fixed.
Note that the 8086 does not work the whole 1MB memory at any given time. However, it
works only with four 64KB segments within the whole 1MB memory.
Types of Segmentation
Non-
Overlapping overlapping
A segment starts at a particular address and its A segment starts at a particular address and its
maximum size can go up to 64kilobytes. But if maximum size can go up to 64kilobytes. But if
another segment starts along with this another segment starts before this 64kilobytes
64kilobytes location of the first segment, then location of the first segment, then the two
the two are said to be Overlapping Segment. segments are said to be Non-Overlapped
Segment.
Md Qaiser Reza
Memory Segmentation
Advantages of the Segmentation:
The main advantages of segmentation are as follows:
• It provides a powerful memory management mechanism.
• Data related or stack related operations can be performed in different segments.
• Code related operation can be done in separate code segments.
• It allows to processes to easily share data.
• It allows to extend the address ability of the processor, i.e. segmentation allows
the use of 16 bit registers to give an addressing capability of 1 Megabytes.
Without segmentation, it would require 20 bit registers.
• It is possible to enhance the memory size of code data or stack segments beyond
64 KB by allotting more than one segment for each area.
Md Qaiser Reza