Subject: 1. Introduction and Intent
This is the x86 Assembly Language FAQ for the comp.lang.asm.x86 and
alt.lang.asm newsgroups. This FAQ is posted monthly on or about the
21st of the month to both newsgroups and news.answers, alt.answers and
comp.answers. It also is archived at the normal FAQ archival site,
ftp://rtfm.mit.edu and to SimTel and its mirror sites in the msdos/info
directory and Garbo and its mirrors in the pc/doc-net directory. When
uploaded to SimTel or Garbo, the filenames are asmxxyyz.zip, where xx is
the two digit year, yy is the number of the month and z is t for text or
h for HTML format. Lastly, the current version is available from my web
page:
http://www.frontiernet.net/~fys/faq/index.htm
and mirrored at:
http://webster.cs.ucr.edu/Articles/index.html
Zipped down as text files:
http://www.frontiernet.net/~fys/faq/asmfaq.zip
Zipped down as HTML documents:
http://www.frontiernet.net/~fys/faq/asmfaqh.zip
Currently, this FAQ is broken into six sections. The following are the
section filenames and the scope of each section of the FAQ.
assembly-language/x86/general/part1 - This is the basic portion of the
FAQ that contains information of interest to all assembly language
programmers. In general, the information contained in this portion
of the FAQ is not specific to any particular assembler.
assembly-language/x86/general/part2 - This is a continuation of the
above FAQ.
assembly-language/x86/general/part3 - This is a continuation of the
above FAQ.
assembly-language/x86/microsoft - This portion of the FAQ contains
information specific for the Microsoft MASM.
assembly-language/x86/borland - This portion of the FAQ contains
information specific for the Borland TASM.
assembly-language/x86/a86 - This portion of the FAQ contains information
specific for the Shareware A86 Assembler and D86 Debugger.
The scope and content of this FAQ is to go beyond just answering the
frequently asked questions. I am including pointers to assembly
language treasure troves that are hidden on the Internet. I believe
that this will enhance the FAQ’s value not only to the novices but also
to the old hands.
For the ease of determining what has changed since the last FAQ, the
Table of Contents will have "REVISED" at the end of the subject line for
all revised subjects. If more than one FAQ revision has been missed,
the "Last Changed:" entry at the end of each subject can be used to
determine which subjects have been revised during the intervening
period.
The information in this FAQ is free for all to use as long as you
acknowledge the source. This FAQ can be reproduced in part or in its
entirety as long as the copyright is included. This FAQ can be made
available on public servers, like ftp, gopher or WWW servers. Please do
not modify the file, such as converting it into some other format,
without prior permission of the author.
All references to files and locations are in Uniform Resource Locators
(URLs) format. Some web browser will be able to use these URLs directly
as hot links. If the format is not clear to you, get RFC 1738. It is
available from:
http://www.faqs.org/rfcs/rfc1738.html
Suggestions for changes and comments are always welcome. They can be
posted to either newsgroup or e-mailed directly to me.
This FAQ was created and maintained by Raymond Moon before I
took it over. Many thanks to Ray for the effort in creating
this FAQ. Even though most of the links and names have been changed
to mine, the credit still goes to Ray for the work he did. Thanks Ray.
Author: Benjamin David Lunt, fys_at_frontiernet.net
Copyright 2004 - Forever Young Software
ALL RIGHTS RESERVED
Last Changed: 3 Mar 2004
Return to the Table Of Contents------------------------------
1. Introduction and Intent 2. Table Of Contents REVISED 3. How to Get the Patch for MASM 6.11 4. What is and How to Access the Microsoft Knowledge Base 5. Pentium Instruction Macros 6. Microsoft’s MASM Newsgroup 7. MASM Information Available At www.microsoft.com REVISED 8. How to Get the Patch for MASM 6.12, 6.13 and 6.14 9. MASM Free From Microsoft REVISED 10. Acknowledgments [General][MASM][TASM][A86/D86]
------------------------------
Subject: 3. How to Get the Patch for MASM 6.11
There is a patch available from Microsoft for MASM 6.11. This patch
converts MASM 6.11 or 6.11a into the latest version MASM 6.11d. This
patch will not work on MASM 6.11c.
To obtain this patch:
ftp://ftp.microsoft.com/softlib/mslfiles/ML611D.EXE
ML611D.EXE is a self-extracting file which when executed will create the
following files:
ERRMSG.TXT PATCH.RTP
H2INC.EXE PATCH.RTD
H2INC.ERR README.TXT
ML611D.TXT SUPPORT.TXT
PATCH.EXE
All the instructions for installing the patch are contained in
ML611D.TXT.
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 20 Mar 98
Return to the Table Of Contents------------------------------
Subject: 4. What is and How to Access the Microsoft Knowledge Base
4.1 WHAT IS THE MICROSOFT KNOWLEDGE BASE
The Microsoft Knowledge Base (KB) is a collection of articles that is
maintained and used by the Microsoft Support personnel to answer
customer questions. Included in the Knowledge Base are detailed how-to
articles, answers to technical support questions, bug lists, fix lists,
and documentation errors. This Knowledge Base is available to all on
Microsoft's Internet Node. An index of all the articles is available in
a file, index.txt.
4.2 HOW TO OBTAIN INDEX.TXT
ftp://ftp.microsoft.com/developr/masm/kb/index.txt [broken]
This index still is available with the last entry dated Aug 96.
4.3 FILE FORMAT OF INDEX.TXT
The format of this file consists of three columns.
Column One is the file type with the following meanings:
FIX - Bug Fix
DOCERR - Documentation Error
INF - Information
PRB - Problem
BUG - Bug
Column Two is the path and file name in the following format:
Qxxxyzz
where: The part, 'Qxxx', is Q followed by two or three numbers
and represents the first subdirectory under the
subdirectory,
The part, 'y', is the next subdirectory under Qxxx, and
The part, 'zz', when combined with .txt' is the filename.
****WARNING**** Some of the Qs are uppercase and some are lower
case. Unlike DOS, the filenames and directory names are case
sensitive.
Column Three is a short description of the file.
4.4 GETTING FILES
You can get all the files from the /developr/masm/kb directory without
navigating this very strange directory structure by using the path in
the get command. As an example, let's say you want Q106399, a very
useful file if you use Visual C++ (see below). Using the parsing rules
above, you can use the following get command:
get q106/3/99.txt
4.5 HOW TO ACCESS USING WWW
Microsoft has removed the MASM option from the their www KB search.
4.6 SOME EXAMPLE FILES FROM THE MICROSOFT KNOWLEDGE BASE
Q86815 Mixed C and MASM with MASM Main Language, No C Run-Time
Q86816 Mixed C and MASM with MASM Main Language, C Run-Time
Q101264 Assembling Code Developed for MASM 5.x with MASM 6.x
Q106399 Using the Visual Workbench with MASM
Q110598 Spontaneous Assembly and MASM 6.11 Errors
Q123729 Accessing Command Line Arguments
I have found Q106399 particularly helpful since I am really upset that
Microsoft did not include direct support of MASM from within the Visual
Workbench.
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 9 Nov 96
Return to the Table Of Contents------------------------------
Subject 5. Pentium Instruction Macros
Macros that implement the new instructions available with the Pentium
processor are available from Intel.
ftp://ftp.intel.com/pub/IAL/pentium/p5masm.mac [Broken]
The new macros are:
CMPXCHG8B - Compare and exchange eight bytes
CPUID - CPU Identification
RDTSC - Read Time Stamp Counter
MOVTOCR4 - Move reg to CR4
MOVFROMCR4 - Move CR4 to reg
RDMSR - Read Model Specific Register
WRMSR - Write Model Specific Register
RSM - Resume from SMM
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 8 Jan 95
Return to the Table Of Contents------------------------------
Subject 6. Microsoft’s MASM Newsgroup
Microsoft has create a whole family of newsgroups devoted to their products. One of these new newsgroups is devoted to MASM. Its URL is news:msnews.microsoft.com/microsoft.public.masm Contributor: Raymond Moon, raymoon@moonware.dgsys.com Last Changed: 20 Apr 97 Return to the Table Of Contents
------------------------------
Subject 7. MASM Information Available At www.microsoft.com
Microsoft doesn't support MASM like it use to.
Microsoft’s web site finally has a few pages to MASM. This overview
page has links to the following areas: features, system requirements,
evaluation tools, standard, academic and volume pricing, FAQ, and
support policies. The basic URL is:
http://www.microsoft.com/catalog/display.asp?subid=22&site=239&pg=1 [Broken]
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 18 Mar 2000
Return to the Table Of Contents------------------------------
Subject 8. How to Get the Patches for MASM 6.12, 6.13 and 6.14
There are patches available to patch MASM 6.11 to update for support
Pentium Pro and MMX instructions (Version 6.12) and AMD 3D instructions
(Version 6.13). Numerous bug fixes have been added. You do not need to
download each, ml613.exe contains everything to upgrade your 6.11, 6.11a
or 6.11d. Again, these patches will not upgrade MASM 6.11c
ftp://ftp.microsoft.com/softlib/mslfiles/ML612.EXE
ftp://ftp.microsoft.com/softlib/mslfiles/ML613.EXE
ftp://ftp.microsoft.com/softlib/mslfiles/ML614.EXE
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 18 Mar 2000
Return to the Table Of Contents------------------------------
Subject 9. MASM Free From Microsoft
9.1 WHERE TO GET MASM
MASM Version 6.11d is available on the Windows 98 Driver Developer Kit.
While the whole file is 18+ Meg file. It can be downloaded in parts.
You will need two files. The URLs are:
http://www.microsoft.com/ddk/download/98/BINS_DDK.EXE (2.9 MBytes)
http://www.microsoft.com/ddk/download/98/98SETUP.EXE (1.9 MBytes)
After downloading each file, execute them to extract the files. Then
run the setup program. MASM is the ml.exe file in the 98ddk/bin/win98
directory. It is version 6.11d that can be patched to 6.14.
9.2 WHAT THIS MASM IS NOT
This is not the same as purchasing MASM product. The linker is 32 bit
and will not create 16-bit DOS programs. Also, the Programmer’s Work
Bench nor CodeView for debugging are included in the full DDK.
NOTE: The linker that comes with the DDK will not produce 16-bit
applications for DOS. To do this, you must have Microsoft’s Linker
version 5.63 that is available from Microsoft’s FTP site:
ftp://ftp.microsoft.com/softlib/mslfiles/lnk563.exe
9.3 JON KIRWAN MASM DOWNLOAD SITE
Jon Kirwan has a site that will walk you thorough downloading MASM and
other Microsoft tools that came with the commercial package (but not
all, as Microsoft has not released all of them). The URL to his site is:
Includes the new version 6.15
http://www.easystreet.com/~jkirwan/pctools.html
9.4 Get the latest versions of MASM for 32-bit assembly
The following lists a rather convenient way to create ml.exe
environments for command prompt links, so as to compile
different files of with different files. It's rather short and sweet.
The complicated part involves editing the setenv.bat file so
as to create a different environment for compiling to different
operating systems.
This was tested successfully using the Microsoft Windows
2003 DDK and should work for prior DDKs as well without
any difference.
For WinNT, Win2K and later.
(1) Download the DDK from the following link. The current DDK
includes the following assemblers:
* 32-bit assembler (\ddk\bin\x86),
* AMD64 assembler (\ddk\bin\win64\x86\amd64),
* Intel64 assembler (\ddk\bin\ia64), and
* 16-bit assembler (\ddk\bin\bin16).
DDK - Windows Driver Development Kit
http://www.microsoft.com/whdc/devtools/ddk/
You can download a CD Image (.iso) and copy the image to a
CD to install the file. Some archiving programs, like Power-
Archiver (http://www.powerarchiver.com) can expand and extract
the contents of .iso CD image files.
(2) Right click upon a cmd.exe (%systemroot%\system32\),
click on Create Shortcut.
(3) Drag the newly created shortcut to a folder to place such
links, and rename it to something like: ml_2k or ml_xp or
ml_2003. Feel free to choose names as appropriate.
(4) Next, copy the setenv.bat file from the Microsoft DDK to
the appropriate folder (folder you keep your cmd.exe links in).
(5a) This step is NOT required, because the next step explains
how to invoke a not bother with editing the batch files. I leave it
up to you to actually edit the batch file. Editing the batch file
represents the most complicated part of these instructions. I
recommend editing the batch file rather than taking the easy way
out in step (5b).
(5b) The setenv.bat file provides several options to invoke a
specific DDK environment. So the only thing required involves
getting to know the options for the setenv.bat file...
W2K
WXP
FRE
CHK
hal NOTE: Microsoft left out the uppercase word HAL here.
So lets say you want to use the batch to create the W2K environ-
ment. Right click upon the ml_2k.lnk file (the file that starts up a
cmd.exe prompt). Click on Properties. Click on the Shortcut tab.
Edit the Target textbox as follows:
%systemroot%\system32\cmd.exe /K C:\asm\env\setenv.cmd W2K
The /K switch tells the cmd.exe prompt to remain open after
executing the .cmd (or .bat) file.
Also, edit the "Start in:" textbox to force the command prompt to
start in an appropriate project file (if so desired).
The eula for the DDK seems a little more relaxed than the eula
for C++ 2005 SDK. They require that you target running any
software on Windows and no other operating system.
NOTE: I've done the same thing for a NASM cmd.exe prompt,
to create an environment for compiling with NASM. This can
be extended to many other compilers as well, if you don't mind
compiling from inside a command prompt. :-)
This helps alot and makes compiling easier when messing with
different compilers (but it requires compiling from inside a cmd.exe
prompt).
NOTE: When compiling with the 16-bit compilers from one of
these cmd.exe prompts, ntvdm.exe starts up and remains running
until you close the cmd.exe-prompt that started the 16-bit compiler.
Hope this helps. If anyone gets any questions, feel free to ask. I
want to hear comments from the peanut gallery (or other).
Contributor: Raymond Moon, raymoon@moonware.dgsys.com, Jim Carlock
Last Changed: 21 Mar 2006
Return to the Table Of Contents------------------------------
I would like to acknowledge all the people who have assisted me or any of the contributors. For their time and effort, this FAQ is a better product. Barry Brey, Daniel Cardenas, Ville Muikkula, Kevin Weinrich, and Jim Carlock. Return to the Table Of Contents