blob: b8b5e6992bca8fbd8a5be3bcde9e9a455887a72c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: TASM: turbo assembler by Borland
Viktor Szépe3fc7a7e2023-08-23 21:20:00 +02003" Maintainer: FooLman of United Force <foolman@bigfoot.com>
Bram Moolenaard47d5222018-12-09 20:43:55 +01004" Last Change: 2012 Feb 03 by Thilo Six, and 2018 Nov 27.
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02006" quit when a syntax file was already loaded
7if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00008 finish
9endif
10
Bram Moolenaarb8ff1fb2012-02-04 21:59:01 +010011let s:cpo_save = &cpo
12set cpo&vim
13
Bram Moolenaar071d4272004-06-13 20:20:40 +000014syn case ignore
15syn match tasmLabel "^[\ \t]*[@a-z_$][a-z0-9_$@]*\ *:"
16syn keyword tasmDirective ALIAS ALIGN ARG ASSUME %BIN CATSRT CODESEG
17syn match tasmDirective "\<\(byte\|word\|dword\|qword\)\ ptr\>"
18" CALL extended syntax
19syn keyword tasmDirective COMM %CONDS CONST %CREF %CREFALL %CREFREF
20syn keyword tasmDirective %CREFUREF %CTLS DATASEG DB DD %DEPTH DF DISPLAY
21syn keyword tasmDirective DOSSEG DP DQ DT DW ELSE EMUL END ENDIF
22" IF XXXX
23syn keyword tasmDirective ENDM ENDP ENDS ENUM EQU ERR EVEN EVENDATA EXITCODE
24syn keyword tasmDirective EXITM EXTRN FARDATA FASTIMUL FLIPFLAG GETFIELD GLOBAL
25syn keyword tasmDirective GOTO GROUP IDEAL %INCL INCLUDE INCLUDELIB INSTR IRP
26"JMP
27syn keyword tasmDirective IRPC JUMPS LABEL LARGESTACK %LINUM %LIST LOCAL
28syn keyword tasmDirective LOCALS MACRO %MACS MASKFLAG MASM MASM51 MODEL
29syn keyword tasmDirective MULTERRS NAME %NEWPAGE %NOCONDS %NOCREF %NOCTLS
30syn keyword tasmDirective NOEMUL %NOINCL NOJUMPS %NOLIST NOLOCALS %NOMACS
31syn keyword tasmDirective NOMASM51 NOMULTERRS NOSMART %NOSYMS %NOTRUNC NOWARN
32syn keyword tasmDirective %PAGESIZE %PCNT PNO87 %POPLCTL POPSTATE PROC PROCDESC
33syn keyword tasmDirective PROCTYPE PUBLIC PUBLICDLL PURGE %PUSHCTL PUSHSTATE
34"rept, ret
35syn keyword tasmDirective QUIRKS RADIX RECORD RETCODE SEGMENT SETFIELD
36syn keyword tasmDirective SETFLAG SIZESTR SMALLSTACK SMART STACK STARTUPCODE
37syn keyword tasmDirective STRUC SUBSTR %SUBTTL %SYMS TABLE %TABSIZE TBLINIT
38syn keyword tasmDirective TBLINST TBLPTR TESTFLAG %TEXT %TITLE %TRUNC TYPEDEF
39syn keyword tasmDirective UDATASEG UFARDATA UNION USES VERSION WAR WHILE ?DEBUG
40
41syn keyword tasmInstruction AAA AAD AAM AAS ADC ADD AND ARPL BOUND BSF BSR
42syn keyword tasmInstruction BSWAP BT BTC BTR BTS CALL CBW CLC CLD CLI CLTS
43syn keyword tasmInstruction CMC CMP CMPXCHG CMPXCHG8B CPUID CWD CDQ CWDE
44syn keyword tasmInstruction DAA DAS DEC DIV ENTER RETN RETF F2XM1
45syn keyword tasmCoprocInstr FABS FADD FADDP FBLD FBSTP FCHG FCOM FCOM2 FCOMI
46syn keyword tasmCoprocInstr FCOMIP FCOMP FCOMP3 FCOMP5 FCOMPP FCOS FDECSTP
47syn keyword tasmCoprocInstr FDISI FDIV FDIVP FDIVR FENI FFREE FFREEP FIADD
48syn keyword tasmCoprocInstr FICOM FICOMP FIDIV FIDIVR FILD FIMUL FINIT FINCSTP
49syn keyword tasmCoprocInstr FIST FISTP FISUB FISUBR FLD FLD1 FLDCW FLDENV
50syn keyword tasmCoprocInstr FLDL2E FLDL2T FLDLG2 FLDLN2 FLDPI FLDZ FMUL FMULP
51syn keyword tasmCoprocInstr FNCLEX FNINIT FNOP FNSAVE FNSTCW FNSTENV FNSTSW
52syn keyword tasmCoprocInstr FPATAN FPREM FPREM1 FPTAN FRNDINT FRSTOR FSCALE
53syn keyword tasmCoprocInstr FSETPM FSIN FSINCOM FSQRT FST FSTP FSTP1 FSTP8
54syn keyword tasmCoprocInstr FSTP9 FSUB FSUBP FSUBR FSUBRP FTST FUCOM FUCOMI
55syn keyword tasmCoprocInstr FUCOMPP FWAIT FXAM FXCH FXCH4 FXCH7 FXTRACT FYL2X
56syn keyword tasmCoprocInstr FYL2XP1 FSTCW FCHS FSINCOS
57syn keyword tasmInstruction IDIV IMUL IN INC INT INTO INVD INVLPG IRET JMP
58syn keyword tasmInstruction LAHF LAR LDS LEA LEAVE LES LFS LGDT LGS LIDT LLDT
59syn keyword tasmInstruction LMSW LOCK LODSB LSL LSS LTR MOV MOVSX MOVZX MUL
60syn keyword tasmInstruction NEG NOP NOT OR OUT POP POPA POPAD POPF POPFD PUSH
61syn keyword tasmInstruction PUSHA PUSHAD PUSHF PUSHFD RCL RCR RDMSR RDPMC RDTSC
62syn keyword tasmInstruction REP RET ROL ROR RSM SAHF SAR SBB SGDT SHL SAL SHLD
63syn keyword tasmInstruction SHR SHRD SIDT SMSW STC STD STI STR SUB TEST VERR
64syn keyword tasmInstruction VERW WBINVD WRMSR XADD XCHG XLAT XOR
65syn keyword tasmMMXinst EMMS MOVD MOVQ PACKSSDW PACKSSWB PACKUSWB PADDB
66syn keyword tasmMMXinst PADDD PADDSB PADDSB PADDSW PADDUSB PADDUSW PADDW
67syn keyword tasmMMXinst PAND PANDN PCMPEQB PCMPEQD PCMPEQW PCMPGTB PCMPGTD
68syn keyword tasmMMXinst PCMPGTW PMADDWD PMULHW PMULLW POR PSLLD PSLLQ
69syn keyword tasmMMXinst PSLLW PSRAD PSRAW PSRLD PSRLQ PSRLW PSUBB PSUBD
70syn keyword tasmMMXinst PSUBSB PSUBSW PSUBUSB PSUBUSW PSUBW PUNPCKHBW
71syn keyword tasmMMXinst PUNPCKHBQ PUNPCKHWD PUNPCKLBW PUNPCKLDQ PUNPCKLWD
72syn keyword tasmMMXinst PXOR
73"FCMOV
74syn match tasmInstruction "\<\(CMPS\|MOVS\|OUTS\|SCAS\|STOS\|LODS\|INS\)[BWD]"
75syn match tasmInstruction "\<\(CMOV\|SET\|J\)N\=[ABCGLESXZ]\>"
76syn match tasmInstruction "\<\(CMOV\|SET\|J\)N\=[ABGL]E\>"
77syn match tasmInstruction "\<\(LOOP\|REP\)N\=[EZ]\=\>"
78syn match tasmRegister "\<[A-D][LH]\>"
79syn match tasmRegister "\<E\=\([A-D]X\|[SD]I\|[BS]P\)\>"
80syn match tasmRegister "\<[C-GS]S\>"
81syn region tasmComment start=";" end="$"
82"HACK! comment ? ... selection
83syn region tasmComment start="comment \+\$" end="\$"
84syn region tasmComment start="comment \+\~" end="\~"
85syn region tasmComment start="comment \+#" end="#"
86syn region tasmString start="'" end="'"
87syn region tasmString start='"' end='"'
88
89syn match tasmDec "\<-\=[0-9]\+\.\=[0-9]*\>"
90syn match tasmHex "\<[0-9][0-9A-F]*H\>"
91syn match tasmOct "\<[0-7]\+O\>"
92syn match tasmBin "\<[01]\+B\>"
93
94" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020095" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000096
Bram Moolenaarf37506f2016-08-31 22:22:10 +020097hi def link tasmString String
98hi def link tasmDec Number
99hi def link tasmHex Number
100hi def link tasmOct Number
101hi def link tasmBin Number
102hi def link tasmInstruction Keyword
103hi def link tasmCoprocInstr Keyword
104hi def link tasmMMXInst Keyword
105hi def link tasmDirective PreProc
106hi def link tasmRegister Identifier
107hi def link tasmProctype PreProc
108hi def link tasmComment Comment
109hi def link tasmLabel Label
Bram Moolenaar071d4272004-06-13 20:20:40 +0000110
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111
Bram Moolenaard47d5222018-12-09 20:43:55 +0100112let b:current_syntax = "tasm"
Bram Moolenaarb8ff1fb2012-02-04 21:59:01 +0100113
114let &cpo = s:cpo_save
115unlet s:cpo_save