GeSHi Language File for PIC Assembler (18Fxxxx)
Even though it lists MPASM among its supported formats, GeSHi highlighting has always been uneven and incomplete, at least when applied to my PIC18F242-based code. For example:
It’s obvious that some opcodes and registers aren’t recognized, and bit names like
TMR0ON are completely ignored. Identifying the
TMR0H register as
0H is just annoying.
I saw that a relatively recent update added a “PIC16” format, and it definitely offered an improvement, which is to say, the opcodes were uniformly ignored:
Finally, I just decided to create a language file to suit my own needs. It’s far from exhaustive, but at least it identifies the registers on the chip I’m using, as well as fuse values, segment identifiers, bit names, and preprocessor directives supported by
gpasm. Here’s the kind of highlighting I’ve been looking for:
Still not perfect in every case, but GeSHi does a fairly good job for what it is. The GeSHi Filter module for Drupal provides a very convenient interface, so I’m satisfied with this solution for now. See Non-Responsive Flash Memory or Function Pointers in PIC Assembler for more extensive examples.
I have no intention of submitting this language file for inclusion in the official GeSHi release, so it doesn’t bother me that GeSHi’s
langcheck.php validation script complains about a few points (the file header comments don’t match a prescribed format, the tab spacing is wrong2, and the file is not described as part of GeSHi). It’s released under GPL v2, though (same as GeSHi), so feel free to use it however you see fit. [Download pic18.php]