Searching \ for 'Xemacs Syntax Hightlighting for PIC Assembler' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Xemacs Syntax Hightlighting for PIC Assembler'.

Truncated match.
PICList Thread
'Xemacs Syntax Hightlighting for PIC Assembler'
1999\01\12@083327 by James Cameron

flavicon
face
part 0 7824 bytes
I've done a first draft of adding colour syntactic highlighting to PIC
assembler files in the Xemacs programmer's editor and kitchen sink.
Attached is a unified context diff of, on my system, the file ...
/usr/share/emacs/20.3/lisp/progmodes/asm-mode.el

The colour decisions I made classified text into these categories ...

       - variables and constants (equ, cblock, endc),
       - assembler built-in opcodes (ifdef, local, org, end, etc),
       - known file register addreess (porta, portb, intcon, etc),
       - instructions that affect call stack, (call, return, retlw),
       - instructions that affect PC, (goto, decfsz, pcl),
       - CLRWDT in bright red.

I'm afraid some of the regular expressions are brain-dead, but that's
because I don't yet know how they work.  I'm amazed I got this far.  If
anybody out there knows what to do to improve them, please do it and
send back the changes.


(*)  Actually, Xemacs runs on other operating systems, it's just that
people who have adopted Linux tend to be quite aware of Xemacs.  More
information on Xemacs is available at <http://www.xemacs.org/>

--
James Cameron                                      (spam_OUTcameronTakeThisOuTspamstl.dec.com)

OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.

"Specialisation is for insects." -- Robert Heinlein.
--- asm-mode.el.saved   Mon Jan 11 21:39:06 1999
+++ asm-mode.el Tue Jan 12 21:03:49 1999
@@ -79,10 +79,113 @@
  (define-key asm-mode-map "\C-m"      'asm-newline)
  )

