8086 new about the microprocessor in engineering

samanvaythanda12 0 views 134 slides Oct 20, 2025
Slide 1
Slide 1 of 134
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134

About This Presentation

mp


Slide Content

8086 MICROPROCESSOR
ARHITECTURE & PIN DIAGRAM
N.Prameela
Assistant Professor
DEPARTMET OF ECE
CMR COLLEGE OF ENGINEERING & TECHNOLOGY

Functional blocksMicroprocessor
Flag
Register
Timing and
control unit
Register array or
internal memory
Instruction
decoding unit
PC/ IP
ALU
Control Bus Address Bus
Data Bus
2
Computational Unit;
performs arithmeticand
logicoperations
Various conditions of the
results are stored as
status bits called flags in
flag register
Internal storage of data
Generates the
address ofthe
instructionstobe
fetchedfromthe
memory andsend
through address
bus to the
memory
Decodes instructions;sends
informationtothetimingand
controlunit
Generates controlsignalsfor
internal and external
operations of the
microprocessor

Functional blocksMicroprocessor
Flag
Register
Timing and
control unit
Register array or
internal memory
Instruction
decoding unit
PC/ IP
ALU
Control Bus Address Bus
Data Bus
3
Computational Unit;
performs arithmeticand
logicoperations
Various conditions of the
results are stored as
status bits called flags in
flag register
Internal storage of data
Generates the
address ofthe
instructionstobe
fetchedfromthe
memory andsend
through address
bus to the
memory
Decodes instructions;sends
informationtothetimingand
controlunit
Generates controlsignalsfor
internal and external
operations of the
microprocessor

8086 Microprocessor Architecture
4
Execution Unit (EU)
EU executes instructions that have
already been fetched by the BIU.
BIU and EU functions separately.
Bus Interface Unit (BIU)
BIU fetches instructions, reads data
from memory and I/O ports, writes
data to memory and I/ O ports .

Architecture
8086 Microprocessor
5
Bus Interface Unit (BIU)
Dedicated Adder to generate
20 bit address
Four 16-bit segment
registers
Code Segment (CS)
Data Segment (DS)
Stack Segment (SS)
Extra Segment (ES)
Segment Registers >>

Architecture
8086 Microprocessor
6
Bus Interface Unit (BIU)
Segment
Registers
8086’s1-megabyte
memory isdivided
intosegments ofup
to64Kbyteseach.
Programs obtainaccess
tocodeanddatainthe
segments bychanging
thesegment register
contenttopointtothe
desiredsegments.
The8086 candirectly
address foursegments
(256Kbyteswithinthe1
Mbyteofmemory) ata
particulartime.

Architecture
8086 Microprocessor
7
Bus Interface Unit (BIU)
Segment
Registers
Code Segment Register
16-bit
CS contains the base or start 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.

Architecture
8086 Microprocessor
8
Bus Interface Unit (BIU)
Segment
Registers
Data Segment Register
16-bit
Points to the current data segment; operands for most
instructions are fetched from this segment.
The 16-bit contents of the Source Index (SI) or
Destination Index (DI) or a 16 -bit displacement are used
as offset for computing the 20 -bit physical address.

Architecture
8086 Microprocessor
9
Bus Interface Unit (BIU)
Segment
Registers
Stack Segment Register
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 PUSHand POP.
In based addressing mode , the 20-bit physical stack
address is calculated from the Stack segment (SS ) and the
Base Pointer (BP).

Architecture
8086 Microprocessor
10
Bus Interface Unit (BIU)
Segment
Registers
Extra Segment Register
16-bit
Points to the extra segment in which data (in excess of
64K pointed to by the DS) is stored.
String instructions use the ES and DI to determine the 20 -
bit physical address for the destination.

Architecture
8086 Microprocessor
11
Bus Interface Unit (BIU)
Segment
Registers
Instruction Pointer
16-bit
Alwayspointstothenextinstructiontobeexecutedwithin
thecurrentlyexecutingcodesegment.
So,thisregistercontainsthe16-bitoffsetaddresspointing
tothenextinstructioncodewithinthe64Kbofthecode
segmentarea.
Itscontentisautomaticallyincremented astheexecution
ofthenextinstructiontakesplace.

Architecture
8086 Microprocessor
12
Bus Interface Unit (BIU)
AgroupofFirst-In-First-
Out(FIFO)inwhichupto
6bytesofinstruction
code areprefetched
fromthememory ahead
oftime.
Thisisdoneinorderto
speeduptheexecution
by overlapping
instruction fetchwith
execution.
Thismechanism isknown
aspipelining.
Instruction queue

Architecture
8086 Microprocessor
13
Some of the 16 bit registers can be
used as two 8 bit registers as :
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
Execution Unit (EU)
EU decodes and
executes instructions.
A decoder in the EU
control system
translates instructions.
16-bit ALU for
performing arithmetic
andlogicoperation
Four general purpose
registers(AX, BX, CX, DX);
Pointer registers (Stack
Pointer, Base Pointer);
and
Index registers (Source
Index, Destination Index)
each of 16-bits

Architecture
8086 Microprocessor
14
EU
Registers
Accumulator Register (AX)
Consistsoftwo8-bitregistersALandAH,whichcanbe
combinedtogetherandusedasa16-bitregisterAX.
ALinthiscasecontainstheloworderbyteoftheword,
andAHcontainsthehigh-orderbyte.
TheI/OinstructionsusetheAXorALforinputting/
outputting16or8bitdatatoorfromanI/Oport.
MultiplicationandDivisioninstructionsalsousetheAXor
AL.
Execution Unit (EU)

Architecture
8086 Microprocessor
15
EU
Registers
Base Register (BX)
Consistsoftwo8-bitregistersBLandBH,whichcanbe
combinedtogetherandusedasa16-bitregisterBX.
BLinthiscasecontainsthelow-orderbyteoftheword,
andBHcontainsthehigh-orderbyte.
Thisistheonlygeneralpurposeregisterwhosecontents
canbeusedforaddressingthe8086memory.
Allmemory referencesutilizingthisregistercontentfor
addressinguseDSasthedefaultsegmentregister.
Execution Unit (EU)

Architecture
8086 Microprocessor
16
EU
Registers
Counter Register (CX)
Consistsoftwo8-bitregistersCLandCH,whichcanbe
combinedtogetherandusedasa16-bitregisterCX.
Whencombined,CLregistercontainstheloworderbyteof
theword,andCHcontainsthehigh-orderbyte.
InstructionssuchasSHIFT,ROTATE andLOOPusethe
contentsofCXasacounter.
Execution Unit (EU)
Example:
TheinstructionLOOPSTARTautomaticallydecrements
CXby1withoutaffectingflagsandwillcheckif[CX]=
0.
Ifitiszero,8086executesthenextinstruction;
otherwisethe8086branchestothelabelSTART.

Architecture
8086 Microprocessor
17
EU
Registers
Data Register (DX)
Consistsoftwo8-bitregistersDLandDH,whichcanbe
combinedtogetherandusedasa16-bitregisterDX.
Whencombined,DLregistercontainstheloworderbyteof
theword,andDHcontainsthehigh-orderbyte.
Usedtoholdthehigh16-bitresult(data)in16X16
multiplicationorthehigh16-bitdividend(data)beforea
32÷16divisionandthe16-bitreminderafterdivision.
Execution Unit (EU)

