Commonly Used Instructions
1. MOVE Instruction
Purpose: Moves or copies data.
Immediate:
MOV EAX, 0xABCD1234(moves the immediate value0xABCD1234intoEAX).Register to Register:
MOV EAX, EBX(copies the value inEBXtoEAX).Memory:
MOV EAX, DWORD PTR [EBP-0xC](moves a value from memory at[EBP-0xC]intoEAX).
2. ADD and SUB Instructions
ADD: Performs addition.
Example:
ADD EAX, EBX(adds the value inEBXtoEAX).
SUB: Performs subtraction.
Example:
SUB EAX, 0x10(subtracts0x10fromEAX).
3. INC and DEC Instructions
INC: Increments an operand by one.
Example:
INC EAX(increases the value inEAXby one).
DEC: Decrements an operand by one.
Example:
DEC EAX(decreases the value inEAXby one).
4. XOR Instruction
Purpose: Performs bit-wise XOR operation.
Example:
XOR EAX, EBX(XORs the value inEAXwithEBX).
5. NOP Instruction
Purpose: No Operation; does nothing.
Usage: Used for timing purposes or memory alignment.
6. Unconditional Jump
Purpose: Transfers control to another code unconditionally.
Example:
JMP LABEL(jumps to the instruction atLABEL).
7. Conditional Jump
Purpose: Transfers control if a specified condition is met.
JE/JZ: Jump if Equal/Jump if Zero (checks if the Zero Flag is set).
Example:
JE LABEL(jumps toLABELif ZF is set).
JNE/JNZ: Jump if Not Equal/Jump if Not Zero (checks if the Zero Flag is not set).
Example:
JNE LABEL(jumps toLABELif ZF is not set).
8. CMP Instruction
Purpose: Compares two operands.
Example:
CMP EAX, EBX(comparesEAXwithEBX).
9. LOOP Instruction
Purpose: Transfers control to a label and decrements the
ECXregister.Usage: Continues looping until
ECXreaches zero.Example:
LOOP LABEL(jumps toLABELand decrementsECXuntilECXis zero).
Last updated