Setting Up Visual Studio 10 for MASM32 Programming

If you are like me and want the comfort and support that Microsoft’s Visual Studio 10 provides, then you will defiantly want that support in your MASM programming tasks. Visual studio makes this quite easy, with a couple of project property changes you will be on your way to MASM programming bliss.

Steps

  1. Create new Visual C++ Empty Project
  2. Right click on the newly created project and select Build Customizations; select masm option, press ok then save the project.
  3. Go to project properties and select linker->system then change subsystem to Windows (/SUBSYSTEM:CONSOLE)
  4. Download and install masm32 libraries then add them to your linker settings.
  5. Go to linker->Advanced and change Entry Point to main [this is what the linker will look for when mapping the entry point for your app.]
  6. Go to Linker->Input  and add masm32.lib to Additional Dependencies.
  7. Go to Microsoft Macro Assembler->General and add the masm32 libraries.
  8. Download and paste usertype.dat into C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
  9. Go to Visual Studio Options->Text Editor->File Extensions: Type asm in the extension box then select Microsoft Visual  C++ from the list.
  10. Right click on project and select Add->New Item: Select Text File and save with *.asm
  11. Create, run and enjoy your code :-)

In a future post I will show how to turn this project into a Visual Studio project template.

About these ads

20 thoughts on “Setting Up Visual Studio 10 for MASM32 Programming

  1. I was able to follow your instructions up to step 7. What reason would there be for ‘Microsoft Macro Assembler’ not to show up in the menu listing?

    • You may have not completed step 2 correctly. Once you selected masm(.targets, .pops) in build customizations the ‘Microsoft Macro Assembler’ listing should be visible in the configuration settings.

    • I had the same problem. I saved the entire project and source files. Closed and re-opened VS and it was only then I could see it. You have probably seen it already, but just thought I’d say it for other users that may be wondering the same thing.

      Hope it helps.

      • First, EXCELLENT ARTICLE!!!!

        I too had the issue of MASM item not showing up in the options tree view, even though I correctly followed, and rechecked the instructions multiple times.

        I suspected that “saving the project” might be a useful step but unlike Pen Tester didn’t try but rather rather just tried compiling.

        After the first compile (attempt) the options displayed the Masm elements.

        Likely this is a small, but beginner frustrating, bug in Visual Studio. Without Romaine excellent instructions I might not have had the stubborness to keep trying until it showed up.

        I do suggest mentioning it in one of the steps when you get a chance. (#2 or later in #7 when it is needed).

        Also, I had the include directories already HARDCODED in my source file so it may not have mattered (much) for me up to this point.

        But the really cool thing is that now I can debug my Masm using VS10.

        Thanks so much Romaine.

        Now, I need to figure out how to deal with debugging a multi-threaded app. My worker threads don’t seem to be running within the debug session even though they run fine outside the debugger — off to Google again….


        HerbM

  2. Same problem here. Macro Assembler isn’t showing up. I had to first add an assembly file, set its own Macro Assembler property first and then go back to the main project and set the Macro Assembler property for the whole project. :/ Anyways, thanks for the tutorial!! I loved it. :)

  3. The usertype.dat isn’t available in the link, it look like that Ivrin’s website is currently down. Could someone upload it again please !

  4. I have another question. I’m using Masm32/JWasm. I figured out after a long time of coding that VS is a solid IDE. I’m sticking to it actually. Could you explain to us how can we set that assembler for the free version of VS (express one’s) and how to set up syntaxe hilghiting.

  5. I’m using VS 2012 express & followed all the above steps but I’m getting the following errors whenever I’m trying to build my project:

    Error 1 error A1000: cannot open file : kernal32.inc C:\Users\XYZ\documents\visual studio 2012\Projects\masm_demo\masm_demo\source.asm 8 1 masm_demo

    Error 2 error MSB3721: The command “ml.exe /c /nologo /Zi /Fo”Debug\source.obj” /I “C:\masm32\lib” /I “C:\masm32\macros” /I “C:\masm32\include” /W3 /errorReport:prompt /Tasource.asm” exited with code 1. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\masm.targets 49 5 masm_demo

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s