Vim: looking up x86 instruction info

I’ve been coding a lot of assembly lately, and I often find myself looking up info about addressing modes or how a certain instruction affects the CPU flags. Intel has PDFs with all the reference info you could ever want. The problem is that they, for some reason I can’t comprehend, have split their instruction reference manual into two pieces, one for instructions starting with A-M and one for instructions starting with N-Z. This quickly becomes annoying and searching doesn’t always take you directly where you need to go.

Initially I wanted to scrape the PDFs into a tag-able buffer similar to how Vim’s own help system works, but that turned out to be very complex. PDFs don’t retain enough layout info so you can reliably reconstruct tables and stuff, so I gave up on that after many wasted attempts.

The approach I took instead is to index the PDF files and then launch the PDF viewer on the right page when I hit a certain button. This also turned out pretty hard because you can’t script the built in Preview viewer in Mac OS X. But I found another free PDF reader called Skim which works well for this, you can script it from AppleScript.

If you want to check it out, the Frankenstein hack to do this including the Vim script is at github. There’s no proper installation support (copy everything to .vim/plugins/intel-ref/ and place the vim-script in .vim/plugins) and it only works on Mac OS X. In addition, you’ll have to download Intel’s PDFs, as I’m pretty sure I can’t redistribute those.

Have fun asming 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s