ASM CodeTable
TRANSFER Flags
Name Comment Code Operation OF DF IF TF SF ZF AF PF CF
MOV Move (Byte, Word or Dword) MOV Dest,Src Dest:=Src
MOVSX Move with Sign Extend MOVSX Dest,Src Dest:=Src (signed)
MOVZX Move with Zero Extend MOVZX Dest,Src Dest:=Src (unsigned)
XCHG Exchange XCHG Op1,Op2 Op1:=Op2 , Op2:=Op1
STC Set Carry STC CF:=1 0
CLC Clear Carry CLC CF:=0 1
CMC Complement Carry CMC CF:= CF ±
STD Set Direction STD DF:=1 (string operations downwards) 1
CLD Clear Direction CLD DF:=0 (string operations upwards) 0
STI Set Interrupt STI IF:=1 1
CLI Clear Interrupt CLI IF:=0 0
PUSH Push Word onto Stack PUSH Src16 Src16=Word ESP:=ESP–2, [ESP]:=Src16
PUSH Src32 Src32=Dword ESP:=ESP–4, [ESP]:=Src32
PUSHF Push Flags onto Stack PUSHF ESP:=ESP–2, [ESP]:=FLAGS (lower 16 bits of EFLAGS)
PUSHFD Push EFlags onto Stack PUSHFD ESP:=ESP–4, [ESP]:=EFLAGS
PUSHA Push all general registers PUSHA PUSHs AX, CX, DX, BX, SP, BP, SI, DI
PUSHAD Push all general registers PUSHAD PUSHs EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
POP Pop from stack POP Dest16 Dest16=Word → Dest16:=[ESP], ESP:=ESP+2
POP Dest32 Dest32=Dword → Dest32:=[ESP], ESP:=ESP+4
POPF Pop Flags off Stack POPF [ESP]:=FLAGS (lower 16 bits of EFLAGS), ESP:=ESP+2 ± ± ± ± ± ± ± ± ±
POPFD Pop EFlags off Stack POPF [ESP]:=EFLAGS, ESP:=ESP+4 ± ± ± ± ± ± ± ± ±
POPA Pop all general registers POPA POPs DI, SI, BP, SP, BX, DX, CX, AX
POPAD Pop all general registers POPAD POPs ESI, EBP, ESP, EBX, EDX, ECX, EAX
CBW Convert byte to word CBW AX:=AL (signed)
CWD Convert word to double CWD DX:AX:=AX (signed) ± ± ± ± ± ±
CWDE Convert word extended double CWDE EAX:=AX (signed)
IN i Input IN Dest, Port AL/AX/EAX := Byte/Word/Dword of specified port
OUT i Output OUT Port, Source Byte/Word/Dword of specified port := AL/AX/EAX
i for more information see instruction specifications Flags: ±=affected by this instruction ?=undefined after this instruction
ARITHMETIC Flags
Name Comment Code Operation OF DF IF TF SF ZF AF PF CF
ADD Add ADD Dest,Source Dest:=Dest+Source ± ± ± ± ± ±
ADC Add with Carry ADC Dest,Source Dest:=Dest+Source+CF ± ± ± ± ± ±
SUB Subtract SUB Dest,Source Dest:=Dest–Source ± ± ± ± ± ±
SBB Subtract with borrow SBB Dest,Source Dest:=Dest–(Source+CF) ± ± ± ± ± ±
DIV Divide (unsigned) DIV Op8 Op8=Byte AL:=AX / Op8 AH:=Rest ? ? ? ? ? ?
DIV Op16 Op16=Word AX:=DX:AX / Op16 DX:=Rest ? ? ? ? ? ?
DIV Op32 Op32=Dword EAX:=EDX:EAX / Op32 EDX:= Rest ? ? ? ? ? ?
IDIV Signed Integer Divide IDIV Op8 Op8=Byte AL:=AX / Op8 AH:=Rest ? ? ? ? ? ?
IDIV Op16 Op16=Word AX:=DX:AX / Op16 DX:=Rest ? ? ? ? ? ?
IDIV Op32 Op32=Dword EAX:=EDX:EAX / Op32 EDX:= Rest ? ? ? ? ? ?
MUL Multiply (unsigned) MUL Op8 Op8=Byte AX:=AL*Op8 if AH=0 ♦ ± ? ? ? ? ±
MUL Op16 Op16=Word DX:AX:=AX*Op16 if DX=0 ♦ ± ? ? ? ? ±
MUL Op32 Op21=Dword EDX:EAX:=EAX*Op32 if EDX=0 ♦ ± ? ? ? ? ±
IMUL i Signed Integer Multiply IMUL Op8 Op=Byte AX:=AL*Op8 if AL sufficient ♦ ± ? ? ? ? ±
IMUL Op16 Op=Word DX:AX:=AX*Op16 if AX sufficient ♦ ± ? ? ? ? ±
IMUL Op32 Op=Dword EDX:EAX:=EAX*Op32 if EAX sufficient ♦ ± ? ? ? ? ±
INC Increment INC Op Op:=Op+1 (Carry not affected !) ± ± ± ± ±
DEC Decrement DEC Op Op:=Op–1 (Carry not affected !) ± ± ± ± ±
CMP Compare CMP Op1,Op2 Op1–Op2 sets Flags ± ± ± ± ± ±
SAL Shift arithmetic left (≡ SHL) SAL Op,Quantity i ± ± ? ± ±
L SB
0
L SB
MSB
MSB
CF
CF
SAR Shift arithmetic right SAR Op,Quantity i ± ± ? ± ±
RCL Rotate left through Carry RCL Op,Quantity i ±
L SB
L SB
MSB
MSB
CF
CF
RCR Rotate right through Carry RCR Op,Quantity i ±
ROL Rotate left ROL Op,Quantity i ±
L SB
L SB
MSB
MSB
CF
CF
ROR Rotate right ROR Op,Quantity i ±
i for more information see instruction specification ♦ then CF:=0, OF:=0 else CF:=1, OF:=1
LOGIC Flags
Name Comment Code Operation OF DF IF TF SF ZF AF PF CF
NEG Two's Complement Negation NEG Op Op:=0–Op if Op=0 then CF:=0 else CF:=1 ± ± ± ± ± ±
NOT One's Compliment Negation NOT Op Op:= ~Op (Logical NOT → invert each bit) (bitwise NOT)
AND Logical AND AND Dest,Source Dest:=Des & Source (bitwise AND) 0 ± ± ? ± 0
OR Logical OR OR Dest,Source Dest:=Dest | Source (bitwise OR) 0 ± ± ? ± 0
XOR Logical eXclusive OR XOR Dest,Source Dest:=Dest ^ Source (bitwise Exclusive-OR) 0 ± ± ? ± 0
TEST Test For Bit Pattern TEST Op1,Op2 Op1 & Op2 sets Flags 0 ± ± ? ± 0
SHL Shift logical left (≡ SAL) SHL Op,Quantity i ± ± ? ± ±
0 0
L SB
L SB
MSB
MSB
CF
CF
SHR Shift logical right SHR Op,Quantity i ± ± ? ± ±
MISC Flags
Name Comment Code Operation OF DF IF TF SF ZF AF PF CF
NOP No operation NOP No operation
LEA Load effective address LEA Dest,Source Dest := address of Source
INT Interrupt INT Nr interrupts current program, runs specified (Nr) int-program 0 0
LOOP Loop if CX Not Zero LOOP Dest ECX:=ECX–1; if ECX !=0 then jump to „Dest”
LOOPE Loop While Equal LOOPE Dest ECX:=ECX–1 (without modifying the Flags)
LOOPZ Loop While Zero LOOPZ Dest if (ECX !=0 && ZF ==1 ) then jump to „Dest”
LOOPNE Loop While Not Equal LOOPNE Dest ECX:=ECX–1 (without modifying the Flags)
LOOPNZ Loop While Not Zero LOOPNZ Dest if (ECX !=0 && ZF ==0 ) then jump to „Dest”
STRING Operations
Name Comment Code Operation Note
MOVSB Byte/Word/Dword at [EDI] := Byte/Word/Dword at [ESI]
Move String
MOVS MOVSW if (DF==0) { ESI:=ESI+(1, 2 or 4); EDI:=EDI+(1, 2 or 4); } Can be used with REP prefixes
(Byte, Word or Dword)
MOVSD else { ESI:=ESI–(1, 2 or 4); EDI:=EDI–(1, 2 or 4); }
STOSB Byte/Word/Dword at [EDI] := (AL, AX or EAX)
Store String
STOS STOSW if (DF==0) { EDI:=EDI+(1, 2 or 4); } Can be used with REP prefixes
(Byte, Word or Dword)
STOSD else { EDI:=EDI–(1, 2 or 4); }
CMPSB Byte/Word/Dword at [ESI] – Byte/Word/Dword at [EDI] sets Flags
Compare String
CMPS CMPSW if (DF==0) { ESI:=ESI+(1, 2 or 4); EDI:=EDI+(1, 2 or 4); } Can be used with REPE/REPNE prefixes
CMPSD else { ESI:=ESI–(1, 2 or 4); EDI:=EDI–(1, 2 or 4); }
LODSB (AL, AX or EAX) := Byte/Word/Dword at [ESI]
Load String
LODS LODSW if (DF==0) { ESI:=ESI+(1, 2 or 4); }
(Byte, Word or Dword)
LODSD else { ESI:=ESI–(1, 2 or 4); }
SCASB Byte/Word/Dword at [EDI] – (AL, AX or EAX) sets Flags
Scan String
SCAS SCASW if (DF==0) { EDI:=EDI+(1, 2 or 4); } Can be used with REPE/REPNE prefixes
(Byte, Word or Dword)
SCASD else { EDI:=EDI–(1, 2 or 4); }
STRING Operations (Prefixes)
Name Comment Code Operation Note
REP MOVS(B/W/D) while ECX != 0
REP STOS(B/W/D) { execute String instruction (MOVS, STOS, INS or OUTS) Can be used with MOVS, STOS, INS or
REP Repeat String Operation
REP INS(B/W/D) ECX:=ECX–1 OUTS
REP OUTS(B/W/D) }
REPE Repeat Equal REPE SCANS(B/W/D) while ECX != 0 & ZF == 1
Can be used with SCANS or CMPSB
REPZ Repeat Zero REPZ CMPS(B/W/D) { execute String instruction (SCANS or CMPS); ECX:=ECX–1 }
REPNE Repeat Not Equal REPNE SCANS(B/W/D) while ECX != 0 & ZF == 0
Can be used with SCANS or CMPSB
REPNZ Repeat Not Zero REPNZ CMPS(B/W/D) { execute String instruction (SCANS or CMPS); ECX:=ECX–1 }
JUMPS (flags remain unchanged)
Name Comment Code Operation Name Comment Code Operation
CALL Call subroutine CALL Proc RET Return from subroutine RET
JMP Jump JMP Dest
JE Jump if Equal JE Dest (≡ JZ) JNE Jump if not Equal JNE Dest (≡ JNZ)
JZ Jump if Zero JZ Dest (≡ JE) JNZ Jump if not Zero JNZ Dest (≡ JNE)
JCXZ Jump if CX Zero JCXZ Dest JECXZ Jump if ECX Zero JECXZ Dest
JP Jump if Parity (Parity Even) JP Dest (≡ JPE) JNP Jump if no Parity (Parity Odd) JNP Dest (≡ JPO)
JPE Jump if Parity Even JPE Dest (≡ JP) JPO Jump if Parity Odd JPO Dest (≡ JNP)
JUMPS Unsigned (Cardinal) JUMPS Signed (Integer)
Name Comment Code Operation Name Comment Code Operation
JA Jump if Above JA Dest (≡ JNBE) JG Jump if Greater JG Dest (≡ JNLE)
JAE Jump if Above or Equal JAE Dest (≡ JNB ≡ JNC) JGE Jump if Greater or Equal JGE Dest (≡ JNL)
JB Jump if Below JB Dest (≡ JNAE ≡ JC) JL Jump if Less JL Dest (≡ JNGE)
JBE Jump if Below or Equal JBE Dest (≡ JNA) JLE Jump if Less or Equal JLE Dest (≡ JNG)
JNA Jump if not Above JNA Dest (≡ JBE) JNG Jump if not Greater JNG Dest (≡ JLE)
JNAE Jump if not Above or Equal JNAE Dest (≡ JB ≡ JC) JNGE Jump if not Greater or Equal JNGE Dest (≡ JL)
JNB Jump if not Below JNB Dest (≡ JAE ≡ JNC) JNL Jump if not Less JNL Dest (≡ JGE)
JNBE Jump if not Below or Equal JNBE Dest (≡ JA) JNLE Jump if not Less or Equal JNLE Dest (≡ JG]
JC Jump if Carry JC Dest JO Jump if Overflow JO Dest
JNC Jump if no Carry JNC Dest JNO Jump if no Overflow JNO Dest
JS Jump if Sign (= negative) JS Dest
JNS Jump if no Sign (= positive) JNS Dest