MP Lecture
MP Lecture
2
3
4
5
6
Useful Links
1.
https://swayam.gov.in/nd1_noc20_ee11/pre
view
2.
https://nptel.ac.in/courses/108/105/1081051
02/
3.
https://www.classcentral.com/course/swaya
m-microprocessors-and-microcontrollers-98
94
4.
https://www.mooclist.com/tags/microproces
7
sors
8086
Microprocessor
Microprocessor
9
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 Mb
HMOS technology Faster speed, Higher Virtual memory space 240 bytes = 1 Tb
packing density Floating point hardware
16 bit processors 40/ 48/ 64 pins Supports increased number of addressing
Easier to program modes
Dynamically relatable programs
Processor has multiply/ divide arithmetic Intel 80386
hardware
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/ 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 10
multiplexed Intel 8085 (8 bit processor)
Microprocessor Functional blocks
12
Pins and signals
8086
Microprocessor
Pins and Signals Common signals
AD0-AD15 (Bidirectional)
Address/Data bus
14
8086
Microprocessor
Pins and Signals Common signals
MN/ MX
MINIMUM / MAXIMUM
READY
RESET (Input)
CLK
18
8086
Microprocessor
Pins and Signals Minimum mode signals
19
8086
Microprocessor
Pins and Signals Minimum mode signals
20
8086
Microprocessor
Pins and Signals Maximum mode signals
21
8086
Microprocessor
Pins and Signals Maximum mode signals
22
8086
Microprocessor
Pins and Signals Maximum mode signals
23
Architecture
8086
Microprocessor
Architecture
Dedicated Adder to
generate 20 bit address
Segment
Registers
27
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
28
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
29
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
30
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
31
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
32
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
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.
33
8086
Architecture Execution Unit (EU)
Microprocessor
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 34
DX can be used as DH and DL
8086
Architecture Execution Unit (EU)
Microprocessor
AL in this case contains the low order byte of the word, and
AH contains the high-order byte.
35
8086
Architecture Execution Unit (EU)
Microprocessor
36
8086
Architecture Execution Unit (EU)
Microprocessor
Example:
37
8086
Architecture Execution Unit (EU)
Microprocessor
EU
Registers
38
8086
Architecture Execution Unit (EU)
Microprocessor
39
8086
Architecture Execution Unit (EU)
Microprocessor
40
8086
Architecture Execution Unit (EU)
Microprocessor
41
8086
Architecture Execution Unit (EU)
Microprocessor
Auxiliary Carry Flag
Carry Flag
Flag Register This is set, if there is a carry from the
This flag is set, when there is
lowest nibble, i.e, bit three during
addition, or borrow for the lowest a carry out of MSB in case of
nibble, i.e, bit three, during addition or a borrow in case of
subtraction. subtraction.
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
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 C
F
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
47
Machine language is the only language which a
machine can understand.
Instructions in this language are written in binary bits
as a specific bit pattern.
The computer interprets this bit pattern as an
instruction to perform a particular task.
The entire program is a sequence of binary numbers.
This is a machine-friendly language but not user
friendly. Debugging is another problem associated
with machine language.
48
To overcome these problems, programmers develop
another way in which instructions are written in
English alphabets.
This new language is known as Assembly language. The
instructions in this language are termed mnemonics. As
microprocessor can only understand the machine
language so mnemonics are translated into machine
language either manually or by a program known as
assembler.
Efficient software development for the microprocessor
requires a complete familiarity with the instruction set,
their format and addressing modes. Here in this chapter,
we will focus on the addressing modes and instructions
formats of microprocessor 8086.
49
ADDRESSING MODES
8086
Microprocessor
Addressing Modes
1. Register Addressing
Group I : Addressing modes for
2. Immediate Addressing register and immediate data
3. Direct Addressing
5. Based Addressing
Group II : Addressing modes for
6. Indexed Addressing memory data
7. Based Index Addressing
8. String Addressing
8. String Addressing
52
8086 Group I : Addressing modes for
Microprocessor
Addressing Modes register and immediate data
1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
2. Immediate Addressing data is specified as part of the instruction
3. Direct Addressing
Example:
4. Register Indirect Addressing
MOV DL, 08H
5. Based Addressing
The 8-bit data (08H) given in the instruction is
6. Indexed Addressing moved to DL
8. String Addressing
10. Indirect I/O port Addressing The 16-bit data (0A9FH) given in the instruction is
moved to AX register
11. Relative Addressing
(AX) 0A9FH
12. Implied Addressing
Mov Cl,’Q’
Mov PRICE, 40
53
8086
Microprocessor
Addressing Modes : Memory Access
1. Register Addressing
2. Immediate Addressing
Here, the effective address of the memory
3. Direct Addressing
location at which the data operand is stored is
4. 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.
57
8086 Group II : Addressing modes
Microprocessor
Addressing Modes for memory data
(CL) (MA)
(CH) (MA +1)
58
DS=1112h
AX=EE78H
BX=3400H
i)Mov [0422h],AL
ii)Mov [0424h],AX
iii)Mov [BX],AX
59
8086 Group II : Addressing modes
Microprocessor
Addressing Modes for memory data
(AL) (MA) 60
(AH) (MA + 1)
8086 Group II : Addressing modes
Microprocessor
Addressing Modes for memory data
(CL) (MA)
(CH) (MA + 1)
61
8086 Group II : Addressing modes
Microprocessor
Addressing Modes for memory data
62
8086 Group II : Addressing modes
Microprocessor
Addressing Modes for memory data
1. Register Addressing
2. Immediate Addressing
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
5. Based Addressing
6. Indexed Addressing
Instructions using this mode have no operands.
The instruction itself will specify the data to be
7. Based Index Addressing
operated by the instruction.
8. String Addressing
Example: CLC
9. Direct I/O port Addressing
This clears the carry flag to zero.
10. Indirect I/O port Addressing
STC – set carry flag
11. Relative Addressing STD – set direction flag
CLD - clear direction flag
12. Implied Addressing
66
INSTRUCTION SET
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
3. Logical Instructions
March 4, 2025 68
8086
Microprocessor
Instruction Set
69
8086
Microprocessor
Instruction Set
70
8086
Microprocessor
Instruction Set
72
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
73
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADC A, data
74
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
75
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB A, data
76
8086
Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
77
8086
Microprocessor
Instruction Set
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…
82
8086
Microprocessor
Instruction Set
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 …
84
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
85
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
86
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
87
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
88
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
89
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
90
8086
Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
91
8086
Microprocessor
Instruction Set
REP
93
8086
Microprocessor
Instruction Set
CMPS
SCASW
MAE = (ES) x 1610 + (DI)
Modify flags (AL) - (MAE)
LODS
97
8086
Microprocessor
Instruction Set
STOS
98
8086
Microprocessor
Instruction Set
CLC Clear CF 0
NOP No operation
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
100
8086
Microprocessor
Instruction Set
Checks flags
101
8086
Microprocessor
Instruction Set
JC disp8 Jump if CF = 1
JP disp8 Jump if PF = 1
JO disp8 Jump if OF = 1
JS disp8 Jump if SF = 1
103