Architecture
8086 Microprocessor
18
EU
Registers
Stack Pointer (SP) and Base Pointer (BP)
SPandBPareusedtoaccessdatainthestacksegment.
SPisusedasanoffsetfromthecurrentSSduring
executionofinstructionsthatinvolvethestacksegmentin
theexternalmemory.
SPcontentsareautomatically updated (incremented/
decremented) duetoexecution ofaPOPorPUSH
instruction.
BPcontainsanoffsetaddressinthecurrentSS,whichis
usedbyinstructionsutilizingthebasedaddressingmode.
Execution Unit (EU)

Architecture
8086 Microprocessor
19
EU
Registers
Source Index (SI) and Destination Index (DI)
Usedinindexedaddressing.
InstructionsthatprocessdatastringsusetheSIandDI
registerstogetherwithDSandESrespectivelyinorderto
distinguishbetweenthesourceanddestinationaddresses.
Execution Unit (EU)

Architecture
8086 Microprocessor
20
EU
Registers
Source Index (SI) and Destination Index (DI)
Usedinindexedaddressing.
InstructionsthatprocessdatastringsusetheSIandDI
registerstogetherwithDSandESrespectivelyinorderto
distinguishbetweenthesourceanddestinationaddresses.
Execution Unit (EU)

LOCATING THE MEMORY
21

REGISTER ORGANIZATION OF 8086
22

Architecture
8086 Microprocessor
23
Flag Register
15141312 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SFZF AF PF CF
Carry Flag
Thisflagisset,whenthereis
acarryoutofMSBincaseof
additionoraborrowincase
ofsubtraction.
Parity Flag
Thisflagissetto1,ifthelower
byteoftheresultcontainseven
number of1’s;foroddnumber
of1’ssettozero.
Auxiliary Carry Flag
Thisisset,ifthereisacarryfromthe
lowestnibble,i.e,bitthreeduring
addition,orborrowforthelowest
nibble,i.e,bitthree,during
subtraction.
Zero Flag
Thisflagisset,iftheresultof
thecomputationorcomparison
performedbyaninstructionis
zero
Sign Flag
This flag is set, when the
result of any computation
is negative
Tarp Flag
Ifthisflagisset,theprocessor
entersthesinglestepexecution
modebygeneratinginternal
interruptsaftertheexecutionof
eachinstruction
Interrupt Flag
Causes the 8086 to recognize
external mask interrupts; clearing IF
disables these interrupts.
Direction Flag
Thisisusedbystringmanipulationinstructions.Ifthisflagbit
is‘0’,thestringisprocessedbeginningfromthelowest
addresstothehighestaddress,i.e.,autoincrementingmode.
Otherwise,thestringisprocessedfromthehighestaddress
towardsthelowestaddress,i.e.,autoincrementingmode.
Over flow Flag
This flag is set, if an overflow occurs, i.e, if the result of a signed
operation is large enough to accommodate in a destination
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
sign operations, then the overflow will be set.
Execution Unit (EU)

24
Architecture
8086 Microprocessor
Sl.No. Type Register width Name of register
1 General purpose register 16 bit AX, BX, CX, DX
8 bit AL, AH, BL, BH, CL, CH, DL,DH
2 Pointerregister 16 bit SP, BP
3 Index register 16 bit SI, DI
4 Instruction Pointer 16 bit IP
5 Segment register 16 bit CS,DS, SS, ES
6 Flag (PSW) 16 bit Flag register
8086 registers
categorized
into 4 groups
1514131211 10 9 8 7 6 5 4 3 2 1 0
OF DF IFTFSFZF AF PF CF

PHYSICAL ADDRESS CALCULATION
26

PHYSICAL ADDRESS CALCULATION
27

28
8086 Microprocessor
20 Address lines 8086 can address up to
2
20
= 1M bytes of memory
However, the largest register is only 16 bits
Physical Address will have to be calculated
Physical Address : Actual address of a byte in
memory. i.e. the value which goes out onto the
address bus.
Memory Address represented in the form –
Seg: Offset (Eg-89AB:F012)
Each time the processor wants to access
memory, it takes the contents of a segment
register, shifts it one hexadecimal place to the
left (same as multiplying by 16
10), then add the
required offset to form the 20-bit address
89AB : F012 89AB 89AB0 (Paragraph to byte 89AB x 10 = 89AB0)
F012 0F012 (Offset is already in byte unit)
+ -------
98AC2 (The absolute address)
16 bytes of
contiguous memory

29
Architecture
8086 Microprocessor
Register Nameof the Register Special Function
AX 16-bit Accumulator Stores the 16-bit results ofarithmetic and logic
operations
AL 8-bit Accumulator Stores the 8-bit results ofarithmetic and logic
operations
BX Base register Used to hold base value in base addressing mode
to access memory data
CX Count Register Used to hold the count value in SHIFT, ROTATE
and LOOP instructions
DX Data Register Used to holddata for multiplication and division
operations
SP Stack Pointer Used to hold the offset address of top stack
memory
BP Base Pointer Used to hold the base value in base addressing
using SS register to access data from stack
memory
SI Source Index Used to hold index value of source operand (data)
for string instructions
DI Data Index Used to hold the index value of destination
operand (data) forstring operations
Registers and Special Functions

8086 PIN DIAGRAM
8086 Microprocessor
30
Common signals AD
0-AD
15(Bidirectional)
Address/Data bus
Loworderaddress bus;theseare
multiplexedwithdata.
When ADlinesareusedtotransmit
memory addressthesymbolAisused
insteadofAD,forexampleA
0-A
15.
WhendataaretransmittedoverADlines
thesymbolDisusedinplaceofAD,for
exampleD
0-D
7,D
8-D
15orD
0-D
15.
A
16/S
3, A
17/S
4, A
18/S
5, A
19/S
6
Highorderaddress bus.These are
multiplexedwithstatussignals

31

Pins and Signals
8086 Microprocessor
32
Common signals
BHE (Active Low)/S
7(Output)
Bus High Enable/Status
Itisusedtoenabledataontothemost
significanthalfofdatabus,D
8-D
15.8-bit
deviceconnected toupperhalfofthe
databususeBHE(ActiveLow)signal.It
ismultiplexedwithstatussignalS
7.
MN/ MX
MINIMUM / MAXIMUM
Thispinsignalindicateswhatmodethe
processoristooperatein.
RD (Read) (Active Low)
The signal is used for read operation.
It is an output signal.
It is active when low.

Pins and Signals
8086 Microprocessor
33
Common signals
TEST
����inputistestedbythe‘WAIT’
instruction.
8086 willenterawaitstateafter
executionoftheWAITinstructionand
willresume executiononlywhenthe
����ismadelowbyanactivehardware.
Thisisusedtosynchronizeanexternal
activitytotheprocessor internal
operation.
READY
Thisistheacknowledgement fromthe
slowdeviceormemory thattheyhave
completedthedatatransfer.
Thesignalmadeavailablebythedevices
issynchronized bythe8284Aclock
generatortoprovidereadyinputtothe
8086.
Thesignalisactivehigh.

