Adding the Assemble 32-bit Command to the Tools Menu

 

(Applies only to Microsoft C++ .NET)

There are often times when you will want to assemble a 32-bit ASM file without linking it. For example, you may be working on an ASM subroutine that you want to call from a C++ program. This tutorial explains how to add the appropriate command to your Tools menu.

Step 1: Create the asm32.bat File

First, you will need to create a batch file named asm32.bat and store it in your Masm directory. Here is a listing of asm32.bat:

REM  asm32.bat -  Batch file for assembling 32-bit programs
@echo off
cls
REM The following three lines can be customized for your system:
REM **************************
SET PATH=C:\Masm615
SET INCLUDE=C:\Masm615\INCLUDE
REM **************************

ML -Zi -c -Fl -coff %1.asm
if errorlevel 1 goto terminate
dir %1.*

:terminate
pause

If you prefer, you can right-click on this link and download the file. You only need to customize this file if you have installed MASM somewhere other than C:\Masm615.

Step 2: Add a Command to the Tools Menu

Open Visual C++.net. Select External Tools... from the Tools menu. Click on the Add button. Insert the following field values, altering the "C:\Masm615" directory name if you want to store this batch file at some other location:

(Be sure to capitalize exactly as shown. Notice the buttons with arrows pointing to the right next to the Arguments and Initial directory entries. If you click them, you can choose from a list of predefined Visual Studio macro identifiers.)

Now you can test your new command by opening up any source file from the book and assembling it. For example, try the RevStr.asm program from Chapter 5.

Tutorial finished.

Last update: 07/08/2002