#TITLE=Assembler (TASM/MASM/NASM) ;------------------------------------------------------------------------------- ; Intel i80x86 processor and i80x87 numeric cooprocessor families assembly ; ; Copyright (c) 2000 by Michał Jazłowiecki ; michalj@prioris.mini.pw.edu.pl ; http://prioris.mini.pw.edu.pl/~michalj (Polish language only) ; ; NASM support by Elias Bachaalany. ; eliasbachaalany@hotmail.com ; ; Supports: ; 1) Highlighting of all 8-bit, 16-bit and 32-bit i80x86 processor family ; registers available in real, protected and virtual 386 modes. ; 2) Highlighting for all (?) instructions available for i8086/i8088, ; i80186/i80188, i80286, i80386, i486, Pentium, Pentium MMX and ; Pentium Pro (sic!) in real, protected and virtual 386 modes. ; 3) Highlighting for floating point instructions available for i8087, ; i80187, i80287 and i80387 stand-alone numeric cooprocessors and ; i486, Pentium, Pentium MMX and Pentium Pro built-in numeric ; cooprocessors. ; 4) Highlighting for some undocumented and removed instructions. ; 5) Highlighting for most TASM/MASM/NASM directives. ; ; Currently: ; - About 365 documented and undocumented i80x86 and i80x87 processor ; families instructions. ; - 6 removed instructions ; - 76 register names ; - 256 TASM/MASM directives ; - 59 NASM directives ;------------------------------------------------------------------------------ #DELIMITER=,{}[]-+*/="'~!&|<>:;# #QUOTATION1=" #QUOTATION2=' #CONTINUE_QUOTE=n #LINECOMMENT=; #LINECOMMENT2= #COMMENTON= #COMMENTOFF= #COMMENTON2= #COMMENTOFF2= #ESCAPE= #CASE=n #PREFIX1= #PREFIX2= #PREFIX3= #PREFIX4= #PREFIX5= #SUFFIX1= #SUFFIX2= #SUFFIX3= #SUFFIX4= #SUFFIX5= #KEYWORD=Intel x86 and x87 register names ; Intel x86 main processor 8-bit registers AH AL BH BL CH CL DH DL ; Intel x86 main processor 16-bit registers AX BP BX CS CX DI DS DX ES IP SI SP SS ; Intel 386+ main processor extended registers EAX EBP EBX ECX EDI EDX EIP ESI ESP FS GS ; Intel x87 numeric processor registers ST ST(0) ST(1) ST(2) ST(3) ST(4) ST(5) ST(6) ST(7) ; Intel Pentium MMX+ MMX registers (aliases for ST(x) registers) MM0 MM1 MM2 MM3 MM4 MM5 MM6 MM7 ; Intel 286+ protected mode registers ; Task Register (286+) TR ; Control registers (386+; CR4 is Pentium+ (also on 486 with CPUID)) ; Note there is no CR1! CR0 CR2 CR3 CR4 ; Debugger registers (386+) DR0 DR1 DR2 DR3 DR4 DR5 DR6 DR7 ; Descriptor Table Registers GDTR IDTR LDTR ; Test Registers (386+) TR6 TR7 ; Test Registers (486+) TR3 TR4 TR5 ; Test Registers (Pentium+) - accessible only with Model Specific Registers TR1 TR2 TR8 TR9 TR10 TR11 TR12 #KEYWORD=Intel x86 and x87 instructions ; Intel 8086/8088+ instructions aaa aad aam aas adc add and arpl bound call cbw clc cld cli clts cmc cmp cmps cmpsb cmpsd cmpsw cwd daa das dec div enter esc hlt idiv imul in inc ins insb insd insw int into iret iretd ja jae jb jbe jc jcxz je jecxz jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz jo jpe jpo js jz lahf lar lds lea leave les lgdt lidt lldt lmsw lock lods lodsb lodsd lodsw loop loope loopne loopnz loopz lsl lss ltr mov movs movsb movsd movsw mul neg nop not or out outs outsb outsd outsw pop popa popad popf popfd push pusha pushad pushf pushfd rcl rcr rep repe repne repnz repz ret retf retn rol ror sahf sal sar sbb scas scasb scasd scasw seta setae setb setbe setc sete setg setge setl setle setna setnae setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets setz sgdt shl shr sidt sldt smsw stc std sti stos stosb stosd stosw str sub test verr verw wait xchg xlat xlatb xor ; Intel 8087+ cooprocessor instructions f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcom fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp feni ffree fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frint2 frndint frstor frstpm fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomp fucompp fwait fxam fxch fxtract fyl2x fyl2xp1 ; Intel 386+ processor instructions bsf bsr bt btc btr bts cdq cwde lfs lgs movsx movzx shld shrd ; Intel 486+ processor instructions bswap cmpxchg cpuid invd invlpg wbinvd xadd ; Pentium+ instructions cmpxchg8b rdmsr rdtsc rsm wrmsr ; Pentium Pro+ instructions cmov fcmov fcomi rdpmc ; Pentium MMX+ instructions emms movd movq packssdw packsswb paddb paddd paddsb paddsw paddusb paddusw paddw pand pandn pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pmaddwd pmulhw pmullw por psrad psraw psrld psrlq psrlw pssld psslq psslw psubb psubd psubsb psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd pxor ; Undocumented instructions icebp loadall rdtsc rsm salc saveall setalc smi smsd umov ; Removed instructions feni fdisi frinear frichop ibts xbts #KEYWORD=Directives $ %bin %conds %cref %crefall %crefuref %ctls %depth %linum %list %macs %newpage %noconds %nocref %noctls %noincl %nolist %nomacs %nosyms %notrunc %out %pagesize %pcnt %poplctl %pushlctl %subttl %syms %tabsize %text %title %trunc .186 .286 .286p .287 .386 .386p .387 .8086 .8087 .alpha .code .const .cref .data .data? .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn .erridni .errnb .errndef .errnz .fardata .fardata? .lall .lfcond .list .model .public .radix .sall .seq .sfcond .stack .tfcond .type .xall .xcref .xlist ??date ??filename ??time ??version @code @codesize @cpu @curseg @data @datasize @fardata @fardata? @filename @model @startup @wordsize align and arg assume byte byte ptr catstr codeptr codeseg comm comment const dataptr dataseg db dd df dosseg dq dt dup dw dword dword ptr else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn elseifidni elseifnb elseifndef emul end endif endm endp ends eq equ err errif errif1 errif2 errifb errifdef errifdif errifdifi errife errifidn errifidni errifnb errifndef even evendata exitm extrn far far ptr fword fword ptr ge global group gt high ideal if if1 if2 ifb ifdef ifdif ifdifi ife ifidn ifidni ifnb ifndef include includelib instr irp irpc jumps label large le length local low lt macro mask masm masm51 mod multerrs name ne near near ptr noemul nojumps nolocals nomasm51 not nowarn offset or org p186 p286 p286n p287 p386 p386n p387 p8086 p8087 page pno87 proc ptr public purge pword pword ptr quirks qword qword ptr record rept seg segment shl short shr size sizestr small stack struc substr subttl symtype tbyte tbyte ptr this title type udataseg ufardata union unknown uses width word word ptr xor ; ------------------------------------------- ; nasm's ; ------------------------------------------- %macro %endmacro %endm %include %if %else %endif %elif %ifdef %ifndef %ifctx %ifnctx %ifidn %ifidni %ifid %ifnum %ifstr %ifnstr %ifnnum %ifnid %elifnid %elifnstr %elifnnum %elifstr %elifid %elifnum %error %rep %repl %assign %endrep %push %pop incbin times resb resw resd resq rest __NASM_MAJOR__ __NASM_MINOR__ __FILE__ __LINE__ __NASMDEFSEG __SECT__ struc endstruc at istruc iend alignb bits section absolute extern common import export #