8086 Microprocessor Notes
8086 Microprocessor Notes
8086 Microprocessor Notes
By,
Dr. Vimal Shrivastava
Assistant Professor
School of Electronics Engg.
KIIT Bhubaneswar
Books for 8086
• Microprocessors & Interfacing: Programming & Hardware
– By Douglas V. Hall.
Features of 8086:
• It is a first 16 bit µp.
• 8086 has a 20 address lines and can access up to 𝟐𝟐𝟎 memory locations (1
MB).
• It uses two stages of pipelining, i.e. Fetch Stage and Execute Stage,
which improves the performance.
• Address Bus: 8085 has 16-bit address bus while 8086 has 20-bit address
bus.
• I/O: 8085 can address 2^8 = 256 I/O's, whereas 8086 can access 2^16 =
65,536 I/O's.
Architecture of 8086
Architecture of 8086 (cont..)
• 8086 Microprocessor is internally divided into two functional
units:
– BIU (Bus Interface Unit)
– EU (Execution Unit)
Instruction Queue:
– It is First-In First-Out (FIFO) group of registers.
– BIU gets up to 6 bytes of next instructions and stores them in
the instruction queue.
– When EU executes instructions and is ready for its next
instruction, then it simply reads the instruction from this
instruction queue resulting in increased execution speed.
– Fetching the next instruction while the current instruction
executes is called pipelining.
– If the instructions such as Jump or subroutine call is
encountered, BIU will reset the queue and begin refilling after
passing the new instruction to the EU.
BIU (cont..)
• Segment registers:
• BIU has four 16-bit segment registers, i.e. CS, DS, SS & ES.
• The 8086 1 MB memory is divided into segments of up to 64KB
each.
• The 8086 can directly address four segments (256KB within the 1
MB memory) at a particular time.
Adder:
• The BIU contains a dedicated adder which is used to produce 20-bit
address.
• The BIU computes 20-bit physical address internally using the
programmer-provided logical addresses (16-bit contents of CS and
IP) by logically shifting the contents of CS four bits to left and then
adding 16-bit contents of IP.
• Note: Go through the example on Page-172 of Rafiquzzaman.
EU (Execution Unit)
• The EU decodes and executes instructions that have already been fetched
by the BIU.
• It has eight 16-bit registers. These are AX, BX, CX, DX, SP, BP, SI and DI.
• The 16-bit registers AX, BX, CX and DX can be used as two 8-bit registers
(AH, AL; BH, BL; CH, CL; DH, DL).
• The general-purpose registers AX, BX, CX and DX are named after special
functions carried out by each one of them.
Ex:
1. AX
– The AX is called the 16-bit accumulator while the AL is the 8-bit
accumulator.
– The use of accumulator register is assumed by some instructions.
– The IN/OUT instructions always use AX or AL.
– Multiplication and division instructions also use AX or AL.
– The AL register is same as 8085 ‘A’ register.
2. BX
– BX register is called base register.
– This is the only general-purpose register , the contents of which can be
used for addressing 8086 memory.
– All memory references utilizing these register contents for addressing
use DS as the default segment register.
– It is similar to 8085 HL registers.
3. CX
– CX register is known as the counter register.
– Some instructions such as shift, rotate and loop instructions use the
contents of CX as a counter.
4. DX
– DX is called data register.
– It is used to hold the results of multiplication and division.
• Flag Register:
– It is a 16-bit register.
– It has 9 active flags and they are divided into 2 groups:
• Six Conditional Flags (CF, AF, PF, ZF, SF, OF): It changes its
status according to the result stored in the accumulator.
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
If this flag is set, the processor enters
Overflow Flag the single step execution mode by
This flag is set, if there is an arithmetic overflow occurs, i.e., if the size of the result generating internal interrupts after the
exceeds the capacity of destination location. execution of each instruction.
Used for debugging the program.
Interrupt Flag
Direction Flag
This is used by string manipulation instructions. If this flag bit is ‘0’, the string
is processed beginning from the lowest address to the highest address, i.e., Causes the 8086 to recognize external mask
auto incrementing mode. Otherwise, the string is processed from the highest interrupts; clearing IF disables these
address towards the lowest address, i.e., auto decrementing mode. interrupts.
15
Summary of 8086 Registers
Sl.No. Type Register Name of register
width
1 General purpose 16 bit AX, BX, CX, DX
register
8 bit AL, AH, BL, BH, CL, CH,
DL, DH
2 Pointer register 16 bit SP, BP
3 Index register 16 bit SI, DI
4 Instruction Pointer 16 bit IP
5 Segment register 16 bit CS, DS, SS, ES
6 Flag (PSW) 16 bit Flag register
Summary of 8086 Registers (cont..)
Register Name of the Register Special Function
AX 16-bit Accumulator Stores the 16-bit results of arithmetic and logic
operations
AL 8-bit Accumulator Stores the 8-bit results of arithmetic and logic
operations
BX Base register Used to hold base value in base addressing mode
to access memory data
CX Count Register Used to hold the count value in SHIFT, ROTATE
and LOOP instructions
DX Data Register Used to hold data for multiplication and division
operations
SP Stack Pointer Used to hold the offset address of top stack
memory
BP Base Pointer Used to hold the base value in base addressing
using SS register to access data from stack
memory
SI Source Index Used to hold index value of source operand (data)
for string instructions
DI Data Index Used to hold the index value of destination
operand (data) for string operations
8086 Pin Diagram
• The 8086 comes in a 40 pin
package where some pins
are multiplexed.
• Ready
– It is an acknowledgement signal from I/O devices that data is
transferred.
– When it is high, it indicates that the device is ready to transfer
data.
– When it is low, it indicates wait state.
• RESET
– It causes the processor to immediately terminate its current
activity.
– Restart the execution from FFFF0H.
– This signal must be active high for the first 4 clock cycles to
RESET the microprocessor.
Common Pins (cont..)
• INTR (Interrupt Request)
– This is a level triggered input.
– It is sampled during the last clock cycle of each instruction to
determine the availability of interrupt request.
• TEST
– This input is examined by a ‘WAIT’ instruction.
– If it goes low, execution will continue, else the processor
remains in an idle state.
– This is used to synchronize an external activity to the processor
internal operation.
Common Pins (cont..)
• MN/MX (Minimum/Maximum Mode)
– It indicates what mode the processor is to operate in.
– When it is high, it works in the minimum mode (single
processor) and when it is low, it works in the maximum mode
(multiprocessor).
• WR (Write)
– The signal is used to indicate write operation (memory or I/O).
Pins used in Minimum Mode (cont..)
• DEN (Data Enable)
– This signal indicates the availability of valid data over the
address/data lines.
– It is used to enable transceivers (bidirectional buffers) to separate
the data from the multiplexed address/data bus.
• LOCK
– This output pin indicates that other processors (system) will be
prevented from gaining the access of system bus, while LOCK signal is
low.
Pins used in Maximum Mode (cont..)
• QS1, QS0 (Queue Status)
• These signals provide the status of instruction queue.
• Their conditions are shown in the following table:
• All the control signals are given out by the microprocessor itself.
• They are used for separating the valid address from multiplexed
address/data signals (AD0-AD15) and address/status signals
(A16/S3-A19/S6).
• Memory:
• The system contains memory: RAM and ROM.