The 8086 Microprocessor Architecture
The 8086 Microprocessor Architecture
Architecture
Features of 8086 Microprocessor
16-bit microprocessor. (ALU, internal registers and most
of its instructions are designed to work with 16-bit binary
words)
In the minimum mode only one processor is used and control signals
required by memory and I/O devices are issued by the processor.
In the maximum mode more than one processor is used and control
signals are generated with the help of external bus controller(8288).
3
Supports multiprogramming. (the code for two or more processes
is in memory at the same time and is executed in a time-
multiplexed fashion)
Supports pipelining.
5
Bus Interface Unit
Sends address of the memory or I/O
6
To implement its functions the BIU contains instruction queue,
segment registers, instruction pointer, address summer and bus
control logic.
7
The code segment (CS) register holds the upper 16
bits of the starting address of the code segment.
The execution unit of 8086 tells the CPU from where to
fetch instructions or data, decodes instructions and
executes instructions.
AX (A- Accumulator): used for instructions like MUL, DIV and IN/OUT
instructions.
BX (B-Base register): used to store the EA of memory location for data transfer
between microprocessor and memory.
CX (C- Counter register): used as a counter for rotate, shift, repeat and loop
instructions.
DX (D-Data register): in MUL and DIV operations if result is of 32 bits, then register
DX is used to store 16 MSBs and register AX is used to store 16 LSBs. The 16-bit
input and output port is also stored in register DX.
11
Operand/Temporary Register
This register can not be used by the programmer. It is used by the
microprocessor to store any intermediate data or result.
ALU
The different arithmetic operations performed in ALU are
addition, subtraction, multiplication, and division of binary
numbers, BCD numbers and ASCII code numbers.
12
Flag Registers
15
Example
Give the contents of the flag registers after execution of the
following addition.
0110 0101 1101 0001
+ 0010 0011 0101 1001
18
Assembly language programs must be translated into
machine code (object code) by a program called an
assembler.
19
An assembly language instruction consists of a
mnemonic, optionally followed by one or two
operands.
20
MOV instruction
The MOV instruction copies data from one location to
another.
MOV destination, source
The above instruction tells the CPU to move (in reality,
copy) the source operand to the destination operand.
21
Example
22
Example
23
In the 8086 CPU, data can be moved among all the
registers as long as the source and destination registers
match in size.
24
26
Quiz
1. Write the assembly language instruction to move value
1234H into register BX.
27
Memory Segmentation
Two types of memory organizations are commonly used:
linear addressing and segmented addressing.
29
30
Physical, Offset, and Logical addresses
Physical address is the 20-bit address that is actually put
on the address pins of the 8086 microprocessor and
decoded by the memory interfacing circuitry. It is an
actual physical location in RAM or ROM within the 1MB
memory range.
33
Code Segment
To execute a program, the 8086 fetches the instructions
(op-codes and operands) from the code segment.
34
Example
35
Logical address vs. physical address
36
The program above shows that the byte at address
1132:0100 contains B0, which is the op-code for
moving a value into register AL, and address
1132:0101 contains the operand (in this case 57) to be
moved to AL.
37
38
Data Segment
40
While CS uses only the IP register as an offset, DS
uses only BX, DI, and SI to hold the offset address of
the data.
41
Examples
42
43
Little Endian Convention
We have seen when 8-bit data is used the bytes are stored one
after the another in memory. What happens when 16-bit data is
used? For example:
MOV AX, 35F3H
MOV [1500], AX
In cases like this, the low byte goes to the low memory location
and the high byte goes to the high memory location.
DS:1500 = F3 DS:1501 = 35
This convention is called little endian convention. All Intel
microprocessors and many microcomputers use this
convention.
44
45
Extra Segment
ES is a segment used as an extra data segment.
46
Stack Segment
The stack is a section of read/write memory (RAM)
used by the CPU to store information temporarily.
The CPU needs this storage area since there are only
a limited number of registers.
With every pop, the top 2 bytes of the stack are copied to the
register specified by the instruction and the stack pointer is
incremented twice. Although the data actually remains in
memory, it is not accessible since the stack pointer is beyond
that point.
49
Example
50
Example
51
What values are assigned to the SP and SS, and who assigns
them?
It is the job of the DOS to assign the values for the SP
and SS since memory management is the responsibility
of the operating system.
The top of the stack is the last stack location occupied.
BP is another register that can be used as an offset into the
stack, but it has very special applications and is widely used to
access parameters passed between assembly language
programs and high-level language programs.
52
Example
53
Important points
There may be many possible logical addresses that
represent a single physical address.
55
Overlapping
In calculating the physical address, it is possible that
two segments can overlap, which is desirable in
some circumstances.
56
Advantages of memory segmentation
1. It allows the memory addressing capacity to be 1MB even
though the address associated with individual instruction is
only 16-bit.
58
Memory map of the IBM PC
For a program to be executed on the PC, DOS must load it into RAM.
During the design phase of the first IBM PC, engineers had to decide
on the allocation of the 1MB memory space to various sections of the
PC. This memory allocation is called a memory map.
Of the 1MB memory, 640KB from addresses 00000 – 9FFFFH were set
aside for RAM.
The remaining 256KB from C0000H to FFFFFH were set aside for
ROM.
59
60
RAM
DOS first allocates the available RAM on the PC for its own use and
then lets the rest be used for applications such as word processors.
For this reason we do not assign any values for the segment registers
since such an assignment means specifying an exact physical
address in the range 00000 – 9FFFFH, and this is beyond the
knowledge of the user.
62
BIOS ROM
Since the CPU can only execute programs that are stored in
memory, there must be some permanent (nonvolatile) memory to
hold the programs telling the CPU what to do when the power is
turned on.
63
It is only after testing and setting up the peripherals
that BIOS will load DOS from disk into RAM and
hand over control of the PC to DOS.
64
Thank You!
65