MPMC Unit-2 Cse Arun
MPMC Unit-2 Cse Arun
6. READY: is the acknowledgement from the addressed memory or I/O device that
it will complete the data transfer.
7. TEST‾ : This input is examined by a ‘WAIT’ instruction. If the TEST pin goes
low, execution will continue, else the processor remains in an idle state.
9. MN/MX ‾ :
• MINIMUM MODE - The 8086 processor works in a single processor
environment. All control signals for memory and I/O are generated by the μp.
• MAXIMUM MODE - is designed to be used when a coprocessor exists in the
system. 8086 works in a multiprocessor environment. Control signals for memory
and I/O are generated by an external BUS Controller
10. BHE ‾/S7 : BUS HIGH ENABLE - used to indicate the transfer of data over the higher
order ( D15-D8 ) data bus .
3. DEN: DATA ENABLE. It is LOW when processor wants to receive data or processor is
giving out data
3. LOCK ‾: Other system bus master will be prevented from gaining the system bus
4. RQ‾/GT1‾: REQUEST/GRANT1 5. RQ‾/GT0‾: REQUEST/GRANT0
7 .M.M. Arun Prasath., AP/ECE
8086
ARCHITECTURE
The BIU performs all bus operations such as instruction fetching, reading and writing
operands for memory and calculating the addresses of the memory operands.
BIU contains Instruction queue, Segment registers, Instruction pointer, Address
adder.
Instruction Queue:
1. To increase the execution speed, BIU fetches as many as six instruction bytes
ahead to time from memory.
2. All six bytes are then held in FIFO 6 byte register called instruction queue.
3. Then all bytes have to be given to EU one by one.
4. This pre fetching operation of BIU may be in parallel with execution operation of EU,
which improves the speed execution of the instruction.
The 8086 microprocessor has a total of fourteen registers that are accessible to
the programmer. It is divided into four groups.
They are:
• The 8086 has four other general purpose registers, two pointer registers
Stack Pointer and Base Pointer and two index registers Source Index and
Destination Index. Used to store the offset addresses
• An offset address represents the displacement of a storage location in
memory from the segment base address in a segment register.
2. Flag Register contains a group of status bits called flags that indicate the status of the
CPU or the result of arithmetic operations. There are two types of flags:
1. The status flags which reflect the result of executing an instruction. The programmer
cannot set/reset these flags directly.
2. The control flags enable or disable certain CPU operations. The programmer can
set/reset these bits to control the CPU's operation.
1. The Direction Flag (D): Affects the direction of moving data blocks by such instructions as
MOVS, CMPS and SCAS. The flag values are 0 = up and 1 = down and can be set/reset by the STD
(set D) and CLD (clear D) instructions.
2. The Interrupt Flag (I): Dictates whether or not system interrupts can occur. The flag values are 0
= disable interrupts or 1 = enable interrupts and can be manipulated by the CLI (clear I) and STI (set
I) instructions.
3. The Trap Flag (T): Determines whether or not the CPU is halted after the execution of each
instruction. When this flag is set (i.e. = 1), the programmer can single step through his program to
debug any errors. When this flag = 0 this feature is off. This flag can be set by the INT 3 instruction.
OUT Instruction - Output a byte or word to a port – OUT port, accumulator AL or AX.
Example: OUT 3BH, AL
copies the value of SF, ZF, AF, PF, and CF, into bits of 7, 6, 4, 2, 0 respectively of AH
register.
SAHF instruction - Store AH Register into FLAGS
SAHF instruction transfers the bits 0-7 of AH of SF, ZF, AF, PF, and CF, into the Flag
register.
PUSHF Instruction - Push flag register on the stack
This instruction decrements the SP by 2 and copies the word in flag register to the memory
location pointed by SP.
POPF Instruction - Pop word from top of stack to flag – register.
ADDITION INSTRUCTIONS
ADD Instruction - ADD destination, source
Example: ADD DX, BX
ADC Instruction - Add with carry
Example: ADC CL,BL
INC Instruction - Increment - INC destination
Example: INC BL
AAA Instruction - ASCII Adjust after Addition
We can add two ASCII numbers directly and use AAA after addition so as
to get result directly in BCD. (Works with AL only)
DAA Instruction - Decimal Adjust Accumulator
SUBTRACTION INSTRUCTION
SUB Instruction - Subtract two numbers
Example: SUB CX, BX
SBB Instruction - Subtract with borrow SBB destination, source
Example: SBB CX, BX
DEC Instruction - Decrement destination register or memory.
NEG Instruction - Form 2’s complement – Syntax: NEG destination
CMP Instruction - Compare byte or word and sets the flag
Syntax: CMP destination, source.
AAS Instruction - ASCII Adjust for Subtraction
DAS Instruction - Decimal Adjust after Subtraction
LOGICAL INSTRUCTION
NOT Instruction - Invert each bit of operand
Ex: NOT BX ; Complement contents of BX register.
AND Instruction - AND corresponding bits of two operands
Ex: AND BH, CL ; AND byte in CL with byte in BH ;result in BH
OR Instruction - Logically OR corresponding of two operands
Ex: OR AH, CL ; CL is OR’ed with AH, result in AH.
XOR Instruction - Exclusive XOR destination, source
Ex: XOR BX, CX ; Exclusive OR CX with BX and Result BX
TEST Instruction – AND operand to update flags
Ex: TEST AL, BH ; AND BH with AL. no result is stored .
Update PF, SF, ZF
SHIFT INSTRUCTION
SAL/SHL Instruction - Shift operand bits left, put zero in LSB(s)
Ex: ; CF = 0, BX = 11100101 11010011
SAL BX, 1 ; Shift BX contents by 1 bit position towards left
; CF = 1, BX = 11001011 10100110
SHR Instruction - Shift operand bits right, put zero in MSB
Ex: ; SI = 10010011 10101101 , CF = 0
SHR SI, 1 ; Result: SI = 01001001 11010110 and CF = 1
SAR Instruction - Shift operand bits right, new MSB = old MSB
Ex: ; AL = 00011101 = +29 decimal, CF = 0
SAR AL, 1 ; Shift signed byte in AL towards right
; AL = 00001110 = +14 decimal, CF = 1
Cont…
CONDITIONAL TRANSFER INSTRUCTIONS
CX register
INSTRUCTIONS INSTRUCTIONS
CMC - complement carry flag ESC - When 8086 fetches an ESC instruction, the
coprocessor decodes the instruction and carries out the
STD - set direction flag
action specified by the 6 bit code. In case of 8086 it
CLD - clear direction flag
treats ESC instruction as an NOP. The coprocessor
STI - set interrupt enable flag
treats all of the 8086 instruction as an NOP except ESC.
CLI- clear interrupt enable flag
LOCK - bus lock signal
NOP - no operation
Ex:
MOV AL, DS
MOV DS, DL
MOV AX, DS
CX
4. Port addressing
Two I/O port addressing modes can be used
Direct (e.g. IN AL, 02H)
Indirect (e.g. IN AL, DXH)
5. Relative addressing
Ex: JNC 08H ;IF carry = 0, PC is loaded with current PC contents
+ 8-bit signed value