This week I decided to pick up the Nerdy Nights tutorial and learn some 6502. I wanted a UDL (user-defined language) for syntax highlighting but I couldn't find one. Everything was either a broken link or too old for the current NP++ so I decided to make my own! It's based off the default assembly highlighting and supports all of the ASM6 directives. Here's a preview:
Installation:
Note:
The UDL system of Notepad++ is not perfect so I had to do some hacks to get this to work. If you type an array of values, the commas are highlighted along with the numbers. There's nothing I can do to fix this. And if a number is touching the EOF, it will not highlight correctly. Lastly, you need to use the ASM6 file extension so that you don't get any conflicts with the default Assembly highlighting. Other than that, this should work well and be easily adapted for other assemblers by changing the directives in the 3rd keyword list. If you do this, feel free to share below!
Finally, here's the code:
Installation:
- Copy the code below and save it as an XML file.
- In Notepad++, go to Language -> Define Your Language... -> Import.
- Import the XML file and it will appear in the Language menu.
Note:
The UDL system of Notepad++ is not perfect so I had to do some hacks to get this to work. If you type an array of values, the commas are highlighted along with the numbers. There's nothing I can do to fix this. And if a number is touching the EOF, it will not highlight correctly. Lastly, you need to use the ASM6 file extension so that you don't get any conflicts with the default Assembly highlighting. Other than that, this should work well and be easily adapted for other assemblers by changing the directives in the 3rd keyword list. If you do this, feel free to share below!
Finally, here's the code:
Code:
<NotepadPlus>
<UserLang name="ASM6" ext="asm6" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00; 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"># $ % 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</Keywords>
<Keywords name="Numbers, extras1"># $ % A B C D E F a b c d e f</Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2">,</Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">( ) + - ~ ! < > * / % = ! & ^ |</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open"></Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close"></Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">adc and asl bcc bcs beq bit bmi bne bpl brk bvc bvs clc cld cli clv cmp cpx cpy dec dex dey eor inc inx iny jmp jsr lda ldx ldy lsr nop ora pha php pla plp rol ror rti rts sbc sec sed sei sta stx sty tax tay tsx txa txs tya</Keywords>
<Keywords name="Keywords2">a x y</Keywords>
<Keywords name="Keywords3">align base bin byte db dc.b dc.w dcb dcw dh dl ds.b ds.w dsb dsw dw else elseif ende endif endm endr enum equ error fillvalue hex if ifdef ifndef incbin include incsrc macro org pad rept word .align .base .bin .byte .db .dc.b .dc.w .dcb .dcw .dh .dl .ds.b .ds.w .dsb .dsw .dw .else .elseif .ende .endif .endm .endr .enum .equ .error .fillvalue .hex .if .ifdef .ifndef .incbin .include .incsrc .macro .org .pad .rept .word</Keywords>
<Keywords name="Keywords4"></Keywords>
<Keywords name="Keywords5"></Keywords>
<Keywords name="Keywords6"></Keywords>
<Keywords name="Keywords7"></Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00' 01 02' 03" 04 05" 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="00D200" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="00FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF8000" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="FFCC00" bgColor="000000" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="8080FF" bgColor="000000" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="8080FF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="FFCC00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="66FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="66FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
<UserLang name="ASM6" ext="asm6" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00; 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"># $ % 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</Keywords>
<Keywords name="Numbers, extras1"># $ % A B C D E F a b c d e f</Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2">,</Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">( ) + - ~ ! < > * / % = ! & ^ |</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open"></Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close"></Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">adc and asl bcc bcs beq bit bmi bne bpl brk bvc bvs clc cld cli clv cmp cpx cpy dec dex dey eor inc inx iny jmp jsr lda ldx ldy lsr nop ora pha php pla plp rol ror rti rts sbc sec sed sei sta stx sty tax tay tsx txa txs tya</Keywords>
<Keywords name="Keywords2">a x y</Keywords>
<Keywords name="Keywords3">align base bin byte db dc.b dc.w dcb dcw dh dl ds.b ds.w dsb dsw dw else elseif ende endif endm endr enum equ error fillvalue hex if ifdef ifndef incbin include incsrc macro org pad rept word .align .base .bin .byte .db .dc.b .dc.w .dcb .dcw .dh .dl .ds.b .ds.w .dsb .dsw .dw .else .elseif .ende .endif .endm .endr .enum .equ .error .fillvalue .hex .if .ifdef .ifndef .incbin .include .incsrc .macro .org .pad .rept .word</Keywords>
<Keywords name="Keywords4"></Keywords>
<Keywords name="Keywords5"></Keywords>
<Keywords name="Keywords6"></Keywords>
<Keywords name="Keywords7"></Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00' 01 02' 03" 04 05" 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="00D200" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="00FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF8000" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="FFCC00" bgColor="000000" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="8080FF" bgColor="000000" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="8080FF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="FFCC00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="66FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="66FF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>