๐Ÿ“Œ Registers Overview

Register Purpose
EAX Accumulator (general-purpose)
EBX Base register
ECX Counter register (looping)
EDX Data register (I/O, math)
ESI Source Index (string ops)
EDI Destination Index (string ops)
EBP Base Pointer (stack frame)
ESP Stack Pointer (points to top of stack)

โš™๏ธ Common Instructions

Instruction Description
mov eax, 3 Move (assign) the value 3 into eax
mov ebx, eax Copy the value in eax into ebx
add eax, 5 Add 5 to the value in eax
sub eax, 2 Subtract 2 from eax
inc eax Increment eax by 1
dec eax Decrement eax by 1
cmp eax, ebx Compare eax with ebx (sets flags, doesn't change values)
jmp label Jump to a label (unconditional jump)
je label Jump if equal (based on previous cmp)
jne label Jump if not equal
call func Call a function (pushes return address to stack)
ret Return from a function (pops return address from stack)
push eax Push value in eax onto the stack
pop eax Pop top value from stack into eax
nop No operation (does nothing, used for alignment or patching)
lea eax, [ebx+4] Load effective address into eax (not the value, just the address)

๐Ÿ” Bitwise and Logical

Instruction Description
and eax, ebx Bitwise AND
or eax, ebx Bitwise OR
xor eax, eax XOR eax with itself (sets eax to 0)
not eax Bitwise NOT
shl eax, 1 Shift left (multiply by 2)
shr eax, 1 Shift right (divide by 2)

๐Ÿ“‚ Memory Access

Syntax Meaning
[eax] Access memory at the address in eax
mov eax, [ebx+4] Move value at address ebx+4 into eax
mov [esi], eax Store eax into the memory at esi

๐Ÿงต Control Flow & Conditions

Instruction Action
jmp Unconditional jump
je / jz Jump if equal / zero
jne / jnz Jump if not equal / not zero
jg / jnle Jump if greater
jl / jnge Jump if less
jge Jump if greater or equal
jle Jump if less or equal

๐Ÿงฎ Arithmetic Operations

Instruction Description
add eax, ebx Add value in ebx to eax
sub eax, ebx Subtract value in ebx from eax
mul ebx Unsigned multiply eax by ebx, result in edx:eax
imul ebx Signed multiply eax by ebx, result in edx:eax
div ebx Unsigned divide edx:eax by ebx, quotient in eax , remainder in edx
idiv ebx Signed divide edx:eax by ebx, quotient in eax , remainder in edx

โšก Flags Register

Flag Description
CF Carry Flag - Set when an arithmetic operation generates a carry
ZF Zero Flag - Set when the result of an operation is zero
SF Sign Flag - Set when the result of an operation is negative
OF Overflow Flag - Set when arithmetic overflow occurs
PF Parity Flag - Set when the number of set bits in the result is even

๐Ÿ“Š String Operations

Instruction Description
movsb Move byte from [ESI] to [EDI], update pointers
movsw Move word from [ESI] to [EDI], update pointers
movsd Move double word from [ESI] to [EDI], update pointers
cmpsb Compare byte at [ESI] with byte at [EDI], update pointers
rep Repeat the following string operation ECX times
repne Repeat while not equal (or while ECX != 0)