Pins and Signals
8086 Microprocessor
34
Common signals
RESET (Input)
Causestheprocessor toimmediately
terminateitspresentactivity.
ThesignalmustbeactiveHIGHforat
leastfourclockcycles.
CLK
Theclockinputprovidesthebasictiming
forprocessoroperationandbuscontrol
activity.Itsanasymmetric squarewave
with33%dutycycle.
INTR Interrupt Request
Thisisatriggeredinput.Thisissampled
duringthelastclockcyclesofeach
instructiontodeterminetheavailability
oftherequest.Ifanyinterruptrequestis
pending, theprocessor enters the
interruptacknowledge cycle.
Thissignalisactivehighandinternally
synchronized.

Pins and Signals
8086 Microprocessor
35
Min/ Max Pins
The8086microprocessor canworkintwo
modesofoperations:Minimum modeand
Maximum mode.
Intheminimum modeofoperationthe
microprocessor donotassociatewithany
co-processors andcannotbeusedfor
multiprocessor systems.
Inthemaximum modethe8086canwork
in multi-processor or co-processor
configuration.
Minimum ormaximum modeoperations
aredecidedbythepinMN/MX(Activelow).
Whenthispinishigh8086operatesin
minimum mode otherwiseitoperatesin
Maximum mode.

Pins and Signals
8086 Microprocessor
Pins 24 -31
For minimum mode operation, the MN/ ��is tied
to VCC (logic high)
8086 itself generates all the bus control signals
DT/ഥ�(Data Transmit/ Receive ) Output signal from the
processor to control the direction of data flow
through the data transceivers
���(Data Enable) Output signalfrom the processor
used as out put enable for the transceivers
ALE (Address Latch Enable ) Usedto demultiplexthe
address and data lines using external latches
M/��Used to differentiatememory access and I/O
access. For memory reference instructions, it is
high. For IN and OUT instructions, it is low.
��Write control signal; asserted lowWhenever
processor writes data to memory or I/O port
����(Interrupt Acknowledge ) When the interrupt
request is accepted by the processor, the output is
low on this line.
36
Minimum mode signals

Pins and Signals
8086 Microprocessor
HOLD Input signal to the processor form the bus masters
as a request to grant the control of the bus.
Usually used by the DMA controller to get the
control of the bus.
HLDA (Hold Acknowledge ) Acknowledge signal by the
processor to the bus master requesting the control
of the bus through HOLD.
The acknowledge is asserted high, when the
processor accepts HOLD.
37
Minimum mode signals
Pins 24 -31
For minimum mode operation, the MN/ ��is tied
to VCC (logic high)
8086 itself generates all the bus control signals

Pins and Signals
8086 Microprocessor
During maximum mode operation, the MN/ ��is
grounded (logic low)
Pins 24 -31 are reassigned
�
�, �
�, �
�Status signals; used by the 8086 bus controller to
generate bus timing and control signals. These are
decodedas shown.
38
Maximum mode signals

Pins and Signals
8086 Microprocessor
During maximum mode operation, the MN/ ��is
grounded (logic low)
Pins 24 -31 are reassigned
��
�, ��
�(QueueStatus)Theprocessorprovidesthestatus
ofqueueintheselines.
Thequeuestatuscanbeusedbyexternaldeviceto
tracktheinternalstatusofthequeuein8086.
TheoutputonQS
0andQS
1canbeinterpretedas
showninthetable.
39
Maximum mode signals

Pins and Signals
8086 Microprocessor
During maximum mode operation, the MN/ ��is
grounded (logic low)
Pins 24 -31 are reassigned
��/��
�,
��/��
�
(BusRequest/BusGrant)Theserequestsareused
byotherlocalbusmasterstoforcetheprocessor
toreleasethelocalbusattheendofthe
processor’scurrentbuscycle.
These pins are bidirectional.
The request on��
�will have higher priority than��
�
40
����AnoutputsignalactivatedbytheLOCKprefix
instruction.
Remains activeuntilthecompletion ofthe
instructionprefixedbyLOCK.
The8086outputlowonthe����pinwhile
executinganinstructionprefixedbyLOCKto
preventotherbusmastersfromgainingcontrolof
thesystembus.
Maximum mode signals

41

42

43

44

45

46

ADDRESSING MODES
&
Instruction set

Introduction
48
8086 Microprocessor
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
High Level Low Level
Machine Language Assembly Language
Binary bits English Alphabets
‘Mnemonics’
Assembler
Mnemonics Machine
Language

ADDRESSING MODES

Group I : Addressing modes for
register and immediate data
Group IV : Relative Addressing mode
Group V : Implied Addressing mode
Group III : Addressing modes for
I/O ports
Group II : Addressing modes for
memory data
Addressing Modes
51
8086 Microprocessor
Everyinstructionofaprogramhastooperateonadata.
Thedifferentwaysinwhichasourceoperandisdenoted
inaninstructionareknownasaddressingmodes.
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing

Addressing Modes
52
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Theinstructionwillspecifythename ofthe
registerwhichholdsthedatatobeoperatedby
theinstruction.
Example:
MOVCL,DH
Thecontentof8-bitregisterDHismoved to
another8-bitregisterCL
(CL)(DH)
Group I : Addressing modes for
register and immediate data

Addressing Modes
53
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Inimmediateaddressingmode,an8-bitor16-bit
dataisspecifiedaspartoftheinstruction
Example:
MOVDL,08H
The8-bitdata(08
H)givenintheinstructionis
movedtoDL
(DL)08
H
MOVAX,0A9FH
The16-bitdata(0A9F
H)givenintheinstructionis
movedtoAXregister
(AX)0A9F
H
Group I : Addressing modes for
register and immediate data

Addressing Modes : Memory Access
55
8086 Microprocessor
20 Address lines 8086 can address up to
2
20
= 1M bytes of memory
However, the largest register is only 16 bits
Physical Address will have to be calculated
Physical Address : Actual address of a byte in
memory. i.e. the value which goes out onto the
address bus.
Memory Address represented in the form –
Seg: Offset (Eg-89AB:F012)
Each time the processor wants to access
memory, it takes the contents of a segment
register, shifts it one hexadecimal place to the
left (same as multiplying by 16
10), then add the
required offset to form the 20-bit address
89AB : F012 89AB 89AB0 (Paragraph to byte 89AB x 10 = 89AB0)
F012 0F012 (Offset is already in byte unit)
+ -------
98AC2 (The absolute address)
16 bytes of
contiguous memory

Addressing Modes
57
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Here,theeffective addressofthememory
locationatwhichthedataoperandisstoredis
givenintheinstruction.
Theeffectiveaddressisjusta16-bitnumber
writtendirectlyintheinstruction.
Example:
MOV BX,[1354H]
MOV BL,[0400H]
Thesquarebracketsaroundthe1354
Hdenotes
thecontentsofthememory location.When
executed,thisinstructionwillcopythecontentsof
thememorylocationintoBXregister.
Thisaddressingmodeiscalleddirectbecausethe
displacement oftheoperandfromthesegment
baseisspecifieddirectlyintheinstruction.
Group II : Addressing modes
for memory data

Addressing Modes
58
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
InRegisterindirectaddressing, name ofthe
registerwhichholdstheeffectiveaddress(EA)
willbespecifiedintheinstruction.
RegistersusedtoholdEAareanyofthefollowing
registers:
BX,BP,DIandSI.
ContentoftheDSregisterisusedforbase
addresscalculation.
Example:
MOVCX,[BX]
Operations:
EA=(BX)
BA=(DS)x16
10
MA=BA+EA
(CX)(MA)or,
(CL)(MA)
(CH)(MA+1)
Group II : Addressing modes
for memory data
Note:Register/memory
enclosedinbracketsrefer
tocontentofregister/
memory

