8086 Microprocessor
8086 Microprocessor
8086 Microprocessor
ARCHITECTURE
INTRODUCTION
Clock signal
• CLK is provided through Pin-19. It provides timing to the processor for operations. Its
frequency is different for different versions, i.e. 5MHz, 8MHz and 10MHz.
Address/data bus
• AD0-AD15 These are 16 address/data bus. AD0-AD7 carries low order byte data and
AD8-AD15 carries higher order byte data.
Address/status bus
• A16-A19/S3-S6 These are the 4 address/status buses. During the first clock cycle, it
carries 4-bit address and later it carries status signals.
Read
• It is available at pin 32 and is used to read signal for Read operation.
Ready
• It is available at pin 22. It is an acknowledgement signal from I/O devices that data is
transferred. It is an active high signal. When it is high, it indicates that the device is ready
to transfer data. When it is low, it indicates wait state.
RESET
• It is available at pin 21 and is used to restart the execution. It causes the processor to
immediately terminate its present activity.
S7/BHE
• BHE Bus High Enable is a control signal that indicates whether the upper byte (D8-
D15) of the data bus is active in a 16-bit data transfer.
INTR
• It is available at pin 18. It is an interrupt request signal. Response can be controlled via
interrupt enable flag
NMI
• It stands for non-maskable interrupt and is available at pin 17. NMIs cannot be disabled
or "masked" by the processor. Emergency situations, critical hardware failures
TEST
• This signal is like wait state and is available at pin 23. When this signal is high, then the
processor has to wait for IDLE state, else the execution continues.
MN/MX
• It stands for Minimum/Maximum and is available at pin 33. It indicates what mode the
processor is to operate in; when it is high, it works in the minimum mode and vice-a
versa. [ MN-Compare and moves the smaller number to destination register while MX-
Compare and moves the largest number to the destination register]
INTA
• It is an interrupt acknowledgement signal and id available at pin 24. When the microprocessor
receives this signal, it acknowledges the interrupt.
ALE
• It stands for address enable latch and is available at pin 25. When ALE is high, it indicates that
the information on the multiplexed lines is an address.
DEN
• It stands for Data Enable and is available at pin 26. It is used to enable Transreceiver 8286. The
transreceiver is a device used to separate data from the address/data bus.
DT/R
• It stands for Data Transmit/Receive signal and is available at pin 27. It decides the direction of
data flow through the transreceiver. When it is high, data is transmitted out and vice-a-versa.
M/IO
• This signal is used to distinguish between memory and I/O operations. When it is high, it
indicates I/O operation and when it is low indicates the memory operation. It is available at pin
28.
WR
• It stands for write signal and is available at pin 29. It is used to write the data into the
memory or the output device.
HLDA
• It stands for Hold Acknowledgement signal and is available at pin 30. This signal
acknowledges the HOLD signal.
HOLD
• This signal indicates to the processor that external devices are requesting to access the
address/data buses. It is available at pin 31.
QS1 and QS0
• These are queue status signals and are available at pin 24 and 25. These signals
provide the status of instruction queue. Their conditions are shown in the following
table:
S0, S1, S2
• These are the status signals that provide the status of operation. These are available at
pin 26, 27, and 28. Following is the table showing their status:
S2 S1 S0 Status
0 0 0 Interrupt
acknowledgement
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
• When this signal is active, it indicates to the other processors not to ask the CPU. It is
activated using the LOCK prefix on any instruction and is available at pin 29.
• Uses pins like M/IO, INTA, ALE, DT/R, DEN, WR, and RD for control and bus management.
• Primarily intended for single-processor systems where the 8086 directly controls the
buses.
• Uses S0, S1, S2 (status signals), RQ/GT0, RQ/GT1 (bus request/grant), LOCK, and QS0, QS1
for interfacing with external bus controllers and coprocessors.
• Designed for multiprocessor systems with external control of the bus via a bus controller
like the 8288.
MIC RO P R O C E SS O R - 8 0 8 6 IN S T RU C T ION
SETS
4) Register indirect mode – In this addressing mode the effective address is in SI, DI or
BX.
Example:
MOV AL, [BP+SI]
MOV AX, [BX+DI]
6) Indexed mode – In this type of addressing mode the effective address is sum of
index register and displacement.
Example:
MOV AX, [SI+2000]
MOV AL, [DI+3000]
7) Based mode – In this the effective address is the sum of base register and
displacement.
Example:
MOV AL, [BP+ 0100]
8) Based indexed displacement mode – In this type of addressing
mode the effective address is the sum of index register, base register and
displacement.
Example:
MOV AL, [SI+BP+2000]
• 9) String mode – This addressing mode is related to string instructions. In
this the value of SI and DI are auto incremented and decremented depending
upon the value of directional flag.
Example:
• CLD ; Clear the Direction Flag to increment SI and DI
• MOV SI, source ; Initialize SI to point to the source string
• MOV DI, destination ; Initialize DI to point to the destination string
• MOV CX, length ; Initialize CX to the length of the string
• REP MOVSB ; Move CX bytes from [SI] to [DI]
• CLD clears the Direction Flag, setting it to zero, which causes SI and DI to be incremented after each
MOVSB operation.
• MOV SI, source sets the source index register SI to point to the beginning of the source string.
• MOV DI, destination sets the destination index register DI to point to the beginning of the destination string.
• MOV CX, length loads the count register CX with the number of bytes to move.
• REP MOVSB repeats the MOVSB instruction CX times, moving the string byte by byte from the address in
SI to the address in DI, while automatically incrementing SI and DI.
10) Input/Output mode – This addressing mode is related with input output operations.
Example:
IN AL, 45
This instruction reads a byte from port 45 and places it into the AL register.
OUT 50, AL
This instruction sends a byte from the AL register to port 50.
11) Relative mode –
the relative addressing mode is used to determine the effective address by adding a
constant value (the offset) to the current value of the instruction pointer (IP).
We have the instruction JNZ 0x08, which means we want to jump to an address that is 8
bytes ahead
• Current IP: Assume IP is 0x0100.
• Offset: The 8-bit offset is 0x08.
These formats dictate how the CPU interprets the data to perform specific operations
Components of 8086 Instruction Formats
1.Opcode: Operation code specifying the operation to be performed.
2.D bit: Direction bit, indicates the direction of data transfer.
3.W bit: Width bit, indicates whether the operation is on a byte or a word.
4.Mod: Mode field, specifies the addressing mode.
5.Reg: Register field, specifies the register.
6.R/M: Register/Memory field, specifies the register or memory location.
7.Displacement: Optional field, used for certain addressing modes.
8.Data: Immediate data to be used by the instruction.
Breakdown of Components
1) Opcode: Operation code specifying the operation to be performed.
For MOV, the opcode is 100010.
Example:
MOV AL, [BX+SI+1234H]: Since AL is an 8-bit register, the W bit would be 0.
MOV AX, [BX+SI+1234H]: Since AX is a 16-bit register, the W bit would be 1.
In our instruction MOV AX, [BX+SI+1234H], the W bit is 1 because AX is a 16-bit register, and
the operation involves moving a word (16 bits).
6) Mod Field (Mode Field)
The Mod field specifies the addressing mode and determines the presence and size of any
displacement.
The Mod field is 2 bits long and has the following values:
3-address:
• ADD T1, B, C ; T1 = B + C
• MUL A, T1, D ; A = T1 * D
2-address:
• MOV T1, B ; T1 = B
• ADD T1, C ; T1 = T1 + C
• MUL T1, D ; T1 = T1 * D
• MOV A, T1 ; A = T1
1-address:
• LOAD B ; Acc = B
• ADD C ; Acc = Acc + C
• MUL D ; Acc = Acc * D
• STORE A ; A = Acc
0-address:
• PUSH B ; Push B onto the stack
• PUSH C ; Push C onto the stack
• ADD ; Pop two values, add, and push the result
• PUSH D ; Push D onto the stack
• MUL ; Pop two values, multiply, and push the result
• POP A ; Pop the result from the stack into A