vim-asm_ca65_p816/README.md

89 lines
3.9 KiB
Markdown
Raw Normal View History

2015-01-06 20:50:01 -08:00
# vim-syntax-asm_ca65
2015-01-11 14:34:25 -08:00
Vim plugin for the `ca65` assembly language.
2015-01-06 21:10:28 -08:00
## Purpose
2015-01-11 14:34:25 -08:00
This repository provides a [Vim](http://www.vim.org/)
syntax-highlighting plugin, auto-indent plugin, and filetype plugin for the
[`ca65`](http://cc65.github.io/doc/ca65.html) assembly language.
2015-01-06 21:10:28 -08:00
2015-01-07 18:41:07 -08:00
`ca65` is a full-featured assembler for the [MOS
6502](https://en.wikipedia.org/wiki/MOS_Technology_6502) family of
microprocessors, which powered such historic platforms as the KIM I, Apple II,
Commodore 64, and Nintendo Entertainment System. It is a part of the popular
[`cc65`](https://github.com/cc65/cc65) suite of development tools for the 6502,
which also includes a C compiler, linker, object dumper, etc. `ca65` is
designed both for direct use by assembly programmers and as the compilation
target of the `cc65` C compiler. `ca65` is especially used by "homebrew"
communities for the [NES](http://nesdev.com), SNES, etc.
2015-01-06 21:10:28 -08:00
The stock Vim runtime distribution includes syntax modules for several dialects
of assembly, as well as a "generic" module (which is really for the GNU
Assembler), none of which works particularly well with 6502 assembly
2015-01-07 18:41:07 -08:00
conventions, and especially not with `ca65`'s many added features.
2015-01-06 21:10:28 -08:00
## Features
2015-01-11 14:34:25 -08:00
* Syntax highlighting
* Highlights 6502 instruction mnemonics as keywords, with special highlighting
for "illegal" instructions, and error highlighting for unknown (typo)
instructions.
* Highlights all valid `ca65` numeric and string literals, label
definitions, and comments, with special highlighting for TODOs, FIXMEs, etc.
* Highlights all valid expression operators and control comands, with special
treatment for various classes of commands, including `.fileopt`, segment
names, includes, macro definitions, storage types, conditional assembly,
linker control commands, structs, unions, procedures, pseudo-functions, some
built-in macros, console output commands (`.out`, `.warn`, .etc.), and
assembler behavior switches.
* Auto-indent
* Auto-indent under labels, `.proc`s, `.if` statements, macro definitions,
macro call parameters, scopes, unions, and structs. Automatically
de-dent when closing these structures.
* Filetype plugin
* Defines `ca65` comment syntax for Vim's automatic comment formatting features.
* Recognizes `.include`, `.incbin`, and `.macpack` statements for Vim's
include-aware features.
2015-01-07 18:41:07 -08:00
2015-01-06 21:10:28 -08:00
### Examples (screenshots)
2015-01-07 17:39:30 -08:00
#### Solarized colorscheme
![](https://raw.githubusercontent.com/maxbane/vim-syntax-asm_ca65/screenshots/sshot0-solarized.png)
![](https://raw.githubusercontent.com/maxbane/vim-syntax-asm_ca65/screenshots/sshot1-solarized.png)
#### Elflord colorscheme
![](https://raw.githubusercontent.com/maxbane/vim-syntax-asm_ca65/screenshots/sshot0-elflord.png)
![](https://raw.githubusercontent.com/maxbane/vim-syntax-asm_ca65/screenshots/sshot1-elflord.png)
2015-01-06 21:10:28 -08:00
## Limitations
2015-01-07 18:41:07 -08:00
* `asm_ca65.vim` currently has no awareness of, or support for, assembler
options that change the rules of valid labels, identifiers, and literals from
their defaults, for example the following `.feature` options and related
command-line switches to `ca65`.
* `.feature at_in_identifiers`
* `.feature dollar_in_identifiers`
* `.feature labels_without_colons`
* `.feature underline_in_numbers`
2015-01-11 14:34:25 -08:00
## Installation and Usage
2015-01-06 21:10:28 -08:00
2015-01-11 14:34:25 -08:00
Install in the normal way (i.e., place the contents of the `syntax/`, `indent`/
and `ftplugin/` directories in corresonding locations in your vim runtime
path), or, if you use [Pathogen](https://github.com/tpope/vim-pathogen), clone
this repository under `~/.vim/bundle/`.
2015-01-07 18:41:07 -08:00
2015-01-11 14:34:25 -08:00
Everything is enabled by setting a buffer's `filetype` to `asm_ca65`. For
example, if all of your `ca65` assembly source files end with the `.s` and
`.inc.`, suffixes, the follwing suffices in your `.vimrc`:
```vim
filetype plugin indent on
augroup filetypedetect
au BufNewFile,BufRead *.s,*.inc set ft=asm_ca65
augroup END
```
2015-01-06 21:10:28 -08:00