Addressing Modes
59
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
InBasedAddressing,BXorBPisusedtoholdthe
basevalueforeffectiveaddressandasigned8-bit
orunsigned16-bitdisplacement willbespecified
intheinstruction.
Incaseof8-bitdisplacement,itissignextended
to16-bitbeforeaddingtothebasevalue.
When BXholdsthebasevalueofEA,20-bit
physicaladdressiscalculatedfromBXandDS.
WhenBPholdsthebasevalueofEA,BPandSSis
used.
Example:
MOVAX,[BX+08H]
Operations:
0008
H08
H(Signextended)
EA=(BX)+0008
H
BA=(DS)x16
10
MA=BA+EA
(AX)(MA) or,
(AL)(MA)
(AH)(MA+1)
Group II : Addressing modes
for memory data

Addressing Modes
60
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
SIorDIregisterisusedtoholdanindexvaluefor
memory dataandasigned8-bitorunsigned16-
bitdisplacement willbespecifiedinthe
instruction.
Displacement isaddedtotheindexvalueinSIor
DIregistertoobtaintheEA.
Incaseof8-bitdisplacement,itissignextended
to16-bitbeforeaddingtothebasevalue.
Example:
MOVCX,[SI+0A2H]
Operations:
FFA2
HA2
H(Signextended)
EA=(SI)+FFA2
H
BA=(DS)x16
10
MA=BA+EA
(CX)(MA)or,
(CL)(MA)
(CH)(MA+1)
Group II : Addressing modes
for memory data

Addressing Modes
61
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
InBasedIndexAddressing,theeffectiveaddress
iscomputed fromthesumofabaseregister(BX
orBP),anindexregister(SIorDI)anda
displacement.
Example:
MOVDX,[BX+SI+0AH]
Operations:
000A
H0A
H(Signextended)
EA=(BX)+(SI)+000A
H
BA=(DS)x16
10
MA=BA+EA
(DX)(MA)or,
(DL)(MA)
(DH)(MA+1)
Group II : Addressing modes
for memory data

Addressing Modes
62
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Employedinstringoperationstooperateonstring
data.
Theeffectiveaddress(EA)ofsourcedataisstored
inSIregisterandtheEAofdestinationisstoredin
DIregister.
Segmentregisterforcalculatingbaseaddressof
sourcedataisDSandthatofthedestinationdata
isES
Example:MOVSBYTE
Operations:
Calculationofsourcememory location:
EA=(SI) BA=(DS)x16
10 MA=BA+EA
Calculationofdestinationmemorylocation:
EA
E=(DI) BA
E=(ES)x16
10MA
E=BA
E+EA
E
(MAE)(MA)
IfDF=1,then(SI)(SI)–1and(DI)=(DI)-1
IfDF=0,then(SI)(SI)+1and(DI)=(DI)+1
Group II : Addressing modes
for memory data
Note:Effectiveaddressof
theExtrasegmentregister

Addressing Modes
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Theseaddressingmodesareusedtoaccessdata
fromstandardI/Omappeddevicesorports.
Indirectportaddressing mode,an8-bitport
addressisdirectlyspecifiedintheinstruction.
Example:INAL,[09H]
Operations:PORT
addr=09
H
(AL)(PORT)
Contentofportwithaddress09
His
movedtoALregister
Inindirectportaddressingmode,theinstruction
willspecifythenameoftheregisterwhichholds
theportaddress.In8086,the16-bitportaddress
isstoredintheDXregister.
Example:OUT[DX],AX
Operations:PORT
addr=(DX)
(PORT)(AX)
ContentofAXismovedtoport
whose addressisspecifiedbyDX
register.
63
Group III : Addressing
modes for I/O ports

Addressing Modes
64
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Inthisaddressingmode,theeffectiveaddressof
aprogram instructionisspecifiedrelativeto
InstructionPointer(IP)byan8-bitsigned
displacement.
Example:JZ0AH
Operations:
000A
H0A
H (signextend)
IfZF=1,then
EA=(IP)+000A
H
BA=(CS)x16
10
MA=BA+EA
IfZF=1,thentheprogramcontroljumpsto
newaddresscalculatedabove.
IfZF=0,thennextinstructionofthe
programisexecuted.
Group IV : Relative
Addressing mode

Addressing Modes
65
8086 Microprocessor
1.Register Addressing
2.Immediate Addressing
3.Direct Addressing
4.Register Indirect Addressing
5.Based Addressing
6.Indexed Addressing
7.Based Index Addressing
8.String Addressing
9.Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
Instructionsusingthismodehavenooperands.
Theinstructionitselfwillspecifythedatatobe
operatedbytheinstruction.
Example:CLC
Thisclearsthecarryflagtozero.
Group IV : Implied
Addressing mode

INSTRUCTION SET

1.Data Transfer Instructions
2.Arithmetic Instructions
3.Logical Instructions
4.String manipulation Instructions
5.Process Control Instructions
6.Control Transfer Instructions
Instruction Set
67
8086 Microprocessor
8086 supports 6 types of instructions.

1. Data Transfer Instructions
Instruction Set
68
8086 Microprocessor
Instructions that are used to transfer data/ address in to
registers, memory locations and I/O ports.
Generally involve two operands: Source operand and
Destination operand of the same size.
Source: Register or a memory location or an immediate data
Destination: Register or a memory location.
The size should be a either a byte or a word.
A 8-bit data can only be moved to 8 -bit register/ memory
and a 16-bit data can be moved to 16-bit register/ memory.

1. Data Transfer Instructions
Instruction Set
69
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
MOV reg2/ mem, reg1/ mem
MOV reg2, reg1
MOV mem,reg1
MOV reg2, mem
(reg2) (reg1)
(mem)(reg1)
(reg2)(mem)
MOV reg/ mem, data
MOV reg, data
MOV mem, data
(reg) data
(mem)data
XCHG reg2/ mem, reg1
XCHG reg2, reg1
XCHG mem, reg1
(reg2) (reg1)
(mem)(reg1)

1. Data Transfer Instructions
Instruction Set
70
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
PUSH reg16/ mem
PUSH reg16
PUSH mem
(SP) (SP) –2
MA
S= (SS) x 16
10+ SP
(MA
S; MA
S+ 1)(reg16)
(SP) (SP) –2
MA
S= (SS) x 16
10+ SP
(MA
S; MA
S+ 1)(mem)
POP reg16/ mem
POP reg16
POP mem
MA
S= (SS) x 16
10+ SP
(reg16) (MA
S; MA
S+ 1)
(SP) (SP) + 2
MA
S= (SS) x 16
10+ SP
(mem) (MA
S; MA
S+ 1)
(SP) (SP) + 2

1. Data Transfer Instructions
Instruction Set
71
8086 Microprocessor
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
IN A, [DX]
IN AL, [DX]
IN AX, [DX]
PORT
addr= (DX)
(AL) (PORT)
PORT
addr= (DX)
(AX) (PORT)
IN A, addr8
IN AL, addr8
IN AX, addr8
(AL) (addr8)
(AX) (addr8)
OUT [DX], A
OUT [DX], AL
OUT [DX], AX
PORT
addr= (DX)
(PORT) (AL)
PORT
addr= (DX)
(PORT) (AX)
OUT addr8, A
OUT addr8, AL
OUT addr8, AX
(addr8) (AL)
(addr8) (AX)

