Visual Studio extension for assembly syntax highlighting and code completion in assembly files and the disassembly window
Under MIT License
By HJLebbink

assembly assembler disassembly visual-studio nasm assembly-language-programming syntax-highlighting x86-64 visual-studio-extension code-completion masm avx512 avx2


Assembly syntax highlighting and code assistance for assembly source files and the disassembly window for Visual Studio 2015, 2017 and 2019. This extension can be found in the visual studio extensions gallery or download latest installer AsmDude.vsix (v1.9.6.14). If assembly is too much of a hassle but you still want access to specific machine instructions, consider Intrinsics-Dude.

Syntax highlighting and Descriptions

The following architectures are supported: the instruction sets of the x86 and the x64, but also
SSE, AVX, AVX2, Xeon-Phi (Knights Corner) instructions with their descriptions are provided.
Most of the regularly used Masm directives are supported and some Nasm directives.

Highlighting and descriptions are also provided for labels.

If you are not happy with highlighting or the descriptions. Mnemonics and descriptions can be added and changed by updating
the AsmDudeData.xml file that will be stored next to the binaries when installing the plugin (.vsix).
The directory where plugins are installed can be difficult to find, try something as
C:\Users\\AppData\Local\Microsoft\VisualStudio\14.0\Extensions. Please consider sharing your updates.

Documentation Links

If you hover the mouse over a mnemonic when the CTRL button is down, mnemonics may become underlined, indicating
that an html reference exists that points to a documentation webpage.

Code Completion

While typing texts completion lists will narrow down to the relevant language keywords. This works for all keywords and
labels. Code suggestion may not be perfect yet, in the sense that only valid code completions should be suggested.
For example, after a call or jump mnemonic you expect a label, thus the list of completions will only show labels to
choose from.

Code Folding

The keywords #region and #endregion lets you specify a block of code that you can expand or collapse when using
the outlining feature of the Visual Studio Code Editor. In longer code files, it is convenient to be able to
collapse or hide one or more regions so that you can focus on the part of the file that you are currently
working on.

Signature Help

Signature Help (also known as Parameter Info) displays the signature of a method in a tooltip when a user types the parameter list start character (eg in c++ an opening parenthesis). As a parameter and parameter separator (typically a comma) are typed, the tooltip is updated to show the next parameter in bold.

Label Analysis

Quick info tooltips for labels allow you to see where labels are defined. If labels are not defined, red error
squiggles appear and an corresponding entry in the error list is added.

If labels are incorrectly defined more than once, quick info tooltips also provide information about these
clashing label definitions. Red error squiggles appear and entries in the error list are added.

Disassembly Window in VS

QuickInfo tooltips, documentation links and syntax highlighting is available for the disassembly window.

Assembly Simulator (Available in version 2.0)

The assembly simulator interprets assembly code and allows to reason about assembly programs.

Multi-Valued Logics

The value of a flag or the value of a single bit in a register can either take the Boolean value of 1, we say the value is set, or it can take the Boolean value of 0, we say that the value is cleared. We assume that these two values are the only two values a bit may assume. When reasoning about these two values, other useful truth-values can be distinguished. These values represent the epistemic state a reasoner has about the value 0 and 1. Three types of ignorance, and an inconsistent state:

  1. When you reason about the truth-value of a bit you try to determine in which world you live: a world in
    which the bit is set, or one in which the bit is cleared. You may conclude that you lack necessary information to determine the truth-value. In such a situation we say that the bit is UNKNOWN, denoted by a question mark '?'. The instruction "IN" retrieves a byte from I/O, the bits in that byte are UNKNOWN.

  2. Another type of ignorance is introduced by instructions themselves. The specification may state that, for example, a flag is undefined after the execution of a specific instruction. The instruction AND sets the value of the auxiliary flag AF (obviously) either to a 0 or to a 1, yet the specification does not tell which one. In such a situation we say that a bit has the truth-value UNDEFINED, denoted by the letter 'U'.

  3. Yet another type of ignorance is introduced by the bounded capacities of the reasoner. The theorem prover Z3 is used to establish the truth-value of bits. After a certain timeout the theorem prover gives up. In such a situation we say that the bit has the truth-value UNDETERMINED, denoted by a hyphen '-'.

  4. The last truth-value indicates an inconsistent state (of the reasoner) when the reasoner establishes that a bit is set and at the same time it has information to conclude that the bit is cleared. This signals a state that cannot be reached. We say that a bit can have the truth-value INCONSISTENT, denoted by the letter 'X'.

Show Register Content

The register content before and after the current line is shown in QuickInfo tooltips when hovering over registers. "RCL EAX, 1" shifts the carry flag into position 0. The carry flag is undefined due to the previous BSF.

Semantic warning when using Undefined Values

Using undefined flags or registers in instruction most often signals a bug. Although it is conceivable that using undefined values is intended (For example in "XOR RAX, RAX"), still, you may want be warned about it. For example, the carry flag is used by RCL but CF has an undefined value.

Semantic warning for Redundant Instructions

When an instruction does not change the state of the registers and flags it writes to, give a redundancy warning.

Semantic warning for Unreachable Instructions

Instructions can be unreachable due to conditional jumps that are never taken. If you were to request the truth-values of a register
in an unreachable instruction the reasoner would conclude that you need an inconsistent state to reach the instruction. Something that cannot happen.

Syntax Errors (found by the assembly simulator)

The Simulator was not build to find syntax errors, yet it does find some when traversing the file. Would be a waste not to feedback these errors.

Register Content in Code Completions

When something is known about the register content, this information is shown in code completions.

Where is the Source (Are you sure this is not a honeypot?!)

If you are reading this you are most likely an assembly programmer, if you are still interested in some dirty c#,
or you are just cautious, you can run the extension from source code. To do that, Visual Studio 2017 SDK needs to
be installed. To run the extension, hit F5 or choose the Debug > Start Debugging menu command. A new instance of
Visual Studio will launch under the experimental hive.

Currently in development:

Known Issues:

Feature Requests: (desire something - let me know)