Frequently Asked Questions (FAQ)

After reading the following FAQ, if you still cannot find your answer, please visit the book's discussion group

Updated 1/20/2003

Q1: Installing the book's CD-ROM
Q2: CodeView bug: 32-bit registers
Q3: Mouse problems in CodeView
Q4: Problem running make16.bat
Q5: Flag notation in CodeView and DEBUG
Q6: Blinking color attributes don't work
Q7: Assembler Editor cannot find ML.EXE
Q8: Searching Microsoft Knowledge Base?
Q9: Accessing MASM help files
Q10: Writing to video memory
Q11: Using an AMD Processor
Q12: All symbols are public in ML.EXE
Q13: Printing screen in DEBUG
Q14: Out of Environment space
Q15: Finding the MASM Manuals
Q16: Intel Pentium Manuals
Q17: Virus detected on CD-ROM?
Q18: Problems with Windows ME
Q19: My program crashes!

Q20: Generate ASM listing from Visual C++
Q21: Creating a link library
Q22: Call procedure using register
Q23: Microsoft Assembler Web Page
Q24: GetMseconds Library procedure
Q25: Running MASM Setup Under Windows XP
Q26:
Q27:
Q28:
Q29:
Q30:
Q31:
Q32:
Q33:
Q34:
Q35:
Q36: Where to go from here?
Q999: Help me do my homework!


Q1 How do I install the CD-ROM that came with the book?

The disk should autostart when you insert in a CD-ROM drive. If this does not happen, double-click on the index.html file in the root directory. This file contains detailed instructions and help.


Q2

When I use Microsoft CodeView to display 32-bit registers, why do zeros mysteriously appear?

This bug is acknowledged by Microsoft. See MSDN article #Q87548 for details. For debugging, you might want to call the DumpRegs procedure from the book's link library to display a snapshot of the 32-bit registers. Microsoft fixed this bug in CodeView version 4.10, but I'll be darned if I can find a copy!
Q3 Why doesn't my mouse work properly when running Microsoft CodeView?
You have to turn of "QuickEdit" mode in the MS-DOS window that runs CodeView. Click here to find out how to do this.
Q4 When I run the make16.bat file from a Command prompt, I cannot run any other programs immediately afterward. What's wrong?
In some situations, make16.bat changes your PATH environment variable, which makes it impossible for the OS to find your other programs. Read the following article for details.
Q5 What are the mnemonics used by CodeView and DEBUG for the flag states?
CY = carry, NC = no carry, OV = overflow, NV = no overflow, UP = direction up, DN = direction down, EI = enable interrupts, DI = disable interrupts, PL = sign flag clear, NG = sign flag set, NZ = zero flag clear, ZR = zero flag set, NA = no auxiliary carry, AC = auxiliary carry, PO = odd parity, PE = even parity.
Q6 Why doesn't the blink attribute work in color text mode in Windows 2000?

As you've noticed, when the highest bit of the color attribute is set, the background color becomes brighter (or brown becomes yellow). You can get the blink attribute to work if you run your program in a Command Window and then press Alt-Enter to switch to full-screen mode while the program is running. On the other hand, if you switch to full-screen mode first and then run your program, the blink attribute doesn't work--the highest bit simply brightens the background color.


Q7 When I try to assemble an ASM source file, the assembler generates the message "Error A2901: cannot run ML.EXE". What's wrong?
ML.EXE is the assembler software, and it will not run unless you either specify its exact location, or modify your system's PATH variable. Read the Getting Started page for more details.
Q8 How do I search the Microsoft Knowledge Base for technical articles?
Go to http://support.microsoft.com. Select Search the Knowledge Base. From there you can search either by topic or by article number.
Q9 How can I access the help files that were installed with MASM 6.15?

The Help files supplied with MASM are an excellent reference, not only on assembly language syntax, but also on using the Assembler (ML.EXE), CodeView, the Linker, and other utilities. You can access help from the Programmers Workbench (PWB.EXE), from CodeView (CV.EXE), or from a stand-alone help program named QuickHelp (QH.EXE). To run QuickHelp directly, double-click on the batch file named runQH.bat in the C:\Masm615 directory.


Q10 Why can't I write directly to video memory under Windows NT, 2000, or XP?
These versions of MS-Windows run MS-DOS applications in Virtual-8086 mode, which is a variant under Protected mode. In this mode, you cannot write directly to video memory. However, you can write to video memory when running Windows 95, 98, and Millenium.
Q11 If my computer uses an AMD processor, can I use MASM and your book?
Yes, the AMD processor is completely compatible with MASM and the programs in my book. In fact, I use an AMD processor on my primary computer.
Q12 When assembling and linking two modules with ML.EXE, why does the linker automatically treat all symbols as public?
This appears to be a bug in ML.EXE, inasmuch there is already a command-line switch (/Zf) that makes all symbols public. The behavior is the same without the switch. There is a workaround, which is to use the /Zm switch (MASM 5.1 compatibility). This will make all symbols private by default. You can then use the PUBLIC directive to expose only selected symbols (see page 679).
Q13 How can I print the screen when working in DEBUG (debug.exe)?
Click here to read an explanation.
Q14 I get an "Out of Environment Space" error message when assembling and/or linking. What can be done?