2. Arithmetic Instructions
Instruction Set
72
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
ADD reg2/ mem, reg1/mem
ADC reg2, reg1
ADC reg2, mem
ADC mem, reg1
(reg2) (reg1) + (reg2)
(reg2)(reg2) + (mem)
(mem)(mem)+(reg1)
ADD reg/mem, data
ADD reg,data
ADD mem, data
(reg) (reg)+ data
(mem)(mem)+data
ADD A, data
ADDAL, data8
ADD AX, data16
(AL)(AL)+ data8
(AX)(AX) +data16

2. Arithmetic Instructions
Instruction Set
73
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
ADC reg2/ mem, reg1/mem
ADC reg2, reg1
ADC reg2, mem
ADC mem, reg1
(reg2) (reg1) + (reg2)+CF
(reg2)(reg2) + (mem)+CF
(mem)(mem)+(reg1)+CF
ADC reg/mem, data
ADC reg,data
ADC mem, data
(reg) (reg)+ data+CF
(mem)(mem)+data+CF
ADDC A, data
ADDAL, data8
ADD AX, data16
(AL)(AL)+ data8+CF
(AX)(AX) +data16+CF

2. Arithmetic Instructions
Instruction Set
74
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
SUB reg2/ mem, reg1/mem
SUB reg2, reg1
SUB reg2, mem
SUB mem, reg1
(reg2) (reg1) -(reg2)
(reg2)(reg2) -(mem)
(mem)(mem) -(reg1)
SUB reg/mem, data
SUB reg,data
SUB mem, data
(reg) (reg)-data
(mem)(mem)-data
SUB A, data
SUBAL, data8
SUB AX, data16
(AL)(AL)-data8
(AX)(AX) -data16

2. Arithmetic Instructions
Instruction Set
75
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
SBB reg2/ mem, reg1/mem
SBB reg2, reg1
SBB reg2, mem
SBB mem, reg1
(reg2) (reg1) -(reg2)-CF
(reg2)(reg2) -(mem)-CF
(mem)(mem) -(reg1) –CF
SBB reg/mem, data
SBB reg,data
SBB mem, data
(reg) (reg) –data -CF
(mem)(mem) -data -CF
SBB A, data
SBB AL, data8
SBB AX, data16
(AL)(AL)-data8 -CF
(AX)(AX) -data16 -CF

2. Arithmetic Instructions
Instruction Set
76
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
INC reg/ mem
INC reg8
INC reg16
INCmem
(reg8) (reg8) + 1
(reg16) (reg16) + 1
(mem) (mem) + 1
DEC reg/ mem
DEC reg8
DEC reg16
DEC mem
(reg8) (reg8) -1
(reg16) (reg16) -1
(mem) (mem) -1

2. Arithmetic Instructions
Instruction Set
77
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
MUL reg/ mem
MUL reg
MUL mem
For byte :(AX) (AL) x (reg8)
Forword: (DX)(AX) (AX) x (reg16)
For byte :(AX) (AL) x (mem8)
Forword: (DX)(AX) (AX) x (mem16)
IMUL reg/ mem
IMUL reg
IMUL mem
For byte :(AX) (AL) x (reg8)
Forword: (DX)(AX) (AX) x (reg16)
For byte :(AX) (AX) x (mem8)
Forword: (DX)(AX) (AX) x (mem16)

2. Arithmetic Instructions
Instruction Set
78
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
DIV reg/ mem
DIV reg
DIV mem
For 16-bit :-8-bit :
(AL) (AX) :-(reg8) Quotient
(AH) (AX) MOD(reg8) Remainder
For 32-bit :-16-bit :
(AX) (DX)(AX) :-(reg16) Quotient
(DX) (DX)(AX) MOD(reg16) Remainder
For 16-bit :-8-bit :
(AL) (AX) :-(mem8) Quotient
(AH) (AX) MOD(mem8) Remainder
For 32-bit :-16-bit :
(AX) (DX)(AX) :-(mem16) Quotient
(DX) (DX)(AX) MOD(mem16) Remainder

2. Arithmetic Instructions
Instruction Set
79
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
IDIV reg/ mem
IDIV reg
IDIV mem
For 16-bit :-8-bit :
(AL) (AX) :-(reg8) Quotient
(AH) (AX) MOD(reg8) Remainder
For 32-bit :-16-bit :
(AX) (DX)(AX) :-(reg16) Quotient
(DX) (DX)(AX) MOD(reg16) Remainder
For 16-bit :-8-bit :
(AL) (AX) :-(mem8) Quotient
(AH) (AX) MOD(mem8) Remainder
For 32-bit :-16-bit :
(AX) (DX)(AX) :-(mem16) Quotient
(DX) (DX)(AX) MOD(mem16) Remainder

2. Arithmetic Instructions
Instruction Set
80
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
CMP reg2/mem, reg1/ mem
CMP reg2, reg1
CMP reg2, mem
CMP mem, reg1
Modify flags (reg2) –(reg1)
If (reg2) > (reg1) then CF=0, ZF=0, SF=0
If (reg2) < (reg1) then CF=1, ZF=0, SF=1
If (reg2) = (reg1) then CF=0, ZF=1, SF=0
Modify flags (reg2) –(mem)
If (reg2) > (mem) then CF=0,ZF=0, SF=0
If (reg2) < (mem) then CF=1,ZF=0, SF=1
If (reg2) = (mem) then CF=0,ZF=1, SF=0
Modify flags (mem) –(reg1)
If (mem) > (reg1) then CF=0, ZF=0, SF=0
If (mem) < (reg1) then CF=1, ZF=0, SF=1
If (mem) = (reg1) then CF=0, ZF=1, SF=0

2. Arithmetic Instructions
Instruction Set
81
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
CMP reg/mem, data
CMP reg, data
CMP mem, data
Modify flags (reg) –(data)
If (reg) > data then CF=0,ZF=0, SF=0
If (reg) < data then CF=1,ZF=0, SF=1
If (reg) = data then CF=0,ZF=1, SF=0
Modify flags (mem) –(mem)
If (mem) > data then CF=0,ZF=0, SF=0
If (mem) < data then CF=1,ZF=0, SF=1
If (mem) = data then CF=0,ZF=1, SF=0

2. Arithmetic Instructions
Instruction Set
82
8086 Microprocessor
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL , DIV, CMP…
CMP A, data
CMP AL, data8
CMP AX, data16
Modify flags (AL) –data8
If (AL) > data8 then CF=0, ZF=0, SF=0
If (AL) < data8 then CF=1, ZF=0, SF=1
If (AL) = data8 then CF=0, ZF=1, SF=0
Modify flags (AX) –data16
If (AX) > data16 then CF=0, ZF=0, SF=0
If (mem) < data16 then CF=1, ZF=0, SF=1
If (mem) = data16 then CF=0, ZF=1, SF=0

3. Logical Instructions
Instruction Set
83
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
84
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
85
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
86
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
87
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
88
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
89
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

3. Logical Instructions
Instruction Set
90
8086 Microprocessor
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …

