Project Description

AsmHighlighter is an extension to Visual Studio 2008 that provides syntax highlighting for x86 ASM language. MASM and NASM syntaxes are supported. .

News

  • 19 June 2012, AsmHighlighter 1.6 - VS2010 + VS2012 release. Add support for VS2010 + VS2012.
  • 20 Dec 2010, AsmHighlighter 1.5 - VS2010 release. Add missing SSE2,SSE3,SSSE3 opcodes and 64bit operands (thanks SergeyV). Only the VS2010 is updated now.
  • 11 Oct 2010, AsmHighlighter 1.4 - VS2010 release. Add support to Visual Studio 2010. Download AsmHighlighter.vsix and execute it. IMPORTANT: AsmHighlighter doesn't install and run from a user domain profile. In order to use the VS2010, you also need to insure that the VC++2010 Runtime is installed on your machine.
  • 23th Oct 2009, AsmHighlighter 1.3 release. Download this version for VS2008 only. This version adds quick info tips when moving mouse over a register/variable while debugging. The Package installation is now using latest WIX 3.X installer, hopefully more reliable than previous one.
  • 22th Oct 2009, AsmHighlighter 1.2 release. This is a bugfix release. It's now possible to set a breakpoint on a valid line. A valid line must contain a parsable x86 ASM instruction. Tested in debug mode with MASM.
  • 20th Oct 2009, (Updated on 12:04:00 PM GMT), Minor bugfixes on AsmHighlighter 1.1 release. If you have downloaded this version, you should reinstall it (i'm a bit lazy to create another release version ;) ). Bugfixes are :
    • Undo is now working when reformating the code
    • Commenting a block with Ctrl-K, Ctrl-C is using ";" comments (instead of C/Cpp comment)
    • Support highlighting for *.cod files (generated assembler listing from C/Cpp source as well as output from MASM).
  • 19th Oct 2009, AsmHighlighter 1.1 release. This release adds the possibility to insert right after an instruction in a comment, the evaluation of the instruction size. See Instruction Size Features below. Warning, if you have installed 1.0 version : you need to desinstall it first before installing 1.1 version.
  • 18th Oct 2009, AsmHighlighter 1.0 initial release. This release supports basic highlighting for x86 ASM, mainly MASM syntax and partially NASM.

Features

  • Basic highlighting for x86 ASM language : comments, number, floats, strings, x86 instructions, registers, FPU, SIMD, MASM/NASM assembler directives...
  • Breakpoint are supported on lines containing valid x86 instructions.
  • Quick info tips on register/variables while debugging.
  • Instruction Size evaluation inserted in comments when formating code ( Format Document : Ctrl+K, Ctrl+D , Format Selection or Current Line : Ctrl+K, Ctrl+J)
  • AsmHighlighter is activated based on the following file extensions : *.asm files, *.inc files, *.cod files

How to install

  • Check the requirements below before installing a version.
  • Download the AsmHighlighter.msi and follow instructions.
  • If you have problem installing or reinstalling a version, it's recommended to remove previous installation before installing the new version.

Screenshots

Screenshot.png

Instruction Size Feature

The AsmHighlighter 1.1 version is adding a new useful features when ones want to quickly visualize the instruction size for each instructions.
You just have to format your code, Menu Edit/Advanced/Format Document (Ctrl+k, Ctrl+d) or Format Selection or current line (Ctrl+k, Ctrl+f), and an evaluation of the instruction's size will be inserted in the comment next to the instruction* as you can see below :

FormatCodeWithInstructionSize.png

For example, if you have the following code :
;!MYVAR=esi

mov dword [eax],0               ; First instruction
fld1                            ; FPU instruction
mov dword [MYVAR + eax], ebx    ; Test with defined
ret                             ; End of test

Pressing Ctrl+K,Ctrl+D will add the instruction size at the beginning of the instruction's comment :

;!MYVAR=esi

mov dword [eax],0               ;#6 First instruction
fld1                            ;#2 FPU instruction
mov dword [MYVAR + eax], ebx    ;#3 Test with defined
ret                             ;#1 End of test

This features only works if there is already a comment start (";") right to the instruction. A simple heuristic is used to determine if an identifier is a label or an offset. If you have an instruction like this mov eax, dword [MYLABEL + eax*2], MYLABEL will be interpreted as an address but if you have mov eax, dword [eax + ebx*2 + MYOFFSET], MYOFFSET will be interpreted as a short offset. The rules is when there are brackets, the first label before any registers is considered as a label address, otherwise it is considered as an offset.

Because the size evaluation is done at the line level, the system doesn't evaluate labels or defines. In order to be close to a real evaluation you need to:
  • specify the memory operand size (dword short) if necessary
  • explicits registers for fpu instructions (like fadd, fsub...)
  • includes defines on the 1st line of your source code: starting with ;! and following key/value pairs, where the key is the string to replace with the value. In the previous example, we had MYVAR that is in fact defined as a register (esi). If you have a label address, you can define something like label=00400000h (a fake address). This is not a nice way, but it was the fastest workaround without having to parse the whole file (this would have been a bit more complicated to get instruction size. For example, MASM doesn't includes any source line number in the generated asm listing...).

Also, every time you perform a formating of the code, all instruction sizes are updated in the comments.

Keep in mind that this system is a fast evaluation and cannot be 100% exact compare to a whole file compilation, but could be useful in some situations.

Requirements

  • Visual Studio 2008 (at least tested on Pro version). Express editions are not supported as they don't allow community addins.
  • .NET Runtime 3.5 on Windows : Microsoft .NET 3.5 Runtime.

Limitations

  • NASM directives syntax are partially supported. Focus is on MASM syntax but should be ok for most of NASM files.
  • No syntax analyzing and checking. AsmHighlighter only use a basic tokenizer to extract keywords.
  • Inline ASM under C code (asm keyword) is not supported
  • No formatting

Future Plans

You are welcome to contribute to this project.

Credits

FASM Managed from Shynd was used to provide instruction size. This is a cool library! Thanks Shynd!

Contact

Go to AsmHighlighter to have more information. Leave a message in the discussion tab.

Contact author: alexandre_mutel <at> yahoo <dot> fr
Blog : Code4k

Last edited Jun 19, 2012 at 5:43 AM by alexandre_mutel, version 30