2 " Language: Z80 assembler asz80
3 " Maintainer: Milan Pikula <www@fornax.elf.stuba.sk>
4 " Last Change: 2003 May 11
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
16 " Common Z80 Assembly instructions
17 syn keyword z8aInstruction adc add and bit ccf cp cpd cpdr cpi cpir cpl
18 syn keyword z8aInstruction daa di djnz ei exx halt im in
19 syn keyword z8aInstruction ind ini indr inir jp jr ld ldd lddr ldi ldir
20 syn keyword z8aInstruction neg nop or otdr otir out outd outi
21 syn keyword z8aInstruction res rl rla rlc rlca rld
22 syn keyword z8aInstruction rr rra rrc rrca rrd sbc scf set sla sra
23 syn keyword z8aInstruction srl sub xor
24 " syn keyword z8aInstruction push pop call ret reti retn inc dec ex rst
27 syn match z8aIdentifier "[a-z_][a-z0-9_]*"
29 " Instructions changing stack
30 syn keyword z8aSpecInst push pop call ret reti retn rst
31 syn match z8aInstruction "\<inc\>"
32 syn match z8aInstruction "\<dec\>"
33 syn match z8aInstruction "\<ex\>"
34 syn match z8aSpecInst "\<inc\s\+sp\>"me=s+3
35 syn match z8aSpecInst "\<dec\s\+sp\>"me=s+3
36 syn match z8aSpecInst "\<ex\s\+(\s*sp\s*)\s*,\s*hl\>"me=s+2
39 syn match z8aLabel "[a-z_][a-z0-9_]*:"
40 syn match z8aSpecialLabel "[a-z_][a-z0-9_]*::"
42 " PreProcessor commands
43 syn match z8aPreProc "\.org"
44 syn match z8aPreProc "\.globl"
45 syn match z8aPreProc "\.db"
46 syn match z8aPreProc "\.dw"
47 syn match z8aPreProc "\.ds"
48 syn match z8aPreProc "\.byte"
49 syn match z8aPreProc "\.word"
50 syn match z8aPreProc "\.blkb"
51 syn match z8aPreProc "\.blkw"
52 syn match z8aPreProc "\.ascii"
53 syn match z8aPreProc "\.asciz"
54 syn match z8aPreProc "\.module"
55 syn match z8aPreProc "\.title"
56 syn match z8aPreProc "\.sbttl"
57 syn match z8aPreProc "\.even"
58 syn match z8aPreProc "\.odd"
59 syn match z8aPreProc "\.area"
60 syn match z8aPreProc "\.page"
61 syn match z8aPreProc "\.setdp"
62 syn match z8aPreProc "\.radix"
63 syn match z8aInclude "\.include"
64 syn match z8aPreCondit "\.if"
65 syn match z8aPreCondit "\.else"
66 syn match z8aPreCondit "\.endif"
69 syn match z8aString "\".*\""
70 syn match z8aString "\'.*\'"
73 syn match z8aNumber "[0-9]\+"
74 syn match z8aNumber "0[xXhH][0-9a-fA-F]\+"
75 syn match z8aNumber "0[bB][0-1]*"
76 syn match z8aNumber "0[oO\@qQ][0-7]\+"
77 syn match z8aNumber "0[dD][0-9]\+"
80 syn match z8aString "\#\'."hs=s+1
83 syn match z8aComment ";.*"
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
90 if version >= 508 || !exists("did_z8a_syntax_inits")
92 let did_z8a_syntax_inits = 1
93 command -nargs=+ HiLink hi link <args>
95 command -nargs=+ HiLink hi def link <args>
98 HiLink z8aSection Special
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
113 let b:current_syntax = "z8a"