" Vim syntax file " Hacked by Adam, from the 68000 asm syntax.... " x Language: Motorola 68000 Assembler " x Maintainer: Steve Wall " Last change: 2001 May 01 " " This is incomplete. In particular, support for 68020 and " up and 68851/68881 co-processors is partial or non-existant. " Feel free to contribute... " " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif syn case ignore " syn region asmx86Comment start="#\(\(\(include\)\|\(define\)\|\(if\)\|\(ifndef\)\|\(endif\)\|\(end\)\|\(ifdef\)\)\s\)\!" end="$" syn region asmx86Commenthash start="#\(\(define\)\|\(if\(n\=\(def\)\)\=\)\|\(include\)\|\(error\)\|\(end\(if\)\=\)\)\!" end="$" contains=asmx86Todo syn region asmx86Commenthash start="#" end="$" contains=asmx86Todo syn region asmx86Commenthash start=";" end="$" contains=asmx86Todo syn match asmx86Operator "[-+*/]" " Must occur before Comments syn match asmx86PreProc "^\s*#\s*\(\(if\(n\=\(def\)\)\=\)\|\(end\(if\)\=\)\|\(define\)\|\(error\)\|\(else\)\)\>" syn region asmx86Commentcpp start="\s*#\s*if\s\+0\+\>" end="\s*#\s*endif\>" contains=asmx86Todo syn region asmx86Commentcxx start="//" end="$" contains=asmx86Todo syn region asmx86Commentc start="/\*" end="\*/" contains=asmx86Todo " Preprocessor, basics: " First make ALL things that are behind #'s and the endline as comments. Then " boil out the stuff that is vaild, like #defines, and such.... It's " kinda tough, since we're allowing two conflicting syntaxes. But when we " consider that the "#" mechanism in the pre-processor isn't ever seen by the " underlying language, it begins to show itself, on why it is so weird. " There's going to be "#"'es left behind by the cpp, so we need to remember " that the assembler will see those as commments. We provide this commenting " Segment Registers -- syn match asmx86Reg "%[cdefgs]s" " Partial list of register symbols " General Purpose Registers -- "syn keyword asmx86Reg eax ax al ah syn match asmx86Reg "%[abcd][xhl]" syn match asmx86Reg "%e[abcd]x" " syn keyword asmx86Reg ebx bx bl bh " syn keyword asmx86Reg ecx cx cl ch " syn keyword asmx86Reg edx dx dl dh " "Special" Registers -- "syn keyword asmx86Reg ebp bp edi di esi si esp sp syn match asmx86Reg "%[bs]p" syn match asmx86Reg "%e[bs]p" syn match asmx86Reg "%[ds]i" syn match asmx86Reg "%e[ds]i" " Protection, extra, and magic registers for all the OS-type fun stuff -- syn match asmx86Reg "%[cd]r[0-3]" syn match asmx86Reg "%[td]r[3-7]" " syn keyword asmx86Reg cr0 cr1 cr2 cr3 " syn keyword asmx86Reg tr3 tr4 tr5 tr6 tr7 " syn keyword asmx86Reg dr0 dr1 dr2 dr3 dr4 dr5 dr6 dr7 syn keyword asmx86Reg gdtr ldtr idtr tr msw pdbr pfla " Page descriptor base register and page fault linear address " MC68010 "syn keyword asmx86Reg vbr sfc sfcr dfc dfcr " MC68020 "syn keyword asmx86Reg msp isp zpc cacr caar "syn keyword asmx86Reg za0 za1 za2 za3 za4 za5 za6 za7 "syn keyword asmx86Reg zd0 zd1 zd2 zd3 zd4 zd5 zd6 zd7 " MC68030 "syn keyword asmx86Reg crp srp tc ac0 ac1 acusr tt0 tt1 mmusr " MC68040 "syn keyword asmx86Reg dtt0 dtt1 itt0 itt1 urp " MC68851 registers "syn keyword asmx86Reg cal val scc crp srp drp tc ac psr pcsr "syn keyword asmx86Reg bac0 bac1 bac2 bac3 bac4 bac5 bac6 bac7 "syn keyword asmx86Reg bad0 bad1 bad2 bad3 bad4 bad5 bad6 bad7 " MC68881/82 registers "syn keyword asmx86Reg fp0 fp1 fp2 fp3 fp4 fp5 fp6 fp7 "syn keyword asmx86Reg control status iaddr fpcr fpsr fpiar "Not sure if this is the case for x86...... " M68000 opcodes - order is important! syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" "" Main x86 branch instructions... syn match asmx86Opcode_br "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode_br "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode "\" syn match asmx86Opcode_mv "\" syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" " syn match asmx86Opcode "\" syn match hexNumber "$0x[0-9a-fA-F]\+\>" syn match hexNumber "0x[0-9a-fA-F]\+\>" syn match hexNumber "\<[0-9][0-9a-fA-F]*H\>" syn match octNumber "@[0-7]\+\>" syn match octNumber "\<[0-7]\+[QO]\>" syn match binNumber "%[01]\+\>" syn match binNumber "\<[01]\+B\>" syn match decNumber "\<[0-9]\+D\=\>" syn match floatE "_*E_*" contained syn match floatExponent "_*E_*[-+]\=[0-9]\+" contained contains=floatE syn match floatNumber "[-+]\=[0-9]\+_*E_*[-+]\=[0-9]\+" contains=floatExponent syn match floatNumber "[-+]\=[0-9]\+\.[0-9]\+\(E[-+]\=[0-9]\+\)\=" contains=floatExponent syn match floatNumber ":\([0-9a-f]\+_*\)\+" " Character string constants "syn match asmx86StringError "'[ -~]*'" "syn match asmx86StringError "'[ -~]*$" "syn region asmx86String start="'" skip="''" end="'" oneline contains=asmx86CharError syn match asmx86CharError "[^ -~]" contained " Immediate data " syn match asmx86Immediate "#\$[0-9a-fA-F]\+" contains=hexNumber " syn match asmx86Immediate "#[0-9][0-9a-fA-F]*H" contains=hexNumber " syn match asmx86Immediate "#@[0-7]\+" contains=octNumber " syn match asmx86Immediate "#[0-7]\+[QO]" contains=octNumber " syn match asmx86Immediate "#%[01]\+" contains=binNumber " syn match asmx86Immediate "#[01]\+B" contains=binNumber " syn match asmx86Immediate "#[0-9]\+D\=" contains=decNumber syn match asmx86Symbol "[a-z_?.][a-z0-9_?.$]*" contained " syn match asmx86Immediate "#[a-z_?.][a-z0-9_?.]*" contains=asmx86Symbol " Special items for comments syn keyword asmx86Todo contained TODO XXX FIXME CHANGED " Operators syn match asmx86Operator "\.SIZEOF\." syn match asmx86Operator "\.STARTOF\." syn match asmx86Operator "<<" " shift left syn match asmx86Operator ">>" " shift right syn match asmx86Operator "&" " bit-wise logical and syn match asmx86Operator "!" " bit-wise logical or syn match asmx86Operator "!!" " exclusive or syn match asmx86Operator "<>" " inequality syn match asmx86Operator "=" " must be before other ops containing '=' syn match asmx86Operator ">=" syn match asmx86Operator "<=" syn match asmx86Operator "==" " operand existance - used in macro definitions " Condition code style operators syn match asmx86Operator "<[CV][CS]>" syn match asmx86Operator "" syn match asmx86Operator "" syn match asmx86Operator "<[HM]I>" syn match asmx86Operator "" syn match asmx86Operator "" syn match asmx86Operator "" " Include syn match asmx86Include "\" syn match asmx86Include display "^\s*#\s*include\>\s*["<]" contains=asmx86Included " Comments " syn match asmx86Comment ";.*" contains=asmx86Todo " syn match asmx86Comment "#.*" contains=asmx86Todo " syn match asmx86Comment "\s!.*"ms=s+1 contains=asmx86Todo " syn match asmx86Comment "^\s*[*!].*" contains=asmx86Todo " Standard macros syn match asmx86Cond "\" syn match asmx86Cond "\" syn match asmx86Cond "\" syn match asmx86Cond "\" syn match asmx86Repeat "\" syn match asmx86Repeat "\" syn match asmx86Repeat "\" syn match asmx86Repeat "\" syn match asmx86Repeat "\" " Macro definition syn match asmx86Macro "\" syn match asmx86Macro "\" syn match asmx86Macro "\" syn match asmx86MacroParam "\\[0-9]" " Conditional assembly syn match asmx86PreCond "\" syn match asmx86PreCond "\" syn match asmx86PreCond "\" " Loop control syn match asmx86PreCond "\" " Directives syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\<\(NO\)\=LIST\>" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\<\(NO\)\=PAGE\>" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Directive "\" syn match asmx86Constraintconst "\.\(\(byte\)\|\(d\=word\)\)\>" syn case match " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_asmx86_syntax_inits") if version < 508 let did_asmx86_syntax_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif " The default methods for highlighting. Can be overridden later " Comment Constant Error Identifier PreProc Special Statement Todo Type " " Constant Boolean Character Number String " Identifier Function " PreProc Define Include Macro PreCondit " Special Debug Delimiter SpecialChar SpecialComment Tag " Statement Conditional Exception Keyword Label Operator Repeat " Type StorageClass Structure Typedef HiLink asmx86Comment DarkGrey HiLink asmx86Commentcpp DarkGrey HiLink asmx86Commentc DarkGrey HiLink asmx86Commentcxx DarkGrey HiLink asmx86Commenthash DarkGrey HiLink asmx86Todo Todo HiLink hexNumber Number " Constant HiLink octNumber Number " Constant HiLink binNumber Number " Constant HiLink decNumber Number " Constant HiLink floatNumber Number " Constant HiLink floatExponent Number " Constant HiLink floatE SpecialChar " Statement "HiLink floatE Number " Constant HiLink asmx86Immediate Identifier " Statement "HiLink asmx86Symbol Constant HiLink asmx86String String " Constant HiLink asmx86Included String " Constant HiLink asmx86CharError Error HiLink asmx86StringError Error HiLink asmx86Reg Identifier HiLink asmx86Operator Identifier HiLink asmx86Include Include " PreProc HiLink asmx86Macro Macro " PreProc HiLink asmx86PreProc PreProc " PreProc HiLink asmx86MacroParam Keyword " Statement HiLink asmx86Directive Special HiLink asmx86PreCond Special HiLink asmx86Constraint Keyword HiLink asmx86Constraintconst Type HiLink asmx86Opcode Keyword HiLink asmx86Opcode_mv Special HiLink asmx86Opcode_pre Todo HiLink asmx86Opcode_br Macro HiLink asmx86Opcode_io String HiLink asmx86Opcode_o2 String " We have "normal" opcodes, "move" opcodes, "prefix" opcodes, and "branch" " opcodes..... Prefixes are rare, and we should alert them VERY specially HiLink asmx86Cond Conditional " Statement HiLink asmx86Repeat Repeat " Statement HiLink asmx86Label Type delcommand HiLink endif let b:current_syntax = "asmx86" " vim: ts=8 sw=2