You are on page 1of 2

Intel Assembler 80186 and higher

TRANSFER Name Comment MOV Move (copy) XCHG Exchange STC CLC CMC STD CLD STI CLI PUSH PUSHF PUSHA POP POPF POPA CBW CWD CWDE Set Carry Clear Carry Complement Carry Set Direction Clear Direction Set Interrupt Clear Interrupt Push onto stack Push flags Push all general registers Pop from stack Pop flags Pop all general registers Convert byte to word Convert word to double Conv word extended double

CodeTable 1/2
Operation Dest:=Source Op1:=Op2 , Op2:=Op1 CF:=1 CF:=0 CF:= CF DF:=1 (string op's downwards) DF:=0 (string op's upwards) IF:=1 IF:=0

1996-2003 by Roger Jegerlehner, Switzerland V 2.3 English. Also available in Spanish

Code MOV Dest,Source XCHG Op1,Op2 STC CLC CMC STD CLD STI CLI PUSH Source PUSHF PUSHA POP Dest POPF POPA CBW CWD CWDE

O D

Flags T S Z A P C

1 0 1 0 1 0

DEC SP, [SP]:=Source O, D, I, T, S, Z, A, P, C 286+: also NT, IOPL AX, CX, DX, BX, SP, BP, SI, DI Dest:=[SP], INC SP O, D, I, T, S, Z, A, P, C 286+: also NT, IOPL DI, SI, BP, SP, BX, DX, CX, AX AX:=AL (signed) DX:AX:=AX (signed) EAX:=AX (signed)

386

IN i Input IN Dest, Port AL/AX/EAX := byte/word/double of specified port OUT i Output OUT Port, Source Byte/word/double 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 O D I T S Z 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 Op Op=byte: AL:=AX / Op AH:=Rest ? ? ? DIV Divide (unsigned) DIV Op Op=word: AX:=DX:AX / Op DX:=Rest ? ? ? DIV 386 Divide (unsigned) DIV Op Op=doublew.: EAX:=EDX:EAX / Op EDX:=Rest ? ? ? IDIV Signed Integer Divide IDIV Op Op=byte: AL:=AX / Op AH:=Rest ? ? ? IDIV Signed Integer Divide IDIV Op Op=word: AX:=DX:AX / Op DX:=Rest ? ? ? IDIV 386 Signed Integer Divide IDIV Op Op=doublew.: EAX:=EDX:EAX / Op EDX:=Rest ? ? ? MUL Multiply (unsigned) MUL Op Op=byte: AX:=AL*Op if AH=0 ? ? MUL Multiply (unsigned) MUL Op Op=word: DX:AX:=AX*Op if DX=0 ? ? MUL 386 Multiply (unsigned) MUL Op Op=double: EDX:EAX:=EAX*Op if EDX=0 ? ? IMUL i Signed Integer Multiply IMUL Op Op=byte: AX:=AL*Op if AL sufficient ? ? IMUL Signed Integer Multiply IMUL Op Op=word: DX:AX:=AX*Op if AX sufficient ? ? IMUL 386 Signed Integer Multiply IMUL Op Op=double: EDX:EAX:=EAX*Op 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 i i i i i i
then CF:=0, OF:=0 else CF:=1, OF:=1

A ? ? ? ? ? ? ? ? ? ? ? ? ? ?

P ? ? ? ? ? ? ? ? ? ? ? ?

C ? ? ? ? ? ?

SAL Shift arithmetic left ( SHL) SAL Op,Quantity SAR Shift arithmetic right SAR Op,Quantity RCL Rotate left through Carry RCL Op,Quantity RCR Rotate right through Carry RCR Op,Quantity ROL Rotate left ROL Op,Quantity ROR Rotate right ROR Op,Quantity i for more information see instruction specifications LOGIC Name Comment Code NEG Negate (two-complement) NEG Op NOT Invert each bit NOT Op AND Logical and AND Dest,Source OR Logical or OR Dest,Source XOR Logical exclusive or XOR Dest,Source SHL SHR Shift logical left Shift logical right ( SAL) SHL Op,Quantity SHR Op,Quantity

Operation Op:=0-Op if Op=0 then CF:=0 else CF:=1 Op:= Op (invert each bit) Dest:=Dest Source Dest:=DestSource Dest:=Dest (exor) Source

O D 0 0 0 i i

Flags T S Z A P C ? ? ? ? ? 0 0 0

Download latest version free of charge from www.jegerlehner.ch/intel This page may be freely distributed without cost provided it is not changed. All rights reserved

