79 lines
2.8 KiB
Org Mode
79 lines
2.8 KiB
Org Mode
|
#+TITLE: asm layer
|
||
|
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" />
|
||
|
|
||
|
#+CAPTION: logo
|
||
|
|
||
|
# The maximum height of the logo should be 200 pixels.
|
||
|
[[img/asm.png]]
|
||
|
|
||
|
* Table of Contents :TOC_4_org:noexport:
|
||
|
- [[Description][Description]]
|
||
|
- [[Install][Install]]
|
||
|
- [[Key bindings][Key bindings]]
|
||
|
|
||
|
* Description
|
||
|
This layer supports for writing Assembly code. The built-in major mode for
|
||
|
editing assmebly code in Emacs is =asm-mode=. The layer adds =nasm-mode=, which
|
||
|
understands NASM-specific syntax. Also =nasm-mode= is intended for NASM, it
|
||
|
actually works well with other variants of Assembly in general, and provides Imenu
|
||
|
integration (so you can jump around with ~SPC s j~).
|
||
|
|
||
|
_Features_:
|
||
|
|
||
|
- Improved syntax highllighting.
|
||
|
- Automatic indentatation.
|
||
|
- Auto-completion for symbol in opened buffers.
|
||
|
- Look up documentation for current instruction at cursor.
|
||
|
- Imenu integration.
|
||
|
|
||
|
* Install
|
||
|
To use this contribution add it to your =~/.spacemacs=
|
||
|
|
||
|
#+begin_src emacs-lisp
|
||
|
(setq-default dotspacemacs-configuration-layers '(asm))
|
||
|
#+end_src
|
||
|
|
||
|
To look up the x86 instructions, two things are required:
|
||
|
|
||
|
- =pdftotext= command line program from Poppler:
|
||
|
|
||
|
#+being_src sh
|
||
|
sudo apt-get install poppler-utils
|
||
|
#+end_src
|
||
|
|
||
|
- [[http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html][Intel® 64 and IA-32 Architectures Software Developer Manuals]]. Any PDF that
|
||
|
contains the full instruction set reference will work, though volume 2 is the
|
||
|
best choice for x86-lookup.
|
||
|
|
||
|
Then, set =x86-lookup-pdf= to the location of your PDF document (Tip: If you use
|
||
|
Helm as your completion of choice, you can use ~SPC f f~ to navigate to the
|
||
|
file, and press ~C-c i~ to insert the path). For example, something like this:
|
||
|
|
||
|
#+begin_src emacs-lisp
|
||
|
(setq x86-lookup-pdf "~/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf")
|
||
|
#+end_src
|
||
|
|
||
|
The first time you launch the command, it took a while for indexing. After that,
|
||
|
the result is cached and the next time you start in an instant.
|
||
|
|
||
|
* Key bindings
|
||
|
|
||
|
| Key Binding | Description |
|
||
|
|-------------+----------------------------------------------------|
|
||
|
| ~<SPC> m h~ | Look up the documentation for instruction at point |
|
||
|
| ~;~ | Insert a comment |
|
||
|
|
||
|
_Note_: Quoted from the docstring of =asm-comment=, the command bound to ~;~:
|
||
|
|
||
|
#+begin_src text
|
||
|
Convert an empty comment to a `larger' kind, or start a new one.
|
||
|
These are the known comment classes:
|
||
|
|
||
|
1 -- comment to the right of the code (at the comment-column)
|
||
|
2 -- comment on its own line, indented like code
|
||
|
3 -- comment on its own line, beginning at the left-most column.
|
||
|
|
||
|
Suggested usage: while writing your code, trigger asm-comment
|
||
|
repeatedly until you are satisfied with the kind of comment.
|
||
|
#+end_src
|