Lecture Number 1 microprocessor
Lecture Number 1 microprocessor
Faculty of Science
Department of CSc.
Microprocessors
Lecture # 1
8086 Microprocessor
1.0 Objectives
1.1 Microprocessor
1.2 8086 Microprocessor
1.2.1 Pins and Signals
1.2.2 Architecture
End
2
Computer Science Dept.
4.0 Objective of This Lecture
3
Computer Science Dept.
1.1 Microprocessor
Fourth Generation
During 1980s
Third Generation Low power version of HMOS technology
During 1978 (HCMOS)
HMOS technology Faster speed, Higher 32 bit processors
packing density Physical memory space 224 bytes = 16 Mb
16 bit processors 40/ 48/ 64 pins Virtual memory space 240 bytes = 1 Tb
Easier to program Floating point hardware
Dynamically relatable programs Supports increased number of addressing
Processor has multiply/ divide arithmetic modes
hardware
More powerful interrupt handling Intel 80386
capabilities
Flexible I/O port addressing Second Generation
During 1973
Intel 8086 (16 bit processor) NMOS technology Faster speed, Higher
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
multiplexed 5
Intel 8085 (8 bit processor)
1.1 Microprocessor (Cont’d.)
Various conditions of the
Computational Unit;
results are stored as Internal storage of data
performs arithmetic and
status bits called flags in
logic operations
flag register
7
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
Common signals
1.2.1 Pins and Signals
AD0-AD15 (Bidirectional)
Address/Data bus
MN/ MX
MINIMUM / MAXIMUM
This pin signal indicates what mode the
processor is to operate in.
CLK
The clock input provides the basic timing for
processor operation and bus control activity. Its an
asymmetric square wave with 33% duty cycle.
EU executes instructions that have already BIU fetches instructions, reads data from
been fetched by the BIU. memory and I/O por ts, writes data to
BIU and EU functions separately. memory and I/ O por ts. 12
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Dedicated Adder to
generate 20 bit address
Segment
Registers
8086’s 1-megabyte The 8086 can directly address Programs obtain access to code
memory is divided into four segments (256 K bytes and data in the segments by
segments of up to 64K within the 1 M byte of memory) changing the segment register
bytes each. at a particular time. content to point to the desired
segments.
Figure 4.8 8086 Microprocessor Segment Registers 14
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Segment Code Segment Register
Registers
16-bit
CS contains the base or star t of the current code segment; IP
contains the distance or offset from this address to the next
instruction byte to be fetched.
BIU computes the 20-bit physical address by logically shifting
the contents of CS 4-bits to the left and then adding the 16-bit
contents of IP.
That is, all instructions of a program are relative to the
contents of the CS register multiplied by 16 and then offset is
added provided by the IP.
15
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Segment Data Segment Register
Registers
16-bit
16
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Segment Stack Segment Register
Registers
16-bit
Points to the current stack.
The 20-bit physical stack address is calculated from the
Stack Segment (SS) and the Stack Pointer (SP) for stack
instructions such as PUSH and POP.
In based addressing mode, the 20-bit physical stack address
is calculated from the Stack segment (SS) and the Base
Pointer (BP).
17
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Segment Extra Segment Register
Registers
16-bit
18
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Segment Instruction Pointer
Registers
16-bit
Always points to the next instruction to be executed within
the currently executing code segment.
So, this register contains the 16-bit offset address pointing to
the next instruction code within the 64Kb of the code
segment area.
Its content is automatically incremented as the execution of
the next instruction takes place.
19
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Bus Interface Unit (BIU)
Instruction queue
A group of First-In-First-Out
(FIFO) in which up to 6 bytes
of instruction code are pre
fetched from the memory
ahead of time.
A decoder in the EU
control system
translates instructions.
Four general purpose
registers(AX, BX, CX, DX);
and
22
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Execution Unit (EU)
EU Base Register (BX)
Registers
Consists of two 8-bit registers BL and BH, which can be
combined together and used as a 16-bit register BX.
BL in this case contains the low-order byte of the word, and
BH contains the high-order byte.
This is the only general purpose register whose contents can
be used for addressing the 8086 memory.
All memory references utilizing this register content for
addressing use DS as the default segment register.
23
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Execution Unit (EU)
EU Counter Register (CX)
Registers
Consists of two 8-bit registers CL and CH, which can be
combined together and used as a 16-bit register CX.
Example:
24
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Execution Unit (EU)
EU Data Register (DX)
Registers
Consists of two 8-bit registers DL and DH, which can be
combined together and used as a 16-bit register DX.
25
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Execution Unit (EU)
EU Stack Pointer (SP) and Base Pointer (BP)
Registers
SP and BP are used to access data in the stack segment.
26
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture Execution Unit (EU)
EU Source Index (SI) and Destination Index (DI)
Registers
Used in indexed addressing.
27
Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
Auxiliary Carry Flag
1.2.2 Architecture Carry Flag
This is set, if there is a carry from the lowest
Flag Register nibble, i.e, bit three during addition, or borrow This flag is set, when there is a carry
for the lowest nibble, i.e, bit three, during out of MSB in case of addition or a
Execution Unit (EU) subtraction. borrow in case of subtraction.
Sign Flag
Zero Flag Parity Flag
This flag is set, when the This flag is set, if the result of the This flag is set to 1, if the lower byte of
result of any computation computation or comparison performed the result contains even number of 1’s
is negative by an instruction is zero ; for odd number of 1’s set to zero.
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
Over flow Flag If this flag is set, the processor enters the
This flag is set, if an overflow occurs, i.e, if the single step execution mode by
result of a signed operation is large enough to generating internal interrupts after the
accommodate in a destination register. The result Direction Flag execution of each instruction
is of more than 7-bits in size in case of 8-bit
This is used by string manipulation instructions.
signed operation and more than 15-bits in size in If this flag bit is ‘0’, the string is processed
case of 16-bit sign operations, then the overflow Interrupt Flag
beginning from the lowest address to the
will be set. highest address, i.e., auto incrementing mode.
Causes the 8086 to recognize external
Otherwise, the string is processed from the 37
mask interrupts; clearing IF disables
highest address towards the lowest address, these interrupts.
Falah Hasan Mohammed i.e., auto incrementing mode. 37 Computer Science Dept.
1.2 8086 Microprocessor (Cont’d.)
1.2.2 Architecture
8086 registers
categorized 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
into 4 groups OF DF IF TF SF ZF AF PF CF
AX 16-bit Accumulator Stores the 16-bit results of arithmetic and logic operations
8-bit Accumulator
AL Stores the 8-bit results of arithmetic and logic operations
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
31
Computer Science Dept.