Giter VIP home page Giter VIP logo

vsnasm's Introduction

VSNASM

Github All Releases GitHub release GitHub issues license donate

About

This project provides a set of build customisations that can be used within Visual Studio to compile assembly code using NASM. Provides Visual Studio integration for the NASM assembler. Supports Visual Studio 2010, 2012, 2013, 2015, 2017, 2019 and 2022.

NASM

The Netwide Assembler (NASM) is an assembler and disassembler for the Intel x86 architecture. It can be used to write 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs. For more information on NASM refer to the official site: www.nasm.us.

Installation

The project provides a basic installer script that can automatically detect any installed Visual Studio 2013, 2015, 2017, 2019 and 2022 installation and then install the required components. To use this script simply run 'install_script.bat' from an elevated (i.e administrator) command prompt.

Usage

Once installed VSNASM adds an additional usable Build Customization into Visual Studio. To use VSNASM in a project you must enable the customization for any project requiring it by right clicking on the project in the Solution Explorer and selecting 'Build Dependencies -> Build Customisations..' and then selecting VSNASM from the available options.

Manual Installation (optional)

Alternatively, to manually install the extension you will first need to download the required win32 or win64 binary (depending on your system) from the official NASM website www.nasm.us.

From the download archive you will need to extract nasm.exe into a location that Visual Studio can see. To tell Visual Studio where to find nasm.exe you have several options:

  1. Find the directory where the Visual Studio C++ compiler is installed. This can be determined from within Visual Studio by checking the contents of the VCInstallDir macro. For example the location for Visual Studio 2015 would be:

    1. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ -- For a 64 bit system
    2. C:\Program Files\Microsoft Visual Studio 14.0\VC\ -- For a 32 bit system
  2. You can install nasm to any directory and then set environment variable NASMPATH to point to the absolute directory of the installed nasm.exe (this path should include the final backslash).

To use the build customisation in Visual Studio you need to copy the 3 provided files (nasm.props, nasm.xml, nasm.targets) into a location where they can be found by the Visual Studio build customisation processes. There are several ways to do this:

  1. Copy these files to the MSBuild customisations directory. This can be determined from within Visual Studio by checking the contents of the VCTargetsPath macro. For example the location for various Visual Studio versions on a 64 bit system would be:

    1. Visual Studio 2013: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations
    2. Visual Studio 2015: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations
    3. Visual Studio 2017: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations
    4. Visual Studio 2019: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations
  2. Copy these files to a convenient location and set that path in the 'Build Customisations Search Path' in the Visual Studio 'Projects and Solutions|VC++ Project Settings' item in the 'Tools|Options' menu.

  3. Copy these files to a convenient location and set this path in the 'Build Customisation dialogue (discussed later).

To use NASM in a project you must enable the customisation by right clicking on the project in the Solution Explorer and select 'Build Customisations..'. This will give you a dialog box that allows you to select NASM as an assembler (note that your assembly files need to have the extension '.asm'). If you have used option 3 above, you will need to let the dialogue find them using the 'Find Existing' button below the dialogue.

To assemble a file with NASM, select the Property Page for the file and ensure that 'Nasm Assembler' is selected in the Tool dialog entry. The additional NASM property page can then be used to change various options supported by NASM.

vsnasm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vsnasm's Issues

VS2022 Tool Options

After successfully installing using the install_script.bat I am unable to change the .asm source file Item Type to be Netwide Assembler

image

image

image

Are you able to provide any info on how to troubleshoot?

VS 2019 Community BuildCustomizations Directory

2019 moved the BuildCustomizations to the following location, readme is outdated.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations

Having Problems with visual studio

I just recently installed this mod to visual studio and since then I had problems not just with projects in assembly but with any project. Whenever I compile my source visual studio tells me it cant find the executable that it is atually supposed to create. This problem just started happening after I ran the batch script included in this repo.

Any help is appreciated. Thanks

Use of Visual Studio 2019

The use of the 'install_script.bat' script does not work and after the manual installation VS2019 returns the error

Severity Code Description Project File Line Suppression State
Error MSB3721 The command "" C: \ Program Files (x86) \ Microsoft Visual Studio \ NASM "nasm.exe -Xvc -f win64 -o" x64 \ Debug \ parteinassembler.obj "" C: \ Users \ cogaa \ source \ repos \ VSeNasm project \ VSeNasm project \ parteinassembler.asm "" exited with code 1.VSeNasm project C: \ Program Files (x86) \ Microsoft Visual Studio \ nasm utility \ nasm.targets 50

I'm not an expert programmer, thanks for the support
I used this test code

section .text
bits 64
global foo
foo:
mov rax,7
ret

VS2019 doesn't rebuild when .asm file is changed

I have a very simple project:

main.cpp

#include <stdio.h>

extern "C" char theText[];

void main()
{
  printf( "%s", theText );
}

data.asm

section .data

global _theText
_theText db "hello!",0

With VS2019, on the first build, or a clean build, everything builds fine and I can run the program and print the string.

However, if I change the string in the .asm and press Build again, I get this: (msbuild set to Diagnostic level)

1>------ Up-To-Date check: Project: NasmPropsTest, Configuration: Debug Win32 ------
1>All outputs are up-to-date.
1>Time Elapsed 9 ms
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

Changing the .cpp file and pressing Build correctly rebuilds the .asm file as well.

Default options for nasm under All Options

Hi,
thanks for the tool. I really appreciate it.

However I'm facing an issue. By default nasm is invoked with some options as -Xvc and -f win32.
This is not always the case since not all projects containing an asm file to be processed by nasm are related to win32 and obj files or the other default options, -Xvc.

Is it possible to have by default only nasm invoked on an item? And under the properties of the project the possibility to insert or specify manually which options I'd like to have?

I've given a look at nasm.xml, .targets, and .props files and my intention was to modify them inorder to achieve the above goal but I don't know those formats (MSBuild?) and at the same time they seem to be interrelated.

Thanks

Visual Studio 2022

The install script needs to be adapted for version 17.0 of Visual Studio, and probably for 64 bit as well.

LNK2001: unresolved external symbol mainCRTStartup

Hello, I have set everything up and manually installed it. I made a new empty C++ project and deleted all the folders and set it to Build customization NASM, and went to the .asm file's properties and set it to Netwide Assembler, but with

section .data

section .text
global main

main:
	mov eax, 5

to test if it works I get the error as in the title (LNK2001: unresolved external symbol mainCRTStartup). If you need any more info or have any idea how to fix it, please let me know!

Access violation

Unhandled exception at 0x00D63014 in nasm.exe: 0xC0000005: Access violation when reading at address 0xFFFFFFFF.

VS 2017, debugging doesn't work

If I run compatible with VS 2010, I cannot debug app.
And for VS 2017 I should use msvcrt.lib;legacy_stdio_definitions.lib (and also debugging doesn't work)

Parallel execution

Is there a chance to support parallel execution of NASM tasks in visual studio? What I observe is that NASM tasks are executed one-after-another. And this keeps 8+-16 core CPUs idle for a long time.
One of the examples of projects that could benefit from parallel asm compilation is ffmpeg avcodec.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.