Adding the Assemble 32-bit Command to the Tools Menu

(Applies only to Microsoft Visual C++ 6.0)

Updated 11/09/02

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

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++ 6.0. Select Customize from the Tools menu. Look for the first opening at the bottom of the list, and input the name Assemble 32-bit. Enter the additional fields as shown:

(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.