|
Last update: 2/18/2005
This document explains how to configure Microsoft Visual Studio .NET
2003 for editing, debugging, and running assembly language programs.
Here are some important guidelines to follow before continuing with the
instructions on this page:
- We will assume that you have installed the assembler in the C:\Masm615
directory.
- The 16-bit linker supplied with MASM does not permit filenames longer
than eight characters, excluding the extension. The same goes for the
directory name holding the program.
Before you begin . . .
Important: You must install Visual C++ in Visual Studio .NET 2003
if you plan to debug assembly language programs.
It would be helpful at this point to know what types of assembly language
programs you will be writing. Most of the programs in the first 11 chapters
of the book are 32-bit Protected mode programs. If you're taking a college
course, ask your professor what types of programs you will be writing.
If you're working alone, we suggest that you create 32-bit programs for
now, and wait until Chapter 12 before creating 16-bit programs.
- If you're going to be writing 32-bit Protected mode programs, click
here.
- If you're going to be writing 16-bit Real-mode programs, click
here.
Step 1: Build 32-bit MASM
Run Visual Studio .NET 2003. Select External Tools... from the
Tools menu. Click on the Add button. Insert the following field
values:
 |
The batch file used in the Command entry
(make32vs.bat) is not part of the default installation on the book's
CD-ROM. Right-click to download it now
and save it to your C:\Masm615 (or appropriate) directory.
|
| Modify the "C:\Masm615" directory name
if you installed the assembler in a different location. |
Click on OK to save the Build 32-bit MASM tool.
Step 2: Run MASM
Select External Tools... from the Tools menu. Click on the Add
button. Insert the following field values:
 |
The Command entry shown here names the Windows
2000 & XP command processor, named cmd.exe. If you get an error
message saying "The command is not a valid executable,"
change the command entry to "command.com".
(Be sure to leave a space after the /C.)
|
Click on OK to save the Run MASM tool.
Step 3: DEBUG 32-Bit MASM
Note: If you plan to debug assembly language programs using Visual
Studio .NET 2003, you must install the C++ language compiler.
Select External Tools... from the Tools menu. Click on the Add
button. Insert the following field values:
 |
For the Command entry, use the browse button
(with the three dots) on the right-hand side to navigate to the location
of the file devenv.exe. It is the Visual Studio .NET 2003 debugger.
|
Click OK to save the Debug 32-bit MASM tool.
Test your configuration
|
Create a new ASM program and save it with an ASM extension, or
open an existing ASM file. Important: The window containing the
ASM file must be the active window when you issue a Tool command.
- Select Build 32-bit MASM from the Tools menu and verify
that the program assembles without errors.
- Select Run 32-bit MASM to run your program.
- Select Debug 32-bit MASM. Your EXE file will load in
a new instance of Visual Studio.
Press the F10 key to begin stepping through the program.
Visual Studio will prompt you to save the SLN file (solution file)
associated with your program. (For example, if we were debugging
the AddSub.exe program, the solution filename would be AddSub.sln.)
Click on the Save button.
Notice that a yellow Arrow appears to the left of the first line
of source code in your program. The F10 key steps over (executes)
procedure calls; F11 traces down into procedure calls. F5
executes the entire program, stopping at any breakpoints you
may have set.
You are finished configuring
Visual Studio .NET 2003 for 32-bit programs
Return
to top
|
Step 1: Build 16-bit MASM
| Run Visual Studio .NET 2003. Select External Tools... from
the Tools menu. Click on the Add button. Insert the following
field values: |
 |
The batch file used in the Command entry
(make16vs.bat) is not part of the default installation on the book's
CD-ROM. Right-click to download it now
and save it to your C:\Masm615 (or appropriate) directory.
|
| Note that we did not select the Use
Output window option. For an unknown reason, the make16vs.bat
file fails when the output window option is used. This is a minor
problem, since we can easily view the assembler's output in a DOS
window. |
Click on OK to save the Build 16-bit MASM tool.
Step 2: Run MASM
(Skip this step if you have already installed the Run MASM tool.)
Select External Tools... from the Tools menu. Click on the Add
button. Insert the following field values:
 |
The Command entry shown here names the Windows
2000 command processor (cmd.exe). If you get an error message saying
"The command is not a valid executable," change the command
entry to "command.com". |
Click on OK to save the Run MASM tool.
Step 3: DEBUG 16-Bit MASM
Select External Tools... from the Tools menu. Click on the Add
button. Insert the following field values:
 |
This tool runs the 16-bit Microsoft CodeView
debugger, using a batch file we've placed in your Masm615 directory. |
Click on OK to save the Debug 16-bit MASM tool.
Test your configuration
Open a 16-bit assembly language program. A good choice would be DateTime.asm
from the Chapter 13 examples directory. Select Build 16-bit MASM
from the Tools menu and verify that the program assembles without errors.
Select Run 16-bit MASM to run your program.
Select Debug 16-bit MASM. The Microsoft CodeView debugging program
will open, and you will be able to see your program's source code. Use
the F10 key to step through your program one line at a time. The F8 key
traces into subroutines, and the F5 key executes the program. When you're
finished debugging, select Exit from the File menu in CodeView
to close the debugging window.
You are finished configuring Visual Studio .NET 2003 for 16-bit programs.
|