Commonly Used Instructions
1. MOVE Instruction
Purpose: Moves or copies data.
Immediate:
MOV EAX, 0xABCD1234
(moves the immediate value0xABCD1234
intoEAX
).Register to Register:
MOV EAX, EBX
(copies the value inEBX
toEAX
).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 inEBX
toEAX
).
SUB: Performs subtraction.
Example:
SUB EAX, 0x10
(subtracts0x10
fromEAX
).
3. INC and DEC Instructions
INC: Increments an operand by one.
Example:
INC EAX
(increases the value inEAX
by one).
DEC: Decrements an operand by one.
Example:
DEC EAX
(decreases the value inEAX
by one).
4. XOR Instruction
Purpose: Performs bit-wise XOR operation.
Example:
XOR EAX, EBX
(XORs the value inEAX
withEBX
).
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 toLABEL
if 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 toLABEL
if ZF is not set).
8. CMP Instruction
Purpose: Compares two operands.
Example:
CMP EAX, EBX
(comparesEAX
withEBX
).
9. LOOP Instruction
Purpose: Transfers control to a label and decrements the
ECX
register.Usage: Continues looping until
ECX
reaches zero.Example:
LOOP LABEL
(jumps toLABEL
and decrementsECX
untilECX
is zero).
Last updated