ASM Instructions Flashcards
ADD op1, op2
Adds op2 to op1 and stores in EAX
SUB op1, op2
Subtracts op2 from op1 and stores in EAX
XOR EAX, EAX
‘Exclusive or’ a register; clears contents of the register
INC op1
Increment op1 by 1
DEC op1
Decrement op1 by 1
CMP op1, op2
Compare (subtract) the value of op1 (register/memory address) with op2 (register/memory address/constant) and set EFLAGS; if op1 = op2 then ZF=1, CF=0; if op1 < op2 then ZF=0, CF=1; if op1 > op2 then ZF=0, CF=0
JMP location
Jumps to a new location and executes
JZ/JE location
Jumps to specified location if ZF=1 following a test; JZ usually used to test if something is explicitly 0; JE commonly found after CMP
JNZ/JLE location
Jumps to specified location if ZF=0 following a test; JNZ usually used to test if something is not set to 0; JNE commonly found after CMP
JECXZ location
Jumps to specified location if ECX=0
AND destination, value
Logical AND operation; equiv to & in python; can be used as modulo
CALL function_name
calls a function; pushes return address (address immediately after CALL) onto stack and changes EIP to destination
CLD
clears direction flag (DF=0); controls incrementing or decremeting counter
(I)DIV value
Performs division (dividend = EDX:EAX, divisor = value, following DIV EAX=quotient, EDX=remainder)
(I)MUL register, (EAX)
Signed multiplication; multiplies two registers (EAX if not specified) and stores product in EDX:EAX