Beruflich Dokumente
Kultur Dokumente
2
Microprocessor Fifth Generation Pentium
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
Third Generation 32 bit processors
During 1978 Physical memory space 224 bytes = 16
HMOS technology ⇒ Faster speed, Higher Mb
packing density Virtual memory space 240 bytes = 1 Tb
16 bit processors ⇒ 40/ 48/ 64 pins Floating point hardware
Easier to program Supports increased number of addressing
Dynamically relatable programs modes
Processor has multiply/ divide arithmetic
hardware Intel 80386
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 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 Intel 8085 (8 bit processor)
3
8086
Microprocessor Overview
First 16- bit processor released by It has 16- bit data bus , so it can
INTEL in the year 1978 read or write data to memory and
ports either 16 bits or 8-bits at a
time.
Dedicated Adder to
generate 20 bit address
Functions of BIU:
1. It sends address of the memory or I/O.
2. It fetches instructions from memory.
3. It reads data from port/memory.
4. It writes data into port/memory.
5. It supports instruction queuing.
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.
Data Segment
Stack Segment
Extra Segment
Segment Registers
F0000
E0000 8000:FFFF
D0000
C0000
B0000
linear addresses
A0000
90000
one segment
80000
70000
60000
8000:0250
50000
0250
40000
30000 8000:0000
20000
10000
seg ofs
00000
18
• Click to edit Master text styles
– Second level
• Third level
– Fourth level
» Fifth level
19
Types of Segmentation
20
21
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
Segment
Registers
Adder
Therefore:
EA 22220 H
=
+ 0016 H
------------
22236 H
Intel
Offset: 0000000000101001
1. CS = 1111 H
The base address of the code segment is 11110 H.
Effective address of memory is given by 11110H + 1232H = 12342H.
2. DS = 3333 H
The base address of the data segment is 33330 H.
Effective address of memory is given by 33330H + 0020H = 33350H.
3. SS = 2526 H
The base address of the stack segment is 25260 H.
Effective address of memory is given by 25260H + 1100H = 26350H.
Your turn . . .
4000H
CS: 0400H
IP 0056H 4056H
CS:IP = 400:56
Logical Address
Memory
0400 0
Segment Register
Offset + 0056
Physical or 0FFFFFH
04056H
Absolute Address
The offset is the distance in bytes from the start of the segment.
The offset is given by the IP for the Code Segment.
Instructions are always fetched with using the CS register.
05C50H
SI 0050 DS:EA
Memory
05C0 0
Segment Register
Offset + 0050
0A00 0A000H
SS:
0A100H
SP 0100 SS:SP
Memory
0A00 0
Segment Register
Offset + 0100
EU decodes and
executes instructions.
A decoder in the EU
control system
translates instructions.
and
Some of the 16 bit registers can be
Index registers (Source used as two 8 bit registers as :
Index, Destination Index)
each of 16-bits AX can be used as AH and AL
BX can be used as BH and BL
CX can be used as CH and CL
DX can be used as DH and DL
44
8086
Architecture Execution Unit (EU)
Microprocessor
Example:
EU
Registers
48
8086
Architecture Execution Unit (EU)
Microprocessor
This flag is set, when the This flag is set, if the result of This flag is set to 1, if the lower
result of any computation the computation or comparison byte of the result contains even
is negative performed by an instruction is number of 1’s ; for odd number
zero 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
This flag is set, if an overflow occurs, i.e, if the result of a signed enters the single step execution
operation is large enough to accommodate in a destination
mode by generating internal
register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit interrupts after the execution of
sign operations, then the overflow will be set. each instruction
Flag O D I T S Z A P C
1
Bit no. 15 14 13 12 11 9 8 7 6 5 4 3 2 1 0
0
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
AD0-AD15 (Bidirectional)
Address/Data bus
MN/ MX
MINIMUM / MAXIMUM
READY
RESET (Input)
CLK
Program
A set of instructions written to solve
a problem.
Instruction
Directions which a microprocessor
follows to execute a task or part of a
task.
Computer language
1. Register Addressing
Group I : Addressing modes for
3. Immediate Addressing register and immediate data
5. Direct Addressing
9. Based Addressing
Group II : Addressing modes for memory
11. Indexed Addressing data
13. Based Index Addressing
1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
3. Immediate Addressing data is specified as part of the instruction
5. Direct Addressing
Example:
7. Register Indirect Addressing
MOV DL, 08H
9. Based Addressing
The 8-bit data (08H) given in the instruction is
11. Indexed Addressing moved to DL
Adder
Supported combinations:
BX SI
+ disp
BP DI
77
8086 Group II : Addressing modes
Microprocessor Addressing Modes for memory data
1. Register Addressing
3. Immediate Addressing
Here, the effective address of the memory
5. Direct Addressing
location at which the data operand is stored is
7. Register Indirect Addressing given in the instruction.
12. Implied Addressing This addressing mode is called direct because the
displacement of the operand from the segment
base is specified directly in the instruction.
78
8086 Group II : Addressing modes
Microprocessor Addressing Modes for memory data
(CL) ← (MA)
(CH) ← (MA +1)
79
8086 Group II : Addressing modes
Microprocessor Addressing Modes for memory data
(AL) ← (MA)
(AH) ← (MA + 1)
80
8086 Group II : Addressing modes
Microprocessor Addressing Modes for memory data
(CL) ← (MA)
(CH) ← (MA + 1)
81
8086 Group II : Addressing modes
Microprocessor Addressing Modes for memory data
1. Register Addressing
3. Immediate Addressing
1. Register Addressing
3. Immediate Addressing
5. Direct Addressing
9. Based Addressing
2. Arithmetic Instructions
3. Logical Instructions
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADDC A, data
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB A, data
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
104
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
105
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
106
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
107
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
108
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
109
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
110
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
111
8086
Microprocessor Instruction Set
REP
MOVS
(MAE) ← (MA)
CMPS
LODS
STOS
CLC Clear CF ← 0
NOP No operation
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
Checks flags
JC disp8 Jump if CF = 1
JP disp8 Jump if PF = 1
JO disp8 Jump if OF = 1
JS disp8 Jump if SF = 1
Used to :
› specify the start and end of a program
› attach value to variables
› allocate storage locations to input/ output data
› define start and end of segments, procedures, macros etc..
125
8086
Microprocessor Assemble Directives
DB Define Byte
PROC
FAR Example:
NEAR LIST DB 7FH, 42H, 35H
ENDP
Three consecutive memory locations are reserved for
SHORT the variable LIST and each data specified in the
instruction are stored as initial value in the reserved
MACRO memory location
ENDM
126
8086
Microprocessor Assemble Directives
DB Define Word
PROC
FAR Example:
NEAR ALIST DW 6512H, 0F251H, 0CDE2H
ENDP
Six consecutive memory locations are reserved for
SHORT the variable ALIST and each 16-bit data specified in
the instruction is stored in two consecutive memory
MACRO location.
ENDM
127
8086
Microprocessor Assemble Directives
ORG
END Segnam SEGMENT
EVEN
…
EQU … Program code
… or
PROC … Data Defining Statements
…
FAR …
NEAR
Segnam ENDS
ENDP
SHORT
ORG
User defined name of
END Segment Register
the segment
EVEN
EQU
PROC Example:
FAR
NEAR ASSUME CS: ACODE, DS:ADATA Tells the compiler that the
ENDP instructions of the program are
stored in the segment ACODE and
data are stored in the segment
SHORT ADATA
MACRO
ENDM
129
8086
Microprocessor Assemble Directives
General form
ASSUME
ORG
procname PROC[NEAR/ FAR]
END
EVEN …
Program statements of the
…
EQU … procedure
DB
Examples:
DW
RET
ORG ADD64 ENDP
END
EVEN
EQU CONVERT PROC FAR The subroutine/ procedure named CONVERT
is declared as FAR and so the assembler will
… code the CALL and RET instructions involved
PROC … in this procedure as far call and return
ENDP …
FAR RET
NEAR CONVERT ENDP
SHORT
MACRO
ENDM
132
8086
Microprocessor Assemble Directives
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
133
8086
Microprocessor Assemble Directives
PROC
ENDP
FAR User defined name of
NEAR the macro
SHORT
MACRO
ENDM
Interfacing memory and i/o ports
135
8086
Microprocessor Memory
Processor Memory
Registers inside a microcomputer
Store data and results temporarily
No speed disparity
Cost ↑
Secondary Memory
Storage media comprising of slow
devices such as magnetic tapes and
disks
Hold large data files and programs:
Operating system, compilers,
databases, permanent programs etc.
136
8086
Microprocessor Memory organization in 8086
137
8086
Microprocessor Memory organization in 8086
138
8086
Microprocessor Memory organization in 8086
Monitor Programs
⇒ Initialization of stack
I/O devices
Interrupt driven I/ O
I/O device interrupts the processor
and initiate data transfer
Direct memory access
Data transfer is achieved by
bypassing the microprocessor
144
8086
Microprocessor 8086 and 8088 comparison
The I/O ports or peripherals can be Only IN and OUT instructions can be
treated like memory locations and used for data transfer between I/O
so all instructions related to device and processor
memory can be used for data
transmission between I/O device
and processor
Data can be moved from any Data transfer takes place only
register to ports and vice versa between accumulator and ports
When memory mapping is used for Full memory space can be used for
I/O devices, full memory address addressing memory.
space cannot be used for
addressing memory. ⇒ Suitable for systems which
require large memory capacity
⇒ Useful only for small systems
where memory requirement is less