8086 Architecture-PS
8086 Architecture-PS
Contd..
• It is possible to perform bit, byte, word and block operations in
8086.
• A 40 pin dual in line package Minimum and Maximum Modes
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 One way to debug a program is to run program
This flag is set, if an overflow occurs, i.e, if the result of a signed one instruction at a time used for register and
operation is large enough to accommodate in a destination memory variables.
register. The result is of more than 7-bits in size in case of 8-bit If this flag is set, the processor enters the single
signed operation and more than 15-bits in size in case of 16-bit step execution mode by generating internal
sign operations, then the overflow will be set. interrupts after the execution of each instruction
Direction Flag
Interrupt Flag
This is used by string manipulation instructions. If DF bit is ‘0’,
It is used to allow/prohibit the
the string is processed beginning from the lowest address
to the highest address, i.e., auto incrementing mode. interruption of a program.
If DF=1 the string is processed from the highest address If set: interrupt can be recognized
towards the lowest address, i.e., auto Decrementing mode. If 0 : interrupt disabled25
Control Flags
Trap Flag (TP)
It is used for single step control.
It allows user to execute one instruction of a program at a time for debugging.
When trap flag is set, program can be run in single step mode.
AD0-AD15 (Bidirectional)
Address/Data bus
Low order address bus; these are multiplexed
with data.
MN/ MX
MINIMUM / MAXIMUM
This pin signal indicates what mode the
processor is to operate in.
MN/MX is 5V (Minimum Mode)
MN/MX is GND (Maximum Mode)
29
8086
Common signals
Microprocessor
TEST
READY
* The signal is active high.
•If Logic 1 No operation in
Microprocessor.
•If Logic 0 8086 enter WAIT states and
remain idle.
•It is used to interface slow operating
peripherals.
30
8086
Common signals
Microprocessor
RESET (Input)
The signal must be active HIGH for at
least four clock cycles.
Causes the processor to immediately
terminate its present activity.
CS & IP are initialized to 0000H and
FFFFH.
CLK
*The clock input provides the basic timing for
processor operation and bus control activity.
•Its an 33% duty cycle .
•It Max Frequency 5 MHz
32
8086
Minimum mode signals
Microprocessor
33
8086
Minimum mode signals
Microprocessor
HOLD Input signal to the processor form the bus masters as a request
to grant the control of the bus.
Logic =1 complete the execution of current instruction and place
it Address, Data and Control bus in High impedance state.
Logic==0 Execute instruction Normally.
34
8086
Maximum mode signals
Microprocessor
35
8086
Maximum mode signals
Microprocessor
36
8086
Maximum mode signals
Microprocessor
37
Memory Segmentation
Rules for Memory Segmentation
• The four segments can overlap for small
programs. In a Minimum System all four
segments can start at the address 00000H
• The segment can begin/start at any
memory address which is divisible by 16.
20 bit Physical Address
• To access a specific memory location from
any segment we need 20 bit physical
address.
Access Memory Location
Each address in physical memory(ROM/EPROM)
is called physical address.
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
45
8086 Group I : Addressing modes for
Microprocessor register and immediate data
1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
2. Immediate Addressing data is specified as part of the instruction
3. Direct Addressing
Example:
4. Register Indirect Addressing
MOV DL, 08H
5. Based Addressing
The 8-bit data (08H) given in the instruction is
6. Indexed Addressing moved to DL
8. String Addressing
10. Indirect I/O port Addressing The 16-bit data (0A9FH) given in the instruction is
moved to AX register
11. Relative Addressing
(AX) 0A9FH
12. Implied Addressing
46
8086
Microprocessor Addressing Modes : Memory Access
1. Register Addressing
2. Immediate Addressing
Here, the effective address of the memory
3. Direct Addressing
location at which the data operand is stored is
4. Register Indirect Addressing given in the instruction.
12. Implied Addressing This addressing mode is called direct because the
displacement of the operand from the segment
base is specified directly in the instruction.
50
8086 Group II : Addressing modes
Microprocessor for memory data
(CL) (MA)
(CH) (MA +1)
51
8086 Group II : Addressing modes
Microprocessor for memory data
(AL) (MA) 52
(AH) (MA + 1)
8086 Group II : Addressing modes
Microprocessor for memory data
(CL) (MA)
(CH) (MA + 1)
53
8086 Group II : Addressing modes
Microprocessor for memory data
54
8086 Group II : Addressing modes
Microprocessor 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
58
INSTRUCTION SET
8086
Microprocessor Instruction Set
8086 supports 6 types of instructions.
2. Arithmetic Instructions
3. Logical Instructions
61
8086
Microprocessor Instruction Set
1. Data Transfer Instructions
62
8086
Microprocessor Instruction Set
1. Data Transfer Instructions
63
8086
Microprocessor Instruction Set
1. Data Transfer Instructions
65
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
66
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADDC A, data
67
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
68
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SBB A, data
69
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
70
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
71
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
72
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
73
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
74
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
75
8086
Microprocessor Instruction Set
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
76
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
77
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
78
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
79
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
80
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
81
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
82
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
83
8086
Microprocessor Instruction Set
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
84
8086
Microprocessor Instruction Set
4. String Manipulation Instructions
85
8086
Microprocessor Instruction Set
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
REP
86
8086
Microprocessor Instruction Set
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
MOVS
(MAE) (MA)
CMPS
SCASW
MAE = (ES) x 1610 + (DI)
Modify flags (AL) - (MAE)
LODS
90
8086
Microprocessor Instruction Set
4. String Manipulation Instructions
Mnemonics: REP, MOVS, CMPS, SCAS, LODS, STOS
STOS
91
8086
Microprocessor Instruction Set
5. Processor Control Instructions
Mnemonics Explanation
STC Set CF 1
CLC Clear CF 0
NOP No operation
92
LOCK Lock bus during next instruction
8086
Microprocessor Instruction Set
6. Control Transfer Instructions
Mnemonics Explanation
CALL reg/ mem/ disp16 Call subroutine
93
8086
Microprocessor Instruction Set
6. Control Transfer Instructions
8086 signed conditional 8086 unsigned conditional
branch instructions branch instructions
Checks flags
94
8086
Microprocessor Instruction Set
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