4. String Manipulation Instructions
Instruction Set
91
8086 Microprocessor
String : Sequence of bytes or words
8086 instruction set includes instruction for string movement, comparison,
scan, load and store.
REP instruction prefix : used to repeat execution of string instructions
String instructions end with Sor SBor SW.
Srepresents string, SBstring byte and SWstring word.
Offset or effective address of the source operand is stored in SIregister and
that of the destination operand is stored in DIregister.
Depending on the status of DF, SIand DIregisters are automatically
updated.
DF = 0 SI and DI are incremented by 1 for byte and 2 for word.
DF = 1 SI and DI are decremented by 1 for byte and 2 for word.

4. String Manipulation Instructions
Instruction Set
92
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
REP
REPZ/ REPE
(Repeat CMPS or SCAS until
ZF = 0)
REPNZ/ REPNE
(Repeat CMPS or SCAS until
ZF = 1)
While CX 0 and ZF = 1, repeatexecution of
string instruction and
(CX) (CX) –1
While CX 0 and ZF = 0, repeatexecution of
string instruction and
(CX) (CX) -1

4. String Manipulation Instructions
Instruction Set
93
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
MOVS
MOVSB
MOVSW
MA = (DS) x 16
10+ (SI)
MA
E= (ES) x 16
10+ (DI)
(MA
E) (MA)
If DF = 0, then (DI) (DI)+ 1; (SI)(SI) + 1
If DF = 1, then (DI) (DI)-1; (SI)(SI) -1
MA = (DS) x 16
10+ (SI)
MA
E= (ES) x 16
10+ (DI)
(MA
E; MA
E+ 1) (MA; MA + 1)
If DF = 0, then (DI) (DI)+ 2; (SI)(SI) + 2
If DF = 1, then (DI) (DI)-2; (SI)(SI) -2

4. String Manipulation Instructions
Instruction Set
94
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
CMPS
CMPSB
CMPSW
MA = (DS) x 16
10+ (SI)
MA
E= (ES) x 16
10+ (DI)
Modifyflags (MA) -(MA
E)
If (MA) > (MA
E), then CF = 0; ZF = 0; SF = 0
If (MA) < (MA
E), then CF = 1; ZF = 0; SF = 1
If (MA) = (MA
E), then CF = 0; ZF = 1; SF = 0
For byte operation
If DF = 0, then (DI) (DI)+ 1; (SI)(SI) + 1
If DF = 1, then (DI) (DI)-1; (SI)(SI) -1
For word operation
If DF = 0, then (DI) (DI)+ 2; (SI)(SI) + 2
If DF = 1, then (DI) (DI)-2; (SI)(SI) -2
Compare two string byte or string word

4. String Manipulation Instructions
Instruction Set
95
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
SCAS
SCASB
SCASW
MA
E= (ES) x 16
10+ (DI)
Modifyflags (AL) -(MA
E)
If (AL) > (MA
E), then CF = 0; ZF = 0; SF = 0
If (AL) < (MA
E), then CF = 1; ZF = 0; SF = 1
If (AL) = (MA
E), then CF = 0; ZF = 1; SF = 0
If DF = 0, then (DI) (DI)+ 1
If DF = 1, then (DI) (DI)–1
MA
E= (ES) x 16
10+ (DI)
Modifyflags (AL) -(MA
E)
If (AX) > (MA
E; MA
E+ 1), then CF = 0; ZF = 0; SF = 0
If (AX) < (MA
E; MA
E+ 1), then CF = 1; ZF = 0; SF = 1
If (AX) = (MA
E; MA
E+ 1), then CF = 0; ZF = 1; SF = 0
If DF = 0, then (DI) (DI)+ 2
If DF = 1, then (DI) (DI)–2
Scan (compare) a string byte or word with accumulator

4. String Manipulation Instructions
Instruction Set
96
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
LODS
LODSB
LODSW
MA = (DS) x 16
10+ (SI)
(AL)(MA)
If DF = 0, then (SI) (SI)+ 1
If DF = 1, then (SI) (SI)–1
MA = (DS) x 16
10+ (SI)
(AX)(MA ; MA + 1)
If DF = 0, then (SI) (SI)+ 2
If DF = 1, then (SI) (SI)–2
Load string byte in to AL or string word in to AX

4. String Manipulation Instructions
Instruction Set
97
8086 Microprocessor
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
STOS
STOSB
STOSW
MA
E= (ES) x 16
10+ (DI)
(MA
E)(AL)
If DF = 0, then (DI) (DI)+ 1
If DF = 1, then (DI) (DI)–1
MA
E= (ES) x 16
10+ (DI)
(MA
E; MA
E+ 1 )(AX)
If DF = 0, then (DI) (DI)+ 2
If DF = 1, then (DI) (DI)–2
Store byte from AL or word from AX in to string

Mnemonics Explanation
STC Set CF 1
CLC Clear CF 0
CMC Complement carry CF CF
/
STD Set direction flag DF 1
CLD Clear direction flag DF 0
STI Set interrupt enable flag IF 1
CLI Clear interrupt enable flag IF 0
NOP No operation
HLT Haltafter interrupt is set
WAIT Wait for TEST pin active
ESC opcodemem/ reg Used to pass instruction to a coprocessor
which shares the address and data bus
with the 8086
LOCK Lock bus during next instruction
5. Processor Control Instructions
Instruction Set
98
8086 Microprocessor

6. Control Transfer Instructions
Instruction Set
99
8086 Microprocessor
Transfer the control to a specific destination or target instruction
Do not affect flags
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
RET Return fromsubroutine
JMPreg/ mem/ disp8/ disp16 Unconditionaljump
8086 Unconditional transfers

6. Control Transfer Instructions
Instruction Set
100
8086 Microprocessor
8086 signed conditional
branch instructions
8086 unsigned conditional
branch instructions
Checks flags
If conditions are true, the program control is
transferred to the new memory location in the same
segment by modifying the content of IP

6. Control Transfer Instructions
Instruction Set
101
8086 Microprocessor
Name Alternate name
JE disp8
Jump if equal
JZ disp8
Jump if result is 0
JNE disp8
Jump if not equal
JNZ disp8
Jump if not zero
JG disp8
Jump if greater
JNLE disp8
Jump if not less or
equal
JGE disp8
Jump if greater
than or equal
JNL disp8
Jump if not less
JL disp8
Jump if less than
JNGE disp8
Jump if not
greater than or
equal
JLE disp8
Jump if less than
or equal
JNGdisp8
Jump if not
greater
8086 signed conditional
branch instructions
8086 unsigned conditional
branch instructions
Name Alternate name
JE disp8
Jump if equal
JZ disp8
Jump if result is 0
JNE disp8
Jump if not equal
JNZ disp8
Jump if not zero
JA disp8
Jump if above
JNBE disp8
Jump if not below
or equal
JAE disp8
Jump if above or
equal
JNB disp8
Jump if not below
JB disp8
Jump if below
JNAE disp8
Jump if not above
or equal
JBE disp8
Jump if below or
equal
JNAdisp8
Jump if not above

6. Control Transfer Instructions
Instruction Set
102
8086 Microprocessor
Mnemonics Explanation
JCdisp8 Jump if CF= 1
JNC disp8 Jump if CF = 0
JP disp8 Jump if PF = 1
JNP disp8 Jump if PF =0
JO disp8 Jump ifOF = 1
JNO disp8 Jump if OF = 0
JS disp8 Jump if SF = 1
JNS disp8 Jump if SF = 0
JZ disp8 Jump if resultis zero, i.e, Z = 1
JNZ disp8 Jump if result is not zero, i.e, Z = 1
8086 conditional branch instructions affecting individual flags

