You are on page 1of 30

Instructions of 8086

8086 has a powerful instruction set containing 117 basic instructions. The instruction set of 8086 can be divided into following groups:1. Data transfer instruction 2. Arithmetic group 3. Bit manipulation group 4. String instruction group 5. Program/control transfer group 6. Process control group

Data transfer instructions

1. MOV reg. , reg.:This instruction will copy the contents of source register to the destination register. Example:-MOV AX, BX 2. MOV Reg., mem:This instruction copies the contents of specified memory locations to the Destination register. Example:- MOV CX,[DI] 3. MOV mem.,reg

4. MOV reg. , Data:This instruction will copy the immediate data to the destination register. Example:- MOV CL,02H 5. MOV Mem. , Data 6. MOV AX , Mem.:This instruction copies the contents of given memory locations to the accumulator. Example:- MOV AL,[SI]

7. MOV Mem., AX:This instruction copies the contents of accumulator to memory location specified in the instruction. Example:-MOV [SI],AL 8. MOV seg. Reg. ,reg-16:This instruction will copy the source register contents to the destination segment register Example:- MOV DS,AX 9. MOV seg. Reg. , Mem 16 Example:- MOV DS,[SI]

10. MOV reg.16,seg reg. 11. MOV mem.,seg reg. 12. PUSH source:PUSH can be used to save the data on the stack. Example:- PUSH AX 13. POP destination Example:- POP AX

14. XCHG destination , source:Exchange byte or word This instruction exchange the contents of a register with the contents of another register or the contents of a register with the contents of memory location. Example:-XCHG AX,DX XCHG [1234],BX

15. XLAT: Translate/replace byte

This instruction replaces a byte in AL register with a byte from a look up table in the memory. 16. IN accumulator , port address Example:- IN AL,0056H 17.OUT port address , accumulator Example:- OUT 3BH,AL

LDS,LEA,LES

Arithmetic Group

Arithmetic instruction:-

Subtraction instruction:-

CMP:-compare byte or word This instruction compares a byte/word from source with the byte/word from destination. The comparison is done by subtracting the source byte or word from the destination word/byte

Multiplication and division instruction

Multiplication:Multiplication MUL IMUL AAM Multiply byte or word unsigned Multiply byte or word signed Integer multiply byte or word ASCII adjust for multiply AH=AL/10 AL=remainder

Division:Division DIV IDIV AAD CBW CWD Divide byte or word unsigned Divide byte or word signed ASCII adjust for division Convert byte to word Convert word to double-word AL=(AH*10)+AL AH=00

Bit manipulation instruction

Logical instruction:Logical Example

NOT
AND OR XOR TEST

NOT byte or word


AND byte or word OR byte or word XOR byte or word TEST byte or word(||er to AND operation)

NOT AX
AND AL,BL OR AL,BL XOR AL,BL TEST AL,75H

Shift operation:SHIFTS SHL SAR Shift logical left byte or word Shift arithmetic right byte or word

SHR
SAR

Shift logical right byte or word


Shift logical right byte or word

Logical and arithmetic shift

Rotate operation:ROTATES ROL ROR Rotate left byte or word Rotate right byte or word

RCL
RCR

Rotate left byte or word through carry flag


Rotate right byte or word through carry flag

Processor control instruction

Flag operations
STC CLC CMC STD CLD STI CLI NOP HLT Set the carry flag Clear the carry flag Complement carry flag Set direction flag Clear direction flag Set interrupt enable flag Clear interrupt enable flag No operation No operation External Synchronization Stop fetching and executing instruction

WAIT
ESC LOCK

WAIT for pin active (enter idle condition)


Escape to external processor (pass instruction to coprocessor) Lock bus during next instruction

Program transfer group

Program transfer instruction


We have four subgroups under this:1. Unconditional transfer 2. Conditional transfer 3. Iteration control 4. Interrupt relate instruction

Unconditional transfer:Instruction CALL RET Meaning Call procedure Return from procedure

JMP

Jump

Iteration control instruction:Instruction LOOP LOOPE/LOOPZ LOOPNE/LOOPNZ Meaning Loop Loop if equal/zero Loop if not equal /not zero

Conditional transfer:Instruction Meaning

JA/JNBE
JAE/JNB JB/JNAE

Jump if above/not below or equal


Jump if above or equal/not below Jump if below/not above or equal

JBE/JNA
JC JNC

Jump if below or equal /not above


Jump if carry Jump if not carry

JE/JZ
JG/JNLE JGE/JNL

Jump if equal/zero
Jump if greater/not less nor equal Jump if greater or equal/not less

JL/JNGE
JLE/JNG

Jump if less/not greater nor equal


Jump if less or equal/not greater

Instruction JNE/JNZ JNO JNP/JPO JNS JO JP/JPE JS

Meaning Jump if not equal/not zero Jump if not overflow Jump if not parity/parity odd Jump if not sign Jump if overflow Jump if parity/parity even Jump if sign

Interrupts instruction
Instructions INT INTO IRET meaning Interrupt Interrupt if overflow Interrupt return

String instruction group

String instructions:Instruction REPE/REPZ Meaning Repeat while equal/zero

REPNE/REPNZ
MOVS MOVSB/MOVSW CMPS SCAS

Repeat while not equal/not zero


Move byte or word string Move byte or word string Compare byte or word string Scan byte or word string

LODS
STOS

Load byte or word string


Store byte or word

You might also like