Академический Документы
Профессиональный Документы
Культура Документы
1
History
6
Bus Interface Unit (BIU)
The function of BIU is to:
Fetch the instruction or data from memory
Write the data to memory
Write the data to the port
Read data from the port
Software Model of the 8086 Microprocessors
8
8086 Registers
AX
General Purpose
AH AL
Index
BP
SP
BH BL
BX
SI
CH CL
DI
CX
DH DL
DX Segment
CS
Flags DS
IP ES
9
General Purpose Registers
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
10
General Purpose Registers
• AX
– Accumulator Register
– Preferred register to use in arithmetic, logic and data
transfer instructions because it generates the shortest
Machine Language Code
– Must be used in multiplication and division operations
– Must also be used in I/O operations
• BX
– Base Register
– Also serves as an address register
11
General Purpose Registers
• CX
– Count register
– Used as a loop counter
– Used in shift and rotate operations
• DX
– Data register
– Used in multiplication and division
– Also used in I/O operations
12
Pointer and Index Registers
Overflow Carry
Direction Parity
EU registers AX AH AL Accumulator
BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Register
DI Destination Index Register
FLAGS
15
The Stack
• The stack is used for temporary storage of information
such as data or addresses.
16
The Stack
17
INTEL 8086 - Pin Diagram
18
INTEL 8086 - Pin Details
Power Supply
5V 10%
Ground
Reset
Registers, seg
regs, flags
CS: FFFFH, IP:
0000H
If high for
minimum 4
Clock clks
19
INTEL 8086 - Pin Details
Address/Data Bus:
Contains address Address Latch Enable:
bits A15-A0 when ALE
is 1 & data bits D15 – When high,
D0 when ALE is 0. multiplexed
address/data bus
contains address
information.
20
INTEL 8086 - Pin Details
INTERRUPT
Non - maskable
interrupt
Interrupt
acknowledge
Interrupt request
21
INTEL 8086 - Pin Details
Direct
Memory
Access
Hold
Hold
acknowledge
22
INTEL 8086 - Pin Details
Address/Status Bus
Address bits A19 –
A16 & Status bits S6
– S3
23
INTEL 8086 - Pin Details
1,1: No selection
24
INTEL 8086 - Pin Details
Min/Max mode
Minimum Mode: +5V
Maximum Mode: 0V
Maximum Mode
Pins
25
Minimum Mode- Pin Details
Read Signal
Write Signal
Memory or
I/0
Data
Transmit/Receive
Data Bus
Enable 26
Maximum Mode - Pin Details
S2 S1 S0
000: INTA’
001: read I/O port
010: write I/O port
011: halt
100: code access Status Signal
101: read memory
110: write memory Inputs to 8288 to
111: none -passive generate eliminated
signals due to max
mode.
27
Maximum Mode - Pin Details
Lock Output
Used to lock peripherals
of the system
DMA
Activated by using the Request/Grant
LOCK: prefix on any
instruction
Lock Output
28
Maximum Mode - Pin Details
QS1 QS0
00: Queue is idle
01: First byte of opcode
10: Queue is empty
11: Subsequent byte of
opcode
Queue Status
Used by numeric
coprocessor (8087)
29
READY
This is the acknowledgement from the
slow device or memory that they have
completed the data transfer.
Minimum Mode 8086 System
31
‘Read’ Cycle timing Diagram for Minimum Mode
32
‘Write’ Cycle timing Diagram for Minimum Mode
33
Maximum Mode 8086 System
34
Maximum Mode 8086 System
Here, either a numeric coprocessor of the type 8087 or another
processor is interfaced with 8086.
The three status outputs S0*, S1*, S2* from the processor are
input to 8788.
35
Memory Read timing in Maximum Mode
36
Memory Write timing in Maximum Mode
37
Instruction Set
8086 supports 6 types of instructions.
2. Arithmetic Instructions
3. Logical Instructions
39
8086 Microprocessor
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.
40
Data Transfer Instructions
41
Data Transfer Instructions
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
MA S = (SS) x 1610 + SP
POP mem (mem) (MA S ; MA S + 1)
(SP) (SP) + 2
42
Data Transfer Instructions
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …
43
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
44
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
45
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
46
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
47
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
48
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
50
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
51
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP reg2/mem, reg1/
mem Modify flags (reg2) – (reg1)
CMP 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
52
8086 Microprocessor
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
53
Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
54
Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
55
Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
56
String Manipulation Instructions
String : Sequence of bytes or words
8086 instruction set includes instruction for string movement, comparison, scan, load and
store.
Offset or effective address of the source operand is stored in SI register and that of the
destination operand is stored in DI register.
57
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
REP
58
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
MOVS
(MAE) (MA)
59
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
Compare two string byte or string word
CMPS
60
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
Scan (compare) a string byte or word with accumulator
SCAS
61
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
LODS
62
String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
Store byte from AL or word from AX in to string
STOS
63
Processor Control Instructions
Mnemonics Explanation
STC Set CF 1
CLC Clear CF 0
NOP No operation
64
Control Transfer Instructions
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
65
Control Transfer Instructions
Checks flags
66
Control Transfer Instructions
8086 signed conditional
8086 unsigned conditional branch
branch instructions
instructions
67
Control Transfer Instructions
8086 conditional branch instructions affecting individual flags
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
68
Memory mapping vs. I/O mapping
69
8086
70
Addressing Modes
Every instruction of a program has to operate on a data.
The different ways in which a source operand is denoted in an instruction
are known as addressing modes.
71
Register Addressing Modes
The instruction will specify the name of the register which holds the data to
be operated by the instruction.
Example:
MOV CL, DH
(CL) (DH)
72
Immediate Addressing
In immediate addressing mode, an 8-bit or 16-bit data is specified as part of the
instruction
Example:
(DL) 08H
(AX) 0A9FH
73
Addressing Modes : Memory Access
75
Direct Addressing
Here, the effective address of the memory location at which the data operand is
stored is given in the instruction.
The effective address is just a 16-bit number written directly in the instruction.
Example:
MOV BX, [1354H]
MOV BL, [0400H]
The square brackets around the 1354H denotes the contents of the memory location.
When executed, this instruction will copy the contents of the memory location into
BX register.
This addressing mode is called direct because the displacement of the operand from
the segment base is specified directly in the instruction.
77
Register Indirect Addressing
In Register indirect addressing, name of the register which holds the effective address
(EA) will be specified in the instruction.
Registers used to hold EA are any of the following registers: BX, BP, DI and SI.
(CL) (MA)
(CH) (MA +1)
78
Based Addressing
In Based Addressing, BX or BP is used to hold the base value for effective address and a signed 8-bit or
unsigned 16-bit displacement will be specified in the instruction.
In case of 8-bit displacement, it is sign extended to 16-bit before adding to the base value.
When BX holds the base value of EA, 20-bit physical address is calculated from BX and DS.
Example:
MOV AX, [BX + 08H]
Operations:
0008H 08H (Sign extended)
EA = (BX) + 0008H
BA = (DS) x 1610
MA = BA + EA
79
Indexed Addressing
SI or DI register is used to hold an index value for memory data and a signed 8-bit or unsigned 16-bit
displacement will be specified in the instruction.
In case of 8-bit displacement, it is sign extended to 16-bit before adding to the base value.
Example:
MOV CX, [SI + 0A2H]
Operations:
FFA2H A2H (Sign extended)
EA = (SI) + FFA2H
BA = (DS) x 1610
MA = BA + EA
(CX) (MA) or,
(CL) (MA)
(CH) (MA + 1)
80
Based Indexed Addressing
In Based Index Addressing, the effective address is computed from the sum of a base
register (BX or BP), an index register (SI or DI) and a displacement.
Example:
MOV DX, [BX + SI + 0AH]
Operations:
000AH 0AH (Sign extended)
81
String Addressing
Employed in string operations to operate on string data.
The effective address (EA) of source data is stored in SI register and the EA of destination is stored in
DI register.
Segment register for calculating base address of source data is DS and that of the destination data is ES
Operations:
Calculation of source memory location:
EA = (SI) BA = (DS) x 1610 MA = BA + EA
(MAE) (MA)
82
I/O Port Addressing
These addressing modes are used to access data from standard I/O mapped devices or ports.
In direct port addressing mode, an 8-bit port address is directly specified in the instruction.
In indirect port addressing mode, the instruction will specify the name of the register which
holds the port address. In 8086, the 16-bit port address is stored in the DX register.
83
Relative Addressing
In this addressing mode, the effective address of a program instruction is specified relative
to Instruction Pointer (IP) by an 8-bit signed displacement.
Example: JZ 0AH
Operations:
If ZF = 1, then
EA = (IP) + 000AH
BA = (CS) x 1610
MA = BA + EA
84
Implied Addressing
Instructions using this mode have no operands. The instruction itself will specify the
data to be operated by the instruction.
Example: CLC
85