blob: a3a8a2bbdf6be7c792222c6e410783db3f9df979 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Z80 assembler asz80
3" Maintainer: Milan Pikula <www@fornax.elf.stuba.sk>
4" Last Change: 2003 May 11
5
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
14syn case ignore
15
16" Common Z80 Assembly instructions
17syn keyword z8aInstruction adc add and bit ccf cp cpd cpdr cpi cpir cpl
18syn keyword z8aInstruction daa di djnz ei exx halt im in
19syn keyword z8aInstruction ind ini indr inir jp jr ld ldd lddr ldi ldir
20syn keyword z8aInstruction neg nop or otdr otir out outd outi
21syn keyword z8aInstruction res rl rla rlc rlca rld
22syn keyword z8aInstruction rr rra rrc rrca rrd sbc scf set sla sra
23syn keyword z8aInstruction srl sub xor
24" syn keyword z8aInstruction push pop call ret reti retn inc dec ex rst
25
26" Any other stuff
27syn match z8aIdentifier "[a-z_][a-z0-9_]*"
28
29" Instructions changing stack
30syn keyword z8aSpecInst push pop call ret reti retn rst
31syn match z8aInstruction "\<inc\>"
32syn match z8aInstruction "\<dec\>"
33syn match z8aInstruction "\<ex\>"
34syn match z8aSpecInst "\<inc\s\+sp\>"me=s+3
35syn match z8aSpecInst "\<dec\s\+sp\>"me=s+3
36syn match z8aSpecInst "\<ex\s\+(\s*sp\s*)\s*,\s*hl\>"me=s+2
37
38"Labels
39syn match z8aLabel "[a-z_][a-z0-9_]*:"
40syn match z8aSpecialLabel "[a-z_][a-z0-9_]*::"
41
42" PreProcessor commands
43syn match z8aPreProc "\.org"
44syn match z8aPreProc "\.globl"
45syn match z8aPreProc "\.db"
46syn match z8aPreProc "\.dw"
47syn match z8aPreProc "\.ds"
48syn match z8aPreProc "\.byte"
49syn match z8aPreProc "\.word"
50syn match z8aPreProc "\.blkb"
51syn match z8aPreProc "\.blkw"
52syn match z8aPreProc "\.ascii"
53syn match z8aPreProc "\.asciz"
54syn match z8aPreProc "\.module"
55syn match z8aPreProc "\.title"
56syn match z8aPreProc "\.sbttl"
57syn match z8aPreProc "\.even"
58syn match z8aPreProc "\.odd"
59syn match z8aPreProc "\.area"
60syn match z8aPreProc "\.page"
61syn match z8aPreProc "\.setdp"
62syn match z8aPreProc "\.radix"
63syn match z8aInclude "\.include"
64syn match z8aPreCondit "\.if"
65syn match z8aPreCondit "\.else"
66syn match z8aPreCondit "\.endif"
67
68" Common strings
69syn match z8aString "\".*\""
70syn match z8aString "\'.*\'"
71
72" Numbers
73syn match z8aNumber "[0-9]\+"
74syn match z8aNumber "0[xXhH][0-9a-fA-F]\+"
75syn match z8aNumber "0[bB][0-1]*"
76syn match z8aNumber "0[oO\@qQ][0-7]\+"
77syn match z8aNumber "0[dD][0-9]\+"
78
79" Character constant
80syn match z8aString "\#\'."hs=s+1
81
82" Comments
83syn match z8aComment ";.*"
84
85syn case match
86
87" Define the default highlighting.
88" For version 5.7 and earlier: only when not done already
89" For version 5.8 and later: only when an item doesn't have highlighting yet
90if version >= 508 || !exists("did_z8a_syntax_inits")
91 if version < 508
92 let did_z8a_syntax_inits = 1
93 command -nargs=+ HiLink hi link <args>
94 else
95 command -nargs=+ HiLink hi def link <args>
96 endif
97
98 HiLink z8aSection Special
99 HiLink z8aLabel Label
100 HiLink z8aSpecialLabel Label
101 HiLink z8aComment Comment
102 HiLink z8aInstruction Statement
103 HiLink z8aSpecInst Statement
104 HiLink z8aInclude Include
105 HiLink z8aPreCondit PreCondit
106 HiLink z8aPreProc PreProc
107 HiLink z8aNumber Number
108 HiLink z8aString String
109
110 delcommand HiLink
111endif
112
113let b:current_syntax = "z8a"
114" vim: ts=8