Tuesday, November 20, 2012

8086 Instruction Set Summary



The following is a brief summary of the 8086 instruction set:

  1. Data copy/transfer Instructions
These type of instruction are used to transfer data from source operand to destination operand. All the store, move, load, exchange, input and output instructions belong to this category.
a) Memory/Register Transfers
LDS Load pointer using data segment
LES Load pointer using extra segment
MOV Move byte or word to register or memory
XCHG Exchange byte or word
XLAT Translate byte using look-up table
b) Stack Transfers
PUSH Push data onto stack
PUSHF Push flags onto stack
POP Pop data onto stack
POPF Pop flags off stack
c) AH/Flags Transfers
LAHF Load AH from flags
SAHF Store AH into flags
d) Address Transfer
LEA Load effective address


  1. Arithmetic & Logical Instructions
All the instruction performing arithmetic, logical, increment, decrement, compare and scan instructions belong to this category.

a) Addition
ADD Add byte or word
AAA ASCII adjust for addition
INC Increment byte or word
b) Subtraction
SUB Subtract byte or word
AAS ASCII adjust for subtraction
DEC Decrement byte or word
c) Multiplication
MUL Multiply byte or word (unsigned)
IMUL Integer multiply byte or word (signed)
AAM ASCII adjust for multiplication
d) Division
DIV Divide byte or word (unsigned)
IDIV Integer divide byte or word (signed)
AAD ASCII adjust for division
e) Conversion
CBW Convert byte to word
CWB Convert word to byte
f) Logical
AND Logical AND of byte or word
OR Logical OR of byte or word
NOT Logical NOT of byte or word (one's complement)
XOR Boolean exclusive OR
TEST Test byte or word (AND without storing)

  1. Branch Instructions
These instructions transfer control of execution to the specified address.
All the call, jump, interrupt and return instruction belong to this class.

a) Unconditional Transfers
CALL Call for procedure
RET Return from procedure
JMP Unconditional jump
INT Software interrupt
IRET Return from interrupt
b) Conditional Transfers
JA (JNBE) Jump if above (not below or equal)
JAE (JNB) Jump if above or equal (not below)
JB (JNAE) Jump if below (not above or equal)
JBE (JNA) Jump if below or equal (not above)
JE (JZ) Jump if equal (zero)
JG (JNLE) Jump if greater (not less or equal)
JGE (JNL) Jump if greater or equal (not less)
JL (JNGE) Jump if less (not greater nor equal)
JLE (JNG) Jump if less or equal (not greater)
JCXZ Jump if CX equals zero


  1. Loop Instructions

If these instructions have REP prefix with CX used as count register, they can be used to implement unconditional and coditional loops. The LOOP, LOOPNZ and LOOPZ instructions belong to this category.
LOOP Loop unconditional, count in CX
LOOPE Loop if equal (zero), count in CX
LOOPNE Loop if not equal (not zero), count in CX




  1. Machine Control Instructions
These instructions control the machine status. NOP, HLT, WAIT and LOCK instructions belong to this class.

HLT Halt processor
LOCK Lock bus during next instruction
NOP No operation (do nothing)
WAIT Wait for signal on TEST input
ESC Escape to external processor interface



  1. Flag Manipulation Instructions

All the instructions which directly affect the flag register, come under this group of instruction. Instructions like CLD, STD, CLI, STI, etc. belong to this category of instructions.

CLC Clear Carry Flag
CMC Compliment Carry Flag
STC Set Carry Flag
CLD Clear Direction Flag
STD Set Direction Flag
CLI Clear Interrupt Enable Flag
STI Set Interrupt Enable Flag



  1. Shift & Rotate Instructions
These instructions involve the bitwise shifting or rotation in either direction with or without a count in CX.

SAL Arithmetic shift left byte or word by 1 or CL
SAR Arithmetic shift right byte or word by 1 or CL
SHL Logical shift left byte or word by 1 or CL
SHR Logical shift right byte or word by 1 or CL
RCL Rotate left through carry byte or word by 1 or CL
RCR Rotate right through carry byte or word by 1 or CL
ROL Rotate left byte or word by 1 or CL
ROR Rotate right byte or word by 1 or CL


  1. String Instructions

These instructions involve various string manipulation operations like load, move, scan, compare, store, etc. These instructions are only to be operate upon the strings.

CMPSB Compare string of bytes
CMPSW Compare string of words
LODSB Load string of bytes
LODSW Load string of words
MOVSB Move string of bytes
MOVSW Move string of words
SCASB Scan string of bytes
SCASW Scan string of words
STOSB Store string of bytes
STOSW Store string of words

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More