The following links
are due to the work of
Jon
Kirwan [Note: Jon's site no longer exists, but this is a link to an archive of his page!] who has
done an excellent job in keeping us informed about MASM and related software! I've tried to simplify here how most
Windows® users can obtain and install MASM on their system. If you need a purely MS-DOS (16-bit) version of
MASM, then take the link above to [the archive of] Jon Kirwan's page! Thankfully, there are still others online (even in
2023) who want to work with such old tools and write about them. One such website is called: The OS/2 Museum; run by Michal Necasek. Don't let the
title put you off, there are plenty of discussions about early DOS there!
On Microsoft®'s Visual
C++ 6.0 Processor Pack
Download
page [another page which no longer exists!], there are links to an SP4 or SP5 update which are publically available
for download. Both the SP4 and SP5 files contain the same
version (6.15) of MASM (ML.EXE) and its associated Error file
(ML.ERR). V.6.15 will only work in a DOS (Command-line) box under Windows®,
but this is good news for many Windows® users; especially if you are using
Windows 2000/XP/2003, but still want to learn how to compile a
PC (x86) Assembly program.
1) Download
either
SP4
(vcpp.exe; 1160 KiB) or
SP5
(vcpp5.exe; 1154 KiB). [I no longer have a link for these at this time.]
You do not need both! Each link has exactly
the same files we need to run MASM.
2) If you can
extract files from within a Microsoft .CAB file (see #4 below), then
change the file extension from .exe to .CAB
and proceed to #3. (First, read the "NOTE:"*
below.)
Or:
If
you'd rather extract every single file from SP4 or SP5 (without using a .CAB
extraction program) and read the EULA, then skip #3 below and enter the
following command in a DOS box at the directory where you've stored the SP4
or SP5 file, C:\TEMP for example:
C:\TEMP>vcpp5
/c /t:C:\MASM615
(the "/c" command
means it will "Extract files only" when also used with the "/t:<full
path>" command which specifies the location).
Before proceeding to step #5, read through
step #4 so you know which files are actually necessary to run MASM;
most of them will have nothing to do with it!
*NOTE: The EULA implies that you should have a licensed version
of either "Visual Studio" or "Visual C++" (something you
would definitely need to have if you wanted to legally sell a "commercial"
program using MASM!). However, the letters that Jon Kirwan exchanged with a
Microsoft employee (see link above) seem to imply that Microsoft wants to encourage
academic (personal?) use of MASM so long as you do not go to them with 'support
questions' without a valid license. If you feel a need to pursue this any further,
you'll have to go to Microsoft (and/or others) for answers.
3) Create a directory for MASM, such as C:\MASM615.
4) Use your favorite .CAB tool, such as
WinZip (demo available) which
can extract files from .CAB archives, to extract only the following files
to the directory you just created:
ml.exe
385,072 bytes 03/16/2000
04:20p
ml.err
9,687 bytes 03/16/2000 04:20p
[ Although Windows XP/2003 can work with .zip archives, it appears you
cannot extract individual files from .CAB archives using only the OS. Does anyone
know of a free .CAB extraction tool? ]
MasmRef.doc (513,536 bytes; 08/09/2000, 2:28
PM), will also be helpful to you; feel free to look through "procpack.chm"
as well, though its mostly for professional programmers.
Although they're not really necessary, you might as well grab these next two
files:
h2inc.exe 249,344 bytes 09/19/1995
02:04p
h2inc.err 21,880 bytes
09/19/1995 02:04p
'h2inc' allows you to convert C language include files into assembly include
files; we've never used it, but you might find a need for it some day.
5) Download the file, LNK563.EXE,
from either here:
HTTP
site or here: FTP
site [Note: Neither of those Microsoft links work anymore either.] into your MASM directory.
6) You can either open this self-extracting file (LNK563.EXE) with
a .ZIP tool such as WinZip, or execute it; if you do the latter, delete
the README.TXT file which can be very confusing as it refers to this
file as a "patch," but these are the full versions of:
LINK.EXE
364,544 bytes 01/13/1995 02:10p and
CVPACK.EXE 169,472 bytes 01/13/1995
02:10p (A CodeView debug information compactor which most
of you won't ever have a reason to use, but here it is.)
And that's all there is to it! You're now ready to compile programs from any .asm source code written for MASM. Open a DOS-box (see "Helpful HINT" below) at your MASM directory, and ENTER ml /? > ML.TXT at the prompt. ML.TXT will then contain a simple listing of all the switches you can use with MASM. ENTER ml all by itself, and you should see:
Microsoft (R) Macro Assembler
Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
usage: ML [ options ] filelist [ /link linkoptions]
Helpful
HINT: Install the Win2000/XP "Power Toy" that allows
you to open a Command-Line (.CMD) window
at any folder by simply right-clicking on the folder name in Windows Explorer
and selecting "Command Prompt Here" from the menu. You'll probably
find a lot more use for .CMD and Batch files after doing this! Direct
Link: |
At this point, I'd recommend going through a very nice tutorial by Jon Kirwan called: Learn ASM. [Thankfully, all of Jon's examples can still be found here at the arcive.org website!] It not only covers the basics of using MASM along with some example source code, but includes valuable information on subjects such as the PSP (Program Segment Prefix), the difference between a .COM and .EXE program file, the EXE Header fields at the beginning of all .EXE files plus historical background you'd rarely find in most tutorials.
Once you've done that, go ahead and download the following .asm source code which will teach you a bit more about Assembly code under MASM: DOSWIN.ASM. (Download to your MASM directory and follow the instructions inside the file.) After compiling and running the program, you should open it under DEBUG and step through each instruction until you have understood what each of them do!
In one of the paragraphs above, I mentioned that you can now compile .asm source code "written for MASM." This refers to the fact that souce code written for other assemblers, such as Borland®'s Turbo Assembler (TASM) which we also consider to be quite good, may use Macro statements which MASM has no idea how to understand, and vice versa. Note that the command-line switches used by a particular assembler often have a completely different function under that of another! A seasoned x86 programmer will most likely have learned how to translate the source code for one to the other (or be able to slog through it) out of necessity, needing to implement some code snippets found only for one in a project using another assembler. Sooner or later, you'll need to consult the manuals which describe all the special directives you can use under each assembler. For now though, you should concentrate on learning the basic Assembly mnemonics used by all of them.
Last Update: 26 JAN 2005. (26.01.2005)
You can write to me using this: online
reply form. (It opens in a new window.)
MBR
and Boot Records Index
PC Assembly Code Index
The Starman's Realm Index Page