Instruction Sets in 8086 Microprocessor

Definition of Instruction and Instruction Sets in 8086 Microprocessor

Instruction is a command or a binary pattern given to a computer to perform a specific operation on given data/Operand.  Instruction is actually a command to the microprocessor to perform a given task on specified data.

The entire group of these instructions is called Instruction Sets which determines what functions the microprocessor should perform.



Learn Microprocessor[Beginner to Advanced]
Instruction Sets in 8086 Microprocessor


Based on the nature of the operation of instruction, 8086 Instruction Sets can be classified as follow:

Table of Content:
  1. Data Transfer Instructions
    • General Purpose Byte or Word Transfer Instructions
    • Simple Input and Output port Transfer Instructions
    • Special Address Transfer Instructions
  2. Arithmetic Instructions
    • Addition Instructions
    • Subtraction Instructions
    • Multiplication Instructions
    • Division Instructions
  3. Bit Manipulation Instructions
    • Logical Instructions
    • Shift Instructions
    • Rotate Instructions
  4. Program Execution Transfer Instructions
    • Unconditional Transfer Instructions
    • Conditional Transfer Instructions
  5. Processor Control Instructions
  6. String Instructions
recommended:
Instructions Sets in 8085 Microprocessor


1. Data Transfer Instructions

1.1 General Purpose Byte or Word Transfer Instructions


Instructions Comments
MOV Destination, Source
Eg: MOV CX,04H
- Copy byte or word from specified Source to Destination
PUSH Source
Eg: PUSH BX
- Copy specified word to top of the stack
POP Destination
Eg: POP AX
- Copy word from top to stack to specified location.
XCHG Destination, Source
Eg: XCHG AX, BX
- Exchange word or byte.

1.2 Simple Input and Output port Transfer Instructions



Instructions Comments
IN AX,Port_Address
Eg: IN AX,34H
- Copy a byte or word from a specified port to accumulator.
OUT Port_Address, AX
Eg: OUT 2CH, AX
- Copy a byte or word from accumulator to specified port

1.3 Special Address Transfer Instructions



Instructions Comments
LEA Register, Source
Eg: LEA BX, PRICE
- Load effective address of operand into a specified register
LDS Register, Source
Eg: LDS BX,[4326H]
- Load DS register and other specified registers from memory.

2. Arithmetic Instructions

2.1 Addition Instructions


Instructions Comments
ADD Destination, Source
Eg: ADD AL,74H
- Add specified byte to byte or word to word
ADC Destination, Source
Eg: ADC CL, BL
Add byte+byte + carry flag
Add word+word + carry flag
INC Register
Eg: INC CX
- Increment specified byte or word by 1.
AAA - ASCII adjust after addition.
DAA - Decimal adjusts after addition.

2.2 Subtraction Instructions


Instructions Comments
SUB Destination, Source
Eg: SUB CX, BX
- Subtract byte from byte or word from word.
SBB Destination, Source
Eg: SBB CH, AL
Subtract byte and carry flag from byte
Subtract word and carry flag from word
DEC Register
Eg: DEC CX
- Decrement specified byte or word by 1.
NEG Register
Eg: NEG AL
- form 2's Complements
CMP Destination, Source
Eg: CMP CX, BX
CF ZF SF
CX = BX 0 1 0
CX > BX 0 0 0
CX < BX 1 0 1
- Compare two specified bytes or words.
AAS - ASCII adjust after subtraction.
DAS - Decimal adjusts after subtraction.

2.3 Multiplication Instructions


Instructions Comments
MUL Source
Eg: MUL CX
- Multiply unsigned byte by byte or unsigned word by word.
- When a byte is multiplied by the content of AL, the result is kept into AX.
- When a word is multiplied by the content of AX, MS Byte in DX and LS Byte in AX.
IMUL Source
Eg: IMUL CX
- Multiply signed byte by byte or signed word by word
AAM - ASCII adjust after multiplication. It converts packed BCD to unpacked BCD.

2.4 Division Instructions


Instructions Comments
DIV Source
Eg: DIV BL
DIV CX
- Divide unsigned word by byte or,
- Divide unsigned word double word by byte.
- When a word is divided by byte, the word must be in AX register and the divisor can be in a register or a memory location.
- After division AL (quotient)
AH (remainder)