Assembler directives

Assemble Directives
104
8086 Microprocessor
Instructions to the Assembler regarding the program being
executed.
Control the generation of machine codes and organization of
the program; but no machine codes are generated for
assembler directives.
Also called ‘pseudo instructions’
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..

Assemble Directives
105
8086 Microprocessor
Define Byte
Define a byte type (8-bit) variable
Reserves specific amount of memory
locations to each variable
Range : 00
H–FF
Hfor unsigned value;
00
H–7F
Hfor positive value and
80
H–FF
Hfor negative value
General form : variable DB value/ values
Example:
LISTDB7FH,42H,35H
Threeconsecutivememory locationsarereservedfor
thevariableLISTandeachdataspecifiedinthe
instructionarestoredasinitialvalueinthereserved
memory location
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM

Assemble Directives
106
8086 Microprocessor
Define Word
Define a word type (16-bit) variable
Reserves two consecutive memory locations
to each variable
Range : 0000
H–FFFF
Hfor unsigned value;
0000
H–7FFF
Hfor positive value and
8000
H–FFFF
Hfor negative value
General form : variable DW value/ values
Example:
ALISTDW6512H,0F251H,0CDE2H
Sixconsecutivememory locationsarereservedfor
thevariableALISTandeach16-bitdataspecifiedin
theinstructionisstoredintwoconsecutivememory
location.
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM

Assemble Directives
107
8086 Microprocessor
SEGMENT : Used to indicate the beginning of
a code/ data/ stack segment
ENDS : Used to indicate the end of a code/
data/ stack segment
General form:
SegnamSEGMENT






SegnamENDS
Program code
or
Data Defining Statements
User defined name of
the segment
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM

Assemble Directives
108
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
Informs the assembler the name of the
program/ data segment that should be used
for a specific segment.
General form:
Segment Register
ASSUME segreg: segnam, .. , segreg: segnam
User defined name of
the segment
ASSUME CS: ACODE, DS:ADATA Tellsthecompiler thatthe
instructionsoftheprogram are
storedinthesegmentACODEand
dataarestoredinthesegment
ADATA
Example:

Assemble Directives
109
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
FAR
NEAR
ENDP
SHORT
MACRO
ENDM
ORG(Origin) is used to assign the starting address
(Effective address) for a program/ data segment
ENDis used to terminate a program; statements
after END will be ignored
EVEN: Informs the assembler to store program/
data segment starting from an even address
EQU(Equate) is used to attach a value to a variable
ORG 1000H Informstheassemblerthatthestatements
followingORG1000Hshouldbestoredin
memory startingwitheffectiveaddress
1000
H
LOOP EQU 10FEH ValueofvariableLOOPis10FE
H
_SDATA SEGMENT
ORG 1200H
A DB 4CH
EVEN
B DW 1052H
_SDATA ENDS
Inthisdatasegment,effectiveaddressof
memory locationassignedtoAwillbe1200
H
andthatofBwillbe1202
Hand1203
H.
Examples:

Assemble Directives
110
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
PROCIndicates the beginning of a procedure
ENDPEnd of procedure
FARIntersegment call
NEARIntrasegment call
General form
procnamePROC[NEAR/ FAR]



RET
procnameENDP
Program statements of the
procedure
Last statement of the
procedure
User defined name of
the procedure

Assemble Directives
111
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
ADD64 PROC NEAR



RET
ADD64 ENDP
Thesubroutine/procedurenamedADD64is
declaredasNEARandsotheassemblerwill
codetheCALLandRETinstructionsinvolved
inthisprocedureasnearcallandreturn
CONVERT PROC FAR



RET
CONVERT ENDP
Thesubroutine/procedurenamedCONVERT
isdeclaredasFARandsotheassemblerwill
codetheCALLandRETinstructionsinvolved
inthisprocedureasfarcallandreturn
Examples:

Assemble Directives
112
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
Reserves one memory location for 8 -bit
signed displacement in jump instructions
JMP SHORT
AHEAD
Thedirectivewillreserve one
memory location for 8-bit
displacementnamedAHEAD
Example:

Assemble Directives
113
8086 Microprocessor
DB
DW
SEGMENT
ENDS
ASSUME
ORG
END
EVEN
EQU
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM
MACROIndicate the beginning of a macro
ENDMEnd of a macro
General form:
macroname MACRO[Arg1, Arg2 ...]



macroname ENDM
Program
statementsin
the macro
User defined name of
the macro

114

Interfacing memory and i/o ports

Memory
116
8086 Microprocessor
Memory
Processor Memory
Primary or Main Memory
Secondary Memory
Store
Programs
and Data
Registers inside a microcomputer
Store data and results temporarily
No speed disparity
Cost 
Storage area which can be directly
accessed by microprocessor
Store programs and data prior to
execution
Should not have speed disparity with
processor Semi Conductor
memories using CMOS technology
ROM, EPROM, Static RAM, DRAM
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.

Memory organization in 8086
117
8086 Microprocessor
Memory IC’s : Byte oriented
8086 : 16-bit
Word : Stored by two
consecutive memory locations;
for LSB and MSB
Address of word : Address of
LSB
Bank 0 : A
0= 0 Even
addressed memory bank
Bank 1 : ??????&#3627408495;??????= 0 Odd
addressed memory bank

Memory organization in 8086
118
8086 Microprocessor
Operation ??????&#3627408495;??????A
0 Data Lines Used
1Read/Write byte at an even address 1 0 D
7–D
0
2Read/Write byte at an odd address 0 1 D
15–D
8
3Read/Write word at an even address 0 0 D
15–D
0
4Read/Write word at an odd address 0 1 D
15–D
0in first operation
byte from odd bank is
transferred
1 0 D
7–D
0in first operation
byte from odd bank is
transferred

Memory organization in 8086
119
8086 Microprocessor
Available memory space = EPROM + RAM
Allot equal address space in odd and even
bank for both EPROM and RAM
Can be implemented in two IC’s (one for
even and other for odd) or in multiple IC’s

Interfacing SRAM and EPROM
120
8086 Microprocessor
Memory interface Read from and write in
to a set of semiconductor memory IC chip
EPROM Read operations
RAM Read and Write
In order to perform read/ write operations,
Memory access time read / write time of
the processor
Chip Select (CS) signal has to be generated
Control signals for read / write operations
Allot address for each memory location

Interfacing SRAM and EPROM
121
8086 Microprocessor
Typical Semiconductor IC Chip
No of
Address
pins
Memorycapacity Range of
address in
hexa
In Decimal In kilo In hexa
20 2
20
= 10,48,576 1024 k = 1M 100000 00000
to
FFFFF

Interfacing SRAM and EPROM
122
8086 Microprocessor
Memory map of 8086
RAM are mapped at the beginning; 00000H is allotted to RAM
EPROM’s are mapped at FFFFF
H
Facilitate automatic execution of monitor programs
and creation of interrupt vector table

