written 2.8 years ago by | • modified 2.8 years ago |
INTRODUCTION
• An instruction is a binary pattern designed inside a microprocessor to perform a specific function. • Instruction is a "command use by a processor to perform a specific operation.
• The entire group of instructions that a microprocessor supports is called Instruction Set.
• 8086 has more than 20,000 instructions.
Classification of Instruction Set
• Data Transfer Instructions
• Arithmetic Instructions
• Logical Instruction
• Shift and Rotate Instruction
• Program Execution Transfer Instructions (Branch and Loop Instructions)
• String Instructions
• Processor Control Instructions
Data Transfer Instruction
Data transfer instruction are those which are used to movement of the data from one location to another location such as memory to microprocessor, microprocessor to port or memory or vice versa. OR The data-transfer functions provide the ability to move data either between its internal registers or between an internal register and a storage location in memory.
The Data-transfer functions include –
• MOV (Move byte or word)
• PUSH (Push to Stack) • POP (Pop from Stack)
• XCHG (Exchange byte or word or exchanges contents of D and S)
• IN (Input to the port or copies a byte or word from S to D)
• Output (Output to the port or copies a byte or word from D to S)
• PUSHA (put all the registers into the stack) • POPA (gets words from the stack to all registers)
• PUSHF (copies the flag register at the top of the stack)
• POPF (copies a word at the top of the stack to the flag register)
Arithmetic instructions in 8086 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. Unlike in 8085 microprocessor, in 8086 microprocessor the destination operand need not be the accumulator.
• ADD (Addition)
• ADC (Addition with carry)
• SUB (Subtraction)
• SBB (Subtraction with Borrow)
• MUL (Multiplication)
Program Execution Transfer Instructions
(Branch and Loop Instructions)
These instructions are used to transfer/branch the instructions during an execution.
There are two types of branching instructions. The unconditional branch and conditional branch.
The Unconditional Branch instructions are
• CALL – Used to call a procedure and save their return address to the stack.
• RET - Used to return from the procedure to the main program. • JMP - Used to jump to the provided address to proceed to the next instruction.
• LOOP - Used to loop a group of instructions until the condition satisfies, i.e., CX = 0)
• SHLD - Shift Left Double
• SHRD - Shift Right Double
Shift and Rotate Instruction
Shifting means to move bits right and left inside an operand. All of the Shift and Rotate instructions affect Overflow and Carry Flags.
• SHL - Shift Left.
• SHR - Shift Right.
• SAL – Shift Arithmetic Left.
• SAR – Shift Arithmetic Right.
• ROL – Rotate Left.
• ROR – Rotate Right.
• RCL - Rotate Carry Left.
• RCR - Rotate Carry Right.
Logical instructions in 8086 microprocessor
Logical instructions are the instructions which perform basic logical operations such as AND, OR, etc. In 8086 microprocessor, the destination operand need not be the accumulator.
• NOT
• AND
• OR
• XOR
• IMUL (Integer Multiplication)
• DIV ( Division)
• IDIV (Integer Division)
• GMP (Compare)
• INC (Increment)
• DEC (Decrement)
Conditional Branch instructions are
• JC (Used to jump if carry flag CY = 1)
• JNC (Used to jump if no carry flag (CY = 0)
• JE/JZ (Used to jump if equal/ jump if zero flag ZF = 1)
• JNE/JNZ (Used to jump if not equal/zero flag ZF = 0)
• JO (Used to jump if overflow flag OF = 1)
• JNO (Used to jump if no overflow flag OF = 0)
• LOOPE/ LOOPZ (Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0)
• LOOPNE/ LOOPNZ (Used to loop a group of instructions till it satisfies ZF = 0 & CX = 0)
String Manipulation Instructions
String is a group of bytes/words and their memory is always allocated in a sequential order. String is either referred as byte string or word string.
• REP (Used to repeat the given instruction till CX # 0)
• REPE/REPZ (Used to repeat the given instruction until CX =O or zero flag ZF = 1)
• REPNE/REPNZ (Used to repeat the given instruction until CX = 0 or zero flag ZF = 1)
• MOVS/MOVSB/MOVSW (Used to move the byte/word from one string to another)
• COMS/COMPSB/COMPSW(Used to compare two string bytes/words)
INS/INSB/INSW (Used as an input string/byte/word from the I/O port to the provided memory location) • OUTS/OUTSB/OUTSW (Used as an output string/byte/word from the provided memory location to the I/O port) • SCAS/SCASB/SCASW (Used to scan a string and compare its byte with a byte in AL or string word with a word in AX)
• LODS/LODSB/LODSW (Used to store the string byte into AL or string word into AX)
Processor Control Instructions
Processor control instructions are the instructions which control the processor's action by setting(1) or resetting(0) the values of flag registers.
• STC (sets carry flag to 1)
• CLC (resets carry flag to 0)
• CMC (compliments the carry flag)
• STD (sets directional flag to 1)
• CLD (resets directional flag to 0)
• STI (Set the interrupt flag to 1)
• CLI (resets the interrupt flag to 0)