x86 Instruction Set

revise and note what's before!


Multiplication and division

Multiplication
Division

only single argument form with implied arguments
complementary to single argument multiplication
dividend 2x longer than divisor and result
two variants:

Single argument multiplication

Instruction Explicit arg | Implicit arguments
MUL, IMUL Multiplier | Product / Multiplicand / /
DIV, IDIV Divisor | Divident / Quotient / Remainder
r/m8 | AX, AL, AH
r/m16 | DX:AX, AX, DX
r/m32 | EDX:EAX, EAX, EDX
r/m64 | RDX, RAX, RAX, RDX
Divion of numbers (of the same length) - required extension of a dividend

Operations on flag register

Jump instructions

User to transfer the constrol from one contigous addres

Jump

Constant (immediate) target address - unconditional and conditional

Sobroutine returns
RET - return
RET n - return and deallocate arguments

Variable target address - JMP & CALL ex.

Conditional instructions other than jumps

CMOVcc - conditional move
SETcc - convert condition to Boolean value 0/1

Instructions for HLL support

RET n - subroutine return with argument deallocation
...

x86 iterative instructions

5 instructions (+2 privileged) using implied registers

Pointers are modified after data access, depending on setting of DF flag in EFLAGS

Instructions
LOAD - load - a=s±±
STOS - store - d±±=a
MOVS - copy - d±±=s±±
SCAS - scan - d±±a
CMPS - compare - d±±S±±

Self looping instructions

...


CPUID instruction

Before execution, EAX is loaded with leaf identifies (32-bit arg. for CPUID)
After execution, EAX, EBX, ECX, EDX contain useful information (changes depending on EAX leaf value)