+;; comment string keyword builtin function-name variable-name type constant
+;; warning
(defconst asm-font-lock-keywords
- '(("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?[ \t]*\\(\\sw+\\)?"
-    (1 font-lock-function-name-face) (3 font-lock-keyword-face nil t))
-   ("^\\s +\\(\\(\\sw\\|\\s_\\)+\\)" 1 font-lock-keyword-face))
+ '(
+; modifications for PIC microcontroller by .....cameronKILLspamspam@spam@stl.dec.com
+
+; declarations of variables and constants
+   ("[ \t]equ[ \t]" . font-lock-variable-name-face)
+   ("[ \t]cblock" . font-lock-variable-name-face)
+   ("[ \t]endc" . font-lock-variable-name-face)
+
+; assembler built-in opcodes
+   ("#define" . font-lock-builtin-face)
+   ("[ \t]processor[ \t]" . font-lock-builtin-face)
+   ("[ \t]list[ \t]" . font-lock-builtin-face)
+   ("[ \t]include[ \t]" . font-lock-builtin-face)
+   ("[ \t]__config[ \t]" . font-lock-builtin-face)
+   ("[ \t]macro" . font-lock-builtin-face)
+   ("[ \t]endm" . font-lock-builtin-face)
+   ("[ \t]if[ \t]" . font-lock-builtin-face)
+   ("[ \t]ifndef[ \t]" . font-lock-builtin-face)
+   ("[ \t]ifdef[ \t]" . font-lock-builtin-face)
+   ("[ \t]else" . font-lock-builtin-face)
+   ("[ \t]endif" . font-lock-builtin-face)
+   ("[ \t]local[ \t]" . font-lock-builtin-face)
+   ("[ \t]org[ \t]" . font-lock-builtin-face)
+   ("[ \t]end" . font-lock-builtin-face)
+
+; known file register addresses and bits (16f84/12c509)
+   (",f[ \t]" . font-lock-variable-name-face)
+   (",w[ \t]" . font-lock-variable-name-face)
+   ("[ \t]indf" . font-lock-variable-name-face)
+   ("[ \t]tmr0" . font-lock-variable-name-face)
+   ("[ \t]status" . font-lock-variable-name-face)
+   ("[ \t]fsr" . font-lock-variable-name-face)
+   ("[ \t]porta" . font-lock-variable-name-face)
+   ("[ \t]portb" . font-lock-variable-name-face)
+   ("[ \t]gpio" . font-lock-variable-name-face)
+   ("[ \t]eedata" . font-lock-variable-name-face)
+   ("[ \t]eeadr" . font-lock-variable-name-face)
+   ("[ \t]pclath" . font-lock-variable-name-face)
+   ("[ \t]intcon" . font-lock-variable-name-face)
+   ("[ \t]option_reg" . font-lock-variable-name-face)
+   ("[ \t]trisa" . font-lock-variable-name-face)
+   ("[ \t]trisb" . font-lock-variable-name-face)
+   ("[ \t]eecon1" . font-lock-variable-name-face)
+   ("[ \t]eecon2" . font-lock-variable-name-face)
+   (",pa0" . font-lock-variable-name-face)
+   (",irp" . font-lock-variable-name-face)
+   (",rp0" . font-lock-variable-name-face)
+   (",rp1" . font-lock-variable-name-face)
+   (",not_to" . font-lock-variable-name-face)
+   (",not_pd" . font-lock-variable-name-face)
+   (",z" . font-lock-variable-name-face)
+   (",dc" . font-lock-variable-name-face)
+   (",c" . font-lock-variable-name-face)
+   (",gie" . font-lock-variable-name-face)
+   (",eeie" . font-lock-variable-name-face)
+   (",t0ie" . font-lock-variable-name-face)
+   (",inte" . font-lock-variable-name-face)
+   (",rbie" . font-lock-variable-name-face)
+   (",t0if" . font-lock-variable-name-face)
+   (",intf" . font-lock-variable-name-face)
+   (",rbif" . font-lock-variable-name-face)
+   ("[ \t]osccal" . font-lock-variable-name-face)
+
+; instructions that affect the call stack
+   ("[ \t]call[ \t]" . font-lock-constant-face)
+   ("[ \t]retlw[ \t]" . font-lock-constant-face)
+   ("[ \t]return" . font-lock-constant-face)
+   ("[ \t]retfie" . font-lock-constant-face)
+
+; instructions that affect the PC
+   ("[ \t]goto[ \t]" . font-lock-type-face)
+   ("[ \t]decfsz[ \t]" . font-lock-type-face)
+   ("[ \t]incfsz[ \t]" . font-lock-type-face)
+   ("[ \t]btfss[ \t]" . font-lock-type-face)
+   ("[ \t]btfsc[ \t]" . font-lock-type-face)
+   ("[ \t]bc[ \t]" . font-lock-type-face)
+   ("[ \t]bnc[ \t]" . font-lock-type-face)
+   ("[ \t]bz[ \t]" . font-lock-type-face)
+   ("[ \t]bnz[ \t]" . font-lock-type-face)
+   ("[ \t]skpc[ \t]" . font-lock-type-face)
+   ("[ \t]skpnc[ \t]" . font-lock-type-face)
+   ("[ \t]skpz[ \t]" . font-lock-type-face)
+   ("[ \t]skpnz[ \t]" . font-lock-type-face)
+   ("[ \t]pcl" . font-lock-variable-name-face)
+
+; show the watchdog clear as unusual
+   ("[ \t]clrwdt" . font-lock-comment-face)
+
+                               ; default colours appear to be:
+                               ; red          font-lock-comment-face
+                               ; orange       font-lock-string-face
+                               ; bright blue  font-lock-keyword-face
+                               ; blue grey    font-lock-builtin-face
+                               ; dark blue    font-lock-function-name-face
+                               ; yellow       font-lock-variable-name-face
+                               ; green        font-lock-type-face
+                               ; green blue   font-lock-constant-face
+
+; labels?
+   ("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?[ \t]*\\(\\sw+\\)?"
+    (1 font-lock-string-face) (3 font-lock-keyword-face nil t))
+; opcodes?
+   ("^\\s +\\(\\(\\sw\\|\\s_\\)+\\)" 1 font-lock-keyword-face)
+)
 "Additional expressions to highlight in Assembler mode.")

(defvar asm-code-level-empty-comment-pattern nil)
@@ -143,7 +246,7 @@
  (make-local-variable 'comment-end)
  (setq comment-end "")
  (make-local-variable 'comment-column)
-  (setq comment-column 32)
+  (setq comment-column 40)
  (setq fill-prefix "\t")
  (run-hooks 'asm-mode-hook))


More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...