blob: 054f6390e6c165088d43aad39348e50bb9a3c95e [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
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
11syn case ignore
12
13" Common Z80 Assembly instructions
14syn keyword z8aInstruction adc add and bit ccf cp cpd cpdr cpi cpir cpl
15syn keyword z8aInstruction daa di djnz ei exx halt im in
16syn keyword z8aInstruction ind ini indr inir jp jr ld ldd lddr ldi ldir
17syn keyword z8aInstruction neg nop or otdr otir out outd outi
18syn keyword z8aInstruction res rl rla rlc rlca rld
19syn keyword z8aInstruction rr rra rrc rrca rrd sbc scf set sla sra
20syn keyword z8aInstruction srl sub xor
21" syn keyword z8aInstruction push pop call ret reti retn inc dec ex rst
22
23" Any other stuff
24syn match z8aIdentifier "[a-z_][a-z0-9_]*"
25
26" Instructions changing stack
27syn keyword z8aSpecInst push pop call ret reti retn rst
28syn match z8aInstruction "\<inc\>"
29syn match z8aInstruction "\<dec\>"
30syn match z8aInstruction "\<ex\>"
31syn match z8aSpecInst "\<inc\s\+sp\>"me=s+3
32syn match z8aSpecInst "\<dec\s\+sp\>"me=s+3
33syn match z8aSpecInst "\<ex\s\+(\s*sp\s*)\s*,\s*hl\>"me=s+2
34
35"Labels
36syn match z8aLabel "[a-z_][a-z0-9_]*:"
37syn match z8aSpecialLabel "[a-z_][a-z0-9_]*::"
38
39" PreProcessor commands
40syn match z8aPreProc "\.org"
41syn match z8aPreProc "\.globl"
42syn match z8aPreProc "\.db"
43syn match z8aPreProc "\.dw"
44syn match z8aPreProc "\.ds"
45syn match z8aPreProc "\.byte"
46syn match z8aPreProc "\.word"
47syn match z8aPreProc "\.blkb"
48syn match z8aPreProc "\.blkw"
49syn match z8aPreProc "\.ascii"
50syn match z8aPreProc "\.asciz"
51syn match z8aPreProc "\.module"
52syn match z8aPreProc "\.title"
53syn match z8aPreProc "\.sbttl"
54syn match z8aPreProc "\.even"
55syn match z8aPreProc "\.odd"
56syn match z8aPreProc "\.area"
57syn match z8aPreProc "\.page"
58syn match z8aPreProc "\.setdp"
59syn match z8aPreProc "\.radix"
60syn match z8aInclude "\.include"
61syn match z8aPreCondit "\.if"
62syn match z8aPreCondit "\.else"
63syn match z8aPreCondit "\.endif"
64
65" Common strings
66syn match z8aString "\".*\""
67syn match z8aString "\'.*\'"
68
69" Numbers
70syn match z8aNumber "[0-9]\+"
71syn match z8aNumber "0[xXhH][0-9a-fA-F]\+"
72syn match z8aNumber "0[bB][0-1]*"
73syn match z8aNumber "0[oO\@qQ][0-7]\+"
74syn match z8aNumber "0[dD][0-9]\+"
75
76" Character constant
77syn match z8aString "\#\'."hs=s+1
78
79" Comments
80syn match z8aComment ";.*"
81
82syn case match
83
84" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020085" Only when an item doesn't have highlighting yet
86command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020088HiLink z8aSection Special
89HiLink z8aLabel Label
90HiLink z8aSpecialLabel Label
91HiLink z8aComment Comment
92HiLink z8aInstruction Statement
93HiLink z8aSpecInst Statement
94HiLink z8aInclude Include
95HiLink z8aPreCondit PreCondit
96HiLink z8aPreProc PreProc
97HiLink z8aNumber Number
98HiLink z8aString String
Bram Moolenaar071d4272004-06-13 20:20:40 +000099
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200100delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101
102let b:current_syntax = "z8a"
103" vim: ts=8