Microprocessor Architecture 8085, 8086 & Other
Microprocessor Architecture 8085, 8086 & Other
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
Source: https://www2.slideshare.net/saquib208/8085- microprocessor-ramesh- gaonkar?fbclid=IwAR08_WdGimDr7BLv_q31aciILlAIjyyG-
40s3CqU1p0Z15hrJb0wB4kRgFw
MICROPROCESSOR 8085
• Reference Book:
– Ramesh S. Goankar, “Microprocessor Architecture,
Programming and Applications with 8085”, 5th Edition,
Prentice Hall
Basic Concepts of Microprocessors
• Differences between:
– Microcomputer – a computer with a
microprocessor as its CPU. Includes memory, I/O
etc.
– Microprocessor – silicon chip which includes
ALU, register circuits & control circuits
– Microcontroller – silicon chip which includes
microprocessor, memory & I/O in a single
package.
What is a Microprocessor?
• The word comes from the combination micro and
processor.
– Processor means a device that processes whatever. In
this context processor means a device that processes
numbers, specifically binary numbers, 0’s and 1’s.
• To process means to manipulate. It is a general term that
describes all manipulation. Again in this content, it means to
perform certain operations on the numbers that depend on the
microprocessor’s design.
What about micro?
• Micro is a new addition.
– In the late 1960’s, processors were built using discrete
elements.
• These devices performed the required operation, but were too
large and too slow.
Output
Input
Memory
Inside The Microprocessor
• Internally, the microprocessor is made up of
3 main units.
– The Arithmetic/Logic Unit (ALU)
– The Control Unit.
– An array of registers for holding data while it is
being manipulated.
Organization of a microprocessor-
based system
• Let’s expand the picture a bit.
I/O
ALU Register Input/ Output
Array
System Bus
Control
Memory
ROM RAM
Memory
• Memory stores information such as instructions
and data in binary format (0 and 1). It provides
this information to the microprocessor whenever
it is needed.
5FFF
RAM 2 6000
Address Range of 2nd RAM Chip
8FFF
9000
RAM 3 Address Range of 3rd RAM Chip
A3FF
RAM 4 A400
F7FF
FFFF
Memory
• To execute a program:
– the user enters its instructions in binary format into the
memory.
– The microprocessor then reads these instructions and
whatever data is needed from memory, executes the
instructions and places the results either in memory or
produces it on an output device.
The three cycle instruction
execution model
• To execute a program, the microprocessor “reads”
each instruction from memory, “interprets” it, then
“executes” it.
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
8085 Microprocessor Architecture
Input/Output/
Memory
Read
Write
Enable
Multiplexed
Address Data
Bus
Address
Bus
• System Bus – wires connecting memory & I/O to
microprocessor
– Address Bus
• Unidirectional
• Identifying peripheral or memory location
– Data Bus
• Bidirectional
• Transferring data
– Control Bus
• Synchronization signals
• Timing signals
• Control signal
Architecture of Intel 8085 Microprocessor
Intel 8085 Microprocessor
• Microprocessor consists of:
– Control unit: control microprocessor operations.
– ALU: performs data processing function.
– Registers: provide storage internal to CPU.
– Interrupts
– Internal data bus
The ALU
• In addition to the arithmetic & logic circuits, the
ALU includes the accumulator, which is part of
every arithmetic & logic operation.
D7 D6 D5 D4 D3 D2 D1 D0
S Z AC P CY
– Sign Flag
• Used for indicating the sign of the data in the accumulator
• The sign flag is set if negative (1 – negative)
• The sign flag is reset if positive (0 –positive)
• Zero Flag
– Is set if result obtained after an operation is 0
– Is set following an increment or decrement operation of that register
10110011
+ 01001101
---------------
1 00000000
• Carry Flag
– Is set if there is a carry or borrow from arithmetic operation
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
1
Non Programmable Registers
• Instruction Register & Decoder
– Instruction is stored in IR after fetched by processor
– Decoder decodes instruction in IR
2
The Address and Data Busses
• The address bus has 8 signal lines A8 – A15
which are unidirectional.
• The other 8 address bits are multiplexed (time
shared) with the 8 data bits.
– So, the bits AD0 – AD7 are bi-directional and serve as
A0 – A7 and D0 – D7 at the same time.
• During the execution of the instruction, these lines carry the
address bits during the early part, then during the late parts of
the execution, they carry the 8 data bits.
– In order to separate the address from the data, we can
use a latch to save the value before the function of the
bits changes.
3
Demultiplexing AD7-AD0
– From the above description, it becomes obvious
that the AD7– AD0 lines are serving a dual purpose
and that they need to be demultiplexed to get all the
information.
– The high order bits of the address remain on the bus
for three clock periods. However, the low order bits
remain for only one clock period and they would
be lost if they are not saved externally. Also, notice
that the low order bits of the address disappear
when they are needed most.
– To make sure we have the entire address for the full
three clock cycles, we will use an external latch
to save the value of AD7– AD0 when it is carrying
the address bits. We use the ALE signal to enable
this latch. 4
Demultiplexing AD7-AD0
8085
A15-A8
ALE
AD7-AD0 Latch
A7- A 0
D7- D0
5
Demultiplexing the Bus AD7 – AD0
• The high order address is placed on the address bus and hold for 3 clk
periods,
• The low order address is lost after the first clk period, this address
needs to be hold however we need to use latch
• The address AD7 – AD0 is connected as inputs to the latch 74LS373.
• The ALE signal is connected to the enable (G) pin of the latch and the
OC – Output control – of the latch is grounded
6
7
Introduction to 8085 Instructions
8
The 8085 Instructions
– Since the 8085 is an 8-bit device it can have up to 28
(256) instructions.
• However, the 8085 only uses 246 combinations that represent a
total of 74 instructions.
– Most of the instructions have more than one format.
10
Data Transfer Operations
– These operations simply COPY the data from the
source to the destination.
– MOV, MVI, LDA, and STA
– They transfer:
• Data between registers.
• Data Byte to a register or memory location.
• Data between a memory location and a register.
• Data between an I\O Device and the accumulator.
LXI B 40 00H B 40 00 C
12
The Memory “Register”
• Most of the instructions of the 8085 can use a
memory location in place of a register.
– The memory location will become the “memory” register M.
• MOV M B
– copy the data from register B into a memory location.
– Which memory location?
14
Arithmetic Operations
– Addition (ADD, ADI):
– Any 8-bit number.
– The contents of a register.
– The contents of a memory location.
• Can be added to the contents of the accumulator and the result
is stored in the accumulator.
15
Arithmetic Operations Related to
Memory
• These instructions perform an arithmetic operation
using the contents of a memory location while
they are still in memory.
– ADD M
• Add the contents of M to the Accumulator
– SUB M
• Sub the contents of M from the Accumulator
– INR M / DCR M
• Increment/decrement the contents of the memory location in
place.
17
Logic Operations
• These instructions perform logic operations on the
contents of the accumulator.
– ANA, ANI, ORA, ORI, XRA and XRI
• Source: Accumulator and
– An 8-bit number
– The contents of a register
– The contents of a memory location
• Destination: Accumulator
ANA R/M AND Accumulator With Reg/Mem
ANI # AND Accumulator With an 8-bit number
18
Logic Operations
– Complement:
• 1’s complement of the contents of the accumulator.
CMA No operand
19
Additional Logic Operations
• Rotate
– Rotate the contents of the accumulator one
position to the left or right.
– RLC Rotate the accumulator left.
Bit 7 goes to bit 0 AND the Carry flag.
– RAL Rotate the accumulator left through the carry.
Bit 7 goes to the carry and carry goes to bit 0.
– RRC Rotate the accumulator right.
Bit 0 goes to bit 7 AND the Carry flag.
– RAR Rotate the accumulator right through the carry.
Bit 0 goes to the carry and carry goes to bit 7.
20
RLC vs. RAL
Carry Flag
• RLC
7 6 5 4 3 2 1 0
Accumulator
Carry Flag
• RAL 7 6 5 4 3 2 1 0
Accumulator
21
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
1
Logical Operations
• Compare
• Compare the contents of a register or memory location with the
contents of the accumulator.
– CMP R/M Compare the contents of the register
or memory location to the contents of
the accumulator.
– CPI # Compare the 8-bit number to the
contents of the accumulator.
• The compare instruction sets the flags (Z, Cy, and S).
2
Branch Operations
• Two types:
– Unconditional branch.
• Go to a new location no matter what.
– Conditional branch.
• Go to a new location if the condition is true.
3
Unconditional Branch
– JMP Address
• Jump to the address specified (Go to).
– CALL Address
• Jump to the address specified but treat it as a subroutine.
– RET
• Return from a subroutine.
6
Instruction Size
• Depending on the operand type, the instruction
may have different sizes. It will occupy a different
number of memory bytes.
– Typically, all instructions occupy one byte only.
– The exception is any instruction that contains
immediate data or a memory address.
• Instructions that include immediate data use two bytes.
– One for the opcode and the other for the 8-bit data.
• Instructions that include a memory address occupy three bytes.
– One for the opcode, and the other two for the 16-bit address.
7
Instruction with Immediate Date
• Operation: Load an 8-bit number into the
accumulator.
– MVI A, 32
• Operation: MVI A
• Operand: The number 32
• Binary Code:
0011 1110 3E 1st byte.
0011 0010 32 2nd byte.
8
Instruction with a Memory Address
9
Addressing Modes
• The microprocessor has different ways of
specifying the data for the instruction. These are
called “addressing modes”.
A000H 78
ALE
RD
WR
A0H A0H
A15- A8 (Higher Order Address bus)
00H 3EH 01H 45H
DA7-DA0 (Lower order address/data Bus)
Instruction:
A000H MVI A, 45H
ALE
Corresponding Coding:
RD
A000H 3E
A001H 45
WR
IO/M
Instruction:
LXI H, FO45H
Corresponding Coding: OFC
MEMR
A000H 21
MEMR
A001H 45
F0 8085 Memory
A002H
Timing Diagram
Op-Code Fetch Cycle Memory Read Cycle Memory Read Cycle
T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
ALE
RD
WR
IO/M
Timing Diagram
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET 1
Timing Diagram
T1 T2 T3 T4 T5 T6 T7
A0H Content of Reg H
A15- A8 (Higher Order Address bus)
00H 7EH L Reg Content of M
Instruction: DA7-DA0 (Lower order address/data Bus)
A000H MOV A, M
Corresponding Coding:
ALE
A000H 7E
RD
WR
IO/M
WR
IO/M
Initialize
Body of loop
No Is this
Final
Count?
Yes
Sample ALP for implementing a loop
Using DCR instruction
MVI C, 15H
LOOP DCR C
JNZ LOOP
Using a Register Pair as a Loop Counter
LXI B, 1000H
LOOP DCX B
MOV A, C
ORA B
JNZ LOOP
Delays
• Each instruction passes through different
combinations of Fetch, Memory Read, and
Memory Write cycles.
• Knowing the combinations of cycles, one can
calculate how long such an instruction would
require to complete.
Delays
• Knowing how many T-States an instruction
requires, and keeping in mind that a T-State is one
clock cycle long, we can calculate the time using
the following formula:
TO = 7 T-States
– Delay of the MVI instruction
TO = 10 T-States
– The delay for the LXI instruction
Body of loop 2
loop.
Is this
– In the figure, the body of
No
Final
Count?
loop2 can be before or
Yes
after loop1.
Nested Loops for Delay
• Instead (or in conjunction with) Register Pairs, a
nested loop structure can be used to increase the
total delay produced.
• Total Delay
– TDelay = 57412 X 0.5 Sec = 28.706 mSec
Increasing the delay
• The delay can be further increased by using
register pairs for each of the loop counters
in the nested loops setup.
• It can also be increased by adding dummy
instructions (like NOP) in the body of the
loop.
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET 1
The Stack
• The stack is an area of memory identified by the
programmer for temporary storage of information.
• The stack is a LIFO structure.
– Last In First Out.
• The stack normally grows backwards into
Memory
memory.
– In other words, the programmer
defines the bottom of the stack The Stack
and the stack grows up into grows
backwards
Bottom
reducing address range. into memory
of the
Stack
The Stack
• Given that the stack grows backwards into
memory, it is customary to place the bottom of the
stack at the end of memory to keep it as far away
from user programs as possible.
• In the 8085, the stack is defined by setting the SP
(Stack Pointer) register.
PUSH B
PUSH D
...
POP D
POP B
The PSW Register Pair
• The 8085 recognizes one additional register pair
called the PSW (Program Status Word).
– This register pair is made up of the Accumulator and
the Flags registers.
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET 1
How Does the Microprocessor Work?
Assume that a program and data are already entered in the
R/W memory.
The microprocessor fetches the first instruction from its
memory sheet, decodes it, and executes that instruction.
The sequence of fetch, decode, and execute is continued
until the microprocessor comes across an instruction to stop.
During the entire process, the microprocessor uses the
system bus to fetch the binary instructions and data from the
memory.
It uses registers from the register section to store data
temporarily, and it performs the computing function in the
ALU section.
Finally, it sends out the result in binary, using the same
bus lines, to memory or an output device. 2
How Does a Microprocessor Differentiate Between Data
and Instruction Code?
3
DATA TRANSFER GROUP
H=20H,L=30H,
H=40H,L=70H.
D=40H,E=70H.
D=20H,E=30H.
Flags Affected :No flags affected.
DATA TRANSFER GROUP
6
ARITHMETIC GROUP
ADC R (ADD register content with Acc and carry and
result in A).
Example:
ADC C (ADD the content of C with A with carry).
LXI H,C200H
MVI C, 0AH
MVI A,00H
UP MOV B,M
ADD B
INX H
DCR C
JNZ UP
STA C300H
RST1
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
MICROPROCESSOR 8086
• Reference Book:
– Microprocessors and Interfacing: Programming and
Hardware - Douglas V. Hall
8086 MICROPROCESSOR
Pinouts
8086 Pins
The 8086 comes in a 40 pin package which means that some pins have
more than one use or are multiplexed. The packaging technology of time
limited the number of pin that could be used.
In particular, the address lines 0 - 15 are multiplexed with data lines 0-15,
address lines 16-19 are multiplexed with status lines. These pins are
The 8086 has one other pin that is multiplexed and this is BHE’/S7.
BHE stands for Bus High Enable. This is an active low signal that is
asserted when there is data on the upper half of the data bus.
The 8086 has two modes of operation that changes the function of some pins.
The SDK-86 uses the 8086 in the minimum mode with the MN/MX’ pin tied to 5
volts.This is a simple single processor mode. The IBM PC uses an 8088 in the
maximum mode with the MN/MX” pin tied to ground. This is the mode
required for a coprocessor like the 8087.
8086 Pins
In the minimum mode the following pins are available.
HOLD When this pin is high, another master is requesting control of the
local bus, e.g., a DMA controller.
GND Ground
READY Acknowledgement from wait-state logic that the data transfer will
be completed.
RESET Stops processor and restarts execution from FFFF:0. Must be high
for 4 clocks. CS = 0FFFFH, IP = DS = SS = ES = Flags = 0000H, no
other registers are affected.
TEST’ The WAIT instruction waits for this pin to go low. Used with 8087.
CLK Clock: 33% duty cycle, i.e., high 1/3 the time.
8086 Features
• 16-bit Arithmetic Logic Unit
The address refers to a byte in memory. In the 8088, these bytes come in on
the 8-bit data bus. In the 8086, bytes at even addresses come in on the low
half of the data bus (bits 0-7) and bytes at odd addresses come in on the upper
half of the data bus (bits 8-15).
•The BIU fetches instructions, reads and writes data, and computes the
20-bit address.
• The EU decodes and executes the instructions using the 16-bit ALU.
• The BIU contains the following registers:
The BIU fetches instructions using the CS and IP, written CS:IP, to contruct the
20-bit address. Data is fetched using a segment register (usually the DS) and
an effective address (EA) computed by the EU depending on the addressing
mode.
8086 Block Diagram
I-10
8086 Architecture
The EU contains the following 16-bit registers:
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
SP - the Stack Pointer \ defaults to stack segment
BP - the Base Pointer /
SI - the Source Index Register
DI - the Destination Register
The AX, BX, CX, and DX registers can be considers as two 8-bit registers, a
High byte and a Low byte. This allows byte operations and compatibility with
the previous generation of 8-bit processors, the 8080 and 8085. 8085 source
code could be translated in 8086 code and assembled. The 8-bit registers are:
AX --> AH,AL
BX --> BH,BL
CX --> CH,CL
DX --> DH,DL
I-11
Execution Unit (EU)
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
If this flag is set, the processor
Over flow Flag enters the single step execution
mode by generating internal
The overflow flag is set to 1 when the result of a signed operation
interrupts after the execution of
is too large to fit.
each instruction
Direction Flag Interrupt Flag
This is used by string manipulation instructions. If this flag bit
is ‘0’, the string is processed beginning from the lowest Causes the 8086 to recognize
address to the highest address, i.e., auto incrementing mode. external mask interrupts; clearing IF
Otherwise, the string is processed from the highest address disables these interrupts.12
towards the lowest address, i.e., auto decrementing mode.
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
8086 Microprocessor
Architecture
Examples
CS 3 4 8 A 0 SS 5 0 0 0 0
IP + 4 2 1 4 SP + F F E 0
Instruction address 3 8 A B 4 Stack address 5 F F E 0
DS 1 2 3 4 0
DI + 0 0 2 2
Data address 1 2 3 6 2
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
Segment
Registers
5
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
6
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
7
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
8
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
9
8086 Microprocessor
Architecture Bus Interface Unit (BIU)
10
8086 Microprocessor
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.
11
8086 Microprocessor
Architecture Execution Unit (EU)
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 12
DX can be used as DH and DL
8086 Microprocessor
Architecture Execution Unit (EU)
13
8086 Microprocessor
Architecture Execution Unit (EU)
14
8086 Microprocessor
Architecture Execution Unit (EU)
Example:
15
8086 Microprocessor
Architecture Execution Unit (EU)
16
8086 Microprocessor
Architecture Execution Unit (EU)
17
8086 Microprocessor
Architecture Execution Unit (EU)
18
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
20
8086 Microprocessor Group I : Addressing modes for
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
MOV AX, 0A9FH
9. Direct I/O port Addressing
The 16-bit data (0A9FH) given in the instruction is
10. Indirect I/O port Addressing
moved to AX register
11. Relative Addressing
(AX) 0A9FH
12. Implied Addressing
21
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
Here, the effective address of the memory
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.
22
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
(CL) (MA)
(CH) (MA +1)
23
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
(AL) (MA)
24
(AH) (MA + 1)
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
(CL) (MA)
(CH) (MA + 1)
25
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data
26
8086 Microprocessor Group II : Addressing modes
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
30
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
3. Logical Instructions
2
8086 Microprocessor
Instruction Set
3
8086 Microprocessor
Instruction Set
4
8086 Microprocessor
Instruction Set
6
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
7
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADDC A, data
8
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
9
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB A, data
10
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
11
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
12
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
13
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
14
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
15
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
16
8086 Microprocessor
Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
17
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
18
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
19
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
20
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
21
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
22
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
23
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
24
8086 Microprocessor
Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
25
8086 Microprocessor
Instruction Set
26
8086 Microprocessor
Instruction Set
REP
27
8086 Microprocessor
Instruction Set
MOVS
(MAE) (MA)
28
8086 Microprocessor
Instruction Set
CMPS
29
8086 Microprocessor
Instruction Set
LODS
31
8086 Microprocessor
Instruction Set
STOS
32
8086 Microprocessor
Instruction Set
CLC Clear CF 0
NOP No operation
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
34
8086 Microprocessor
Instruction Set
Checks flags
35
8086 Microprocessor
Instruction Set
Mnemonics Explanation
JC disp8 Jump if CF = 1
JP disp8 Jump if PF = 1
JO disp8 Jump if OF = 1
JS disp8 Jump if SF = 1
37
EE 3213
Microprocessors, Microcontrollers and Peripherals
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
8086 Microprocessor
Assemble Directives
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..
2
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 3
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 4
8086 Microprocessor
Assemble Directives
ORG
END Segnam SEGMENT
EVEN
…
EQU … Program code
… or
PROC … Data Defining Statements
…
FAR …
NEAR
ENDP Segnam ENDS
SHORT
ORG
User defined name of
END Segment Register
the segment
EVEN
EQU
PROC Example:
FAR
NEAR ASSUME CS: ACODE, DS:ADATA Tells the assembler that the
ENDP instructions of the program are
stored in the segment ACODE and
data are stored in the segment
SHORT ADATA
MACRO
ENDM 6
8086 Microprocessor
Assemble Directives
ORG
Examples:
END
EVEN ORG 1000H Informs the assembler that the statements
EQU following ORG 1000H should be stored in
memory starting with effective address
1000H
PROC
FAR
LOOP EQU 10FEH Value of variable LOOP is 10FEH
NEAR
ENDP
_SDATA SEGMENT In this data segment, effective address of
SHORT ORG 1200H memory location assigned to A will be 1200H
A DB 4CH and that of B will be 1202H and 1203H.
EVEN
MACRO B DW 1052H
ENDM _SDATA ENDS 7
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 9
8086 Microprocessor
Assemble Directives
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM 10
8086 Microprocessor
Assemble Directives
PROC
ENDP
FAR User defined name of
NEAR the macro
SHORT
MACRO
ENDM 11
8086 Microprocessor
8086 Programming
CODE SEGMENT
ASSUME CS: CODE & DS: CODE
MOV AX, 1234H
MOV CX, 0034H
MUL CX
HLT
CODE ENDS
END
12
8086 Microprocessor
8086 Programming
Write a program using 8086 SDK which multiplies the two 16-bit words
in the memory locations and save the results in the next memory
locations.
DATA SEGMENT
MULTIPLICAND DW 204AH
MULTIPLIER DW 3B2AH
PRODUCT DW 2 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE & DS: DATA
MOV AX, DATA
MOV DS, AX
MOV AX, MULTIPLICAND
MUL MULTIPLIER
MOV PRODUCT, AX
MOV PRODUCT+2, DX
HLT
CODE ENDS
END 13
8086 Microprocessor
8086 and 8088 comparison
8086 8088
16-bit Data bus lines obtained by 8-bit Data bus lines obtained by
demultiplexing AD0 – AD15 demultiplexing AD0 – AD7
In MIN mode, pin 28 is assigned the In MIN mode, pin 28 is assigned the
signal M / 𝐈𝐎 signal IO / 𝐌
To access higher byte, 𝐁𝐇𝐄 signal is No such signal required, since the
used data width is only 1-byte
14
8086 Microprocessor
Co-processor – Intel 8087
15
8086 Microprocessor
Co-processor – Intel 8087
16
8086 Microprocessor
Co-processor – Intel 8087
17
8086 Microprocessor
Co-processor – Intel 8087
18
8086 Microprocessor
Co-processor – Intel 8087
19
8086 Microprocessor
Co-processor – Intel 8087
𝐒𝟎- 𝐒𝟐
𝐒𝟐 𝐒𝟏 𝐒𝟎 Status
1 0 0 Unused
1 0 1 Read memory
1 1 0 Write memory
1 1 1 Passive
QS0 – QS1
20
8086 Microprocessor
Co-processor – Intel 8087
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
Intel 80186
80186
• 80186 contains 8086 processor and
several additional functional chips:
–clock generator
–2 independent DMA channels
–PIC (Priority Interrupt Controller)
–3 programmable 16-bit timers
• more a microcontroller than a
microprocessor
• used mostly in industrial control
applications
Intel 80286
Salient features of 80286
80186 16 20 1M
80286 16 24 16M
Salient features of 80286 Operating Modes
Intel 80286 has 2 operating modes:
Real Address Mode :
80286 is just a fast 8086 --- up to 6
times faster
All memory management and
protection mechanisms are disabled
286 is object code compatible with
8086
Protected Virtual Address Mode
80286 works with all of its memory
management and protection
capabilities with the advanced
instruction set.
it is source code compatible with 8086
Internal Block Diagram of 80286
EU EU AU
BIU IU
8085 BIU
8086 80286
Functional Parts
1. Address unit
2. Bus unit
3. Instruction unit
4. Execution unit
Address Unit
4. Instruction pointer.
Flag Registers
Intel 80386
Architecture of 80386
Architecture of 80386
• The Internal Architecture of 80386 is divided into 3 sections.
• Instruction Unit
• Paging Unit
CS CODE S EGMENT
SS S TACK S EGMENT
DS
ES DATA S EGMENT
FS
GS
INS TRUCTION POINTER AND FLAG REGIS TER
31 16 15 0
IP
EIP
FLAGS
EFLAGS
Register Organization
• The six segment registers available in 80386 are CS, SS, DS,
ES, FS and GS.
• The CS and SS are the code and the stack segment registers
respectively, while DS, ES, FS, GS are 4 data segment
registers.
• A 16 bit instruction pointer IP is available along with 32 bit
counterpart EIP.
• Flag Register of 80386: The Flag register of 80386 is a 32 bit
register. Out of the 32 bits, Intel has reserved bits D18 to D31,
D5 and D3, while D1 is always set at 1.Two extra new flags are
added to the 80286 flag to derive the flag register of 80386.
They are VM and RF flags.
• The 80386 has three modes of operation:
1. Real Address Mode (Real Mode)
2. Protected Virtual Addressing mode (Protected Mode)
3. Virtual 8086 mode.
Does not support virtual address space Gives virtual and physical address space
Does not support LDT and GDT Supports LDT and GDT
Course Teacher
Dr. Kalyan Kumar Halder
Associate Professor
Dept. of EEE, KUET
LIMITATIONS OF 80286 THAT LEAD TO 80386
80286 has only a 16 bit processor.
64 bit
I1 I1 I1 I2 I2 I2 I3 I3 I3
Clock
Cycle 1 2 3 4 5 6 7 8 9
F I1 I2 I3 I4 I5
I1 I2 I3 I4
D
I1 I2 I3
E
Clock
Cycle 1 2 3 4 5
On a non pipelined machine 9 clock cycles are needed for the
individual fetch, decode and execute cycle.
In comparison, RISC processors are more or less the opposite of the above:
Reduced instruction set.
Less complex, simple instructions.
Hardwired control unit and machine instructions.
Few addressing schemes for memory operands with only two basic
instructions, LOAD and STORE
Many symmetric registers which are organized into a register file.