INSTRUCTIONS of 8086
INSTRUCTIONS of 8086
08/31/2024 2
Data Transfer/Copy Instructions
If these instructions have REP prefix with CX used as count register, they can be used to
implement unconditional and conditional loops.
LOOP, LOOPNZ, and LOOPZ belongs to this category
08/31/2024 4
Shift and rotate Instructions
These instructions involve the bitwise shifting or rotation in either direction with or without a
count in CX.
String Instructions
These instructions controlthe machine status.
These instructions involve various string manipulation operatins like load, move, scan, compare,
store, etc.
These instructions are only to be operated upon strings.
08/31/2024 5
8086
Microprocess
Data can transfer from
or
1. Data Transfer/copy Instructions 1. Memory to register
2. Register to memory
3. Register to register only.
08/31/2024 6
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
08/31/2024 7
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
PUSH mem
08/31/2024 6 8
3
8086
Microprocess Instruction Set
or
1. Data Transfer Instructions
addr8 AX
08/31/2024 9
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
08/31/2024 10
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADD A, data
08/31/2024 11
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
ADC A, data
08/31/2024 12
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
SUB A, data
08/31/2024 13
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SBB, INC, DEC, MUL, DIV, CMP…
SUB,
SBB reg2/ mem, reg1/mem
SBB A, data
08/31/2024 14
8086
Microprocess Instruction Set
or
2. Arithmetic Instructions
Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
CMP A, data
08/31/2024 15
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 16
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 17
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 18
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
Test instruction performs a bit by bit logical AND operation on the two operands
Each bit of result is set to one. The corresponding bits of both are one. Else result bit reset to 0
Further AND operation not available
But flags are effected , flags are OF, CF, SF, ZF, and PF.
08/31/2024 19
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 20
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 21
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
RCR, Rotate right through carry
RCL, Rotate left through carry
ROL, Rotate left without carry
ROR, Rotate right without carry
08/31/2024 22
8086
Microprocess Instruction Set
or
3. Logical Instructions
Mnemonics: AND, OR, XOR, TEST, SHR, SHL, RCR, RCL …
08/31/2024 23
8086
Microprocess Instruction Set
or
4. String Manipulation Instructions
To perform string operation two parameter are required
i. Start and end address of the string
ii. Length of the string
iii. Length of the string usually stored in count CX register
08/31/2024 29
08/31/2024 30
Conditional jumps:
JC:
This stands for Jump if Carry.
Eg: JC next;
If the carry flag = 1, then it will jump to the “next” label.
JNC:
This stands for Jump if No Carry.
Eg: JNC next;
If the carry flag = 0, then it will jump to the “next” label.
JZ:
This stands for Jump if Zero.
Eg: JZ next;
If the zero flag = 1, then it will jump to the “next” label.
JNZ:
This stands for Jump if No Zeroy.
Eg: JNZ next;
If the zero flag = 0, then it will jump to the “next” label.
JPE:
This stands for Jump if Parity is Even.
Eg: JPE next;
If the parity flag = 1, then it will jump to the “next” label.
08/31/2024 31
JPO:
This stands for Jump if Parity is Odd.
Eg: JPO next;
If the parity flag = 0, then it will jump to the “next” label.
JO:
This stands for Jump if Overflow.
Eg: JO next;
If the overflow flag = 1, then it will jump to the “next” label.
JNO:
This stands for Jump if No Overflow.
Eg: JNO next;
If the overflow flag = 0, then it will jump to the “next” label.
JS:
This stands for Jump if Sign.
Eg: JS next;
If the sign flag = 1, then it will jump to the “next” label.
JNS:
This stands for Jump if No Sign.
Eg: JNS next;
If the sign flag = 0, then it will jump to the “next” label
08/31/2024 32
Flag manipulation or process control instructions
• Categorized in to 2
• 1. Flag manipulation instructions
• 2. Machine control instruction
• The flag manipulation instructions directly modify some of the flags of
8086.
• The machine control instructions control the bus usage and execution
08/31/2024 33
Flag manipulation instructions
• 1. CLC --- Clear carry flag, CLCCARRY 0
• 2. CMC --- Complement Carry flag 01, 10.
• 3. STC --- Set Carry Flag STC SET CARRY 1
08/31/2024 34
Machine control instructions
• 1. WAIT ---- Wait for the Test input pin to go low. Refer test pin.
• 2. HLT ---- Halt the processor, HALT or PAUSE our programme.
• 3. NOP ---- No operation, be ideal for some time
• 4. ESC ---- Escape to external device like NDP(numeric co-processor),
escape to other processor
• 5. LOCK ---- Bus lock instruction prefix, in max mode to avoid other
processor requisitions.
08/31/2024 35
WAIT
• This instruction is used to prevent the CPU from accessing memory that may be
temporarily in use by coprocessor
• TEST =0 ;; Processor is busy (ie, working with memory) Else Processor is idle.
• If WAIT is executed during TEST pin 0:: the processor waits for it to return 1
If WAIT is executed during TEST pin 1:: , the processor can continue with execution
LOCK
When the CPU is executing a critical instruction
which requires the system bus, the LOCK prefix
instruction ensures that other processors connected
in the system will not gain the control of the bus
08/31/2024 36