blob: adc964ea9602394ea0cb8575d3e5e9f5961567e9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: PIC16F84 Assembler (Microchip's microcontroller)
3" Maintainer: Aleksandar Veselinovic <aleksa@cs.cmu.com>
4" Last Change: 2003 May 11
5" URL: http://galeb.etf.bg.ac.yu/~alexa/vim/syntax/pic.vim
6" Revision: 1.01
7
8" For version 5.x: Clear all syntax items
9" For version 6.x: Quit when a syntax file was already loaded
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
15
16syn case match
17syn keyword picTodo NOTE TODO XXX contained
18
19syn case ignore
20
21syn match picIdentifier "[a-z_$][a-z0-9_$]*"
22syn match picLabel "^[A-Z_$][A-Z0-9_$]*"
23syn match picLabel "^[A-Z_$][A-Z0-9_$]*:"me=e-1
24
25syn match picASCII "A\='.'"
26syn match picBinary "B'[0-1]\+'"
27syn match picDecimal "D'\d\+'"
28syn match picDecimal "\d\+"
29syn match picHexadecimal "0x\x\+"
30syn match picHexadecimal "H'\x\+'"
31syn match picHexadecimal "[0-9]\x*h"
32syn match picOctal "O'[0-7]\o*'"
33
34
35syn match picComment ";.*" contains=picTodo
36
37syn region picString start=+"+ end=+"+
38
39syn keyword picRegister INDF TMR0 PCL STATUS FSR PORTA PORTB
40syn keyword picRegister EEDATA EEADR PCLATH INTCON INDF OPTION_REG PCL
41syn keyword picRegister FSR TRISA TRISB EECON1 EECON2 INTCON OPTION
42
43
44" Register --- bits
45
46" STATUS
47syn keyword picRegisterPart IRP RP1 RP0 TO PD Z DC C
48
49" PORTA
50syn keyword picRegisterPart T0CKI
51syn match picRegisterPart "RA[0-4]"
52
53" PORTB
54syn keyword picRegisterPart INT
55syn match picRegisterPart "RB[0-7]"
56
57" INTCON
58syn keyword picRegisterPart GIE EEIE T0IE INTE RBIE T0IF INTF RBIF
59
60" OPTION
61syn keyword picRegisterPart RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0
62
63" EECON2
64syn keyword picRegisterPart EEIF WRERR WREN WR RD
65
66" INTCON
67syn keyword picRegisterPart GIE EEIE T0IE INTE RBIE T0IF INTF RBIF
68
69
70" OpCodes...
71syn keyword picOpcode ADDWF ANDWF CLRF CLRW COMF DECF DECFSZ INCF INCFSZ
72syn keyword picOpcode IORWF MOVF MOVWF NOP RLF RRF SUBWF SWAPF XORWF
73syn keyword picOpcode BCF BSF BTFSC BTFSS
74syn keyword picOpcode ADDLW ANDLW CALL CLRWDT GOTO IORLW MOVLW RETFIE
75syn keyword picOpcode RETLW RETURN SLEEP SUBLW XORLW
76syn keyword picOpcode GOTO
77
78
79" Directives
80syn keyword picDirective __BADRAM BANKISEL BANKSEL CBLOCK CODE __CONFIG
81syn keyword picDirective CONSTANT DATA DB DE DT DW ELSE END ENDC
82syn keyword picDirective ENDIF ENDM ENDW EQU ERROR ERRORLEVEL EXITM EXPAND
83syn keyword picDirective EXTERN FILL GLOBAL IDATA __IDLOCS IF IFDEF IFNDEF
84syn keyword picDirective INCLUDE LIST LOCAL MACRO __MAXRAM MESSG NOEXPAND
85syn keyword picDirective NOLIST ORG PAGE PAGESEL PROCESSOR RADIX RES SET
86syn keyword picDirective SPACE SUBTITLE TITLE UDATA UDATA_OVR UDATA_SHR
87syn keyword picDirective VARIABLE WHILE INCLUDE
88syn match picDirective "#\=UNDEFINE"
89syn match picDirective "#\=INCLUDE"
90syn match picDirective "#\=DEFINE"
91
92
93" Define the default highlighting.
94" For version 5.7 and earlier: only when not done already
95" For version 5.8 and later: only when an item doesn't have highlighting yet
96if version >= 508 || !exists("did_pic16f84_syntax_inits")
97 if version < 508
98 let did_pic16f84_syntax_inits = 1
99 command -nargs=+ HiLink hi link <args>
100 else
101 command -nargs=+ HiLink hi def link <args>
102 endif
103
104 HiLink picTodo Todo
105 HiLink picComment Comment
106 HiLink picDirective Statement
107 HiLink picLabel Label
108 HiLink picString String
109
110 "HiLink picOpcode Keyword
111 "HiLink picRegister Structure
112 "HiLink picRegisterPart Special
113
114 HiLink picASCII String
115 HiLink picBinary Number
116 HiLink picDecimal Number
117 HiLink picHexadecimal Number
118 HiLink picOctal Number
119
120 HiLink picIdentifier Identifier
121
122 delcommand HiLink
123endif
124
125let b:current_syntax = "pic"
126
127" vim: ts=8