Using Visual Studio 2008 to Assemble, Link, Debug, and Execute MASM 6.11 Assembly Code

Kreychek picture Kreychek · Sep 22, 2008 · Viewed 9.5k times · Source

I would like to use Visual Studio 2008 to the greatest extent possible while effectively compiling/linking/building/etc code as if all these build processes were being done by the tools provided with MASM 6.11. The exact version of MASM does not matter, so long as it's within the 6.x range, as that is what my college is using to teach 16-bit assembly.

I have done some research on the subject and have come to the conclusion that there are several options:

  1. Reconfigure VS to call the MASM 6.11 executables with the same flags, etc as MASM 6.11 would natively do.
  2. Create intermediary batch file(s) to be called by VS to then invoke the proper commands for MASM's linker, etc.
  3. Reconfigure VS's built-in build tools/rules (assembler, linker, etc) to provide an environment identical to the one used by MASM 6.11.

Option (2) was brought up when I realized that the options available in VS's "External Tools" interface may be insufficient to correctly invoke MASM's build tools, thus a batch file to interpret VS's strict method of passing arguments might be helpful, as a lot of my learning about how to get this working involved my manually calling ML.exe, LINK.exe, etc from the command prompt.

Below are several links that may prove useful in answering my question. Please keep in mind that I have read them all and none are the actual solution. I can only hope my specifying MASM 6.11 doesn't prevent anyone from contributing a perhaps more generalized answer.

Similar method used to Option (2), but users on the thread are not contactable:
http://www.codeguru.com/forum/archive/index.php/t-284051.html
(also, I have my doubts about the necessity of an intermediary batch file)

Out of date explanation to my question:
http://www.cs.fiu.edu/~downeyt/cop3402/masmaul.html

Probably the closest thing I've come to a definitive solution, but refers to a suite of tools from something besides MASM, also uses a batch file:
http://www.kipirvine.com/asm/gettingStarted/index.htm#16-bit

I apologize if my terminology for the tools used in each step of the code -> exe process is off, but since I'm trying to reproduce the entirety of steps in between completion of writing the code and generating an executable, I don't think it matters much.

Answer

Sam Harwell picture Sam Harwell · Mar 8, 2010

There is a MASM rules file located at (32-bit system remove (x86)):

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\masm.rules

Copy that file to your project directory, and add it to the Custom Build Rules for your project. Then "Modify Rule File...", select the MASM build rule and "Modify Build Rule...".

Add a property:

  • User property type: String
  • Default value: *.inc
  • Description: Add additional MASM file dependencies.
  • Display name: Additional Dependencies
  • Is read only: False
  • Name: AdditionalDependencies
  • Property page name: General
  • Switch: [value]

Set the Additional Dependencies value to [AdditionalDependencies]. The build should now automatically detect changes to *.inc, and you can edit the properties for an individual asm file to specify others.