z8a.vim 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. " Vim syntax file
  2. " Language: Z80 assembler asz80
  3. " Maintainer: Milan Pikula <www@fornax.elf.stuba.sk>
  4. " Last Change: 2003 May 11
  5. " quit when a syntax file was already loaded
  6. if exists("b:current_syntax")
  7. finish
  8. endif
  9. syn case ignore
  10. " Common Z80 Assembly instructions
  11. syn keyword z8aInstruction adc add and bit ccf cp cpd cpdr cpi cpir cpl
  12. syn keyword z8aInstruction daa di djnz ei exx halt im in
  13. syn keyword z8aInstruction ind ini indr inir jp jr ld ldd lddr ldi ldir
  14. syn keyword z8aInstruction neg nop or otdr otir out outd outi
  15. syn keyword z8aInstruction res rl rla rlc rlca rld
  16. syn keyword z8aInstruction rr rra rrc rrca rrd sbc scf set sla sra
  17. syn keyword z8aInstruction srl sub xor
  18. " syn keyword z8aInstruction push pop call ret reti retn inc dec ex rst
  19. " Any other stuff
  20. syn match z8aIdentifier "[a-z_][a-z0-9_]*"
  21. " Instructions changing stack
  22. syn keyword z8aSpecInst push pop call ret reti retn rst
  23. syn match z8aInstruction "\<inc\>"
  24. syn match z8aInstruction "\<dec\>"
  25. syn match z8aInstruction "\<ex\>"
  26. syn match z8aSpecInst "\<inc\s\+sp\>"me=s+3
  27. syn match z8aSpecInst "\<dec\s\+sp\>"me=s+3
  28. syn match z8aSpecInst "\<ex\s\+(\s*sp\s*)\s*,\s*hl\>"me=s+2
  29. "Labels
  30. syn match z8aLabel "[a-z_][a-z0-9_]*:"
  31. syn match z8aSpecialLabel "[a-z_][a-z0-9_]*::"
  32. " PreProcessor commands
  33. syn match z8aPreProc "\.org"
  34. syn match z8aPreProc "\.globl"
  35. syn match z8aPreProc "\.db"
  36. syn match z8aPreProc "\.dw"
  37. syn match z8aPreProc "\.ds"
  38. syn match z8aPreProc "\.byte"
  39. syn match z8aPreProc "\.word"
  40. syn match z8aPreProc "\.blkb"
  41. syn match z8aPreProc "\.blkw"
  42. syn match z8aPreProc "\.ascii"
  43. syn match z8aPreProc "\.asciz"
  44. syn match z8aPreProc "\.module"
  45. syn match z8aPreProc "\.title"
  46. syn match z8aPreProc "\.sbttl"
  47. syn match z8aPreProc "\.even"
  48. syn match z8aPreProc "\.odd"
  49. syn match z8aPreProc "\.area"
  50. syn match z8aPreProc "\.page"
  51. syn match z8aPreProc "\.setdp"
  52. syn match z8aPreProc "\.radix"
  53. syn match z8aInclude "\.include"
  54. syn match z8aPreCondit "\.if"
  55. syn match z8aPreCondit "\.else"
  56. syn match z8aPreCondit "\.endif"
  57. " Common strings
  58. syn match z8aString "\".*\""
  59. syn match z8aString "\'.*\'"
  60. " Numbers
  61. syn match z8aNumber "[0-9]\+"
  62. syn match z8aNumber "0[xXhH][0-9a-fA-F]\+"
  63. syn match z8aNumber "0[bB][0-1]*"
  64. syn match z8aNumber "0[oO\@qQ][0-7]\+"
  65. syn match z8aNumber "0[dD][0-9]\+"
  66. " Character constant
  67. syn match z8aString "\#\'."hs=s+1
  68. " Comments
  69. syn match z8aComment ";.*"
  70. syn case match
  71. " Define the default highlighting.
  72. " Only when an item doesn't have highlighting yet
  73. hi def link z8aSection Special
  74. hi def link z8aLabel Label
  75. hi def link z8aSpecialLabel Label
  76. hi def link z8aComment Comment
  77. hi def link z8aInstruction Statement
  78. hi def link z8aSpecInst Statement
  79. hi def link z8aInclude Include
  80. hi def link z8aPreCondit PreCondit
  81. hi def link z8aPreProc PreProc
  82. hi def link z8aNumber Number
  83. hi def link z8aString String
  84. let b:current_syntax = "z8a"
  85. " vim: ts=8