Chapter 4 - Introduction To Intel 8086 Microprocessor
Chapter 4 - Introduction To Intel 8086 Microprocessor
8086 Microprocessor is divided into two functional units, i.e., EU (Execution Unit) and BIU (Bus Interface
Unit).
i) EU (Execution Unit)
Execution unit gives instructions to BIU stating from where to fetch the data and then decode and execute
those instructions. Its function is to control operations on data using the instruction decoder & ALU. EU
has no direct connection with system buses as shown in the above figure, it performs operations over data
through BIU.
Let us now discuss the functional parts of 8086 microprocessors.
ALU
It handles all arithmetic and logical operations, like +, −, ×, /, OR, AND, NOT operations.
Flag Register
It is a 16-bit register that behaves like a flip-flop, i.e. it changes its status according to the result stored in the
accumulator. It has 9 flags and they are divided into 2 groups − Conditional Flags and Control Flags.
Conditional Flags
It represents the result of the last arithmetic or logical instruction executed. Following is the list of conditional
flags −
Carry flag − This flag indicates an overflow condition for arithmetic operations.
Auxiliary flag − When an operation is performed at ALU, it results in a carry/barrow from lower nibble
(i.e. D0 – D3) to upper nibble (i.e. D4 – D7), then this flag is set, i.e. carry given by D3 bit to D4 is AF
flag. The processor uses this flag to perform binary to BCD conversion.
Parity flag − This flag is used to indicate the parity of the result, i.e. when the lower order 8-bits of the
result contains even number of 1’s, then the Parity Flag is set. For odd number of 1’s, the Parity Flag is
reset.
Zero flag − This flag is set to 1 when the result of arithmetic or logical operation is zero else it is set to
0.
Sign flag − This flag holds the sign of the result, i.e. when the result of the operation is negative, then the
sign flag is set to 1 else set to 0.
Overflow flag − This flag represents the result when the system capacity is exceeded.
Control Flags
Control flags controls the operations of the execution unit. Following is the list of control flags −
Trap flag − It is used for single step control and allows the user to execute one instruction at a time for
debugging. If it is set, then the program can be run in a single step mode.
Interrupt flag − It is an interrupt enable/disable flag, i.e. used to allow/prohibit the interruption of a
program. It is set to 1 for interrupt enabled condition and set to 0 for interrupt disabled condition.
Direction flag − It is used in string operation. As the name suggests when it is set then string bytes are
accessed from the higher memory address to the lower memory address and vice-a-versa.
General purpose register
There are 8 general purpose registers, i.e., AH, AL, BH, BL, CH, CL, DH, and DL. These registers can be
used individually to store 8-bit data and can be used in pairs to store 16bit data. The valid register pairs
are AH and AL, BH and BL, CH and CL, and DH and DL. It is referred to the AX, BX, CX, and DX
respectively.
AX register − It is also known as accumulator register. It is used to store operands for arithmetic
operations.
BX register − It is used as a base register. It is used to store the starting base address of the memory area
within the data segment.
CX register − It is referred to as counter. It is used in loop instruction to store the loop counter.
DX register − This register is used to hold I/O port address for I/O instruction.
Stack pointer register
It is a 16-bit register, which holds the address from the start of the segment to the memory location, where a
word was most recently stored on the stack.
ii) BIU (Bus Interface Unit)
BIU takes care of all data and addresses transfers on the buses for the EU like sending addresses, fetching
instructions from the memory, reading data from the ports and the memory as well as writing data to the
ports and the memory. EU has no direction connection with System Buses so this is possible with the
BIU. EU and BIU are connected with the Internal Bus.
It has the following functional parts −
Instruction queue − BIU contains the instruction queue. BIU gets upto 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.
Segment register − BIU has 4 segment buses, i.e. CS, DS, SS& ES. It holds the addresses of instructions
and data in memory, which are used by the processor to access memory locations. It also contains 1
pointer register IP, which holds the address of the next instruction to executed by the EU.
CS − It stands for Code Segment. It is used for addressing a memory location in the code segment
of the memory, where the executable program is stored.
DS − It stands for Data Segment. It consists of data used by the program and is accessed in the
data segment by an offset address or the content of other register that holds the offset address.
SS − It stands for Stack Segment. It handles memory to store data and addresses during execution.
ES − It stands for Extra Segment. ES is additional data segment, which is used by the string to
hold the extra destination data.
Instruction pointer − It is a 16-bit register used to hold the address of the next instruction to be executed.
3. 8086 Pin Configuration
8086 was the first 16-bit microprocessor available in 40-pin DIP (Dual Inline Package) chip. Let us now
discuss in detail the pin configuration of a 8086 Microprocessor. Here is the pin diagram of 8086
microprocessor –
S0, S1, S2
These are the status signals that provide the status of operation, which is used by the Bus Controller 8288 to
generate memory & I/O control signals. These are available at pin 26, 27, and 28. Following is the table
showing their status −
S2 S1 S0 Status
0 0 0 Interrupt acknowledgement
0 0 1 I/O Read
0 1 0 I/O Write
0 1 1 Halt
1 0 0 Opcode fetch
1 0 1 Memory read
1 1 0 Memory write
1 1 1 Passive
LOCK
When this signal is active, it indicates to the other processors not to ask the CPU to leave the system bus. It
is activated using the LOCK prefix on any instruction and is available at pin 29.
RQ/GT1 and RQ/GT0
These are the Request/Grant signals used by the other processors requesting the CPU to release the system
bus. When the signal is received by CPU, then it sends acknowledgment. RQ/GT 0 has a higher priority than
RQ/GT1.
4. Addressing Modes of 8086
The different ways in which a source operand is denoted in an instruction is known as addressing modes.
There are 8 different addressing modes in 8086 programming −
1. Immediate addressing mode
The addressing mode in which the data operand is a part of the instruction itself is known as immediate
addressing mode.
Example
MOV CX, 4929 ;
ADD AX, 2387H;
MOV AL, FFH;
2. Register addressing mode
It means that the register is the source of an operand for an instruction.
Example
MOV CX, AX ; copies the contents of the 16-bit AX register into
; the 16-bit CX register),
ADD BX, AX
3. Direct addressing mode
The addressing mode in which the effective address of the memory location is written directly in the
instruction.
Example
MOV AX, [1592H];
MOV AL, [0300H];
4. Register indirect addressing mode
This addressing mode allows data to be addressed at any memory location through an offset address held in
any of the following registers: BP, BX, DI & SI.
Example
MOV AX, [BX] ; Suppose the register BX contains 4895H, then the contents
; 4895H are moved to AX
ADD CX, {BX}
5. Based addressing mode
In this addressing mode, the offset address of the operand is given by the sum of contents of the BX/BP
registers and 8-bit/16-bit displacement.
Example
MOV DX, [BX+04];
ADD CL, [BX+08];
6. Indexed addressing mode
In this addressing mode, the operands offset address is found by adding the contents of SI or DI register and
8-bit/16-bit displacements.
Example
MOV BX, [SI+16];
ADD AL, [DI+16];
7. Based-index addressing mode
In this addressing mode, the offset address of the operand is computed by summing the base register to the
contents of an Index register.
Example
ADD CX, [AX+SI];
MOV AX, [AX+DI];
8. Based indexed with displacement mode
In this addressing mode, the operands offset is computed by adding the base register contents. An Index
registers contents and 8 or 16-bit displacement.
Example
MOV AX, [BX+DI+08], ADD CX, [BX+SI+16]
There are two operating modes of operation for Intel 8086, namely the minimum mode and the maximum
mode.
When only one 8086 CPU is to be used in a microprocessor system, the 8086 is used in the Minimum mode of
operation.
In this minimum mode of operation, the pin MN/MX is connected to 5V D.C. supply i.e. MN/MX = VCC.
The description about the pins from 24 to 31 for the minimum mode is as follows:
INTA (Output): Pin number 24 interrupts acknowledgement. On receiving interrupt signal, the processor
issues an interrupt acknowledgment signal. It is active LOW.
ALE (Output): Pin no. 25. Address latch enable. It goes HIGH during T1. The microprocessor 8086 sends
this signal to latch the address into the Intel 8282/8283 latch.
DEN (Output): Pin no. 26. Data Enable. When Intel 8287/8286 octal bus transceiver is used this signal. It is
active LOW.
DT/R (output): Pin No. 27 data Transmit/Receives. When Intel 8287/8286 octal bus transceiver is used this
signal controls the direction of data flow through the transceiver. When it is HIGH, data is sent out. When it
is LOW, data is received.
M/IO (Output): Pin no. 28, Memory or I/O access. When this signal is HIGH, the CPU wants to access
memory. When this signal is LOW, the CPU wants to access I/O device.
WR (Output): Pin no. 29, Write. When this signal is LOW, the CPU performs memory or I/O write operation.
HLDA (Output): Pin no. 30, Hold Acknowledgment. It is sent by the processor when it receives HOLD
signal. It is active HIGH signal. When HOLD is removed HLDA goes LOW.
HOLD (Input): Pin no. 31, Hold. When another device in microcomputer system wants to use the address
and data bus, it sends HOLD request to CPU through this pin. It is an active HIGH signal.
In the maximum mode of operation, the pin MN/¯MX is made LOW. It is grounded. The description about
the pins from 24 to 31 is as follows:
QS1, QS0 (Output): Pin numbers 24, 25, Instruction Queue Status. Logics are given below:
S0, S1, S2 (Output): Pin numbers 26, 27, 28 Status Signals. These signals are connected to the bus controller
of Intel 8288. This bus controller generates memory and I/O access control signals. Logics for status signal
are given below:
S2 S1 S0 Operation
0 0 0 Interrupt acknowledgement
0 0 1 Read data from I/O port
0 1 0 Write data from I/O port
0 1 1 Halt
1 0 0 Opcode fetch
1 0 1 Memory read
1 1 0 Memory write
1 1 1 Passive state
LOCK (Output): Pin no. 29. It is an active LOW signal. When this signal is LOW, all interrupts are masked
and no HOLD request is granted. In a multiprocessor system all other processors are informed through this
signal that they should not ask the CPU for relinquishing the bus control.
RQ/GT1, RQ/GT0 (Bidirectional): Pin numbers 30, 31, Local Bus Priority Control. Other processors ask
the CPU by these lines to release the local bus.
In the maximum mode of operation signals WR, ALE, DEN, DT/R etc. are not available directly from the
processor. These signals are available from the controller 8288.
The 8086 microprocessor uses a 20-bit address to access memory. With 20-bit address the processor can
generate 220 = 1 Mega address. The basic memory word size of the memories used in the 8086 system is 8-bit
or 1-byte (i.e., in one memory location an 8-bit binary information can be stored). Hence, the physical memory
space of the 8086 is 1Mb (1 Mega-byte).
For the programmer, the 8086 memory address space is a sequence of one mega-byte in which one location
stores an 8-bit binary code/data and two consecutive locations store 16-bit binary code/data. But physically
(i.e., in the hardware), the 1Mb memory space is divided into two banks of 512kb (512kb + 512kb = 1Mb).
The two memory banks are called Even (or Lower) bank and Odd (or Upper) bank. The organization of even
and odd memory banks in the 8086-based system is shown in Figure.
The 8086-based system will have two sets of memory IC's. One set for even bank and another set for odd
bank. The data lines D0-D7 are connected to even bank and the data lines D8 -D15 are connected to odd bank.
The even memory bank is selected by the address line Ao and the odd memory bank is selected by the control
signal BHE. The memory banks are selected when these signals are low(active low). Any memory location
in the memory bank is selected by the address line A1 to A19.
Figure: Organization of even and odd memory banks in 8086 based system
The organization of memory into two banks and providing bank select signals allows the programmer to
read/write the byte (8-bit) operand in any memory address through 16-bit data bus. It also allows the
programmer to read/write the word (16-bit) operand starting from even address or odd address.
A memory device must have three types of lines or connections: Address, Data, and Enable & Control.
Address Lines: The input lines that select a memory location within the memory device. Decoders
are used, inside the memory chip, to select a specific location. The number of address pins on memory
chip specifies the number of memory locations.
If a memory chip has 13 address pins (𝐴0 − 𝐴12 ), then the size is:
213 = 23 × 210 = 8 𝐾𝑏𝑦𝑡𝑒.
If a memory chip has 4 Kbytes, then it has N pins:
2𝑁 = 4 𝑘𝑏𝑦𝑡𝑒 = 212 → 𝑁 = 12 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 𝑝𝑖𝑛𝑠 (𝐴0 − 𝐴11 )
Data Connections: All memory devices have a set of data output pins (for ROM devices), or
input/output pins (for RAM devices).
Enable and Control Connections: All memory devices have at least one Chip Select (CS) or Chip
Enable (CE) input, used to select or enable the memory device. If a device is not selected or enabled
then no data can be read from, or written into it.
The CS or CE input is usually controlled by the microprocessor through the higher address lines via an
address decoding circuit. RAM chips have two control input signals that specify the type of memory
operation: The Read (RD) and the Write (WR) signals. ROM chips can perform only memory read
operations, thus there is only read (RD) signal. In most real ROM devices, the read signal is called the
Output Enable (OE) signal.
8. Types of semiconductor Memory Devices:
There are two basic types of a semiconductor memory:
Non-volatile: It maintains its data even without Volatile: It loses its data when the power supply
power supply. is switched-off
Used to store programs such as the BIOS Used to store user programs that are loaded from
a secondary memory (disk) and temporary
data used by programs such as variables and
arrays.
A ROM device can be: A RAM device can be:
1. Masked ROM 1. Static RAM (SRAM)
2. Programmable ROM 2. Dynamic RAM (DRAM)
9. Types of RAMs:
There are two basic types of RAMs:
Types of ROMs:
Masked ROM: is programmed by the manufacturer.
Programmable Read Only Memory (PROM): are programmed during manufacturing
process. The contents of each memory cell is locked by a fuse (diodes). PROMs are used for
permanent data storage.
Erasable programmable Read Only Memory (EPROM): There is a possibility to erase
EPROM with ultra-violet light (about 20 minutes).
Electrically erasable read only memory (EEPROM) – erasing does not require ultra-violet
light but higher voltage and can be applied not to the whole circuit but to each memory cell
separately. Flash memory is an example of EEPROM.
10. Example: Design an 8 Kbyte RAM module using 2Kbyte RAM chips. The module should
be connected on an 8-bit processor with a 16-bit address bus, and occupy the address range
starting from A000H. Show the circuit and the memory map.
Solution:
Number of memory devices needed = 8K/2K = 4
Number of address lines on each 2Kbytes memory chip = 11
2Kbyte = 21 × 210 = 211 → (𝐴0 − 𝐴10 )
Two address lines are needed for the decoder → (𝐴11 − 𝐴12 )
The address lines (𝐴13 − 𝐴15 ) are input to the NAND gate to active the decoder.
Step-1: The processor loads the address of the memory location to be read on the Address bus.
̅̅̅̅ ).
Step-2: The processor activates the Read signal (𝑅𝐷
Step-3: The selected memory device loads on the data bus the content of the
memory location specified by the address bus.
Step-4: The processor reads the data from the data bus, and resets the RD signal
Memory Write Operations:
A memory write operation is carried out in the following steps:
Step-1: The processor loads the address of the memory location on the Address
bus.
Step-2: The processor loads the data to be written on the data bus.
Step-3: The processor activates the Write (WR) signal.
Step-4: The data at the data bus is stored in the memory location specified by the address bus.