Mod2- 8086
Mod2- 8086
b. 8086-2 (8 MHz)
c. 8086-1 (10 MHz)
• It consists of 29,000 transistors.
• It has a 16 line data bus and 20 line address bus.
• It could address up to 1 MB of memory.
• It has more than 20,000 instructions.
These lines are multiplexed bidirectional address/data bus. During T1, they carry lower
order 16-bit address. In the remaining clock cycles,they carry 16-bit data. AD0-AD7 carry
lower order byte of data. AD8-AD15 carry higher order byte of data.
These lines are multiplexed unidirectional address and status bus. During T1, they carry
higher order 4-bit address. In the remaining clock cycles, they carry status signals.
BHE stands for Bus High Enable. BHE signal is used to indicate the transfer of data over
higher order data bus (D8 – D15). 8-bit I/O devices use this signal. It is multiplexed with
status pin S7.
It is a read signal used for read operation. It is an output signal. It is an active low signal.
RESET[Pin 21 (Input)]
It is a system reset. It is an active high signal. When high, microprocessor enters into reset
state and terminates the current activity. It must be active for atleast four clock cycles to
reset the microprocessor.
NMI[Pin 17 (Input)]
It is used to test the status of math coprocessor 8087. The BUSY pin of 8087 isconnected
to this pin of 8086. If low, execution continues else microprocessor is in wait state.
CLK[Pin 19 (Input)]
This clock input provides the basic timing for processor operation. It is symmetric square
wave with 33% duty cycle. The range of frequency of different versions is 5 MHz, 8 MHz
and 10 MHz.
VCC is power supply signal. +5V DC is supplied through this pin. VSS is ground signal
MN / MX[Pin 33 (Input)]
8086 works in two modes: Minimum Mode, Maximum Mode. If MN/MX is high, it works
in minimum mode. If MN/MX is low, it works in maximum mode. Pins 24 to 31 issue two
different sets of signals. One set of signals is issued when CPU operates in minimum mode.
Other set of signals is issued when CPU operates in maximum mode.
This is an Address LatchEnable signal. It indicates that valid address is available on bus
AD0 – AD15. It is an active high signal and remains high during T1 state. It is connected
to enable pin of latch 8282.
DEN[Pin 26 (Output)]
This is a Data Enable signal. This signal is used toenable the transceiver 8286. Transceiver
is used to separate the data from the address/data bus. It is an active low signal
DT / R[Pin 27 (Output)]
This is a DataTransmit/Receive signal. It decides the direction ofdata flow through the
transceiver. When it is high, data is transmitted out. When it is low, data is received in.
M / IO[Pin 28 (Output)]
This signal is issued by the microprocessor to distinguish memory access from I/O access.
When it is high, memory is accessed. When it is low, I/O devices are accessed.
WR [Pin 29 (Output)]
It is a Write signal. It is used to write data inmemory or output device depending on the
status of M/IO signal. It is an active low signal
HLDA[Pin 30 (Output)]
HOLD[Pin 31 (Input)]
When DMA controller needs to use address/data bus, it sends a request to the CPU through
this pin. It is an active high signal. When microprocessor receives HOLD signal, it issues
HLDA signal to the DMA controller.
These status signals indicate the operation being done by the microprocessor. This
information is required by the Bus Controller 8288. Bus controller 8288 generates all
memory and I/O control signals.
S0 S1 S2 STATUS
0 0 0 Interrupt Acknowledge
0 0 1 I/O Read
0 1 0 I/O Write
0 1 1 Halt
1 0 0 Opcode Fetch
1 0 1 Memory Read
1 1 0 Memory Write
1 1 1 Passive
LOCK[Pin 29 (Output)]
• This signal indicates that other processors should not ask CPU to relinquish the
system bus. When it goes low, all interrupts are masked and HOLD request is not
granted. This pin is activated by using LOCK prefix on any instruction.
• These are Request/Grant pins. Other processors request the CPU through these
lines to release the system bus. After receiving the request, CPU sends
acknowledge signal on the same lines. RQ/GT0 has higher priority than
RQ/GT1.
ARCHITECTURE OF 8086
The microprocessors functions as the CPU in the stored program model of the digital
computer. Its job is to generate all system timing signals and synchronize the transfer of data
between memory, I/O, and itself. The microprocessor also has a S/W function. It must
recognize, decode, and execute program instructions fetched from the memory unit. This
requires an Arithmetic-Logic Unit (ALU) within the CPU to perform arithmetic and logical
(AND, OR, NOT, compare, etc) functions.
The 8086 has pipelined architecture. The 8086 CPU is organized as two separate
processors, called the Bus Interface Unit (BIU) and the Execution Unit (EU).
Fig : 2.2Architecture of 8086
• To increase the execution speed, BIU fetches as many as six instruction bytes
ahead to time from memory.
• All six bytes are then held in first in first out 6 byte register called instruction
queue.
• This pre fetching operation of BIU may be in parallel with execution operation of
EU, which improves the speed execution of the instruction.
The EU contains the control circuitry to perform various internal operations. A decoder in
EU decodes the instruction fetched memory to generate different internal or external control
signals required to perform the operation. EU has 16-bit ALU, which can perform
arithmetic and logical operations on 8-bit as well as 16-bit.
These registers can be used as 8-bit registers individually or can be used as 16-bit in pair
to have AX, BX, CX, and DX.
• DX Register: DX register is used to contain I/O port address for I/O instruction.
SEGMENT REGISTERS :
Additional registers called segment registers generate memory address when combined with
other in the microprocessor. In 8086 microprocessor, memory is divided into 4 segments as
follow:
• Code Segment (CS): The CS register is used for addressing a memory location in
the Code Segment of the memory, where the executable program is stored.
• Data Segment (DS): The DS contains most data used by program. Data are accessed
in the Data Segment by an offset address or the content of other register that holds
the offset address.
• Stack Segment (SS): SS defined the area of memory used for the stack
• Extra Segment (ES): ES is additional data segment that is used by some of the
string to hold the destination data.
1. Conditional Flags
2. Control Flags
CONDITIONAL FLAGS
1. Carry Flag (CF): This flag indicates an overflow condition for unsigned integer
arithmetic. It is also used in multiple-precision arithmetic.
3. Parity Flag (PF): This flag is used to indicate the parity of result. If lower order
8- bits of the result contains even number of 1’s, the Parity Flag is set and for odd
number of 1’s, the Parity Flag is reset.
4. Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else
it is reset.
5. Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB
bit. If the result of operation is negative, sign flag is set.
6. Overflow Flag (OF): It occurs when signed numbers are added or subtracted. An
OF indicates that the result has exceeded the capacity of machine.
CONTROL FLAGS
Control flags are set or reset deliberately to control the operations of the execution unit.
Control flags are as follows:
c. When trap flag is set, program can be run in single step mode.
2. Interrupt Flag (IF):
c. When it is reset, the string bytes are accessed from lower memory
address to higher memory address.
RELATIVE ADDRESSING
Data transfer using registers is called register addressing mode. Here operand value is
present in register. For example
MOV
AL,BL
; MOV
AX,B
X;
When data is stored in code segment instead of data segment immediate addressing
mode is used. Here operand value is present in the instruction. For example
MOV AX, 0A9FH;
When direct memory address is supplied as part of the instruction is called direct
addressing mode. Operand offset value with respect to data segment is given in
instruction. For example
MOV AX,
[089DH];
ADD AX,
[0ADH];
Here operand offset is given in a CPU register. Register used are BX, SI (source
index), DI (destination index), or BP(base pointer). BP holds offset w.r.t Stack
segment, but SI, DI and BX refer to data segment. For example-
MOV [BX], AX;
ADD AX, [SI];
When Memory is accessed, the 20 bit physical address is computed from BX and DS
.On the other hand, when the stack is accessed, the 20 bit physical address is computed
from BP and SS.
In this mode,the EA is calculated by adding the unsigned 16 bit or signed extended 8 bit
displacement and the contents of SI or DI.
Moves the contents of the 20 bit address computed from the displacement START, SI and
DS into BH register. The 8 bit displacement is provided by the programmer using the
assembler pseudo instruction such as EQU. For 16 bit displacement, the EU adds this to SI
to determine EA. On the other hand, for 8 bit displacement the EU sign extends it to 16 bits
and then adds to SI for determining EA.
Operand offset given by a sum of a value held either in BP, or BX and a constant offset
specified as an operand. For example
MOV
AX,[BP+1];
JMP [BX+1];
Here operand offset is given by sum of either BX or BP with either SI or DI. For
example
MOV AX,
[BX+S] JMP
[BP+DI]
STRING ADDRESSING
This mode uses index registers. The string instructions automatically assume SI to point to
the first byte or word of the source operand and DI to point to the first byte or word of the
destination operand.
The segment register for the source is DS and may be overridden. The segment register
for the destination must be ES and cannot be overridden.
Here the port number is a 8 bit immediate operand.This allows fixed access to ports
numbered 0 to 255.
The port number is taken from DX allowing 64K 8 bit ports or 32K 16 bit ports.
eg:- IN AX,DX
If [DX]=5040,Inputs the 8 bit content of port 5040 into AL and 5041 into AH.
Then, if carry=0,PC is loaded with current PC contents plus the 8 bit signed value of
START, otherwise the next instruction is executed.