Module 1 8086
Module 1 8086
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
32 bit processors
Third Generation
Physical memory space 224 bytes = 16 Mb
During 1978
Virtual memory space 240 bytes = 1 Tb
HMOS technology Faster speed, Higher
Floating point hardware
packing density
Supports increased number of addressing
16 bit processors 40/ 48/ 64 pins
modes
Easier to program
Dynamically relatable programs
Intel 80386
Processor has multiply/ divide arithmetic
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
Various conditions of the
Computational Unit;
results are stored as
performs arithmetic and Internal storage of data
status bits called flags in
logic operations
flag register
EU executes instructions that have BIU fetches instructions, reads data from
already been fetched by the BIU. memory and I/O ports, writes data to
memory and I/ O ports.
BIU and EU functions separately.
The Execution Unit (EU)
• Control circuitry
The main • Instruction Decoder
components of • The ALU
the EU are: • Flag /Status registers
• General Purpose Registers
Control Circuitry, Instruction
Decoder And ALU:
• The EU contains control circuit which directs internal operations.
• Fetches instructions from the Queue in BIU, decodes and executes
arithmetic and logic operations using the ALU.
• Sends control signals for internal data transfer operations within the
microprocessor.
• Sends request signals to the BIU to access the external module.
• It operates with respect to T-states (clock cycles) and not machine
cycles.
Flag /Status Register
The flag register, 6 out of 9 flags are used as status flags.
When the microprocessor performs an arithmetic or
logical operation in ALU, then depending upon the status
of the result, the microprocessor will store corresponding
status bits 0 or 1 in status flags.
The status flags are,
• Carry flag (CF)
• Parity flag (PF)
• Auxiliary carry flag (AF)
• Zero flag (ZF)
• Sign flag (SF), and
• Overflow flag (OF).
Control Flags :
• Depending upon the value of the controlling flag bit, the
microprocessor will control a particular operation i.e.,
these flags are used to control certain operations. There
are three controlling flags namely,
• Interrupt flag (IF),
• Direction flag (DF), and
• Trap flag (TP).
Registers
General-purpose registers are used to store temporary data within the
microprocessor. There are 4 general-purpose registers and 4 special purpose
register are there in the 8086 microprocessor.
General Purpose Register
• AX register: This is the accumulator. It is of 16 bits and is divided into two 8-bit registers AH and AL to
also perform 8-bit instructions. It is generally used for arithmetical and logical instructions .
• BX register: The base register. It is of 16 bits and is divided into two 8-bit registers BH and BL to also
perform 8-bit instructions. It is used to store the value of the offset.
Example: MOV BL, [500] (BL = 500H)
• CX register: Counter register. It is of 16 bits and is divided into two 8-bit registers CH and
CL to also perform 8-bit instructionsIt holds count for instructions like loop, rotate, shift and
MOV CX, 0005 LOOP
string operations.
Example:
• DX register: Data register. It is of 16 bits and is divided into two 8-bit registers DH and
DL to also perform 8-bit instructions. It is used with AX to hold 32 bit values during
multiplication and division.
Special purpose Register
• SP: This is the stack pointer. It is of 16 bits. It points to the topmost item of the
stack. If the stack is empty the stack pointer will be (FFFE)H. Its offset address
is relative to the stack segment.
• BP :This is the base pointer. It is of 16 bits. It is primarily used in accessing
parameters passed by the stack. Its offset address is relative to the stack
segment.
• SI :This is the source index register. It is of 16 bits. It is used in the pointer
addressing of data and as a source in some string-related operations. Its offset
is relative to the data segment.
• DI :This is the destination index register. It is of 16 bits. It is used in the pointer
addressing of data and as a destination in some string-related operations. Its
offset is relative to the extra segment.
• 4 Segment registers
BIU • The Instruction Pointer
Contains • A prefetch queue
• Address Generation Circuit.
1. The Bus Interface Unit (BIU)
• It provides the interface of 8086 to external memory and I/O devices
via the System Bus.
• It performs various machine cycles such as memory read, I/O read
etc. to transfer data between memory and I/O devices.
• BIU performs the following functions-
• It generates the 20 bit physical address for memory access.
• It fetches instructions from the memory.
• It transfers data to and from the memory and I/O.
• Maintains the 6 byte prefetch instruction queue(supports pipelining).
Instruction Pointer (IP)
• It is a 16 bit register. It holds offset of the next instructions in the Code
Segment.
• IP is incremented after every instruction byte is fetched.
• IP gets a new value whenever a branch instruction occurs.
• CS is multiplied by 10H to give the 20 bit physical address of the Code
Segment.
• Address of the next instruction is calculated as CS x 10H + IP.
Example:
• CS = 4321H IP = 1000H, then CS x 10H = 43210H + offset = 44210H
• This is the address of the instruction.
SEGMENT REGISTER
Code Segment
register:
CS holds the base Data Segment
address for the Code register:
Segment. All programs DS holds the base
are stored in the Code address for the Data
Segment and accessed Segment
via the IP.
MN/ MX
MINIMUM / MAXIMUM
READY
CLK
31
8086
Microprocessor Pins and SignalsMinimum mode signals
Pins 24 -31
Pins 24 -31
33
8086
Microprocessor Pins and Signals Maximum mode signals
34
8086
Microprocessor Pins and Signals
Maximum mode signals
35
8086
Microprocessor Pins and SignalsMaximum mode signals
During maximum mode operation, the MN/ is
grounded (logic low)
• The other components which are transceivers, latches, 8284 clock generator,
74138 decoder, memory and i/o devices are also present in the system.
• The address bus of 8086 is 20 bits long. By this we can access 220 byte
memory i.e. 1MB . Out of 20 bits, 16 bits A0 to A15(or 16 lines) are multiplexed
with a data bus. By multiplexing, it means they will act as address lines
during the first T state of the machine cycle and in the rest, they act as data
lines. A16 to A19 are multiplexed S3 to S6 and BHE’ is multiplexed with S7.
8282 (8 bits) latch :
The latches are buffered D FF. They are used to
separate the valid address from the multiplexed
Address/data bus by using the control signal ALE,
which is connected to strobe(STB) of 8282. The
ALE is active high signal. Here three such latches
are required because the address is 20 bits.
40
•8284 clock generator is used to provide the clock
used to synchronize process.
74138 3:8 decoder.
•M/IO’= 1,then I/O transfer is performed over the
bus. and when M/IO’ = 0, then I/O operation is
performed.
•The signals RD’ and write WR’ are used to identify
whether a read bus cycle or a write bus cycle is
performing. When WR’ = 0 ,then it indicates that
valid output data on the data bus.
•RD’ indicates that the 8086 is performing a read
data or instruction fetch process is occurring .During
read operations, one other control signal is also
used, which is DEN ( data enable) and it indicates the
external devices when they should put data on the
bus.
•Control signals for all operations are generated by
decoding M/IO’, RD’, WR’. They are decoded by
41
•INTR and INTA :
When INTR = 1,then there is an
interrupt to 8086 by other
devices for their service. When
INTA’= 0,then it indicates that
the processor is ready to
service them.
45
•At T1 state ALE =1 ,this indicates that a valid address is latched on
the address bus and also M / IO’= 1, which indicates the memory
operation is in progress.
•In T2, the processor sends the data to be written to the addressed
location.
•The data is buffered on the bus until the middle of T4 state.
•The WR’=0 becomes at the beginning of T2.
•The BHE’ and A0 signals are used to select the byte or bytes of
memory or I/O word.
•During T2 DEN’ =0, which enables, transceivers and DT/R’ =
1 ,which indicates that the data is transferred by the processor to
the addressed device.
All kinds of memory and i/o operations are performed using the
decoding of M/IO’ and RD’ WR’ .
Maximum Mode 8086 System
47
•In this we can connect more
processors to 8086 (8087/8089).
•8086 max mode is basically for
implementation of allocation of global
resources and passing bus control to
other coprocessor(i.e. second
processor in the system), because two
processors can not access system bus
at same instant.
•All processors execute their own
program.
•The resources which are common to
all processors are known as global
resources.
•The resources which are allocated to
a particular processor are known as
local or private resources.
48
•When MN/ MX’ = 0 , 8086 works in max
mode.
•Clock is provided by 8284 clock generator.
•8288 bus controller- Address form the
address bus is latched into 8282 8-bit latch.
Three such latches are required
because address bus is 20 bit. The ALE(Address
latch enable) is connected to STB(Strobe) of
the latch. The ALE for latch is given by 8288
bus controller.
•The data bus is operated through 8286 8-bit
transceiver. Two such transceivers are required,
because data bus is 16-bit. The transceivers
are enabled the DEN signal, while the
direction of data is controlled by the DT/R
signal. DEN is connected to OE’ and DT/ R’ is
connected to T. Both DEN and DT/ R’ are given
by 8288 bus controller.
49
Control signals for all
operations are generated by
decoding S’2, S’1 and
S’0 using 8288 bus
controller.
53
8086
Microprocessor Addressing Modes
Every instruction of a program has to operate on a data.
The different ways in which a source operand is denoted
in an instruction are known as addressing modes.
1. Register Addressing
Group I : Addressing modes for register and
2. Immediate Addressing immediate data
3. Direct Addressing
5. Based Addressing
Group II : Addressing modes for memory data
6. Indexed Addressing
8. String Addressing
9. Direct I/O port Addressing Group III : Addressing modes for I/O ports
10. Indirect I/O port Addressing
Group IV : Relative Addressing mode
11. Relative Addressing
Adder
Segment Offset within a program, all memory locations within a segment are relative to the
segment starting address. The distance in bytes from the segment address to another location
57
within the segment is expressed as an offset (or displacement)
8086
Microprocessor Addressing Modes : Memory Access
20 Address lines 8086 can address up to 220 = 1M bytes of memory
Each time the processor wants to access memory, it takes the contents of
a segment register, shifts it one hexadecimal place to the left (same as
multiplying by 1610), then add the required offset to form the 20- bit
16 bytes of contiguous
address memory
Supported
[BX + SI] combinations:
[SI]
[BX + SI + d8]
[BX + DI] [BX + DI + d8]
[DI]
[BP + SI] [BP + SI + d8] BX SI
d16 (variable offset only)
[BP + DI] [BP + DI + d8] + disp
[BX]
BP DI
If ZF = 1, then
EA = (IP) + 000AH
BA = (CS) x 1610
MA = BA + EA
• Example: CLC
• This clears the carry flag to zero.