x86 Mnemonics 32-bit
Here is a detailed list of x86 instructions (32-bit architecture), with explanations, examples, and usage.
Data Processing Instructions:
ADD (Addition)
Description: Adds two operands and stores the result in the destination operand.
Example:
ADD EAX, EBXAdds the value in
EBXtoEAX, storing the result inEAX.
SUB (Subtraction)
Description: Subtracts the second operand from the first operand and stores the result in the destination operand.
Example:
SUB EAX, EBXSubtracts the value in
EBXfromEAXand stores the result inEAX.
MUL (Unsigned Multiplication)
Description: Multiplies the accumulator register (
EAX) by the operand, storing the result inEDX:EAX.Example:
MUL EBXMultiplies the value in
EAXbyEBX, storing the result inEDX:EAX.
IMUL (Signed Multiplication)
Description: Multiplies the accumulator register (
EAX) by the operand, storing the result inEDX:EAX(signed).Example:
IMUL EAX, EBXMultiplies the value in
EAXbyEBX, storing the result inEDX:EAX.
DIV (Unsigned Division)
Description: Divides the value in the accumulator register (
EDX:EAX) by the operand, storing the quotient inEAXand the remainder inEDX.Example:
DIV EBXDivides the value in
EDX:EAXbyEBX, storing the quotient inEAXand the remainder inEDX.
IDIV (Signed Division)
Description: Divides the value in the accumulator register (
EDX:EAX) by the operand (signed division), storing the quotient inEAXand the remainder inEDX.Example:
IDIV EBXDivides the value in
EDX:EAXbyEBX, storing the quotient inEAXand the remainder inEDX.
INC (Increment)
Description: Increments the operand by 1.
Example:
INC EAXIncrements the value in
EAXby 1.
DEC (Decrement)
Description: Decrements the operand by 1.
Example:
DEC EAXDecrements the value in
EAXby 1.
AND (Bitwise AND)
Description: Performs a bitwise AND between two operands and stores the result in the destination operand.
Example:
AND EAX, EBXPerforms a bitwise AND between
EAXandEBX, storing the result inEAX.
OR (Bitwise OR)
Description: Performs a bitwise OR between two operands and stores the result in the destination operand.
Example:
OR EAX, EBXPerforms a bitwise OR between
EAXandEBX, storing the result inEAX.
XOR (Bitwise XOR)
Description: Performs a bitwise XOR between two operands and stores the result in the destination operand.
Example:
XOR EAX, EBXPerforms a bitwise XOR between
EAXandEBX, storing the result inEAX.
NOT (Bitwise NOT)
Description: Performs a bitwise NOT (inversion) of the operand.
Example:
NOT EAXPerforms a bitwise NOT on
EAX, inverting all bits.
NEG (Negate)
Description: Negates the operand (computes the two's complement).
Example:
NEG EAXNegates the value in
EAX.
Shift and Rotate Instructions:
SHL (Shift Left)
Description: Shifts the bits of the operand to the left, inserting zeros into the least significant bits.
Example:
SHL EAX, 1Shifts the bits of
EAXto the left by 1, filling with zeros.
SHR (Shift Right)
Description: Shifts the bits of the operand to the right, inserting zeros into the most significant bits.
Example:
SHR EAX, 1Shifts the bits of
EAXto the right by 1, filling with zeros.
SAR (Arithmetic Shift Right)
Description: Shifts the bits of the operand to the right, preserving the sign bit (for signed integers).
Example:
SAR EAX, 1Shifts the bits of
EAXto the right by 1, preserving the sign bit.
ROL (Rotate Left)
Description: Rotates the bits of the operand to the left.
Example:
ROL EAX, 1Rotates the bits of
EAXto the left by 1.
ROR (Rotate Right)
Description: Rotates the bits of the operand to the right.
Example:
ROR EAX, 1Rotates the bits of
EAXto the right by 1.
Load and Store Instructions:
MOV (Move)
Description: Copies data from one operand to another.
Example:
MOV EAX, EBXCopies the value in
EBXtoEAX.
PUSH (Push onto stack)
Description: Pushes a value onto the stack.
Example:
PUSH EAXPushes the value in
EAXonto the stack.
POP (Pop from stack)
Description: Pops a value from the stack into a register.
Example:
POP EAXPops the top value from the stack into
EAX.
LEA (Load Effective Address)
Description: Loads the effective address of a memory operand into a register.
Example:
LEA EAX, [EBX + ECX*4]Loads the address calculated from
EBX + ECX*4intoEAX.
MOVZX (Move with Zero Extension)
Description: Moves a value and zero-extends it to a larger size.
Example:
MOVZX EAX, BYTE [EBX]Moves the byte at the memory address in
EBXintoEAX, zero-extending it.
MOVSX (Move with Sign Extension)
Description: Moves a value and sign-extends it to a larger size.
Example:
MOVSX EAX, BYTE [EBX]Moves the byte at the memory address in
EBXintoEAX, sign-extending it.
Branch Instructions:
JMP (Jump)
Description: Unconditionally jumps to a target address.
Example:
JMP labelJumps to the instruction at the label.
JE (Jump if Equal)
Description: Jumps to a target address if the zero flag is set (i.e., if the two operands were equal).
Example:
JE labelJumps to the label if the zero flag is set.
JNE (Jump if Not Equal)
Description: Jumps to a target address if the zero flag is cleared (i.e., if the operands were not equal).
Example:
JNE labelJumps to the label if the zero flag is cleared.
JL (Jump if Less)
Description: Jumps to a target address if the signed comparison is less.
Example:
JL labelJumps to the label if the signed comparison is less.
JLE (Jump if Less or Equal)
Description: Jumps to a target address if the signed comparison is less or equal.
Example:
JLE labelJumps to the label if the signed comparison is less or equal.
JGE (Jump if Greater or Equal)
Description: Jumps to a target address if the signed comparison is greater or equal.
Example:
JGE labelJumps to the label if the signed comparison is greater or equal.
JMP (Jump)
Description: An unconditional jump to a specified address.
Example:
JMP labelJumps to
labelunconditionally.
Comparison Instructions:
CMP (Compare)
Description: Compares two operands by subtracting them and updating the flags.
Example:
CMP EAX, EBXCompares the values in
EAXandEBX.
TEST (Test)
Description: Performs a bitwise AND between two operands and updates the flags.
Example:
TEST EAX, EBXPerforms a bitwise AND between
EAXandEBXand updates the flags.
Stack Management Instructions:
CALL (Call Function)
Description: Calls a function, pushing the return address onto the stack.
Example:
CALL funcCalls the function
func.
RET (Return from Function)
Description: Pops the return address from the stack and returns to that address.
Example:
RETPops the return address and returns to it.
Miscellaneous Instructions:
NOP (No Operation)
Description: Does nothing; typically used for padding or alignment.
Example:
NOPNo operation.
HLT (Halt)
Description: Stops the processor.
Example:
HLTHalts execution.
CLD (Clear Direction Flag)
Description: Clears the direction flag, ensuring string operations auto-increment addresses.
Example:
CLDClears the direction flag.
STD (Set Direction Flag)
Description: Sets the direction flag, ensuring string operations auto-decrement addresses.
Example:
STDSets the direction flag.
System Instructions:
SYSENTER (System Enter)
Description: Used for fast system calls.
Example:
SYSENTER
SYSCALL (System Call)
Description: Triggers a system call.
Example:
SYSCALLIssues a system call to the operating system.
This list covers many of the essential x86 instructions, including those for arithmetic, logic, shifting, branching, stack management, system calls, and more.