views:

5417

answers:

6

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.

+1  A: 

instead of batch files, why not use the a custom build step defined on the file?

shoosh
A: 

If you are going to use Visual Studio, couldn't you give them a skeleton project in C/C++ with the entry point for a console app calling a function that has en empty inline assembly block, and let them fill their results in it?

R Caloca
He wants 16-bit code. He'd have to use Visual C++ 1.52 for that.
Roger Lipscombe
+2  A: 

You can create a makefile project. In Visual Studio, under File / New / Project, choose Visual C++ / Makefile project.

This allows you to run an arbitrary command to build your project. It doesn't have to be C/C++. It doesn't even have to be a traditional NMake makefile. I've used it to compile a driver using a batch file, and using a NAnt script.

It should be fairly easy to get it to run the MASM 6.x toolchain.

Roger Lipscombe
+2  A: 

I would suggest to define Custom Build rules depending on file extension. (Visual Studio 2008, at least in Professinal Edition, can generate .rules files, which can be distributed). There you can define custom build tools for asm files. By using this approach, you should be able to leave the linker step as is.

Way back, we used MASM32 link text as IDE to help students learn assembly. You could check their batchfiles what they do to assemble and link.

tabdamage
A: 

Why don't you use Irvine's guide? Irvine's library is nice and if you want, you can ignore it and work with Windows procs directly. I've searching for a guide like this, Irvine's was the best solution.

TCJ
+1  A: 

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.

280Z28