When Windows runs a 16-bit MSDOS application, it needs a certain amount of environment space for temporary variables (such as PATH and TEMP). Click here to learn how to increase this space.


Q15 Where can I find the Microsoft MASM Assembler Manuals?

Microsoft no longer publishes the printed manuals, but HTML versions of the manuals can be found on Web sites belonging to Randall Hyde and Kevin Lillis.


Q16 Where can I read the Intel manual covering the IA-32 instruction set?
Intel has three programmers manuals for the IA-32 processor family (Intel386 through Pentium 4): http://developer.intel.com/design/Pentium4/manuals/
Q17 Why does my virus scanning software pick up a virus on the book's CD-ROM?
The files on the CD were produced by Microsoft in 1992, long before many of the current viruses were written. Virus scanning programs search for matching strings of bytes, and by coincidence, strings from at least one program on the CD match. For example, the file cref.exe, in the \BIN directory seems to match an existing virus string. Anyway, I use the same files on my own computer, and neither I nor anyone else I know has had a problem with the assembler files.
Q18 Can I run MS-DOS programs under Windows Millenium?

Windows ME has an installable option that permits the use of a DOS prompt. Please see their help files for an explanation of installing this. Also, you might want to read article Q179644 in the Microsoft knowledge base (http://www.msdn.microsoft.com).


Q19 Why does my assembly language program crash?

First of all, never run a nontrivial program without a debugger. There are too many things that can go wrong! In Microsoft CodeView, for example, you can trace your program using the F8 and F10 function keys, watch the registers and stack, and in general be aware of everything your program does, statement by statement. It's surprising how often beginning students ignore this advice, much to their frustration later. Experienced programmers, on the other hand, develop excellent skills with CodeView and other debuggers.

Here are some of the most common causes for a wayward assembly language program:

  1. The stack has been corrupted because of a mismatching sequence of pushes and pops, causing a RET instruction to go to the wrong location. To catch this error, you must press F8 on the RET instruction and note carefully the location to which it branches.
  2. A loop doesn't stop, possibly because ECX or some other loop counter has been altered inside the loop. Or, perhaps a conditional jump instruction that was supposed to exit the loop was never taken.
  3. Machine code in the code segment has been overwritten by data, possibly because the value of an index register (such as ESI, EDI, or EBX) is incorrect. This is quite difficult to detect, unless you switch the source window options in CodeView to the Disassembly option. When you see garbled instructions in place of the code you know you wrote, it's clear that the code has been corrupted

Q20 How can I generate an assembly language listing file from Visual C++?
To create an assembly language source file, use the /FAs option. Here's a short article that explains it more completely.
Q21 How can I create and use my own link library?
Read the article I've written on this topic
Q22

Can a procedure be called using a register name as the target label?

Easily! For example, we can load EDX with the offset of MyProc and call the procedure directly:

     mov edx,OFFSET MyProc

     call edx

You can also call a procedure indirectly, as is done on page 209. EBX + 1 points to a memory operand containing the offset of a procedure:

     call NEAR PTR [ebx + 1]

Q23

Why does my browser display an error message when trying to follow your link to Microsoft's Assembler Reference page?

Your browser may be out-of-date. Try Internet Explorer 5.0 or later, or Netscape 6.0 or later. Both of those have been successfully tested with Microsoft's Web site.
Q24 Why does the GetMseconds Library procedure give me different results under different versions of MS-Windows?

GetMseconds calls a Win32 API function named GetLocalTime (see page 406). This function is accurate to 10ms under Windows NT/2000/XP, but it is only accurate to about 50ms under Windows 98/Me. The GetMseconds function in the Irvine16 library accomplishes its task using calls to INT 21h, and is also accurate to about 50ms.


Q25 I'm using Windows XP Home Edition. When I try to run the MASM setup program on the CD-ROM, I get an error message: "16 bit Windows Subsystem: An application has attempted to directly access the hard disk, which cannot be supported. . .".

You may have installed Windows XP on top of an older operating system such as Windows 98. In that case, your autoexec.nt and config.nt files may have out-of-date information. Check out Microsoft Knowledge Base Article 314495, entitled "How to Troubleshoot 16-bit Windows Programs in Windows XP".


Q26  

Q27  

Q28  

Q29  

Q30  

Q31  
 
Q32  
 
Q33  
 
Q34  

Q35  

Q36 Ok, so now I've finished your whole book, done all the programming exercises. Where do I go from here?

I'm impressed! Next, try: 1) Windows Assembly Language and Systems Programming by Barry Kauler; 2) Graphics Programming Black Book by Michael Abrash. They're both fantastic.


Q999 Will you help me write or debug my programming assignment?

Absolutely not! It would not be ethical for me to do so.