MP Exp1
MP Exp1
The 8086 microprocessor, designed by Intel and introduced in 1978, is a 16-bit microprocessor, which
means it can process 16 bits of data at a time. It has a 20-bit address bus, enabling it to access a memory
range of 1MB (2^20 bytes). It is known for its use in embedded systems, personal computers, and other
electronic applications. Here's a detailed explanation of its architecture:
Architecture of 8086:
The 8086 microprocessor consists of several components that work together to perform various
operations. These components include:
Execution Unit (EU)
Bus Interface Unit (BIU)
Registers
Flags Register
ALU (Arithmetic and Logic Unit)
Let's break down each part:
3. Registers:
The 8086 has 14 registers, divided into several categories:
General Purpose Registers (8-bit and 16-bit):
AX (Accumulator Register): Used for arithmetic, logic, and data transfer operations. It is often used for
I/O operations.
BX (Base Register): It is used for addressing data in memory.
CX (Count Register): Often used for loop control and repeated operations.
DX (Data Register): Used in operations that require a larger range (e.g., multiplication and division).
The 16-bit versions of these registers can be broken into two 8-bit registers:
AH, AL (for AX)
BH, BL (for BX)
CH, CL (for CX)
DH, DL (for DX)
Pointer and Index Registers (16-bit):
SP (Stack Pointer): Points to the top of the stack. It helps in the operation of function calls and returns.
BP (Base Pointer): Used to access data in the stack.
SI (Source Index): Used for string operations and points to the source of data.
DI (Destination Index): Used for string operations and points to the destination of data.
Segment Registers (16-bit):
CS (Code Segment): Contains the base address of the code segment.
DS (Data Segment): Contains the base address of the data segment.
SS (Stack Segment): Contains the base address of the stack segment.
ES (Extra Segment): Used as an additional data segment.
Flags Register (16-bit):
The 8086 has a 16-bit flag register (also called the status register) that contains individual flag bits that
represent the outcome of operations and help control the execution flow.
Sign Flag (SF): Set if the result of the operation is negative.
Zero Flag (ZF): Set if the result of the operation is zero.
Auxiliary Carry Flag (AF): Used in BCD arithmetic operations.
Parity Flag (PF): Set if the result has an even number of 1-bits.
Carry Flag (CF): Set if there is a carry in or out of the most significant bit during arithmetic operations.
Overflow Flag (OF): Set if there is a signed overflow in an arithmetic operation.
6. Memory Segmentation:
One of the distinctive features of the 8086 architecture is its segmented memory model. The processor
uses 20-bit addressing to access 1MB of memory. This memory is divided into segments, each of which
is 64KB in size. The 8086 uses segment registers (CS, DS, SS, and ES) to handle different parts of
memory.
The processor calculates memory addresses using a combination of segment registers and offset
addresses. For example:
Physical Address = (Segment * 16) + Offset
This allows the processor to access different parts of memory efficiently.
2. Explain register organization/programmers model of 8086.
It is one of the most important chips ever created due to its part in the development of x86-based
architecture. One significant aspect of this microprocessor is that it contains general registers. Efficiency
and speed of computations in the processor are influenced by these registers since they determine
arithmetic operations execution and data manipulations. Understanding such registers is important for
code optimization as well as assembly language programming and system design.
The 8086 microprocessor contains a set of 16-bit general-purpose registers which are used for
performing various arithmetic, logical, and data movement operations. Since these registers are flexible
and can assume different combinations to perform various functions, they form the basic operation
units of the processor itself.
General-purpose registers are used to store temporary data within the microprocessor
There are 8 general-purpose registers in the 8086 microprocessor.
1. AX: 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 but in 8086
microprocessor it is not mandatory to have an accumulator as the destination operand. Example:
ADD AX, AX (AX = AX + AX)
2. BX: This is 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)
3. CX: This is the counter register. It is of 16 bits and is divided into two 8-bit registers CH and CL to also
perform 8-bit instructions. It is used in looping and rotation. Example:
MOV CX, 0005
LOOP
4. DX: This is the 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 in the multiplication and input/output port addressing. Example:
MUL BX (DX, AX = AX * BX)
5. 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.
It is AB and manage the present position of the top of the stack.
Example: To push or pop data from the stack in a function call, the SP is altered.
PUSH R1 ; Decrement the SP and then store the value of R1 that is at SP.
R1 = POP; R1 = increment SP; R1 = get value in SP
6. 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.
MOV AX, [BP+4] ; Access a parameter passed to the function
(4 bytes above BP in the Stack)
7. 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.
MOV AL, [SI] ; Move the byte at the address pointed to by SI into the AL
register
(used as a pointer to source data).
8.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.
MOV [DI], AL; Move the byte in AL to the address pointed to by DI
(serves as the destination for the data).
Control signals for all operations are generated by decoding S’2, S’1 and S’0 using 8288 bus controller.
Bus request is done using RQ’ / GT’ lines interfaced with 8086. RQ0/GT0 has more priority than
RQ1/GT1.
INTA’ is given by 8288, in response to an interrupt on INTR line of 8086.
In max mode, the advanced write signals get enabled one T-state in advance as compared to normal
write signals. This gives slower devices more time to get ready to accept the data, therefore it reduces
the number of cycles.
Advantages of Max Mode of 8086
It helps to interface more devices like 8087.This interface is also called a closely coupled co-Processor
configuration. In this 8086 is called as the host and 8087 as Co-processor.
It supports multiprocessing, Therefore it helps to increase the efficiency.
The 8087 was the first floating-point coprocessor for the 8086 series of microprocessors. The purpose of
the 8087 was to increase calculations for floating point operations, such as add, sub, multiply, divide,
and square root.
Disadvantages of Max Mode Over Min Mode
It has more complex circuit than min mode.
The increased complexity of max mode leads to higher costs due to the need for additional components
like the 8288 bus controller and potentially more sophisticated circuitry.
Applications of 8086
Microcomputer are built using 8086. For example : IBM PC, used the Intel 8088, a version of the 8086
with 8-bit data bus.
It is used in calculators.
It is used for control purposes like in traffic signals(uses micro controllers which are nothing but contains
one or more CPUs along with memory and programmable I/O peripherals)
7. Explain Interrupt structure of 8086
An interrupt is a condition that halts the microprocessor temporarily to work on a different task and
then returns to its previous task. An interrupt is an event or signal that requests the CPU’s attention.
This halt allows peripheral devices to access the microprocessor. Whenever an interrupt occurs, the
processor completes the current instruction and starts the implementation of an Interrupt Service
Routine (ISR) or Interrupt Handler. ISR is a program that tells the processor what to do when the
interrupt occurs. After the ISR execution, control returns to the main routine where it was interrupted.
In the 8086 microprocessor following tasks are performed when the microprocessor encounters an
interrupt:
The value of the flag register is pushed into the stack. It means that first, the value of SP (Stack Pointer)
is decremented by two then the value of the flag register is pushed to the memory address of the stack
segment.
The value of starting memory address of CS (Code Segment) is pushed into the stack.
The value of IP (Instruction Pointer) is pushed into the stack.
IP is loaded from word location (Interrupt type) * 04.
CS is loaded from the following word location.
Interrupt, and Trap flags are reset to 0.
The different types of interrupts present in the 8086 microprocessor are given by:
Hardware Interrupts – Hardware interrupts are those interrupts that are caused by any peripheral
device by sending a signal through a specified pin to the microprocessor. There are two hardware
interrupts in the 8086 microprocessor. They are:
NMI (Non-Maskable Interrupt): It is a single pin non-maskable hardware interrupt that cannot be
disabled. It is the highest priority interrupt in the 8086 microprocessor. After its execution, this interrupt
generates a TYPE 2 interrupt. IP is loaded from word location 00008 H, and CS is loaded from the word
location 0000A H.
INTR (Interrupt Request): It provides a single interrupt request and is activated by the I/O port. This
interrupt can be masked or delayed. It is a level-triggered interrupt. It can receive any interrupt type, so
the value of IP and CS will change on the interrupt type received.
Software Interrupts – These are instructions inserted within the program to generate interrupts. There
are 256 software interrupts in the 8086 microprocessor. The instructions are of the format INT type,
where the type ranges from 00 to FF. The starting address ranges from 00000 H to 003FF H. These are 2-
byte instructions. IP is loaded from type * 04 H, and CS is loaded from the following address given by
(type * 04) + 02 H. Some important software interrupts are:
TYPE 0 corresponds to division by zero(0).
TYPE 1 is used for single-step execution for debugging the program.
TYPE 2 represents NMI and is used in power failure conditions.
TYPE 3 represents a break-point interrupt.
TYPE 4 is the overflow interrupt.