| Getting Started |
|
Updated 4/4/2004 Let's assume that you bought my book, and you need to get the Microsoft Assembler and sample programs installed so you can start working. Step 1Insert the book's CD-ROM and double-click on the index.html file in the root directory. It explains how to install the assembler, editor, and sample programs. Run the Setup.exe program in the CD-ROM's root directory.
If you installed the assembler using the default setup path, the Microsoft Assembler and sample programs should be located in the C:\Masm615 directory. If you decide to use a different path, you'll have to modify some of the batch files we use for assembling, linking, and debugging (read the instructions). From this point on, we will refer to the assembler's install path as <masm>. Step 2Download and install the Library Update Patch. Also, download the online help file for the library. Step 3Create a directory on your hard drive where you would like to do your work. We will call this your working directory from now on.
Type the following command to assembe and link the AddSub.asm program:
(Program names and filenames are not case-sensitive at the command prompt.) You should see the following output screen. It shows the execution of the Microsoft Assembler, the Linker, and lists all filenames in the current directory beginning with "addsub":
(Filenames in MS-DOS are not case-sensitive, by the way.) The file addsub.exe is called the executable program. Run this program by typing addsub at the command prompt. You should see the following:
If you received this output, then you have installed the assembler correctly. Working at the DOS PromptIt is possible to do all your editing and assembling from a command prompt, which is the way we always did it when only MS-DOS was around. We will assume that your command window is still open and you're still in the same directory that you used when testing the make32.bat command just now. Type the following command and press Enter:
This is a screen snapshot of the NotePad editor, containing the AddSub.asm file:
Just for fun, change the first "mov" instruction (on line 11) to "move". Save the file and exit to the DOS prompt. Run the make32.bat file again:
Notice that this time, the assembler displays an error message that refers to line 11 in the source file:
Of course, the assembler's not too smart. Rather than detecting the misspelling of the MOV instruction, the assembler assumed that you wanted to type MOVE. It just didn't know what to do with EAX that followed on the same line! And so the process goes. Every time you make a change to the source code, you must save the file and run the make32.bat file again. If you want to save a little time, you can open two command windows and set them to the same directory. Run the editor in one window, and run the make32.bat file in the other one. Most likely, you will want to use an integrated text editor to create your programs. You will be able to assemble, link, and debug your programs from your editor. Click here to read about the various integrated development environments you can use. Read the note for Window 98 users.
Choosing a Custom Install PathIf you're here, you've decided to install MASM in a location other that C:\Masm. You will need to modify the following files, located in your <masm> directory:
It's not as bad as it sounds. Basically, you must find every occurrence of C:\Masm615 and replace it with the name of your custom directory. Suppose, for example, your custom directory were named C:\Apps\Masm. You would customize the following lines in make32.bat: SET PATH=C:\Apps\Masm SET INCLUDE=C:\Apps\Masm\INCLUDE SET LIB=C:\Apps\Masm\LIB By the way, if you're concerned that the PATH variable is being permanently changed, don't worry. From Windows 2000 onward, the Windows command shell restores your path to the way it was when the batch file finishes executing. If you're using Windows 98, read the special note.
A Note for Windows 98 UsersWindows 98 does not restore its PATH variable when the path is modified by a batch file. So that you don't change your PATH variable by running the make32.bat file, you can try the following workaround: Add the <masm> directory to your permanent path by editing the PATH statement in the Autoexec.bat file in the boot directory. For example, if <masm> were equal to C:\Masm615, for example, your path would look something like this: PATH C:\Windows;C:\Windows\Command;C:\Masm615 And so on. You will have to restart your computer. After doing this, you can remove the PATH command from the make32.bat file, leaving only the following two SET statements: SET INCLUDE=C:\Masm615\INCLUDE SET LIB=C:\Masm615\LIB
|