- When a double word is divided by word, the double word must be in DX: AX pair and the divisor can be in a register or a memory location.
- After division AX (quotient)
DX (remainder)
AAD - ASCII adjust before the division
- BCD to binary convert before division.
CBW - Fill upper byte of a word with copies of a sign bit of lower byte.
CWD - Fill upper word of a double word with a sign bit of lower word.

3. Bit Manipulation Instructions

3.1 Logical Instructions


Instructions Comments
NOT Destination
Eg: NOT BX
- Invert each bit of a byte or word.
AND Destination, Source
Eg: AND BH, CL
- AND each bit in a byte/word with the corresponding bit in another byte or word.
OR Destination, Source
Eg: OR AH, CL
- OR each bit in a byte or word with the corresponding bit in another byte or word.
XOR Destination, Source Eg: XOR CL, BH - XOR each bit in a byte or word with the corresponding bit in another byte or word.

3.2 Shift Instructions



Instructions Comments
SHL Destination, Count
CF <- 0="" lsb="" msb="" td="">
- Shift Bits of Word or Byte Left, Put Zero(s) in LSB.
SHR Destination,Count
0 -> MSB LSB -> CF
- Shift Bits of Word or Byte Right, Put Zero(s) in MSB.
SAR Destination, Count
MSB->MSB LSB->CF
- Shift Bits of Word or Byte Right, Copy Old MSB into New MSB

3.3 Rotate Instructions


Instructions Comments
ROL - Rotate Bits of Byte or Word Left, MSB to LS and to CF.
ROR - Rotate Bits of Byte or Word Right, LSB to MSB and to CF.
RCL - Rotate Bits of Byte or Word Left, MSB to CF and CF to LSB.
RCR - Rotate Bits of Byte or Word Right, LSB TO CF and CF TO MSB.

4. Program Execution Transfer Instructions

4.1 Unconditional Transfer Instructions


Instructions Comments
CALL - Call a Subprogram/Procedure
RET - Return From Procedure to Calling Program.
JMP - Goto Specified Address to Get Next Instruction (Unconditional Jump to Specified Destination).

4.2 Conditional Transfer Instructions


Instructions Comments
JC - Jump if Carry Flag CF=1.
JNC - Jump if No Carry i.e. CF=0
JE/JZ - Jump if Equal/Jump if Zero Flag (ZF=1).
JNE/JNZ - Jump if Not Equal/Jump if Not Zero(ZF=0)
JNO - Jump if No Overflow.
JO - Jump on Overflow
JP/JNP - Jump if Parity/Jump if Not Parity
JPO/JPE - Jump if Parity Odd. / Jump if Parity Even (PF=1
JS/JNS - Jump on Sign(SF=1)/Jump if Not Sign(SF=0)
LOOP - Loop Through a Sequence of Instructions Until CX=0(count register).
JCXZ - Jump to Specified Address if CX=0.

5. Processor Control Instructions


Instructions Comments
STC - Set Carry Flag CF to 1.
CLC - Clear Carry Flag to 0.
CMC - Complement the State of CF
STD - Set Direction Flag to 1.
CLD - Clear Direction Flag to 0
STI - Set Interrupt Flag to 1. (Enable INTR Input)
CLI - Clear Interrupt Enable to 0
NOP - No Action Except Fetch and Decode
HLT Halt (Do Nothing) Until Interrupt or Reset.

6. String Instructions

Instructions Comments
MOV S/ SB/ SW - Move Byte or Word From One String to Another.
STO S/ SB/ SW - Store String Instruction
LOD S/ SB/ SW - Load String Instruction
CMP S/ SB/ SW - Compare Two String Bytes or Two String Words
SCA S/ SB/ SW - Compares a Byte in AL or Word in AX With a Byte or Word Pointed By DI in ES.
REP - Repeat Instruction Until CX=0.
REP E/REP Z - Repeat if Equal/Repeat if Zero
REP NE/ REP NZ - Repeat if Not Equal/Repeat if Not Zero.


Conclusion: 
So these are the Instruction sets in 8086 Microprocessor which helps in performing different operations.


Related Posts: 
Instruction Sets in 8086 Microprocessor Instruction Sets in 8086 Microprocessor Reviewed by Sandesh Shrestha on 02 April Rating: 5

No comments:

Powered by Blogger.