Interfacing SRAM and EPROM
123
8086 Microprocessor
Monitor Programs
Programing 8279 for keyboard scanning and display
refreshing
Programming peripheral IC’s 8259, 8257, 8255,
8251, 8254 etc
Initialization of stack
Display a message on display (output)
Initializing interrupt vector table
8279 Programmable keyboard/ display controller
8257 DMA controller
8259 Programmable interrupt controller
8255 Programmable peripheral interface
Note :

Interfacing I/O and peripheral devices
124
8086 Microprocessor
I/O devices
For communication between microprocessor and
outside world
Keyboards, CRT displays, Printers, Compact Discs
etc.

Data transfer types
Microprocessor I/ O devices
Ports / Buffer IC’s
(interface circuitry)
Programmed I/ O
Data transfer is accomplished
through an I/O port
controlled by software
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
Memory mapped
I/O mapped

8086 and 8088 comparison
125
8086 Microprocessor
Memory mapping I/O mapping
20 bit address are provided for I/O
devices
8-bit or 16-bit addresses are
provided for I/O devices
The I/O ports orperipherals can be
treated like memory locations and
so all instructions related to
memory can be used for data
transmission between I/O device
and processor
Only IN and OUT instructions can be
used for datatransfer between I/O
device and processor
Data can bemoved from any
register to ports and vice versa
Data transfer takes place only
between accumulator and ports
When memory mapping is used for
I/O devices, full memory address
space cannot be used for
addressing memory.
Useful only for small systems
where memory requirement is less
Full memory space can be used for
addressing memory.
Suitable for systemswhich
require large memory capacity
For accessing the memory mapped
devices, the processor executes
memory read or write cycle.
M / &#3627408392;&#3627408398;is asserted high
For accessing the I/O mapped
devices, the processor executes I/O
read or write cycle.
M / &#3627408392;&#3627408398;is asserted low

8086 and 8088 comparison

8086 and 8088 comparison
127
8086 Microprocessor
8086 8088
Similar EUand Instruction set ; dissimilar BIU
16-bit Databus lines obtained by
demultiplexingAD
0–AD
15
8-bit Databus lines obtained by
demultiplexingAD
0–AD
7
20-bit address bus 8-bit address bus
Two banks of memory each of 512
kb
Single memory bank
6-bit instruction queue 4-bit instruction queue
Clock speeds: 5 / 8 / 10 MHz 5 / 8 MHz
In MIN mode, pin 28 is assigned the
signal M / &#3627408392;&#3627408398;
In MIN mode, pin 28 is assigned the
signal IO / ഥ&#3627408396;
To access higher byte, &#3627408385;&#3627408391;&#3627408388;signal is
used
No such signal required, since the
data width is only 1-byte

8087 Coprocessor

Co-processor –Intel 8087
129
8086 Microprocessor
Multiprocessor
system
A microprocessor system comprising of two or more
processors
Distributed processing: Entire task is divided in to
subtasks
Advantages
Better system throughput by having more than one
processor
Each processor have a local bus to access local
memory or I/O devices so that a greater degree of
parallel processing can be achieved
System structure is more flexible.
One can easily add or remove modules to change the
system configuration without affecting the other
modules in the system

Co-processor –Intel 8087
130
8086 Microprocessor
Specially designed to take care of mathematical
calculations involving integer and floating point data
“Math coprocessor” or “Numeric Data Processor (NDP)”
Works in parallel with a 8086 in the maximum mode
8087
coprocessor
1)Can operate on data of the integer, decimal and real
types with lengths ranging from 2 to 10 bytes
2)Instruction set involves square root, exponential,
tangent etc. in addition to addition, subtraction,
multiplication and division.
3)High performance numeric data processor it can
multiply two 64-bit real numbers in about 27 s and
calculate square root in about 36 s
4)Follows IEEE floating point standard
5)It is multi bus compatible
Features

Co-processor –Intel 8087
131
8086 Microprocessor
16 multiplexed address / data pins
and 4 multiplexed address / status
pins
Hence it can have 16-bit external
data bus and 20-bit external address
bus like 8086
Processor clock, ready and reset
signals are applied as clock, ready
and reset signals for coprocessor

Co-processor –Intel 8087
132
8086 Microprocessor
BUSY signal from 8087 is connected
to the &#3627408403;&#3627408388;&#3627408402;&#3627408403;input of 8086
If the 8086 needs the result of some
computation that the 8087 is doing
before it can execute the next
instruction in the program, a user can
tell 8086 with a WAIT instruction to
keep looking at its &#3627408403;&#3627408388;&#3627408402;&#3627408403;pin until it
finds the pin low
A low on the BUSY output indicates
that the 8087 has completed the
computation
BUSY

Co-processor –Intel 8087
133
8086 Microprocessor
The request / grant signal from the
8087 is usually connected to the
request / grant (&#3627408401;&#3627408400;/ &#3627408390;&#3627408403;
&#3627409358;or &#3627408401;&#3627408400;/ &#3627408390;&#3627408403;
&#3627409359;)
pin of the 8086
&#3627408401;&#3627408400;/ &#3627408390;&#3627408403;
&#3627409358;
The request / grant signal from the
8087 is usually connected to the
request / grant pin of the
independent processor such as 8089
&#3627408401;&#3627408400;/ &#3627408390;&#3627408403;
&#3627409359;

Co-processor –Intel 8087
134
8086 Microprocessor
The interrupt pin is connected to the
interrupt management logic.
The 8087 can interrupt the 8086
through this interrupt management
logic at the time error condition
exists
INT

Co-processor –Intel 8087
135
8086 Microprocessor
ഥ&#3627408402;
&#3627409358;-ത&#3627408402;
&#3627409360;
ഥ&#3627408402;
&#3627409360;
ഥ&#3627408402;
&#3627409359;
ഥ&#3627408402;
&#3627409358;Status
1 0 0 Unused
1 0 1 Read memory
1 1 0 Writememory
1 1 1 Passive
QS
0–QS
1
QS
0 QS
1 Status
0 0 No operation
0 1 First byte ofopcode
from queue
1 0 Queueempty
1 1 Subsequent byte of
opcodefrom queue

Co-processor –Intel 8087
136
8086 Microprocessor
8087
instructions
are inserted
in the 8086
program
8086 and 8087 reads
instruction bytes and
puts them in the
respective queues
NOP
8087 instructions have
11011 as the MSB of
their first code byte
8087 keeps track for ESC
instruction by monitoring
&#3627408506;
&#3627409360;-&#3627408506;
&#3627409358;and AD
0–AD
15of
8086.
Also keeps track of QS
0–
QS
1.
Q status 00; does nothing
Q status 01; 8087
compares the five MSB
bits with 11011
If there is a match, then
the ESC instruction is
fetched and executed by
8087
If there is error during
decoding an ESC
instruction, 8087 sends
an interrupt request
Memory read/ write
Additional words : &#3627408505;&#3627408504;-
&#3627408494;&#3627408507;
&#3627409358;
8087 BUSY pin high
&#3627408507;??????&#3627408506;&#3627408507;
WAIT
Ref: Microprocessor, AtulP. Godse, DeepaliA. Gode, Technical publications, Chap 11

Co-processor –Intel 8087
137
8086 Microprocessor
ESC
Execute the
8086
instructions
WAIT
Monitor
8086/
8088
Deactivate the
host’s TEST pin
and execute the
specific
operation
Activate
the TEST
pin
Wake up the
coprocessor
Wake up the
8086/ 8088
8086/ 8088 Coprocessor

138