-(defvar asm-mode-map nil
- "Keymap for asm-mode")
-
-(if asm-mode-map
- nil
- (setq asm-mode-map (make-sparse-keymap))
- (define-key asm-mode-map ";" 'asm-comment)
- (define-key asm-mode-map ":" 'asm-colon)
- (define-key asm-mode-map "\C-i" 'tab-to-tab-stop)
- (define-key asm-mode-map "\C-j" 'asm-newline)
- (define-key asm-mode-map "\C-m" 'asm-newline)
- )
-
-(defvar asm-code-level-empty-comment-pattern nil)
-(defvar asm-flush-left-empty-comment-pattern nil)
-(defvar asm-inline-empty-comment-pattern nil)
+(defvar asm-mode-map
+ (let ((map (make-sparse-keymap)))
+ ;; Note that the comment character isn't set up until asm-mode is called.
+ (define-key map ":" 'asm-colon)
+ (define-key map "\C-c;" 'comment-region)
+ (define-key map "\C-j" 'newline-and-indent)
+ (define-key map "\C-m" 'newline-and-indent)
+ map)
+ "Keymap for Asm mode.")
+
+(defconst asm-font-lock-keywords
+ '(("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?[ \t]*\\(\\sw+\\(\\.\\sw+\\)*\\)?"
+ (1 font-lock-function-name-face) (3 font-lock-keyword-face nil t))
+ ;; label started from ".".
+ ("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>:"
+ 1 font-lock-function-name-face)
+ ("^\\((\\sw+)\\)?\\s +\\(\\(\\.?\\sw\\|\\s_\\)+\\(\\.\\sw+\\)*\\)"
+ 2 font-lock-keyword-face)
+ ;; directive started from ".".
+ ("^\\(\\.\\(\\sw\\|\\s_\\)+\\)\\>[^:]?"
+ 1 font-lock-keyword-face))
+ "Additional expressions to highlight in Assembler mode.")