Unit 1
Unit 1
8086 Microprocessor -
Architecture
Microprocess
or
2
Microprocess Fifth Generation
or 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, Virtual memory space 240 bytes = 1 Tb
Higher Floating point hardware
16 bit processors 40/ 48/ packing
64 pins Supports increased number of addressing
density
Easier to program modes
Dynamically relatable
programs
Processor has multiply/ divide arithmetic Intel 80386
hardware
More powerful interrupt
handling Second Generation
capabilitie During 1973
s Flexible I/O port NMOS technology Faster speed, Higher
addressing
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 Greater number of levels of subroutine
TTL nesting
4 bit processors Better interrupt handling capabilities
16 pins 4
8 and 16 bit processors 40 Intel 8085 (8 bit processor)
Microprocess Functional blocks
or
Various conditions of the
Computational Unit;
results are stored as
performs arithmetic and Internal storage of data
status bits called flags
logic operations
in flag register
6
Pins and signa l s
8086
Microprocess Pins and Common signals
or Signals
AD0-AD15 (Bidirectional)
Address/Data bus
7
8086
Microprocess Pins and Common signals
or Signals
BHE (Active Low)/S7 (Output)
MN/ MX
MINIMUM / MAXIMUM
READY
11
8086
Microprocess Pins and Minimum mode signals
or Signals
13
8086
Microprocess Pins and Maximum mode signals
or Signals
14
8086
Microprocess Pins and Maximum mode signals
or Signals
15
8086
Microprocess Pins and Maximum mode signals
or Signals
16
Architectu
re
8086
Microprocess Architecture
or
Segment
Registers
21
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
22
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
23
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
24
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
25
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
26
8086
Architecture Bus Interface Unit (BIU)
Microprocess
or
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.
27
8086
Architecture Execution Unit (EU)
Microprocess
or
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 29
and CL DX can be used as
8086
Architecture Execution Unit (EU)
Microprocess
or
29
8086
Architecture Execution Unit (EU)
Microprocess
or
30
8086
Architecture Execution Unit (EU)
Microprocess
or
Example:
31
8086
Architecture Execution Unit (EU)
Microprocess
or
EU
Registers
32
8086
Architecture Execution Unit (EU)
Microprocess
or
33
8086
Architecture Execution Unit (EU)
Microprocess
or
34
8086
Architecture Execution Unit (EU)
Microprocess
or
35
8086
Architecture Execution Unit (EU)
Microprocess
or Auxiliary Carry Flag
Carry Flag
Flag This is set, if there is a carry from the
This flag is set, when there is
lowest nibble, i.e, bit three during
Register 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
subtraction. of 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
categorized
into 4 groups OF DF IF TF SF ZF AF PF CF
Instruction
Directions which a microprocessor
follows to execute a task or part of
a task.
Computer language
5. Based Addressing
Group II : Addressing modes for
6. Indexed Addressing memory data
7. Based Index Addressing
8. String Addressing
45
8086 Group I : Addressing modes for
Microprocessor Addressing register and immediate
Modes 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,
9. Direct I/O port Addressing
0A9FH
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
46
8086
Microprocess Addressing Modes : Memory
or Access
20 Address lines 8086 can address up
to 2 = 1M bytes of memory
20
2. Immediate
Here, the effective address of the memory
3. Addressing
Direct Addressing
location at which the data operand is stored is
4. Register Indirect Addressing given in the instruction.
50
8086 Group II : Addressing modes
Microprocessor Addressing for memory data
Modes
1. Register In Register indirect addressing, name of
Addressing the
register which holds the effective address (EA)
will be specified in the
2. Immediate instruction.
Addressing Registers used to hold EA are any of the
following registers:
3.
4. Direct Addressing
Register Indirect Addressing
BX, BP, DI and SI.
5. Based Addressing
Content of DS is used base
6. Indexed Addressing
address
the register
calculation. for
7. Based Index Addressing
Example:
Note : Register/ memory
8. String Addressing
enclosed in brackets refer
MOV CX, [BX]
to content of register/
9. Direct I/O port Addressing memory
Operations:
10. Indirect I/O port Addressing
EA = (BX)
11. Relative Addressing BA = (DS) x 1610
MA = BA + EA
12. Implied Addressing
(CX) (MA)
or,
(CL) (MA)
(CH) (MA +1)
51
8086 Group II : Addressing modes
Microprocessor Addressing for memory data
Modes
1. Register In Based Addressing, BX or BP is used to hold
Addressing base value for effective addressthe
and a signed 8-
or unsigned 16-bit displacement will be
bit
2. Immediate specified
in the
Addressing instruction.
In case of 8-bit displacement, it is sign extended
3.
4. Direct Addressing
Register Indirect Addressing to 16-bit before adding to the base value.
(AX) (MA)
or,
(AL) (MA)
52
(AH) (MA + 1)
8086 Group II : Addressing modes
Microprocessor Addressing for memory data
Modes
1. Register SI or DI register is used to hold an index value
Addressing memory for
data and a signed 8-bit or unsigned 16-
bit displacement will be specified in
2. Immediate the instruction.
Addressing
Displacement is added to the index value in SI
3.
4. Direct Addressing
Register Indirect Addressing or DI register to obtain the EA.
54
8086 Group II : Addressing modes
Microprocessor Addressing for memory data
Modes
1. Register Employed in string operations to operate on
Addressing string data.
(AX)
Content of AX is 56
moved to port
8086 Group IV : Relative
Microprocessor Addressing Addressing
Modes mode
1. Register
Addressing
2. Immediate
Addressing In this addressing mode, the effective address
a
of program instruction is specified relative to
3.
4. Direct Addressing
Register Indirect Addressing Instruction Pointer (IP) by an 8-bit
displacement. signed
5. Based Addressing
Example: JZ 0AH
6. Indexed Addressing
2. Immediate
Addressing
3.
4. Direct Addressing
Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
Instructions using this mode have no operands.
7. Based Index Addressing
The instruction itself will specify the data to be
operated by the instruction.
8. String Addressing
Example: CLC
9. Direct I/O port Addressing
This clears the carry flag to
10. Indirect I/O port Addressing zero.
58
INSTRUCTION
SET
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
3. Logical Instructions
60
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
61
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
62
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
PUSH mem
(SP) (SP) – 2
MA S = (SS) x 1610 + SP
(MA S ; MA S + 1)
(mem)
POP reg16/ mem
addr8 AX
64
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
65
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADDC A, data
66
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
67
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SBB, INC, DEC, MUL, DIV, CMP…
SUB,
SBB reg2/ mem, reg1/mem
SBB A, data
68
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, INC, DEC MUL, DIV, CMP…
SBB, ,
INC reg/ mem
69
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
70
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
71
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
72
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
73
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
74
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
75
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
76
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
77
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
78
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
79
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
80
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
81
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
82
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
83
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
84
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS,
STOS
REP
85
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
Mnemonics: REP, MOVS CMPS, SCAS, LODS,
, STOS
MOVS
(MAE) (MA)
86
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS,
STOS
Compare two string byte or string
word
CMPS
LODS
89
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
STOS
90
8086
Microprocess Instruction Set
or
5. Processor Control Instructions
Mnemonics Explanation
STC Set CF 1
CLC Clear CF 0
NOP No operation
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
92
8086
Microprocess Instruction Set
or
6. Control Transfer Instructions
8086 signed conditional 8086 unsigned conditional
branch instructions branch instructions
Checks flags
93
8086
Microprocess Instruction Set
or
6. Control Transfer Instructions
8086 signed conditional 8086 unsigned conditional
branch instructions branch instructions
JC disp8 Jump if CF = 1
JP disp8 Jump if PF = 1
JO disp8 Jump if OF = 1
JS disp8 Jump if SF = 1
95
Assembl dire ctiv
er es
8086
Microprocess Assemble
or Directives
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..
97
8086
Microprocess Assemble
or Directives
DB Define Byte
PROC
FAR Example:
NEAR LIST DB 7FH, 42H, 35H
PROC
FAR Example:
NEAR ALIST DW 6512H, 0F251H, 0CDE2H
ORG
END Segnam SEGMENT
EVEN
…
EQU … Program
… code or
PROC … Data Defining
… Statements
FAR …
NEAR
Segnam ENDS
ENDP
SHORT
PROC Example:
FAR
NEAR ASSUME CS: ACODE, DS:ADATA Tells the compiler that the
instructions of the program are
stored in the segment ACODE and
ENDP data are stored in the segment
SHORT ADATA
MACRO
ENDM 101
8086
Microprocess Assemble
or Directives
ORG (Origin) is used to assign the starting
DB
address (Effective address) for a program/ data
segment
DW END is used to terminate a program;
statements after END will be ignored
SEGMENT
ENDS EVEN : Informs the assembler to store program/
data segment starting from an even address
ASSUME
EQU (Equate) is used to attach a value to a
variable
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
General form
ASSUME
ORG
procname PROC[NEAR/ FAR]
END
EVEN …
… Program statements of
EQU the procedure
…
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
RET
FAR CONVERT ENDP
NEAR
SHOR
T
MACRO
ENDM 104
8086
Microprocess Assemble
or Directives
DB Reserves one memory location for 8-bit
signed displacement in jump instructions
DW
Example:
SEGMENT
ENDS
PROC
ENDP
FAR
NEAR
SHORT
MACRO
ENDM 105
8086
Microprocess Assemble
or Directives
DB MACRO Indicate the beginning of a macro
PROC
MACRO
ENDM 106
107
Int e rfacing
memor y and i/o
ports
8086
Microprocess Memory
or
Processor Memory
Registers inside a microcomputer
Store data and results
temporarily
No speed disparity
Cost
110
8086
Microprocess Memory organization in 8086
or
112
8086
Microprocess Interfacing SRAM and EPROM
or
113
8086
Microprocess Interfacing SRAM and EPROM
or
114
8086
Microprocess Interfacing SRAM and EPROM
or
115
8086
Microprocess Interfacing SRAM and EPROM
or
Monitor Programs
Programing 8279 for keyboard scanning and display
refreshing
Initialization of stack
116
8086
Microprocess Interfacing I/O and peripheral devices
or
I/O devices
For communication between microprocessor and
outside world
Data transfer
types Memory
Programmed I/ O mapped
Data transfer is I/O mapped
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 117
bypassing the