Visual Studio extension for assembly syntax highlighting and code completion in assembly files and the disassembly window

Overview

Asm-Dude

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.

Features

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.

label-analysis

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<user>\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.

label-analysis

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.

label-analysis

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

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.

label-analysis

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.

label-analysis

Disassembly Window in VS

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

label-analysis

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.

show-register-content

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.

show-register-content

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.

redundant-instruction

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.

unreachable-instruction

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.

syntax-errors

Register Content in Code Completions

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

register-content-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:

  • Considering Irony for proper parsing and error handling.
  • Considering Z3 for proof tree induction to track propagation of register and flag state-change trough time.

Known Issues:

  • Incomplete descriptions. E.g. PMOVSX, the source html has a split table and only the first table is used as source.
  • MASM versions 6.0 and later treat all statement labels inside a procedure as local. AsmDude however does not yet honor this freedom, and will diligently complain about label clashes.

Feature Requests: (desire something - let me know)

  • Documentation for opcodes. Hit F12 to get full official documentation of the selected opcode.
  • Proper Register Highlighting. E.g. When you select GPR rax, GPR al is also highlighted.
  • No code completion in remarks.
  • Improved syntax highlighting. Add label highlights.
  • Code completion for labels in jumps. Provide a list of existing labels from which one can choose.
  • Support for segment registers, debug registers and control registers.
  • Label analysis. When jumping to a label, check if the label exists. Check if labels are unique. Provide error squiggles if something is wrong.
  • Code folding for documentation blocks, folding for Masm procedure blocks and and Masm segments definitions.
  • Code completion restrictions. E.g. opcode movss can only be followed by an xmm register and not by a GPR such as rax.
  • Signature Help. Provide help which operands (type of registers, mem etc) are allowed for a given mnemonic).
  • Add syntax highlighting for AT&T syntax.
  • Syntax highlighting for the Debug/Windows/Disassembly view.
  • Label rename assistance.
  • Create new file item with .asm extension.
  • Syntax highlighting in quickinfo tooltips, code folding block previews.
  • Code formatting.
  • Track flag influence. Select an opcode that uses a flag (as input), find the opcodes that produce this flag (as output). E.g. select opcode cmovc or setc , highlight all opcodes such as btr, sal, sar, shl, shr, etc.
  • Register rename assistance. Highly desirable but very challenging. E.g. rename GPR rdx to rbx, find which rdx, edx, dx, dl and dh will need to be renamed, check if renames will clash with existing occurances of rbx, ebx, bx, bl and bh.
  • Arm support.
  • Nasm macros syntax highlighting.
  • Provide one (large) label graph for the complete solution such that label usage can be tracked throughout the solution.
  • Add pragmas to disable warnings such as "#pragma AsmDude warning disable/restore".
  • Add support for MASM keyword "comment".
  • Add syntax highlighting, statement completion and syntax checks for struct member fields.
  • Disassembly window: show memory content from selected address (see here).
  • Disassembly window: show memory content of the stack frame and stack pointer (see here).
  • Add comment/uncomment functionality (see Issue).

Updates:

  • 19 February 2016: Initial alpha release. Basic highlighting and descriptions for i386 instructions are available.
  • 20 February 2016: Added highlighting and descriptions for SSE, AVX, AVX2 instructions.
  • 21 February 2016: Added .vsix installer
  • 22 February 2016: Added .vsix installer to the visual studio extensions gallery
  • 23 February 2016: Added code completion [v1.1]
  • 26 February 2016: Added code folding [v1.2]
  • 2 March 2016: Added option pages for customizations. [v1.4]
  • 7 March 2016: Added documentation for opcodes for CTRL + left mouse. [v1.4.2]
  • 9 March 2016: Added register highlighting. [v1.4.4]
  • 14 March 2016: bugfixes and anoyances fixes [v1.4.6]
  • 21 March 2016: Added code completion for labels in jumps [v1.4.8]
  • 8 May 2016: Added Label analysis [v1.5.0.0]
  • 22 July 2016: Added Signature Help [v1.6.1.1]
  • 13 Feb 2017: Added Performance Data for Skylake & Broadwell (Data from Agner Fog) [v1.7.4.0]
  • 16 June 2017: Added AT&T syntax support [v1.8.2.0]
  • 25 Juli 2017: Added support for the VS Disassembly Window [v1.9.0.0]
  • 04 June 2018: added Performance Data for Skylake-X [v1.9.5.0]
  • 5 Januari 2019: Added support for VS2019 [v1.9.6.0]
