Getting Started with MASM and Visual Studio
-
Installing masm32 SDK and Irvine
Click here to get masm32. After install masm32 SDK, the files are stored into C:\masm32 folder.
Click this link to get the latest copy of the book's link libraries and example programs. The examples are stored in a Microsoft Install (.MSI) file that installs into the c:\Irvine folder. Unless you have some objection to using that location, do not alter the path. (Note to lab administrators: you can designate c:\Irvine directory as read-only.) If you plan to change the installation location, read our instructions relating to Creating a Project from Scratch.
The folllowing files will be copied into the c:\Irvine directory:
Filename | Description |
b16.asm, b32.asm | Blank templates for 16-bit and 32-bit assembly language source files |
GraphWin.inc | Include file for writing Windows applications |
Irvine16.inc | Include file used with the Irvine16 link library (16-bit applications) |
Irvine16.lib | 16-bit link function library used with this book |
Irvine32.inc | Include file used with the Irvine32 link library (32-bit applications) |
Irvine32.lib | Irvine's 32-bit link library |
Irvine64.obj | Irvine's 64-bit library |
Kernel32.lib | 32-bit link library for Windows API |
Link16.exe | 16-bit Microsoft linker |
Macros.inc | Irvine's macro include file (see Chapter 10) |
make16_vs2012.bat | Visual Studio 2012 batch file for building 16-bit applications |
make16_vs2013.bat | Visual Studio 2013 batch file for building 16-bit applications |
SmallWin.inc | Small-sized include file containing MS-Windows definitions, used by Irvine32.inc |
User32.lib | MS-Windows basic I/O link library |
VirtualKeys.inc | Keyboard code definitions file, used by Irvine32.inc |
A subdirectory named Examples will contain all the example programs shown in the book, source code for the book's 16-, 32-, and 64-bit libraries, and two sample projects for earlier versions of Visual Studio.
- Include Paths
Right-click the project name in the Solution Explorer window and select Properties from the popup menu. Expand the entry under Configuration Properties. Then expand the entry named Microsoft Macro Assembler. This is what you should see:
Modify the Include Paths option so it equals "C:\Irvine C:\masm32\include".
Next, select the Listing File entry, also in the Microsoft Macro Assembler group. Modify the Assembled Code Listing File entry (shown below) so it contains $(ProjectName).lst. This uses a built-in variable to identify the name of the source input file, with a file extension of .lst. So, if your project were named MyProject, the listing file would be named MyProject.lst:
- Add Irvine32.lib in the Additional Dependiencies;
Find the Linker entry under Configuration Properties. Select the Input entry in the left panel and insertirvine32.lib; at the beginning of the Additional Dependencies entry. The irvine32.lib file is the link library file supplied with this book. The filenames must be separated by semicolons.
Select Linker under Configuration Properties, and then select General. The Additional Library Directories entry must contain c:\Irvine so the linker can find the Irvine32.lib library file:
Select Linker under the Configuration Properties and select Debugging. Verify that the Generate Debug Info option is equal to Yes(/DEBUG)
Select Advanced under the Linker entry. Set the Image Has Safe Exception Handlers option to No.
Click the OK button to close the Property Pages window. Verify that your project has been created correctly by building and debugging the program as you did in an earlier tutorial.