blob: 94198e6a422ba366816a41d6d6693d6124f05776 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: xa 6502 cross assembler
Bram Moolenaar438f67a2014-01-07 06:09:28 +01003" Maintainer: Clemens Kirchgatterer <clemens@1541.org>
4" Last Change: 2014 Jan 05
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
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" Opcodes
17syn match a65Opcode "\<PHP\($\|\s\)" nextgroup=a65Address
18syn match a65Opcode "\<PLA\($\|\s\)" nextgroup=a65Address
19syn match a65Opcode "\<PLX\($\|\s\)" nextgroup=a65Address
20syn match a65Opcode "\<PLY\($\|\s\)" nextgroup=a65Address
21syn match a65Opcode "\<SEC\($\|\s\)" nextgroup=a65Address
22syn match a65Opcode "\<CLD\($\|\s\)" nextgroup=a65Address
23syn match a65Opcode "\<SED\($\|\s\)" nextgroup=a65Address
24syn match a65Opcode "\<CLI\($\|\s\)" nextgroup=a65Address
25syn match a65Opcode "\<BVC\($\|\s\)" nextgroup=a65Address
26syn match a65Opcode "\<BVS\($\|\s\)" nextgroup=a65Address
27syn match a65Opcode "\<BCS\($\|\s\)" nextgroup=a65Address
28syn match a65Opcode "\<BCC\($\|\s\)" nextgroup=a65Address
29syn match a65Opcode "\<DEY\($\|\s\)" nextgroup=a65Address
30syn match a65Opcode "\<DEC\($\|\s\)" nextgroup=a65Address
31syn match a65Opcode "\<CMP\($\|\s\)" nextgroup=a65Address
32syn match a65Opcode "\<CPX\($\|\s\)" nextgroup=a65Address
33syn match a65Opcode "\<BIT\($\|\s\)" nextgroup=a65Address
34syn match a65Opcode "\<ROL\($\|\s\)" nextgroup=a65Address
35syn match a65Opcode "\<ROR\($\|\s\)" nextgroup=a65Address
36syn match a65Opcode "\<ASL\($\|\s\)" nextgroup=a65Address
37syn match a65Opcode "\<TXA\($\|\s\)" nextgroup=a65Address
38syn match a65Opcode "\<TYA\($\|\s\)" nextgroup=a65Address
39syn match a65Opcode "\<TSX\($\|\s\)" nextgroup=a65Address
40syn match a65Opcode "\<TXS\($\|\s\)" nextgroup=a65Address
41syn match a65Opcode "\<LDA\($\|\s\)" nextgroup=a65Address
42syn match a65Opcode "\<LDX\($\|\s\)" nextgroup=a65Address
43syn match a65Opcode "\<LDY\($\|\s\)" nextgroup=a65Address
44syn match a65Opcode "\<STA\($\|\s\)" nextgroup=a65Address
45syn match a65Opcode "\<PLP\($\|\s\)" nextgroup=a65Address
46syn match a65Opcode "\<BRK\($\|\s\)" nextgroup=a65Address
47syn match a65Opcode "\<RTI\($\|\s\)" nextgroup=a65Address
48syn match a65Opcode "\<NOP\($\|\s\)" nextgroup=a65Address
49syn match a65Opcode "\<SEI\($\|\s\)" nextgroup=a65Address
50syn match a65Opcode "\<CLV\($\|\s\)" nextgroup=a65Address
51syn match a65Opcode "\<PHA\($\|\s\)" nextgroup=a65Address
52syn match a65Opcode "\<PHX\($\|\s\)" nextgroup=a65Address
53syn match a65Opcode "\<BRA\($\|\s\)" nextgroup=a65Address
54syn match a65Opcode "\<JMP\($\|\s\)" nextgroup=a65Address
55syn match a65Opcode "\<JSR\($\|\s\)" nextgroup=a65Address
56syn match a65Opcode "\<RTS\($\|\s\)" nextgroup=a65Address
57syn match a65Opcode "\<CPY\($\|\s\)" nextgroup=a65Address
58syn match a65Opcode "\<BNE\($\|\s\)" nextgroup=a65Address
59syn match a65Opcode "\<BEQ\($\|\s\)" nextgroup=a65Address
60syn match a65Opcode "\<BMI\($\|\s\)" nextgroup=a65Address
61syn match a65Opcode "\<LSR\($\|\s\)" nextgroup=a65Address
62syn match a65Opcode "\<INX\($\|\s\)" nextgroup=a65Address
63syn match a65Opcode "\<INY\($\|\s\)" nextgroup=a65Address
64syn match a65Opcode "\<INC\($\|\s\)" nextgroup=a65Address
65syn match a65Opcode "\<ADC\($\|\s\)" nextgroup=a65Address
66syn match a65Opcode "\<SBC\($\|\s\)" nextgroup=a65Address
67syn match a65Opcode "\<AND\($\|\s\)" nextgroup=a65Address
68syn match a65Opcode "\<ORA\($\|\s\)" nextgroup=a65Address
69syn match a65Opcode "\<STX\($\|\s\)" nextgroup=a65Address
70syn match a65Opcode "\<STY\($\|\s\)" nextgroup=a65Address
71syn match a65Opcode "\<STZ\($\|\s\)" nextgroup=a65Address
72syn match a65Opcode "\<EOR\($\|\s\)" nextgroup=a65Address
73syn match a65Opcode "\<DEX\($\|\s\)" nextgroup=a65Address
74syn match a65Opcode "\<BPL\($\|\s\)" nextgroup=a65Address
75syn match a65Opcode "\<CLC\($\|\s\)" nextgroup=a65Address
76syn match a65Opcode "\<PHY\($\|\s\)" nextgroup=a65Address
77syn match a65Opcode "\<TRB\($\|\s\)" nextgroup=a65Address
78syn match a65Opcode "\<BBR\($\|\s\)" nextgroup=a65Address
79syn match a65Opcode "\<BBS\($\|\s\)" nextgroup=a65Address
80syn match a65Opcode "\<RMB\($\|\s\)" nextgroup=a65Address
81syn match a65Opcode "\<SMB\($\|\s\)" nextgroup=a65Address
82syn match a65Opcode "\<TAY\($\|\s\)" nextgroup=a65Address
83syn match a65Opcode "\<TAX\($\|\s\)" nextgroup=a65Address
84
85" Addresses
86syn match a65Address "\s*!\=$[0-9A-F]\{2}\($\|\s\)"
87syn match a65Address "\s*!\=$[0-9A-F]\{4}\($\|\s\)"
88syn match a65Address "\s*!\=$[0-9A-F]\{2},X\($\|\s\)"
89syn match a65Address "\s*!\=$[0-9A-F]\{4},X\($\|\s\)"
90syn match a65Address "\s*!\=$[0-9A-F]\{2},Y\($\|\s\)"
91syn match a65Address "\s*!\=$[0-9A-F]\{4},Y\($\|\s\)"
92syn match a65Address "\s*($[0-9A-F]\{2})\($\|\s\)"
93syn match a65Address "\s*($[0-9A-F]\{4})\($\|\s\)"
94syn match a65Address "\s*($[0-9A-F]\{2},X)\($\|\s\)"
95syn match a65Address "\s*($[0-9A-F]\{2}),Y\($\|\s\)"
96
97" Numbers
98syn match a65Number "#\=[0-9]*\>"
99syn match a65Number "#\=$[0-9A-F]*\>"
100syn match a65Number "#\=&[0-7]*\>"
101syn match a65Number "#\=%[01]*\>"
102
103syn case match
104
105" Types
106syn match a65Type "\(^\|\s\)\.byt\($\|\s\)"
107syn match a65Type "\(^\|\s\)\.word\($\|\s\)"
108syn match a65Type "\(^\|\s\)\.asc\($\|\s\)"
109syn match a65Type "\(^\|\s\)\.dsb\($\|\s\)"
110syn match a65Type "\(^\|\s\)\.fopt\($\|\s\)"
111syn match a65Type "\(^\|\s\)\.text\($\|\s\)"
112syn match a65Type "\(^\|\s\)\.data\($\|\s\)"
113syn match a65Type "\(^\|\s\)\.bss\($\|\s\)"
114syn match a65Type "\(^\|\s\)\.zero\($\|\s\)"
115syn match a65Type "\(^\|\s\)\.align\($\|\s\)"
116
117" Blocks
118syn match a65Section "\(^\|\s\)\.(\($\|\s\)"
119syn match a65Section "\(^\|\s\)\.)\($\|\s\)"
120
121" Strings
122syn match a65String "\".*\""
123
124" Programm Counter
125syn region a65PC start="\*=" end="\>" keepend
126
127" HI/LO Byte
128syn region a65HiLo start="#[<>]" end="$\|\s" contains=a65Comment keepend
129
130" Comments
131syn keyword a65Todo TODO XXX FIXME BUG contained
132syn match a65Comment ";.*"hs=s+1 contains=a65Todo
133syn region a65Comment start="/\*" end="\*/" contains=a65Todo,a65Comment
134
135" Preprocessor
136syn region a65PreProc start="^#" end="$" contains=a65Comment,a65Continue
137syn match a65End excludenl /end$/ contained
138syn match a65Continue "\\$" contained
139
140" Define the default highlighting.
141" For version 5.7 and earlier: only when not done already
142" For version 5.8 and later: only when an item doesn't have highlighting yet
143if version >= 508 || !exists("did_a65_syntax_inits")
144 if version < 508
145 let did_a65_syntax_inits = 1
146 command -nargs=+ HiLink hi link <args>
147 else
148 command -nargs=+ HiLink hi def link <args>
149 endif
150
151 HiLink a65Section Special
152 HiLink a65Address Special
153 HiLink a65Comment Comment
154 HiLink a65PreProc PreProc
155 HiLink a65Number Number
156 HiLink a65String String
157 HiLink a65Type Statement
158 HiLink a65Opcode Type
159 HiLink a65PC Error
160 HiLink a65Todo Todo
161 HiLink a65HiLo Number
162
163 delcommand HiLink
164endif
165
166let b:current_syntax = "a65"