Comments
  • Highlight colors are not saved in VS2015

    Highlight colors are not saved in VS2015

    See the attached image. I changed a few highlight colors, but the Asm Dude plugin ignores them and uses the predefined colors instead. Restarting VS doesn't help. (I have v1.7.3.2 on VS2015.) highlight

    bug 
    opened by adigostin 21
  • No Highlighting on VS2015 (v1.8.1.1 BROKEN; v1.8.0.0 OK)

    No Highlighting on VS2015 (v1.8.1.1 BROKEN; v1.8.0.0 OK)

    For some reason my highlighting is gone... I have fiddled around with opening / closing VS with different settings. I cannot find a file extension that asm is associated with.. so I don't think that is the issue.

    I see there was an update a couple days ago.. Is it related? Next step is to uninstall / re-install the plugin.

    bug 
    opened by dwkrueger2 14
  • Creating new data base to microcontroller

    Creating new data base to microcontroller

    Hi! I was trying to reconfigure its extension to Visual Studio 2017, causing VS to highlight the Expressions of the ESP32 Microcontroller (ULP) Assembly.

    Here is the mnemonic's and register's: http://esp-idf.readthedocs.io/en/latest/api-guides/ulp_instruction_set.html

    I was able to change the registers and guidelines, but it was not perfect, see "NOREG" in highlight box: https://i.imgur.com/mgRmJ0M.png This is true even with the description of the defined register, see in picture bellow.

    The mnemonic's did not work in any of my attempts. I tried changing the 2 SIGNATURE files and even creating a in asmdudedata, but it also did not work. https://i.imgur.com/NPdMi2r.png

    Can you help me or even create highlights for the assembly of that microcontroller? There are few register's and mnemonicos, I did a small part that was not perfect, but the mnemonicos discouraged me :(

    enhancement 
    opened by urbanze 11
  • included files are not scanned

    included files are not scanned

    capture1

    why is there a warning regarding openInputfile and such ? the extension was working perfectly but suddenly it acted like this! even thought the code runs successfully

    P.s. : when i disable the extension the warning is gone

    bug 
    opened by Sherry-Ashraf 9
  • Workaround for labels defined in other files?

    Workaround for labels defined in other files?

    I have a hunch this will be difficult to get working properly, but let's say you have these files:

    a.asm

    include "a.inc"
    segment_name SEGMENT USE64
        jmp mylabel
    segment_name ENDS
    

    a.inc

    inc_segment_name SEGMENT USE64
        mylabel:
        hlt
    inc_segment_name ENDS
    

    "mylabel" is considered an undefined label, even though it will be defined once "a.inc" is included into the file.

    We use this a lot and it results in AsmDude writing many "Undefined Label" warnings in Visual Studio's Error List.

    Any ideas?

    opened by Tinister 6
  • Options Menu Disappears After Restarting VS

    Options Menu Disappears After Restarting VS

    The options menu (Tools > Options > AsmDude) disappears after restarting Visual Studio Community 2015 on Windows 10. Does not appear to be related to changing or using different themes.

    100% repeatable

    Workaround: Disable AsmDude, restart, enable AsmDude, restart. This workaround is rather inconvenient since VS must be restarted to apply changes to some options.

    bug 
    opened by TacticalMook 6
  • VS 2019 - Could not resolve Include Bug

    VS 2019 - Could not resolve Include Bug

    New to assembly, so be nice :)

    Added an *.inc file in the same folder as .asm file. MASM include path is empty. image

    It successfully finds the procedure, but for the INCLUDE - "Could not resolve include". EDIT: If all of the rest of "dependencies" for the *.inc file are in place in the same folder as .asm - no underlines. If it is written in relative path mod "../.." with all of its dependencies there - it will have underlines, but not the procedure.

    EDIT2: Turns out I messed up the relative path syntax, I guess. If one makes a directory AsmDudeInc next to the source files and writes:

    INCLUDE AsmDudeInc/Irvine32.inc

    everything works beautifully. As long as the include paths from the project configuration cannot be scanned by AsmDude, this seems like the cleanest solution atm.

    opened by ethanr0x 5
  • System.IO.FileNotFoundException Looking for C:\Users\henk\Dropbox...

    System.IO.FileNotFoundException Looking for C:\Users\henk\Dropbox...

    I'm getting the following error in Visual Studio since an update to AsmDude.

    The troubling thing about the error is that it references a file in a C:> user-folder dropbox. Can you tell me where i can fix this issue so I don't get the error on startup?

    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp.Scripting, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.CodeAnalysis.CSharp.Scripting, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at AsmTools.ExpressionEvaluator.Evaluate_Constant(String str, Boolean isCapitals) at AsmTools.AsmSourceTools.Evaluate_Constant(String token, Boolean isCapitals) at AsmDude.MasmTokenTagger.<GetTags>d__20.MoveNext() in C:\Users\henk\Dropbox\sc\GitHub\asm-dude\VS\CSHARP\asm-dude-vsix\SyntaxHighlighting\MasmTokenTagger.cs:line 189 at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__39.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

    opened by pallenfgcu 5
  • Incorrect syntax highlighting for remarks in the disassembly window

    Incorrect syntax highlighting for remarks in the disassembly window

    When using VSLinux to debug a Linux program in VS2015, I found ASM Dude will mistakenly look some instructions as remark(when enabling ASM Dude's syntax highlighting, please see screenshot2), could you tell me how to fix the problem? thanks. Screenshot1: asmdude1 Screenshot2: asmdude2

    enhancement 
    opened by matt-elson 5
  • Unable to load asmdude 1.9.3.0 in VS15

    Unable to load asmdude 1.9.3.0 in VS15

    Except from the vs15 log

    Begin package load [AsmDudePackage]

    CreateInstance failed for package [AsmDudePackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0,

    opened by Thremus 5
  • AsmDude does not work (when .asm extension is associated to an editor)

    AsmDude does not work (when .asm extension is associated to an editor)

    I've installed AsmDude through the Visual Studio marketplace. I restarted my computer and tried editing a .asm file, but the syntax highlighting is not showing.

    image

    I've gone to Tools -> Options -> AsmDude and it says that sytax highlighting is enabled.

    image

    Why can't I get the syntax highlighting working?

    opened by justinshapiro 5
  • Syntax coloring lost on copy paste to MS Word

    Syntax coloring lost on copy paste to MS Word

    The issue is with due to extension colors. Unlike when I paste default files/langs colors (such as C++ file) in word, the colors remain the same as they were in VS. but this does not happen in ASM files. Only the 1st line retains its colors. So, to get complete coloring u have to manually copy/paste each single line to word.

    (MS VS rich copy/paste is turned on.)

    opened by Wakeelfahmed 0
  • VS2022 - No Screen effect at all

    VS2022 - No Screen effect at all

    Hi,

    I installed the preview VS2022 version, and everything seemed to be 100% (properties page on TOOLS - OPTIONS- ASMDUDE and TOOLS FONTS), but I can't see any color (they're all ON now) and intellicode.

    I started my code through a C++ Empty project.

    I appreciate any help on this.

    opened by DBenS 1
  • asm-dude not aware that labels are targets of jump instructions

    asm-dude not aware that labels are targets of jump instructions

    The tooltip that appears when hovering over many labels claims that they are not used when they in fact are. For example, between_rows on line 252 is the target of a bcc instruction on line 228 in https://github.com/pinobatch/lorom-template

    Also, keyoff_ready_notes is a procedure defined starting at line 685, but the tooltip at line 250 says "Undefined Label" and there is a swiggly under the jump target.

    image

    opened by jeffythedragonslayer 1
  • Custom Registers and Mneumonics

    Custom Registers and Mneumonics

    I was wondering if someone had more information regarding adding custom instructions/registers to the plugin. I'm working with a chip that doesn't use a common instruction set and wanted to add the instructions from the datasheet but am having trouble. The readme for this project says just to change the XML file in the extension folder but that doesn't seem to be working on its own.

    opened by jlevis73 0
Releases(1.9.6.14)
Owner
Henk-Jan Lebbink
Henk-Jan Lebbink
A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files

HLSL Tools for Visual Studio This extension is for Visual Studio 2017 / 2019. Go here for the Visual Studio Code extension. HLSL Tools is a Visual Stu

Tim Jones 429 Nov 26, 2022
C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting

ccls ccls, which originates from cquery, is a C/C++/Objective-C language server. code completion (with both signature help and snippets) definition/re

Fangrui Song 3.2k Dec 4, 2022
A Visual Studio extension containing a collection of tools to help contributing code to the Chromium project.

VsChromium VsChromium is a Visual Studio Extension containing a collection of tools useful for editing, navigating and debugging code. VsChromium was

The Chromium Project 259 Nov 23, 2022
Visual Studio Extension that installs additional color themes

Using this Extension Download and install the extension Restart Visual Studio Navigate to Tools > Options > Environment > General and select your colo

Microsoft 327 Nov 21, 2022
Visual Studio native debugger extension to help debug native applications using Mono.

Unity Mixed Callstack UnityMixedCallstack is a Visual Studio 2017/2019 extension to help debug native applications embedding Mono, like Unity. If you

Unity Technologies 83 Nov 28, 2022
anthemtotheego 392 Dec 1, 2022
Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.

Sharpmake Introduction Sharpmake is a generator for Visual Studio projects and solutions. It is similar to CMake and Premake, but it is designed for s

Ubisoft 777 Nov 25, 2022
A D++ Discord Bot template for Visual Studio 2019 (x64 and x86)

D++ Windows Bot Template A D++ Discord Bot template for Visual Studio 2019 (x64 and x86, release and debug). The result of this tutorial. This templat

brainbox.cc 26 Nov 29, 2022
Bungie's Oni modified so it compiles with Microsoft Visual Studio 2019.

OniFoxed What's this? This is a modified variant of the recently leaked Oni source code so that it compiles under Microsoft Visual Studio 2019 with so

Mark Sowden 58 Nov 28, 2022
A Visual Studio template used to create Cobalt Strike BOFs

Introduction Cobalt Strike beacon object files (BOFs) is a feature that added to the beacon in order to allow rapid beacon extendibility in a more OPS

Securify 162 Nov 26, 2022
Visual Studio Test Adapter for Catch2

Test Adapter for Catch2 Within Visual Studio, the Test Explorer is a convenient way to run and debug unit tests. This test adapter adds support for th

null 93 Nov 24, 2022
Useful UE4 Visual Studio extensions.

UE4 Smarter Macro Indenting This extension was designed to fix the unnecessary and annoying "smart" indenting that Visual Studio likes to do around va

Chris Pawlukowsky 248 Oct 25, 2022
Half-Life Singleplayer SDK 2.3, updated to compile with Visual Studio 2019. Provided as-is with no further support. See the README for more information.

Half Life 1 SDK LICENSE Half Life 1 SDK Copyright© Valve Corp. THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE CORPORATION (“Valve”). PLEASE

Sam Vanheer 6 Oct 10, 2022
Capstone disassembly/disassembler framework

Capstone Engine Capstone is a disassembly framework with the target of becoming the ultimate disasm engine for binary analysis and reversing in the se

Capstone Engine 2 Nov 8, 2021
Capstone disassembly/disassembler framework: Core + bindings.

Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings.

Capstone Engine 6k Dec 2, 2022
Capstone disassembly/disassembler framework

Capstone Engine Capstone is a disassembly framework with the target of becoming the ultimate disasm engine for binary analysis and reversing in the se

Capstone Engine 37 Sep 11, 2022
Automatic Disassembly Desynchronization Obfuscator

desync-cc --- Automatic Disassembly Desynchronization Obfuscator desync-cc is designed as a drop-in replacement for gcc, which applies disassembly des

Ulf Kargén 7 Aug 11, 2022
Create a Jupyter Kernel for 8085 Microprocessor assembly language that can interpret assembly-level programs right from the Jupyter notebook.

Create a Jupyter Kernel for 8085 Microprocessor assembly language that can interpret assembly-level programs right from the Jupyter notebook.

Sarita Singh 4 Oct 5, 2022