2016-01-06 09:13:05 +00:00
|
|
|
#+TITLE: asm layer
|
|
|
|
|
2019-05-02 21:49:30 +00:00
|
|
|
#+TAGS: general|imperative|layer|programming
|
2019-04-25 23:05:56 +00:00
|
|
|
|
2016-01-12 03:58:57 +00:00
|
|
|
[[file:img/asm.png]]
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2017-08-06 02:14:10 +00:00
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
2017-12-31 00:39:19 +00:00
|
|
|
- [[#layer][Layer]]
|
|
|
|
- [[#pdfs][PDFs]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2016-01-06 09:13:05 +00:00
|
|
|
|
|
|
|
* Description
|
2016-01-12 03:58:57 +00:00
|
|
|
This layer adds support for Assembly code. The built-in major mode for
|
|
|
|
editing assembly code in Emacs is =asm-mode=.
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2016-01-12 03:58:57 +00:00
|
|
|
The layer also adds =nasm-mode= for NASM-specific syntax. Although =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~.
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2017-08-06 02:14:10 +00:00
|
|
|
** Features:
|
2016-01-12 03:58:57 +00:00
|
|
|
- Improved syntax highlighting.
|
|
|
|
- Automatic indentation.
|
2016-01-06 09:13:05 +00:00
|
|
|
- Auto-completion for symbol in opened buffers.
|
|
|
|
- Look up documentation for current instruction at cursor.
|
|
|
|
- Imenu integration.
|
|
|
|
|
|
|
|
* Install
|
2017-12-31 00:39:19 +00:00
|
|
|
** Layer
|
2016-01-12 03:58:57 +00:00
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =asm= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
file.
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2017-12-31 00:39:19 +00:00
|
|
|
** PDFs
|
2016-01-06 09:13:05 +00:00
|
|
|
To look up the x86 instructions, two things are required:
|
2016-01-12 03:58:57 +00:00
|
|
|
- the =pdftotext= command line tool from Poppler:
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
#+BEGIN_SRC sh
|
|
|
|
sudo apt-get install poppler-utils
|
|
|
|
#+END_SRC
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2017-04-26 13:50:19 +00:00
|
|
|
- [[https://software.intel.com/en-us/articles/intel-sdm][Intel® 64 and IA-32 Architectures Software Developer Manuals]]. Any PDF that
|
2016-01-06 09:13:05 +00:00
|
|
|
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:
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2016-01-06 09:13:05 +00:00
|
|
|
(setq x86-lookup-pdf "~/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf")
|
2018-09-19 03:54:47 +00:00
|
|
|
#+END_SRC
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2016-01-12 03:58:57 +00:00
|
|
|
The first time you launch the command, it can take a while for indexing, this
|
|
|
|
is a one time operation and the result is cached for later use.
|
2016-01-06 09:13:05 +00:00
|
|
|
|
|
|
|
* Key bindings
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2016-01-06 09:13:05 +00:00
|
|
|
|-------------+----------------------------------------------------|
|
2016-01-12 03:58:57 +00:00
|
|
|
| ~SPC m h h~ | Look up the documentation for instruction at point |
|
|
|
|
| ~;~ | Insert a comment |
|
2016-01-06 09:13:05 +00:00
|
|
|
|
|
|
|
_Note_: Quoted from the docstring of =asm-comment=, the command bound to ~;~:
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
#+BEGIN_SRC text
|
|
|
|
Convert an empty comment to a `larger' kind, or start a new one.
|
|
|
|
These are the known comment classes:
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
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.
|
2016-01-06 09:13:05 +00:00
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
Suggested usage: while writing your code, trigger asm-comment
|
|
|
|
repeatedly until you are satisfied with the kind of comment.
|
|
|
|
#+END_SRC
|