Configuring Visual Studio 2010 for Assembly Development

In my last blog entry “Assembling Old-School Skills” I bemoaned the fact (or what I thought the fact was) that Visual Studio 2010 ended up just being a glorified text editor when doing MASM development.

Buzzzz! Wrong!

You can in fact configure Visual Studio 2010 for use in MASM Assembly development.  The following list of steps are what is needed to accomplish this:

  • Create a Visual C++ “Win32 Console Application” project

image

  • Press ‘Next’, uncheck ‘Precompiled header’ and press ‘Finish’
  • Choose ‘Build Customizations…’ from the projects context menu and press ‘OK’

image

  • Delete all .cpp and .h files from the project
  • Add the file ‘Main.asm’ under ‘Source Files’
  • Add the following text from the tutorial at http://win32assembly.online.fr/tut2.html to ‘Main.asm’

        .386
        .model flat,stdcall
        option casemap:none

        include windows.inc
        include kernel32.inc
        includelib kernel32.lib
        include user32.inc
        includelib user32.lib

        .data
        MsgBoxCaption db "Iczelion Tutorial No.2",0
        MsgBoxText db "Win32 Assembly is Great!",0

        .code
        start:
        invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK
        invoke ExitProcess, NULL
        end start
  • Now when you look at the project properties you will find ‘Microsoft Macro Assembler’ under the ‘Configuration Properties’

image

  • In the project properties edit the following:
    • Linker –> General
      • Additional Library Directories
    • Microsoft Macro Assembler
      • General
        • Include Paths – Add the path to your .inc files.  I’m using the ones from the MASM32 SDK.
      • Listing File
        • Assembled Code Listing File – Set to something similar to: $(IntDir)%(FileName).lst
  • Ignore the auto-correct squiggly at the beginning for the ‘PCH warning’.  It seems to be something to do with Visual Studio 2010 SP1 ‘PCH warning after installing SP1
  • Compile and run your code

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>