8086 Instruction code summary
8086 Instructions have two forms: assembly language instructions and instruction codes , The assembly language instruction form is processed by the assembler to generate the instruction code form .
Through the form of instruction code, it can help to understand the meaning and usage of assembly language instruction format .
8086 Script format
0B/1B | 1B/2B | 0B/1B | 0B/1B/2B/4B | 0B/1B/2B/4B |
Instruction prefix | Opcode segment | Addressing mode segment | Offset parameter | Immediate parameter |
explain : The presence or absence of the offset parameter and the immediate parameter is determined by the addressing mode segment ;
- Transfer class instructions
MOV Instructions |
|
|
|
|
REG/MEM→/←REG | 100010DW | mod reg r/m |
|
|
IMME→REG/MEM | 1000111w | mod 000 r/m | data | data if w=1 |
IMME→REG | 1011wreg | data | data if w=1 |
|
MEM→AX | 1010000w | addr-low | addr-high |
|
AX→MEM | 1010001w | addr-low | addr-high |
|
REG/MEM→ paragraph REG | 10001110 | mod reg r/m |
|
|
paragraph REG→REG/MEM | 10001100 | mod reg r/m |
|
|
PUSH Instructions |
|
|
|
|
REG/MEM | 11111111 | mod 110 r/m |
|
|
REG | 01010reg |
|
|
|
paragraph REG | 000reg110 |
|
|
|
POP Instructions |
|
|
|
|
REG/MEM | 10001111 | mod 000 r/m |
|
|
REG | 01011reg |
|
|
|
paragraph REG | 000reg111 |
|
|
|
XCHG Instructions |
|
|
|
|
REG/MEM←→REG | 1000011w | mod reg r/m |
|
|
REG←→AX | 10010reg |
|
|
|
XLAT Instructions | 11010111 |
|
|
|
LEA Instructions | 10001101 | mod reg r/m |
|
|
LDS Instructions | 11000101 | mod reg r/m |
|
|
LES Instructions | 11000100 | mod reg r/m |
|
|
LAHF Instructions | 10011111 |
|
|
|
SAHF Instructions | 10011110 |
|
|
|
PUSHF Instructions | 10011100 |
|
|
|
POPF Instructions | 10011101 |
|
|
|
IN Instructions |
|
|
|
|
Direct addressing | 1110010w | port |
|
|
Indirect addressing | 1110110w |
|
|
|
OUT Instructions |
|
|
|
|
Direct addressing | 1110011w | port |
|
|
Indirect addressing | 1110111w |
|
|
|
CBW Instructions | 10011000 |
|
|
|
CWD Instructions | 10011001 |
|
|
|
explain :d--0/1 Express REG As source / Destination operands ;
w--0/1 Indicates that the operand type is BYTE/WORD;
mod、r/m-- Addressing mode ;
IMME-- Immediate operands , Use... In the field data Express ;
reg-- Universal REG use 3 Bit code , paragraph REG use 2 Bit code ;
- Arithmetic instructions
ADD Instructions |
|
|
|
|
REG/MEM+REG→ any | 000000dw | mod reg r/m |
|
|
REG/MEM+=IMME | 100000sw | mod 000 r/m | data | data if sw=01 |
AX+=IMME | 0000010w | data | data if w=1 |
|
ADC Instructions |
|
|
|
|
REG/MEM+REG→ any | 000100dw | mod reg r/m |
|
|
REG/MEM+=IMME | 100000sw | mod 010 r/m | data | data if sw=01 |
AX+=IMME | 0001010w | data | data if w=1 |
|
INC Instructions |
|
|
|
|
REG/MEM | 1111111w | mod 000 r/m |
|
|
REG | 01000reg |
|
|
|
SUB Instructions |
|
|
|
|
REG/MEM-REG→ any | 001010dw | mod reg r/m |
|
|
REG/MEM-=IMME | 100000sw | mod reg r/m | data | data if sw=01 |
AX-=IMME | 0010110w | data | data if w=1 |
|
SBB Instructions |
|
|
|
|
REG/MEM-REG→ any | 000110dw | mod reg r/m |
|
|
REG/MEM-=IMME | 100000sw | mod 011 r/m | data | data if sw=01 |
AX-=IMME | 0001110w | data | data if w=1 |
|
DEC Instructions |
|
|
|
|
REG/MEM | 11111111w | mod 001 r/m |
|
|
REG | 01001reg |
|
|
|
NEG | 1111011w | mod 011 r/m |
|
|
CMP Instructions |
|
|
|
|
REG/MEM-REG | 001110dw | mod reg r/m |
|
|
REG/MEM-IMME | 100000sw | mod 111 r/m | data | data if sw=01 |
AX-IMME | 0011110w | data | data if w=1 |
|
MUL Instructions | 1111011w | mod 100 r/m |
|
|
IMUL Instructions | 1111011w | mod 101 r/m |
|
|
DIV Instructions | 1111011w | mod 110 r/m |
|
|
IDIV Instructions | 1111011w | mod 111 r/m |
|
|
AAA Instructions | 00110111 |
|
|
|
DAA Instructions | 00100111 |
|
|
|
AAS Instructions | 00111111 |
|
|
|
DAS Instructions | 00101111 |
|
|
|
AAM Instructions | 11010100 | 00001010 |
|
|
AAD Instructions | 11010101 | 00001010 |
|
|
explain :sw--01 Express 16 Immediately ,11 Express 8 Immediately , When operating, expand to 16 position ;
REG/MEM-REG--MEM It can be subtracted or subtracted ;
- Logic operation class instruction
NOT Instructions | 1111011w | mod 010 r/m |
|
|
AND Instructions |
|
|
|
|
REG/MEM®→ any | 001000dw | mod reg r/m |
|
|
REG/MEM&=IMME | 1000000w | mod 100 r/m | data | data if w=1 |
AX&=IMME | 0010010w | data | data if w=1 |
|
OR |
|
|
|
|
REG/MEM|REG→ any | 000010dw | mod reg r/m |
|
|
REG/MEM|=IMME | 1000000w | mod 001 r/m | data | data if w=1 |
AX|=IMME | 0000110w | data | data if w=1 |
|
TEST Instructions |
|
|
|
|
RET/MEM® | 100010dw | mod reg r/m |
|
|
REG/MEM&IMME | 1111011w | mod 000 r/m | data | data if w=1 |
AX&IMME | 1010110w | data | data if w=1 |
|
SHL/SA/ Instructions | 110100vw | mod 100 r/m |
|
|
SHR Instructions | 110100vw | mod 101 r/m |
|
|
SAR Instructions | 110100vw | mod 111 r/m |
|
|
POL Instructions | 110100vw | mod 000 r/m |
|
|
ROR Instructions | 110100vw | mod 001 r/m |
|
|
RCL Instructions | 110100vw | mod 010 r/m |
|
|
RCR Instructions | 110100vw | mod 011 r/m |
|
|
explain :v--0/1 Represents the number of displacements 1/(CL).
- Control transfer class instruction
JMP Instructions |
|
|
|
|
In segment - Direct short transfer | 11101011 | disp |
|
|
In segment - Direct transfer | 11101001 | disp-low | disp-high |
|
In segment - Indirect transfer | 11111111 | mod 100 r/m |
|
|
Inter segment - Direct transfer | 11101010 | offset-low | offset-high | seg-low seg-high |
Inter segment - Indirect transfer | 11111111 | mod 101 r/m |
|
|
JO Instructions | 01110000 | disp |
|
|
JNO Instructions | 01110001 | disp |
|
|
JC Instructions | 01110010 | disp |
|
|
JNC Instructions | 01110011 | disp |
|
|
JE/JZ Instructions | 01110100 | disp |
|
|
JNE/JNZ Instructions | 01110101 | disp |
|
|
JS Instructions | 01111000 | disp |
|
|
JNS Instructions | 01111001 | disp |
|
|
JP/JPE Instructions | 01111010 | disp |
|
|
JNP/JPO Instructions | 01111011 | disp |
|
|
JA/JNBE Instructions | 01110111 | disp |
|
|
JAE/JNB Instructions | 01110011 | disp |
|
|
JB/JNAE Instructions | 01110010 | disp |
|
|
JBE/JNA Instructions | 01110110 | disp |
|
|
JG/JNE Instructions | 01111111 | disp |
|
|
JGE/JNL Instructions | 01111101 | disp |
|
|
JL/JNGE Instructions | 01111100 | disp |
|
|
JLE/JNG Instructions | 01111110 | disp |
|
|
JCXZ Instructions | 11100011 | disp |
|
|
LOOP Instructions | 11100010 | disp |
|
|
LOOPZ/LOOPE Instructions | 11100001 | disp |
|
|
LOOPNZ/LOOPN Instructions | 11100000 | disp |
|
|
CALL Instructions |
|
|
|
|
In segment - direct | 11101000 | disp-low | disp-high |
|
In segment - indirect | 11111111 | mod 010 r/m |
|
|
Inter segment - direct | 10011010 | offset-low | offset-high | seg-low set-high |
Inter segment - indirect | 11111111 | mod 011 r/m |
|
|
RET Instructions |
|
|
|
|
In segment - return | 11000011 |
|
|
|
In segment - Add parameters to return | 11000010 | data-low | data-high |
|
Inter segment - return | 11001011 |
|
|
|
Inter segment - Add parameters to return | 11001010 | data-low | data-high |
|
INT Instructions |
|
|
|
|
Routine interrupt | 11001101 | type |
|
|
3 Interrupt number | 11001100 |
|
|
|
INTO Instructions | 11001110 |
|
|
|
IRET Instructions | 11001111 |
|
|
|
explain :JB/JNE-- And JC The same instruction ;
JAE/JNB-- And JNC The same instruction ;
type-- Interrupt type number ;
- String operation class instruction
REP Instructions | 1111011z |
|
|
|
MOVS Instructions | 1010010w |
|
|
|
CMPS Instructions | 1010011w |
|
|
|
SCAS Instructions | 1010111w |
|
|
|
LODS Instructions | 1010110w |
|
|
|
STOS Instructions | 1010101w |
|
|
|
explain :REP--z=0 When is REPNE,z=1 When is REP and REPZ,8086 Default REP Corresponding MOVS、STOS,REPZ Corresponding CMPS、SCAS( Compare the two with 5 Effectiveness of the coordination of instructions );
- Processor control class instructions
CLC Instructions | 11111000 |
|
|
|
STC Instructions | 11111001 |
|
|
|
CMC Instructions | 11110101 |
|
|
|
CLI Instructions | 11111010 |
|
|
|
STI Instructions | 11111011 |
|
|
|
CLD Instructions | 11111100 |
|
|
|
STD Instructions | 11111101 |
|
|
|
NOP Instructions | 10010000 |
|
|
|
HLT Instructions | 11110100 |
|
|
|
WAIT Instructions | 10011011 |
|
|
|
ESC Instructions | 11011xxx | mod xxx r/m |
|
|
LOCK Instructions | 11110000 |
|
|
|
explain :x-- It can be any value (0/1);