Intel Assembler 80186 and higher


MISC Name NOP LEA INT Comment No operation Load effective address Interrupt Code NOP LEA Dest,Source INT Nr

CodeTable 2/2
Operation No operation Dest := address of Source

1996-2003 by Roger Jegerlehner, Switzerland V 2.3 English. Also available in Spanish

O D

Flags T S Z A P C

interrupts current program, runs spec. int-program

JUMPS (flags remain unchanged) Name Comment CALL Call subroutine JMP JE JZ JCXZ JP JPE Jump Jump if Equal Jump if Zero Jump if CX Zero Jump if Parity (Parity Even) Jump if Parity Even

Code CALL Proc JMP Dest JE Dest JZ Dest JCXZ Dest JP Dest JPE Dest

Operation

Name RET JNE JNZ JECXZ JNP JPO

Comment Return from subroutine Jump if not Equal Jump if not Zero Jump if ECX Zero Jump if no Parity (Parity Odd) Jump if Parity Odd

Code RET JNE Dest JNZ Dest JECXZ Dest JNP Dest JPO Dest

Operation

( JZ) ( JE) ( JPE) ( JP)

( JNZ) ( JNE)
386

( JPO) ( JNP)

JUMPS Unsigned (Cardinal) JA Jump if Above JAE Jump if Above or Equal JB Jump if Below JBE Jump if Below or Equal JNA Jump if not Above JNAE Jump if not Above or Equal JNB Jump if not Below JNBE Jump if not Below or Equal JC Jump if Carry JNC Jump if no Carry General Registers: EAX 386 AX AH 31 24 23 16 15 EDX 386 DX DH 31 24 23 16 15 ECX 386 CX CH 31 24 23 16 15 EBX 386 BX BH 31 Flags: 24 23 16 15 87 BL 87 CL 87 DL 87 AL

JA Dest JAE Dest JB Dest JBE Dest JNA Dest JNAE Dest JNB Dest JNBE Dest JC Dest JNC Dest

( JNBE) ( JNB JNC) ( JNAE JC) ( JNA) ( JBE) ( JB JC) ( JAE JNC) ( JA)

JUMPS Signed (Integer) JG Jump if Greater JGE Jump if Greater or Equal JL Jump if Less JLE Jump if Less or Equal JNG Jump if not Greater JNGE Jump if not Greater or Equal JNL Jump if not Less JNLE Jump if not Less or Equal JO Jump if Overflow JNO Jump if no Overflow JS Jump if Sign (= negative) JNS Jump if no Sign (= positive) Example: .DOSSEG .MODEL SMALL .STACK 1024 Two EQU 2 .DATA VarB DB ? VarW DW 1010b VarW2 DW 257 VarD DD 0AFFFFh S DB "Hello !",0 .CODE main: MOV AX,DGROUP MOV DS,AX MOV [VarB],42 MOV [VarD],-7 MOV BX,Offset[S] MOV AX,[VarW] ADD AX,[VarW2] MOV [VarW2],AX MOV AX,4C00h INT 21h END main

JG Dest JGE Dest JL Dest JLE Dest JNG Dest JNGE Dest JNL Dest JNLE Dest JO Dest JNO Dest JS Dest JNS Dest

( JNLE) ( JNL) ( JNGE) ( JNG) ( JLE) ( JL) ( JGE) ( JG)

; Demo program

Accumulator 0

; Const ; define Byte, any value ; define Word, binary ; define Word, decimal ; define Doubleword, hex ; define String ; resolved by linker ; init datasegment reg ; init VarB ; set VarD ; addr of "H" of "Hello !" ; get value into accumulator ; add VarW2 to AX ; store AX in VarW2 ; back to system

Data mul, div, IO 0

Count loop, shift 0

BaseX data ptr 0

- - - - OD I T S

-A- P-C

Control Flags (how instructions are carried out): D: Direction 1 = string op's process down from high to low address I: Interrupt whether interrupts can occur. 1= enabled T: Trap single step for debugging

Status Flags (result of operations): C: Carry result of unsigned op. is too large or below zero. 1 = carry/borrow O: Overflow result of signed op. is too large or small. 1 = overflow/underflow S: Sign sign of result. Reasonable for Integer only. 1 = neg. / 0 = pos. Z: Zero result of operation is zero. 1 = zero A: Aux. carry similar to Carry but restricted to the low nibble only P: Parity 1 = result has even number of set bits

Download latest version free of charge from www.jegerlehner.ch/intel This page may be freely distributed without cost provided it is not changed. All rights reserved

You might also like