Frequently Asked Questions (FAQ)

After reading the following FAQ, if you still cannot find your answer, plase post it to the discussion group

Q1: Installing the CD that came with the book
Q2: CodeView bug: 32-bit registers
Q3: Mouse problems in CodeView
Q4: Runnng ML.EXE from command prompt
Q5: Flag notation in Debug
Q6: Blinking color attributes don't work
Q7: Assembler Editor cannot find ML.EXE
Q8: Source code for book's link library
Q9: Problems with Sector/Cluster programs
Q10: Using 32-bit registers
Q11: Using link library with Borland Assembler
Q12: How Windows stores extended filenames
Q13: Accessing MASM help files
Q14: Generating a listing file
Q15: Direct video memory under Windows
Q16: Finding the official MASM manuals
Q17: Using the INCLUDE directive
Q18: Using the macro library in Chapter 8
Q19: MASM patch for version 6.13

Q20: Uninstalling sample program files
Q21: All symbols are public in ML.EXE
Q22: How to get solution programs
Q23: Printing the screen from DEBUG.EXE
Q24: Where to go from here
Q25: Out of Environment space

Q26: Linker error message: "object file not found"
Q27: Using Programmers Workbench (PWB)
Q28: Finding Intel's Pentium Instruction Set manual
Q29: FAT16 and FAT32 Differences
Q30: Virus detected on the Book's CD?
Q31: Problems with Windows ME
Q32: Problems with STRUC directive

Q33: My program crashes!
Q34: Generate ASM listing from Visual C++
Q35:
Q36:

Q999: Help me do my homework!


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

Read the Getting Started page.


Q2

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

This bug is acknowledged by Microsoft, and fixed in CodeView 4.10. 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. Go to the useful files section.
Q3 Why doesn't my mouse work properly when running 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 ML.EXE assembler from a Command prompt (MS-DOS window), I get the message "Bad command or file name." What's wrong?
This is explained on the Getting Started page.
Q5 What are the mnemonics used by Debug.exe 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 modify your system's PATH variable. Read the Getting Started topic, which covers installation of the book's software.
Q8 Where can I get a copy of the source code for the link library (IRVINE.LIB)?
You can download it from the files area.
Q9 The Sector Display program on p. 406 and the Cluster Display program on page 412 do not work if they are run on a hard drive. Why?

Both programs were designed to work on disks formatted with the FAT-16 file system. Therefore, they will only run from a diskette. Click here to download a new version of this program that works on FAT32 disks (under Windows 95, 98, and Me., but still not under Windows NT/2000/XP, because of their tight security restrictions).


Q10 Why does the assembler generate an error message when I use 32-bit registers?
You need to place the .386 directive in your program on the line following the .stack directive. This was not clearly explained in the book, but there is a reference to the .386 directive in Table 2 on page 93.
Q11 How do I use the book's link library with the Borland Turbo Assembler (TASM)?
You can modify the editor configuration file (AE.CFG), or write a simple batch file. Click here for more details.
Q12 How does Windows 95/98/NT store extended (long) filenames?
Click here to view an example and explanation of extended filenames.
Q13 How can I access the help files that were installed with MASM 6.13?
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). Look for the Shortcut named QH in the C:\Masm directory. You might have to modify its properties to suit your computer setup. Double-click on the shortcut to run QuickHelp.
Q14 How can I generate a listing file when assembling programs?

The Make16.bat file automatically generates a listing file for your program. In the following command, taken from the file, the -Fl is the listing file parameter:

ML /nologo -c -Fl -Zi %1.asm


Q15 Why can't I write directly to video memory under Windows NT, 2000, or XP?

These versions of 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. This affects both the Writechar_direct and Writestring_direct functions in the book's link library. However, you can run these functions under Windows 95, 98, and Millenium.


Q16 Is there a way to read the MASM manuals?
The manuals are published online by Randall Hyde.
Q17 How is the INCLUDE directive used?
The INCLUDE directive allows you to insert the contents of another source code file into the input stream when your current file is assembled. On the sample programs CD, for example, we supply an include file that contains all of the EXTRN directives to match the book's link library. Click here to see a sample program that uses the LIBRARY.INC file. The file being INCLUDEd should either be in the same directory as your main program, or you must supply a relative path so the assembler can find it. For example,
    INCLUDE ch08\macros.inc
Q18 How can I use the Macro library from Chapter 8?
The Macro library is in a file named MACROS.INC, listed on page 298 of the book. Copy this file from the MASM directory (C:\Masm613) to the same directory as your ASM program. Insert the following statement in your program just before the .data directive:
   INCLUDE macros.inc

Alternatively, you can specify the complete pathname for the macro libary and leave MACROS.INC where it is:

   INCLUDE c:\Masm613\macros.inc

Click here to view a sample program that uses the macro library.


Q19 Where can I get the free Microsoft Patch to upgrade MASM 6.11 to  6.13?
You can get it on this Web site from the file download page.
Q20 How do I uninstall the sample program files supplied with the book? Also, how to I uninstall MASM 6.11?
The MASM installation no longer modifies the registry, so you can just delete the directory where you installed MASM (such as C:\Masm613).
Q21 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 Section 9.4.1).
Q22 How can I get a copy of the solution programs for the book's programming exercises and even-numbered review questions?
I get a lot of requests for these. Only adopting instructors can get the solution programs, from the protected Instructor web site. I know this is hard on individuals who are self-studying assembler with my book, but there is no way to prevent the solution programs from circulating among students.
Q23 How can I print the screen when working in Debug?
Click here to read an explanation.
Q24 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.
Q25 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.


Q26 When I assemble and link a program, I see the message "object file not found". Why?

The Microsoft 16-bit Linker (from 1992) can only handle filenames that are eight characters or less, not counting the file extension. To work around this problem, shorten the name of your source code file. Also, be sure that no directory name along the file's path has more than 8 characters. 

Q27 I'm having trouble assembling and linking programs using the Microsoft Programmers Workbench. In particular, how can I link to IRVINE.LIB?
Click here to view a good explanation of this topic from Professor Tim Downey of Florida International University. (I don't use Programmers Workbench.)
Q28 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/
Q29 Some disk-related functions such as Get Free Space(36h) and Read/Write Sectors (INT 25/26) do not work on FAT32 disks. What should I do?
Those functions were designed to work only on FAT12 and FAT16 disks (<= 2GB). For now, the easiest thing to do is to create a small FAT16 partition and test the functions only on this partition. In the Fourth edition, FAT32 and NTFS functions will be used throughout. Be sure to read my updated explanation of disk formats (pp. 394-396). View/download the related PDF file.
Q30 Why does my virus scanning software pick up a virus on the Sample Program CD?
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.
Q31 Can I run MS-DOS programs under Windows Millenium Edition (Windows ME)?
  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).
Q32 Why don't the programs in the book that use the STRUC directive assemble under MASM version 6?
 

This issue has been addressed on the corrections page. It affects the programs on pages 412, 429, 269, and 292. The book's programs were compiled and run under both MASM 5 and Borland Turbo Assembler. Unfortunately, MASM 6 introduced a stricter syntax for references to structure members. The simple workaround to the problem is to insert the following directive on the line following the .stack directive. It ensures compatibility with MASM 5:

   OPTION M510

Q33 What might cause my assembly language program to crash when I run it?
 

First of all, never run your program without testing it in with a debugger. There are too many things that can go wrong. In 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 CX 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 SI, DI, or BX) 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
Q34 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.


Q35  

 


Q36  

 


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

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