Text Editors for Assembly

contributed by Dylan Brotherston

Atom

Install atom:language-mips, by going to Edit ▷ Preferences ▷ Install, and searching for the package. Like Sublime Text's and VSCode's support, this is based on the TextMate syntax bundle.

To set your tab-width to 8, go to Edit ▷ Preferences ▷ Editor, and set Tab Length to 8.

contributed by Jashank Jeremy

Emacs

GNU Emacs' asm-mode works great for writing assembly. It will automatically ensure your operands, comments, and labels are correctly aligned — but beware, it assumes that ;, //, or /*...*/ indicate comments, which is not the case for SPIM.

On CSE, files with a .s extension are assumed to be for a statistics language in the S family (e.g., R), and will start in ESS mode. You'll need to explicitly flip into asm-mode, by running M-x asm-mode, or change your auto-mode-alist.

contributed by Jashank Jeremy

gedit

gedit is really a thin wrapper around GtkSourceView, a general-purpose text editing widget, which supports configurable syntax highlighting. However, it doesn't support MIPS assembly out-of-the-box — you need to help it along a bit.

On CSE, just run

1521 gedit-spim-styles

Elsewhere, you'll need to install the language files yourself. Here's asm-mips.lang; you'll need to do something like:

mkdir -p ~/.local/share/gtksourceview-{2..4}.0/language-specs
cp -n asm-mips.lang ~/.local/share/gtksourceview-2.0/language-specs
cp -n asm-mips.lang ~/.local/share/gtksourceview-3.0/language-specs
cp -n asm-mips.lang ~/.local/share/gtksourceview-4.0/language-specs

To set your tab-width to 8 in gedit, under Edit ▷ Preferences, choose the Editor tab, and set Tab width to 8.

contributed by Callum Avery

nano

github:scopatz/nanorc:asm.nanorc is a working syntax definition for most assembly languages; add its contents to your nanorc.

Beware: it assumes that //, or /*...*/ indicate comments, which is not the case for SPIM. You may need to modify the syntax file before adding it to your nanorc.

To set your tab-width to 8, do:

echo 'set tabsize 8' >> ~/.nanorc

contributed by Callum Avery

Sublime Text

In PackageControl, install MIPS Syntax, which corresponds to github:contradictioned/mips-syntax. Like Atom's and VSCode's support, this is based on the TextMate syntax bundle.

To set your tab-width to 8, choose Preferences ▷ Settings, and, in the right-hand-side editor, between the braces add: "tab_size": 8

contributed by Dylan Brotherston, Callum Avery

Vim

A few good options exist for Vim syntax files. We suggest github:harenome/vim-mipssyntax. Add the mips.vim language file from that repository to your ~/.vim/syntax, or if you use Pathogen, add the repository to your set of bundles.

To set your tab-width to 8:

echo 'set shiftwidth=8 | set softtabstop=8 | set tabstop=8' >> ~/.vimrc

contributed by Callum Avery

Visual Studio Code

In Visual Studio Code, open the quick-open (Ctrl+P) and type ext install kdarkhan.mips. Like Atom's and Sublime Text's support, this is based on the TextMate syntax bundle.

To set your tab-width to 8, under File ▷ Preferences ▷ Settings, set Editor: Tab Size to 8.