Notepad++ 6502 Highlighting

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Notepad++ 6502 Highlighting
by on (#59736)
I got bored a while back and made a 'User Defined Language' file that you can use with Notepad++. If anyone wants it, you can download it from my site:

Note: The reason I didn't provide a direct link is because it actually took me a little while to figure out how to get it 'installed' so I put a video tutorial on the page on how to do it.

by on (#59757)
I think I've seen a couple of others provide their own 6502 highlighters as well. I ended up hacking out my own, due to a need for seeing a totally black background. I've tried to use the global overrides but they don't usually look nice with built in language definitions or others' definitions.

One thing that I wish Notepad++ would do is add a feature where when you open a .asm file, your user-defined highlighter is used instead of the built in one. As far as I know there is no way to do this.

by on (#59759)
Perhaps its just some dumb luck on my part but when I open up one of my .asm files, it opens the 6502 highlighting, not to mention I put a backup file extention of .650 just in case someone wants to be a little too organized.

by on (#59760)
Gradualore wrote:
I ended up hacking out my own, due to a need for seeing a totally black background.

I ended up making my own too, because my preferences are always slightly different... =)

One thing that I wish Notepad++ would do is add a feature where you can load a user defined language for a given extension. The only ones for which this works are the built in ones, as far as I know. (So the built in asm highlighter is set up for x86, not 6502).

Don't ask me what I did, but my Notepad++ highlights 6502 code in files with the "asm" extension automatically. I believe there I specified the extension(s) somewhere...

by on (#59761)
When you make the 'userDefinedLanguage' file, there is an option to add extension recognition. I am not sure how it decides which assembly to use, but I would guess it may check for keywords or something to see which one fits.

by on (#59763)
Maybe the user defined languages have the preference if they use the same extensions as the built in languages?

by on (#59781)
Hmm, I'll have to take another look at that. I doubt it was dumb luck that it worked for you, I probably just didn't dig deep enough to make it work. All I did was go into I think view/user-defined-dialogue, and I did associate it with ".asm, " but so far npp still opens the default asm language. Did you actually replace the default one with your own or..?

by on (#59808)
I meant dumb luck that the .asm extension took priority in the user-lang file as opposed to the already existent assembly language file.

by on (#59810)
Turns out the problem was, I had entered ".asm" instead of just "asm". When I changed it to "asm" my user defined lang overrode the default one. How refreshing to finally be able to open all my source files at once and not have to select my lang for each one I want to look at. :) I can't believe I put up with that for so long.

by on (#59811)
Isn't that the way of things? The most mundane little detail can screw up an entire process.

by on (#59812)
I think I had this problem before, just forgot about it.

For now I'm using Notepad++ but if my prototype for my ca65 text editor goes well, I may use it less for 6502 coding. The current concept is to allow syntax highlighting, pull down with name of symbols/function for finding them, suggestion for name based on the symbols defined in your code etc.

If it become more than a prototype, I may post it someday. For now I can only work only a few minutes per day during lunch time so I'm not expecting anything for a while. I have a few other ideas but unless I can make them work, I won't mention them yet.

by on (#70865)
Sorry to bring this back up, but I just got tired of notepad and wanted something more useful but with the same. Got N++ and now this and want to say thanks so much. This is so helpful! Your work definitely doesn't go cherished here! :D

by on (#70866)
The main problem with Notepad (the built in Windows program) is that it doesn't automatically indent code, so every new line you have to hit the TAB key. At least that's what bothered me the most.

by on (#70867)
Another problem I have with notepad is when you hit tab, it is about the size of two tabs in pretty much any code editor. I know some people advocate the 'two spaces' idea in lieu of a tab but I cannot do it.

by on (#70868)
Maybe that is me who am stupid, but I never got any of those downloaded .xml files to work (there 2 or 3 links around on this boards).

I made my own, but then I can use it but I have to manually select it every time I open a .asm file (which default to 386 ASM).

by on (#70869)
IIRC, you just have to replace the "userDefineLang.xml" file, and at least in my case, since 6502 asm is assigned to the "asm" extension, it takes priority over the built in asm definition (I think user definitions have priority over built in definitions if they share the same extension(s)), so it already opens with 6502 selected.

by on (#70873)
Nah, I saw that but passed. It turns out if you put it in the appdata file for notepad++, it appears there. But thanks! ^_^ (And plus mine didn't have that file! ) :?

by on (#70874)
Well here is what I have in the XML:

    <UserLang name="6502" ext="650 asm">

Granted, I hand coded the XML file but this is what I have for the extensions. It recognizes both a .asm and .650 (in case you want a different extension). Perhaps you could try opening your userDefineLang.xml file and check the line that has the 'ext' attribute.

If you don't know where the file is, use run and type %APPDATA%/notepad++

by on (#77183)
Here's something I whipped up today. It's a tad more unconventional than the other ones I've seen, but I like it:

It's based on miau's work.